Subversion Repositories sa-exim

Compare Revisions

Ignore whitespace Rev 12 → Rev 13

/trunk/sa-exim.c
515,6 → 515,7
int pid;
int writefd[2];
int readfd[2];
char *spamc_argv[10];
int i;
/* These are the only values that we want working after the longjmp
* The automatic ones can be clobbered, but we don't really care */
552,6 → 553,7
static char *SAspamcSockPath=NULL;
static char *SAspamcPort="783";
static char *SAspamcHost="127.0.0.1";
static char *SAspamcUser=NULL;
static char *SAEximRunCond="0";
static char *SAEximRejCond="1";
static int SAmaxbody=250*1024;
712,6 → 714,7
M_CHECKFORSTR(SAspamcSockPath);
M_CHECKFORSTR(SAspamcPort);
M_CHECKFORSTR(SAspamcHost);
M_CHECKFORSTR(SAspamcUser);
M_CHECKFORSTR(SAEximRunCond);
M_CHECKFORSTR(SAEximRejCond);
M_CHECKFORVAR(SAmaxbody, "%d");
914,6 → 917,22
ret=dup2(readfd[1],2);
CHECKERR(ret,"dup2 stderr",__LINE__);
 
i = 0;
spamc_argv[i++] = "spamc";
if (SAspamcUser && SAspamcUser[0])
{
expand=expand_string(SAspamcUser);
if (expand == NULL)
{
log_write(0, LOG_MAIN | LOG_PANIC, "SA: SAspamcUser expansion failure on %s, will run as Exim user instead.", SAspamcUser);
}
else
{
spamc_argv[i++] = "-u";
spamc_argv[i++] = expand;
}
}
 
/*
* I could implement the spamc protocol and talk to spamd directly
* instead of forking spamc, but considering the overhead spent
924,17 → 943,26
/* Ok, we cheat, spamc cares about how big the whole message is and
* we only know about the body size, so I'll give an extra 16K
* to account for any headers that can accompany the message */
 
spamc_argv[i++] = "-s";
spamc_argv[i++] = string_sprintf("%d", SAmaxbody+16384);
 
if(SAspamcSockPath)
{
ret=execl(SAspamcpath, "spamc", "-s", string_sprintf("%d", SAmaxbody+16384), "-U", SAspamcSockPath, NULL);
CHECKERR(ret,string_sprintf("exec %s", SAspamcpath),__LINE__);
spamc_argv[i++] = "-U";
spamc_argv[i++] = SAspamcSockPath;
}
else
{
ret=execl(SAspamcpath, "spamc", "-s", string_sprintf("%d", SAmaxbody+16384), "-d", SAspamcHost, "-p", SAspamcPort, NULL);
CHECKERR(ret,string_sprintf("exec %s", SAspamcpath),__LINE__);
spamc_argv[i++] = "-d";
spamc_argv[i++] = SAspamcHost;
spamc_argv[i++] = "-p";
spamc_argv[i++] = SAspamcPort;
}
spamc_argv[i++] = NULL;
 
ret=execv(SAspamcpath, spamc_argv);
CHECKERR(ret,string_sprintf("exec %s", SAspamcpath),__LINE__);
}
 
if (SAEximDebug > 8)