Browse Source

Removed support for integration with sendmail for OpenBSD and FreeBSD.

Changed sendmail reload to "/etc/init.d/sendmail reload" because the service command is in different
locations in different Ubuntu OS versions.


git-svn-id: https://svn.microneil.com/svn/SNFUtility/trunk@42 aa37657e-1934-4a5f-aa6d-2d8eab27ff7c
master
adeniz 12 years ago
parent
commit
5895eb8e5d

+ 14
- 0
SNFMilterConfig/SNFMilterConfig.cpp View File

ExclusiveCommandsHelp = " -with=postfix Integrate with postfix and start/reload postfix\n"; ExclusiveCommandsHelp = " -with=postfix Integrate with postfix and start/reload postfix\n";
ExclusiveCommandsHelp += " -with=sendmail Integrate with sendmail and start/reload sendmail\n"; ExclusiveCommandsHelp += " -with=sendmail Integrate with sendmail and start/reload sendmail\n";
ExclusiveCommandsHelp += " (Not available on OpenBSD or FreeBSD)\n";
ExclusiveCommandsHelp += " -with=none Remove any integration with all supported MTAs\n"; ExclusiveCommandsHelp += " -with=none Remove any integration with all supported MTAs\n";
cout cout
NumCommandsFound++; NumCommandsFound++;
} else if (0 == OneInput.find(IntegrateWithSendmailKey)) { } else if (0 == OneInput.find(IntegrateWithSendmailKey)) {
std::string OsType;
OsType = GetOperatingSystemType(); // Check whether the platform is supported.
if ( ("OpenBSD" == OsType) || ("FreeBSD" == OsType) ) {
std::string Temp;
Temp = "Integration with sendmail is not supported on " + OsType;
Temp += ".\n";
throw runtime_error(Temp);
}
Command = IntegrateWithSendmailCommand; Command = IntegrateWithSendmailCommand;
NumCommandsFound++; NumCommandsFound++;

+ 0
- 5
SNFMilterConfig/SNFMilterConfig.hpp View File

// //
void SaveFileState(void); // OBSOLETE. void SaveFileState(void); // OBSOLETE.
#if 0
/// Execute the command to integrate/unintegrate with the MTAs.
void DoIntegrationCommand();
#endif
private: private:
/// Load the socket info (file name) from the <platform> section /// Load the socket info (file name) from the <platform> section

+ 0
- 8
SNFMilterConfig/SNFMilterConfigTests.txt View File

SENDMAIL-09: Repeat SENDMAIL-01 and SENDMAIL-04 on CentOS. SENDMAIL-09: Repeat SENDMAIL-01 and SENDMAIL-04 on CentOS.


Result: Result:

SENDMAIL-10: Repeat SENDMAIL-01 and SENDMAIL-04 on OpenBSD.

Result:

SENDMAIL-11: Repeat SENDMAIL-01 and SENDMAIL-04 on FreeBSD.

Result:

+ 20
- 17
SNFMilterConfig/SendmailIntegrate.cpp View File

if ("OpenBSD" == OperatingSystemType) { if ("OpenBSD" == OperatingSystemType) {
SendmailSendmailMcPath = "/etc/mail/sendmail.mc";
SendmailSendmailCfPath = "/etc/mail/localhost.cf";
ReloadMtaCommand = "kill -HUP `head -1 /var/run/sendmail.pid`";
ReloadMtaCommand = "pkill -HUP sendmail";
FileToBackup.push_back(SendmailSendmailMcPath);
FileToBackup.push_back(SendmailSendmailCfPath);
IntegrationIsSupported = false;
} else if ("FreeBSD" == OperatingSystemType) { } else if ("FreeBSD" == OperatingSystemType) {
SendmailSendmailMcPath = "/etc/mail/freebsd.mc";
SendmailSendmailCfPath = "/etc/mail/sendmail.cf";
BuildInstallSendmailCfFile = "(cd /etc/mail && make cf && make install)";
ReloadMtaCommand = "/etc/rc.d/sendmail restart";
FileToBackup.push_back(SendmailSendmailMcPath);
FileToBackup.push_back(SendmailSendmailCfPath);
IntegrationIsSupported = false;
} else if ("Ubuntu" == OperatingSystemType) { } else if ("Ubuntu" == OperatingSystemType) {
IntegrationIsSupported = true;
SendmailSendmailMcPath = "/etc/mail/sendmail.mc"; SendmailSendmailMcPath = "/etc/mail/sendmail.mc";
SendmailSendmailCfPath = "/etc/mail/sendmail.cf"; SendmailSendmailCfPath = "/etc/mail/sendmail.cf";
BuildInstallSendmailCfFile = "(cd /etc/mail && make)"; BuildInstallSendmailCfFile = "(cd /etc/mail && make)";
ReloadMtaCommand = "/usr/sbin/service sendmail reload";
ReloadMtaCommand = "/etc/init.d/sendmail reload";
FileToBackup.push_back(SendmailSendmailMcPath); FileToBackup.push_back(SendmailSendmailMcPath);
FileToBackup.push_back(SendmailSendmailCfPath); FileToBackup.push_back(SendmailSendmailCfPath);
} else if ("RedHat" == OperatingSystemType) { } else if ("RedHat" == OperatingSystemType) {
IntegrationIsSupported = true;
SendmailSendmailMcPath = "/etc/mail/sendmail.mc"; SendmailSendmailMcPath = "/etc/mail/sendmail.mc";
SendmailSendmailCfPath = "/etc/mail/sendmail.cf"; SendmailSendmailCfPath = "/etc/mail/sendmail.cf";
BuildInstallSendmailCfFile = "(cd /etc/mail && make)"; BuildInstallSendmailCfFile = "(cd /etc/mail && make)";
ReloadMtaCommand = "/sbin/service sendmail reload";
ReloadMtaCommand = "/etc/init.d/sendmail reload";
FileToBackup.push_back(SendmailSendmailMcPath); FileToBackup.push_back(SendmailSendmailMcPath);
FileToBackup.push_back(SendmailSendmailCfPath); FileToBackup.push_back(SendmailSendmailCfPath);
} else if ("Suse" == OperatingSystemType) { } else if ("Suse" == OperatingSystemType) {
IntegrationIsSupported = true;
SendmailSendmailMcPath = "/etc/mail/linux.mc"; SendmailSendmailMcPath = "/etc/mail/linux.mc";
SendmailSendmailCfPath = "/etc/mail/sendmail.cf"; SendmailSendmailCfPath = "/etc/mail/sendmail.cf";
BuildInstallSendmailCfFile = "(cd /etc/mail && rm -f sendmail.cf && m4 /etc/mail/linux.mc > sendmail.cf)"; BuildInstallSendmailCfFile = "(cd /etc/mail && rm -f sendmail.cf && m4 /etc/mail/linux.mc > sendmail.cf)";
ReloadMtaCommand = "/sbin/service sendmail reload";
ReloadMtaCommand = "/etc/init.d/sendmail reload";
FileToBackup.push_back(SendmailSendmailMcPath); FileToBackup.push_back(SendmailSendmailMcPath);
FileToBackup.push_back(SendmailSendmailCfPath); FileToBackup.push_back(SendmailSendmailCfPath);
void void
SendmailIntegrate::Integrate(FileBackup *SaveFile) { SendmailIntegrate::Integrate(FileBackup *SaveFile) {
if (!IntegrationIsSupported) {
return;
}
if (IsIntegrated()) { if (IsIntegrated()) {
return; return;
void void
SendmailIntegrate::Unintegrate(FileBackup *SaveFile) { SendmailIntegrate::Unintegrate(FileBackup *SaveFile) {
if (!IntegrationIsSupported) {
return;
}
if (!IsIntegrated()) { if (!IsIntegrated()) {
return; return;

+ 3
- 0
SNFMilterConfig/SendmailIntegrate.hpp View File

/// Command to reload the MTA. /// Command to reload the MTA.
std::string ReloadMtaCommand; std::string ReloadMtaCommand;
/// True if integration is supported on this platform.
bool IntegrationIsSupported;
/// typedef for container of filenames to backup up before integrating or unintegrating. /// typedef for container of filenames to backup up before integrating or unintegrating.
typedef std::vector<std::string> FileToBackupType; typedef std::vector<std::string> FileToBackupType;

Loading…
Cancel
Save