From 71c0ffd3806f74b85aff561733e4287e87a22c24 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Mon, 2 Aug 2004 23:51:53 +0000 Subject: =?UTF-8?q?=20=20-=20Fixed=20endless=20loop=20that=20occurred=20on?= =?UTF-8?q?=20failure=20to=20connect=20out=20[Jo=EF=BF=BD=EF=BF=BDo=20Carl?= =?UTF-8?q?os=20Mendes=20Lu=EF=BF=BD=EF=BF=BDs]=20=20=20-=20Added=20option?= =?UTF-8?q?=20for=20leaving=20all=20files=20in=20temp=20directory=20(debug?= =?UTF-8?q?ging=20purposes)=20=20=20-=20Prints=20version=20number=20when?= =?UTF-8?q?=20run=20with=20-v?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/clamsmtpd.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/clamsmtpd.c b/src/clamsmtpd.c index 600f31c..e529dde 100644 --- a/src/clamsmtpd.c +++ b/src/clamsmtpd.c @@ -146,6 +146,7 @@ const char* g_directory = _PATH_TMP; /* The directory for temp files */ unsigned int g_unique_id = 0x00100000; /* For connection ids */ int g_bounce = 0; /* Send back a reject line */ int g_quarantine = 0; /* Leave virus files in temp dir */ +int g_debugfiles = 0; /* Leave all files in temp dir */ /* For main loop and signal handlers */ int g_quit = 0; @@ -199,7 +200,7 @@ int main(int argc, char* argv[]) char* t; /* Parse the arguments nicely */ - while((ch = getopt(argc, argv, "bc:d:D:h:l:m:p:qt:")) != -1) + while((ch = getopt(argc, argv, "bc:d:D:h:l:m:p:qt:vX")) != -1) { switch(ch) { @@ -264,6 +265,17 @@ int main(int argc, char* argv[]) g_quarantine = 1; break; + /* Print version number */ + case 'v': + printf("clamsmtpd (version %s)\n", VERSION); + exit(0); + break; + + /* Leave all files in the tmp directory */ + case 'X': + g_debugfiles = 1; + break; + /* Usage information */ case '?': default: @@ -359,8 +371,9 @@ static void on_quit(int signal) static int usage() { - fprintf(stderr, "clamsmtpd [-bq] [-c clamaddr] [-d debuglevel] [-D tmpdir] [-h header] " + fprintf(stderr, "usage: clamsmtpd [-bq] [-c clamaddr] [-d debuglevel] [-D tmpdir] [-h header] " "[-l listenaddr] [-m maxconn] [-p pidfile] [-t timeout] serveraddr\n"); + fprintf(stderr, " clamsmtpd -v\n"); exit(2); } @@ -901,7 +914,7 @@ static int avcheck_data(clamsmtp_context_t* ctx, char* logline) }; cleanup: - if(havefile) + if(havefile && !g_debugfiles) { messagex(ctx, LOG_DEBUG, "deleting temporary file: %s", buf); unlink(buf); @@ -1332,7 +1345,7 @@ cleanup: close(sock); message(ctx, LOG_ERR, "couldn't connect to: %s", addrname); - RETURN(-1); + return -1; } ASSERT(sock != -1); -- cgit v1.2.3