ソースを参照

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年前
コミット
5895eb8e5d

+ 14
- 0
SNFMilterConfig/SNFMilterConfig.cpp ファイルの表示

@@ -85,6 +85,7 @@ SNFMilterConfig::DisplayHelp(std::string Version) {
ExclusiveCommandsHelp = " -with=postfix Integrate with postfix and start/reload postfix\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";
cout
@@ -123,6 +124,19 @@ SNFMilterConfig::GetCommandLineInput(int argc, char* argv[]) {
NumCommandsFound++;
} 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;
NumCommandsFound++;

+ 0
- 5
SNFMilterConfig/SNFMilterConfig.hpp ファイルの表示

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

+ 0
- 8
SNFMilterConfig/SNFMilterConfigTests.txt ファイルの表示

@@ -645,11 +645,3 @@ SENDMAIL-08: Repeat SENDMAIL-01 and SENDMAIL-04 on OpenSuse.
SENDMAIL-09: Repeat SENDMAIL-01 and SENDMAIL-04 on CentOS.

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 ファイルの表示

@@ -40,50 +40,41 @@ SendmailIntegrate::SetOperatingSystem(std::string 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) {
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) {
IntegrationIsSupported = true;
SendmailSendmailMcPath = "/etc/mail/sendmail.mc";
SendmailSendmailCfPath = "/etc/mail/sendmail.cf";
BuildInstallSendmailCfFile = "(cd /etc/mail && make)";
ReloadMtaCommand = "/usr/sbin/service sendmail reload";
ReloadMtaCommand = "/etc/init.d/sendmail reload";
FileToBackup.push_back(SendmailSendmailMcPath);
FileToBackup.push_back(SendmailSendmailCfPath);
} else if ("RedHat" == OperatingSystemType) {
IntegrationIsSupported = true;
SendmailSendmailMcPath = "/etc/mail/sendmail.mc";
SendmailSendmailCfPath = "/etc/mail/sendmail.cf";
BuildInstallSendmailCfFile = "(cd /etc/mail && make)";
ReloadMtaCommand = "/sbin/service sendmail reload";
ReloadMtaCommand = "/etc/init.d/sendmail reload";
FileToBackup.push_back(SendmailSendmailMcPath);
FileToBackup.push_back(SendmailSendmailCfPath);
} else if ("Suse" == OperatingSystemType) {
IntegrationIsSupported = true;
SendmailSendmailMcPath = "/etc/mail/linux.mc";
SendmailSendmailCfPath = "/etc/mail/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(SendmailSendmailCfPath);
@@ -104,6 +95,12 @@ SendmailIntegrate::SetOperatingSystem(std::string OperatingSystemType) {
void
SendmailIntegrate::Integrate(FileBackup *SaveFile) {
if (!IntegrationIsSupported) {
return;
}
if (IsIntegrated()) {
return;
@@ -185,6 +182,12 @@ SendmailIntegrate::Integrate(FileBackup *SaveFile) {
void
SendmailIntegrate::Unintegrate(FileBackup *SaveFile) {
if (!IntegrationIsSupported) {
return;
}
if (!IsIntegrated()) {
return;

+ 3
- 0
SNFMilterConfig/SendmailIntegrate.hpp ファイルの表示

@@ -51,6 +51,9 @@ private:
/// Command to reload the MTA.
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 std::vector<std::string> FileToBackupType;

読み込み中…
キャンセル
保存