|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
try {
|
|
|
|
|
|
|
|
|
cerr << "Restoring all configuration files...";
|
|
|
|
|
|
|
|
|
cerr << "Restoring all configuration files...";
|
|
|
|
|
|
|
|
|
Config->SaveFile.RestoreAllFilesFromBackup();
|
|
|
|
|
|
|
|
|
Config->SaveFile.RestoreAllFilesFromBackup();
|
|
|
|
|
|
|
|
|
Config->SetOwnerPermissionsOfConfigFiles();
|
|
|
|
|
|
|
|
|
Config->SetOwnerPermissionsOfConfigFiles();
|
|
|
|
|
|
|
|
|
cerr << "done.\n\n"
|
|
|
|
|
|
<< "Configuration files that resulted in this error are saved with a suffix \""
|
|
|
|
|
|
<< Config->SaveFile.GetFailedFileName("") << "\".\n";
|
|
|
|
|
|
|
|
|
cerr << "done.\n\n"
|
|
|
|
|
|
<< "Configuration files that resulted in this error are saved with a suffix \""
|
|
|
|
|
|
<< Config->SaveFile.GetFailedFileName("") << "\".\n";
|
|
|
}
|
|
|
}
|
|
|
catch(exception& e) {
|
|
|
catch(exception& e) {
|
|
|
|
|
|
|
|
|
cerr << "SNFMilterConfig::SaveFile Exception: " << e.what() << endl;
|
|
|
|
|
|
|
|
|
cerr << "SNFMilterConfig::SaveFile Exception: " << e.what() << endl;
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SNFMilterConfig SnfMilterConfig;
|
|
|
SNFMilterConfig SnfMilterConfig;
|
|
|
|
|
|
|
|
|
if (!SnfMilterConfig.GetCommandLineInput(argc, argv) || // If our command line arguments
|
|
|
|
|
|
SnfMilterConfig.Help()) { // don't look right, or if help is
|
|
|
|
|
|
// requested then display our help
|
|
|
|
|
|
SnfMilterConfig.DisplayHelp(SNF_MILTERCONFIG_VERSION); // screen.
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
try { // Catch anything that breaks loose.
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
if (!SnfMilterConfig.GetCommandLineInput(argc, argv) || // If our command line arguments
|
|
|
|
|
|
SnfMilterConfig.Help()) { // don't look right, or if help is
|
|
|
|
|
|
// requested then display our help
|
|
|
|
|
|
SnfMilterConfig.DisplayHelp(SNF_MILTERCONFIG_VERSION); // screen.
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
bool DebugMode = false; // This will be our debug mode.
|
|
|
|
|
|
string argv0(argv[0]); // Capture how we were called.
|
|
|
|
|
|
if(
|
|
|
|
|
|
string::npos != argv0.find("Debug") || // If we find "Debug" or
|
|
|
|
|
|
string::npos != argv0.find("debug") // "debug" in our command path
|
|
|
|
|
|
) { // then we are in DebugMode.
|
|
|
|
|
|
DebugMode = true; // Set the flag and tell the
|
|
|
|
|
|
cout << SNF_MILTERCONFIG_VERSION << endl; // watchers.
|
|
|
|
|
|
cout << "Debug Mode" << endl;
|
|
|
|
|
|
SnfMilterConfig.SetDebug(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
try { // Catch anything that breaks loose.
|
|
|
|
|
|
|
|
|
bool DebugMode = false; // This will be our debug mode.
|
|
|
|
|
|
string argv0(argv[0]); // Capture how we were called.
|
|
|
|
|
|
if(
|
|
|
|
|
|
string::npos != argv0.find("Debug") || // If we find "Debug" or
|
|
|
|
|
|
string::npos != argv0.find("debug") // "debug" in our command path
|
|
|
|
|
|
) { // then we are in DebugMode.
|
|
|
|
|
|
DebugMode = true; // Set the flag and tell the
|
|
|
|
|
|
cout << SNF_MILTERCONFIG_VERSION << endl; // watchers.
|
|
|
|
|
|
cout << "Debug Mode" << endl;
|
|
|
|
|
|
SnfMilterConfig.SetDebug(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
SnfMilterConfig.ExecuteCommand();
|
|
|
|
|
|
|
|
|
SnfMilterConfig.ExecuteCommand();
|
|
|
|
|
|
|
|
|
} // That's all folks.
|
|
|
} // That's all folks.
|
|
|
|
|
|
|
|
|
catch(exception& e) { // Report any normal exceptions.
|
|
|
catch(exception& e) { // Report any normal exceptions.
|
|
|
cerr << "\n\nSNFMilterConfig Exception: " << e.what() << endl << endl;
|
|
|
cerr << "\n\nSNFMilterConfig Exception: " << e.what() << endl << endl;
|
|
|
RestoreFiles(&SnfMilterConfig);
|
|
|
|
|
|
return(-1);
|
|
|
|
|
|
|
|
|
RestoreFiles(&SnfMilterConfig);
|
|
|
|
|
|
return(-1);
|
|
|
}
|
|
|
}
|
|
|
catch (snfCFGmgr::LoadFailure) { // Error loading configuration file.
|
|
|
catch (snfCFGmgr::LoadFailure) { // Error loading configuration file.
|
|
|
cerr << "\n\nsnfCFGmgr Exception: Unable to load the configuration file "
|
|
|
|
|
|
<< SnfMilterConfig.GetConfigFileName() << endl << endl;
|
|
|
|
|
|
RestoreFiles(&SnfMilterConfig);
|
|
|
|
|
|
return(-1);
|
|
|
|
|
|
|
|
|
cerr << "\n\nsnfCFGmgr Exception: Unable to load the configuration file "
|
|
|
|
|
|
<< SnfMilterConfig.GetConfigFileName() << endl << endl;
|
|
|
|
|
|
RestoreFiles(&SnfMilterConfig);
|
|
|
|
|
|
return(-1);
|
|
|
}
|
|
|
}
|
|
|
catch(...) { // Report any unexpected exceptions.
|
|
|
catch(...) { // Report any unexpected exceptions.
|
|
|
cerr << "\n\nSNFMilterConfig Panic! Unknown Exception!" << endl << endl;
|
|
|
cerr << "\n\nSNFMilterConfig Panic! Unknown Exception!" << endl << endl;
|
|
|
RestoreFiles(&SnfMilterConfig);
|
|
|
|
|
|
return(-1);
|
|
|
|
|
|
|
|
|
RestoreFiles(&SnfMilterConfig);
|
|
|
|
|
|
return(-1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
return 0; // Normally we return zero.
|
|
|
return 0; // Normally we return zero.
|