More for Redox support, & cleaner exclusion of SMTP stuff when SUPPORTS_NETWORKING is false

This commit is contained in:
brc0x1 2017-09-22 21:02:50 -07:00
parent 6a104efd03
commit 9b6750a98c
5 changed files with 35 additions and 10 deletions

View File

@ -94,6 +94,13 @@
#include <assert.h> #include <assert.h>
#include "msystem.h" #include "msystem.h"
#if IS_REDOX
#define setuid(x) sleep(0)
#define setgid(x) sleep(0)
#endif
/* /*
* signal type * signal type
*/ */

View File

@ -77,6 +77,10 @@
#include <pwd.h> #include <pwd.h>
#if IS_REDOX
#define restrict __restrict__
#endif
#if HAVE_SYS_SOCKET_H #if HAVE_SYS_SOCKET_H
# include <sys/socket.h> # include <sys/socket.h>
# include <netdb.h> # include <netdb.h>
@ -539,6 +543,7 @@ bool cUnixFSServices::GetGroupName( gid_t group_id, TSTRING& tstrGroup ) const
{ {
bool fSuccess = true; bool fSuccess = true;
#if !IS_REDOX
if( mResolveNames ) if( mResolveNames )
{ {
struct group* pg = getgrgid( group_id ); struct group* pg = getgrgid( group_id );
@ -552,10 +557,13 @@ bool cUnixFSServices::GetGroupName( gid_t group_id, TSTRING& tstrGroup ) const
} }
else else
{ {
#endif
std::stringstream sstr; std::stringstream sstr;
sstr << group_id; sstr << group_id;
tstrGroup = sstr.str(); tstrGroup = sstr.str();
#if !IS_REDOX
} }
#endif
return( fSuccess ); return( fSuccess );
} }

View File

@ -36,7 +36,11 @@
#include "core/error.h" #include "core/error.h"
#endif #endif
#if HAVE_SYS_SOCKET_H #if IS_REDOX
#define restrict __restrict__
#endif
#if SUPPORTS_NETWORKING && HAVE_SYS_SOCKET_H
# include <sys/socket.h> # include <sys/socket.h>
#endif #endif
#define SOCKET int #define SOCKET int
@ -207,7 +211,7 @@ public:
}; };
#if SUPPORTS_NETWORKING
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //
// This class implements sending a message via SMTP // This class implements sending a message via SMTP
@ -245,7 +249,7 @@ private:
TSTRING mstrServerName; TSTRING mstrServerName;
unsigned short mPortNumber; unsigned short mPortNumber;
}; };
#endif
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //

View File

@ -42,6 +42,8 @@
#include <time.h> #include <time.h>
#if SUPPORTS_NETWORKING
//All the spleck that it takes to run sockets in Unix... //All the spleck that it takes to run sockets in Unix...
#include <stdio.h> #include <stdio.h>
#if HAVE_SYS_SOCKET_H #if HAVE_SYS_SOCKET_H
@ -564,3 +566,5 @@ void cSMTPMailMessage::DecodeError()
#endif // defined(_DEBUG) #endif // defined(_DEBUG)
} }
#endif // SUPPORTS_NETWORKING

View File

@ -536,15 +536,16 @@ static bool EmailReportTo(const TSTRING &toAddress, const cFCOReportHeader& head
// allocate the right kind of emailer object based on what came out of the config file. // allocate the right kind of emailer object based on what came out of the config file.
switch (modeCommon->mMailMethod) switch (modeCommon->mMailMethod)
{ {
default: #if SUPPORTS_NETWORKING
ASSERT(false);
return false;
case cMailMessage::MAIL_BY_SMTP: case cMailMessage::MAIL_BY_SMTP:
reportMail = TW_UNIQUE_PTR<cMailMessage>(new cSMTPMailMessage(modeCommon->mSmtpHost, modeCommon->mSmtpPort)); reportMail = TW_UNIQUE_PTR<cMailMessage>(new cSMTPMailMessage(modeCommon->mSmtpHost, modeCommon->mSmtpPort));
break; break;
#endif
case cMailMessage::MAIL_BY_PIPE: case cMailMessage::MAIL_BY_PIPE:
reportMail = TW_UNIQUE_PTR<cMailMessage>(new cPipedMailMessage(modeCommon->mMailProgram)); reportMail = TW_UNIQUE_PTR<cMailMessage>(new cPipedMailMessage(modeCommon->mMailProgram));
break; break;
default:
return false;
} }
TSTRING strTempFilename; TSTRING strTempFilename;
@ -690,15 +691,16 @@ bool cTWCmdLineUtil::SendEmailTestMessage(const TSTRING &mAddress, const cTWMode
// allocate the right kind of emailer object based on what came out of the config file. // allocate the right kind of emailer object based on what came out of the config file.
switch (modeCommon->mMailMethod) switch (modeCommon->mMailMethod)
{ {
default: #if SUPPORTS_NETWORKING
ASSERT(false);
return false;
case cMailMessage::MAIL_BY_SMTP: case cMailMessage::MAIL_BY_SMTP:
reportMail = TW_UNIQUE_PTR<cMailMessage>(new cSMTPMailMessage(modeCommon->mSmtpHost, modeCommon->mSmtpPort)); reportMail = TW_UNIQUE_PTR<cMailMessage>(new cSMTPMailMessage(modeCommon->mSmtpHost, modeCommon->mSmtpPort));
break; break;
#endif
case cMailMessage::MAIL_BY_PIPE: case cMailMessage::MAIL_BY_PIPE:
reportMail = TW_UNIQUE_PTR<cMailMessage>(new cPipedMailMessage(modeCommon->mMailProgram)); reportMail = TW_UNIQUE_PTR<cMailMessage>(new cPipedMailMessage(modeCommon->mMailProgram));
break; break;
default:
return false;
} }