From aa8dd5d2add8f620b86ea8e05a6cc01bee5bc32d Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Sat, 12 Mar 2005 05:10:24 +0000 Subject: Accept special formatting arguments in the Header line. --- src/clamsmtpd.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/clamsmtpd.c b/src/clamsmtpd.c index 253d1ee..f9f1bf8 100644 --- a/src/clamsmtpd.c +++ b/src/clamsmtpd.c @@ -65,7 +65,6 @@ typedef struct clstate /* Settings ------------------------------- */ struct sockaddr_any clamaddr; /* Address for connecting to clamd */ const char* clamname; - const char* header; /* The header to add to email */ const char* directory; /* The directory for temp files */ const char* virusaction; /* Program to run when event occurs */ int bounce; /* Send back a reject line */ @@ -122,8 +121,9 @@ clctx_t; */ #define CFG_CLAMADDR "ClamAddress" -#define CFG_HEADER "ScanHeader" #define CFG_DIRECTORY "TempDirectory" +#define CFG_HEADER "Header" +#define CFG_SCANHEADER "ScanHeader" #define CFG_BOUNCE "Bounce" #define CFG_QUARANTINE "Quarantine" #define CFG_DEBUGFILES "DebugFiles" @@ -165,9 +165,11 @@ int main(int argc, char* argv[]) /* Configuration defaults */ memset(&g_clstate, 0, sizeof(g_clstate)); - g_clstate.header = DEFAULT_HEADER; g_clstate.directory = _PATH_TMP; + /* Setup a default header */ + sp_parse_option(CFG_HEADER, DEFAULT_HEADER); + /* We need the default to parse into a useable form, so we do this: */ r = cb_parse_option(CFG_CLAMADDR, DEFAULT_CLAMAV); ASSERT(r == 1); @@ -358,7 +360,7 @@ int cb_check_data(spctx_t* sp) * and transfer the file to it. */ case 0: - if(sp_done_data(sp, g_clstate.header) == -1) + if(sp_done_data(sp) == -1) return -1; break; @@ -395,14 +397,11 @@ int cb_parse_option(const char* name, const char* value) return 1; } - else if(strcasecmp(CFG_HEADER, name) == 0) + else if(strcasecmp(CFG_SCANHEADER, name) == 0) { - g_clstate.header = (const char*)trim_space((char*)value); - - if(strlen(g_clstate.header) == 0) - g_clstate.header = NULL; - - return 1; + /* Pass old format header option through */ + warnx("please use \"Header\" option instead of \"ScanHeader\""); + return sp_parse_option(CFG_HEADER, optarg); } else if(strcasecmp(CFG_DIRECTORY, name) == 0) -- cgit v1.2.3