|
|
|
|
|
|
|
|
// Configuration. ////////////////////////////////////////////////////////////////////////////////////////
|
|
|
// Configuration. ////////////////////////////////////////////////////////////////////////////////////////
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
const std::string SnfMilterMainCfSearchString("unix:/var/snf-milter/socket");
|
|
|
|
|
|
|
|
|
|
|
|
const std::string SnfMilterMainCfMilterSpec("unix:/var/snf-milter/socket");
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
// End of configuration. /////////////////////////////////////////////////////////////////////////////////
|
|
|
// End of configuration. /////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ("OpenBSD" == OperatingSystemType) {
|
|
|
if ("OpenBSD" == OperatingSystemType) {
|
|
|
|
|
|
|
|
|
|
|
|
PostfixDefaultIsChrooted = true;
|
|
|
|
|
|
PostfixSocketSpec = "unix:/snf-milter/socket";
|
|
|
PostfixMainCfPath = "/etc/postfix/main.cf";
|
|
|
PostfixMainCfPath = "/etc/postfix/main.cf";
|
|
|
PostfixMasterCfPath = "/etc/postfix/master.cf";
|
|
|
PostfixMasterCfPath = "/etc/postfix/master.cf";
|
|
|
ReloadMtaCommand = "/usr/local/sbin/postfix reload";
|
|
|
ReloadMtaCommand = "/usr/local/sbin/postfix reload";
|
|
|
|
|
|
|
|
|
} else if ("FreeBSD" == OperatingSystemType) {
|
|
|
} else if ("FreeBSD" == OperatingSystemType) {
|
|
|
|
|
|
|
|
|
|
|
|
PostfixDefaultIsChrooted = false;
|
|
|
|
|
|
PostfixSocketSpec = "unix:/var/snf-milter/socket";
|
|
|
PostfixMainCfPath = "/usr/local/etc/postfix/main.cf";
|
|
|
PostfixMainCfPath = "/usr/local/etc/postfix/main.cf";
|
|
|
PostfixMasterCfPath = "/usr/local/etc/postfix/master.cf";
|
|
|
PostfixMasterCfPath = "/usr/local/etc/postfix/master.cf";
|
|
|
ReloadMtaCommand = "/usr/local/sbin/postfix reload";
|
|
|
ReloadMtaCommand = "/usr/local/sbin/postfix reload";
|
|
|
|
|
|
|
|
|
} else if ("Ubuntu" == OperatingSystemType) {
|
|
|
} else if ("Ubuntu" == OperatingSystemType) {
|
|
|
|
|
|
|
|
|
|
|
|
PostfixDefaultIsChrooted = true;
|
|
|
|
|
|
PostfixSocketSpec = "unix:/snf-milter/socket";
|
|
|
PostfixMainCfPath = "/etc/postfix/main.cf";
|
|
|
PostfixMainCfPath = "/etc/postfix/main.cf";
|
|
|
PostfixMasterCfPath = "/etc/postfix/master.cf";
|
|
|
PostfixMasterCfPath = "/etc/postfix/master.cf";
|
|
|
ReloadMtaCommand = "/usr/sbin/postfix reload";
|
|
|
ReloadMtaCommand = "/usr/sbin/postfix reload";
|
|
|
|
|
|
|
|
|
} else if ("RedHat" == OperatingSystemType) {
|
|
|
} else if ("RedHat" == OperatingSystemType) {
|
|
|
|
|
|
|
|
|
|
|
|
PostfixDefaultIsChrooted = false;
|
|
|
|
|
|
PostfixSocketSpec = "unix:/var/snf-milter/socket";
|
|
|
PostfixMainCfPath = "/etc/postfix/main.cf";
|
|
|
PostfixMainCfPath = "/etc/postfix/main.cf";
|
|
|
PostfixMasterCfPath = "/etc/postfix/master.cf";
|
|
|
PostfixMasterCfPath = "/etc/postfix/master.cf";
|
|
|
ReloadMtaCommand = "/usr/sbin/postfix reload";
|
|
|
ReloadMtaCommand = "/usr/sbin/postfix reload";
|
|
|
|
|
|
|
|
|
} else if ("Suse" == OperatingSystemType) {
|
|
|
} else if ("Suse" == OperatingSystemType) {
|
|
|
|
|
|
|
|
|
|
|
|
PostfixDefaultIsChrooted = false;
|
|
|
|
|
|
PostfixSocketSpec = "unix:/var/snf-milter/socket";
|
|
|
PostfixMainCfPath = "/etc/postfix/main.cf";
|
|
|
PostfixMainCfPath = "/etc/postfix/main.cf";
|
|
|
PostfixMasterCfPath = "/etc/postfix/master.cf";
|
|
|
PostfixMasterCfPath = "/etc/postfix/master.cf";
|
|
|
ReloadMtaCommand = "/usr/sbin/postfix reload";
|
|
|
ReloadMtaCommand = "/usr/sbin/postfix reload";
|
|
|
|
|
|
|
|
|
std::string Line;
|
|
|
std::string Line;
|
|
|
bool ModifiedLine = false;
|
|
|
bool ModifiedLine = false;
|
|
|
|
|
|
|
|
|
PostfixMilterConf MilterConf; // Object to update the config line.
|
|
|
|
|
|
|
|
|
PostfixMilterConf MilterConf(PostfixSocketSpec); // Object to update the config line.
|
|
|
|
|
|
|
|
|
while (getline(Input, Line)) {
|
|
|
while (getline(Input, Line)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string Content;
|
|
|
std::string Content;
|
|
|
std::string Line;
|
|
|
std::string Line;
|
|
|
|
|
|
|
|
|
PostfixMilterConf MilterConf; // Object to update the config line.
|
|
|
|
|
|
|
|
|
PostfixMilterConf MilterConf(PostfixSocketSpec); // Object to update the config line.
|
|
|
|
|
|
|
|
|
while (getline(Input, Line)) {
|
|
|
while (getline(Input, Line)) {
|
|
|
|
|
|
|
|
|
MilterConf.ConfLine(Line); // Load the object with the line.
|
|
|
|
|
|
|
|
|
MilterConf.ConfLine(Line); // Load the object with the line.
|
|
|
|
|
|
|
|
|
if (MilterConf.IsIntegrated()) { // Check for integration.
|
|
|
|
|
|
|
|
|
if (MilterConf.IsIntegrated()) { // Check for integration.
|
|
|
|
|
|
|
|
|
MilterConf.RemoveIntegration(); // Integrated. Remove the milter spec.
|
|
|
|
|
|
|
|
|
MilterConf.RemoveIntegration(); // Integrated. Remove the milter spec.
|
|
|
|
|
|
|
|
|
if (Verbose()) {
|
|
|
if (Verbose()) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
throw std::runtime_error(Temp);
|
|
|
throw std::runtime_error(Temp);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
PostfixMilterConf MilterConf; // Object to update the config line.
|
|
|
|
|
|
|
|
|
PostfixMilterConf MilterConf(PostfixSocketSpec); // Object to update the config line.
|
|
|
std::string Line;
|
|
|
std::string Line;
|
|
|
|
|
|
|
|
|
while (getline(Input, Line)) {
|
|
|
while (getline(Input, Line)) {
|