diff options
author | Stef Walter <stef@memberwebs.com> | 2004-08-02 23:51:53 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2004-08-02 23:51:53 +0000 |
commit | 1451a338c6fa44881d05715f3276c93e3514ca23 (patch) | |
tree | 25810053c0ede72c2121a69e9e85bbeb00dc7639 | |
parent | 64bce4ccd66a0e91adaef90619c83cc2c45fa975 (diff) |
- Fixed endless loop that occurred on failure to connect out [Jo��o Carlos Mendes Lu��s]
- Added option for leaving all files in temp directory (debugging purposes)
- Prints version number when run with -v
-rw-r--r-- | common/smtppass.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/common/smtppass.c b/common/smtppass.c index 600f31c..e529dde 100644 --- a/common/smtppass.c +++ b/common/smtppass.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); |