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 "msystem.h"
#if IS_REDOX
#define setuid(x) sleep(0)
#define setgid(x) sleep(0)
#endif
/*
* signal type
*/

View File

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

View File

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

View File

@ -42,6 +42,8 @@
#include <time.h>
#if SUPPORTS_NETWORKING
//All the spleck that it takes to run sockets in Unix...
#include <stdio.h>
#if HAVE_SYS_SOCKET_H
@ -564,3 +566,5 @@ void cSMTPMailMessage::DecodeError()
#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.
switch (modeCommon->mMailMethod)
{
default:
ASSERT(false);
return false;
#if SUPPORTS_NETWORKING
case cMailMessage::MAIL_BY_SMTP:
reportMail = TW_UNIQUE_PTR<cMailMessage>(new cSMTPMailMessage(modeCommon->mSmtpHost, modeCommon->mSmtpPort));
break;
#endif
case cMailMessage::MAIL_BY_PIPE:
reportMail = TW_UNIQUE_PTR<cMailMessage>(new cPipedMailMessage(modeCommon->mMailProgram));
break;
default:
return false;
}
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.
switch (modeCommon->mMailMethod)
{
default:
ASSERT(false);
return false;
#if SUPPORTS_NETWORKING
case cMailMessage::MAIL_BY_SMTP:
reportMail = TW_UNIQUE_PTR<cMailMessage>(new cSMTPMailMessage(modeCommon->mSmtpHost, modeCommon->mSmtpPort));
break;
#endif
case cMailMessage::MAIL_BY_PIPE:
reportMail = TW_UNIQUE_PTR<cMailMessage>(new cPipedMailMessage(modeCommon->mMailProgram));
break;
default:
return false;
}