diff options
author | Stef Walter <stef@memberwebs.com> | 2004-08-27 16:59:47 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2004-08-27 16:59:47 +0000 |
commit | 0c41db052b4c3271315d5267f3cacbc737617758 (patch) | |
tree | d18f62b1dc7abb6abaf75e391c85363a36a850d5 | |
parent | 4b0e5506db124d17521e20dc9664eca60c71ece9 (diff) |
- Fixed most warnings when compiled with -Wall
-rw-r--r-- | common/compat.c | 3 | ||||
-rw-r--r-- | common/smtppass.c | 34 | ||||
-rw-r--r-- | common/sock_any.c | 7 | ||||
-rw-r--r-- | common/stringx.c | 7 |
4 files changed, 35 insertions, 16 deletions
diff --git a/common/compat.c b/common/compat.c index d3730e0..262f94d 100644 --- a/common/compat.c +++ b/common/compat.c @@ -68,6 +68,9 @@ #include "usuals.h" #include "compat.h" +#include <ctype.h> +#include <stdlib.h> + #ifndef HAVE_REALLOCF void* reallocf(void* ptr, size_t size) diff --git a/common/smtppass.c b/common/smtppass.c index a0e59cf..01a986b 100644 --- a/common/smtppass.c +++ b/common/smtppass.c @@ -42,14 +42,16 @@ #include <sys/param.h> #include <sys/stat.h> +#include <ctype.h> #include <paths.h> #include <stdio.h> -#include <pthread.h> #include <unistd.h> #include <fcntl.h> #include <syslog.h> #include <signal.h> #include <errno.h> +#include <err.h> +#include <pthread.h> #include "usuals.h" #include "compat.h" @@ -92,7 +94,9 @@ clamsmtp_thread_t; #define SMTP_DATA "DATA" CRLF #define SMTP_BANNER "220 clamsmtp" CRLF #define SMTP_HELO_RSP "250 clamsmtp" CRLF -#define SMTP_DELIMS "\r\n\t :-" +#define SMTP_EHLO_RSP "250-clamsmtp" CRLF +#define SMTP_DELIMS "\r\n\t :" +#define SMTP_MULTI_DELIMS " -" #define ESMTP_PIPELINE "PIPELINING" #define ESMTP_TLS "STARTTLS" @@ -169,7 +173,7 @@ pthread_mutexattr_t g_mutexattr; * FORWARD DECLARATIONS */ -static usage(); +static void usage(); static void on_quit(int signal); static void pid_file(const char* pid, int write); static void connection_loop(int sock); @@ -199,7 +203,6 @@ static int write_data_raw(clamsmtp_context_t* ctx, int* fd, unsigned char* buf, int main(int argc, char* argv[]) { const char* listensock = DEFAULT_SOCKET; - clamsmtp_thread_t* threads = NULL; struct sockaddr_any addr; char* pidfile = NULL; int daemonize = 1; @@ -385,7 +388,7 @@ static void on_quit(int signal) /* fprintf(stderr, "clamsmtpd: got signal to quit\n"); */ } -static int usage() +static void usage() { fprintf(stderr, "usage: clamsmtpd [-bq] [-c clamaddr] [-d debuglevel] [-D tmpdir] [-h header] " "[-l listenaddr] [-m maxconn] [-p pidfile] [-t timeout] serveraddr\n"); @@ -430,7 +433,6 @@ static void pid_file(const char* pidfile, int write) static void connection_loop(int sock) { clamsmtp_thread_t* threads = NULL; - struct sockaddr_any addr; int fd, i, x, r; /* Create the thread buffers */ @@ -863,7 +865,8 @@ static int smtp_passthru(clamsmtp_context_t* ctx) { filter_host = 0; - if(check_first_word(ctx->line, OK_RSP, KL(OK_RSP), SMTP_DELIMS) > 0) + /* Check for a simple '250 xxxx' */ + if(is_first_word(ctx->line, OK_RSP, KL(OK_RSP))) { messagex(ctx, LOG_DEBUG, "intercepting host response"); @@ -872,6 +875,17 @@ static int smtp_passthru(clamsmtp_context_t* ctx) continue; } + + /* Check for the continued response '250-xxxx' */ + if(check_first_word(ctx->line, OK_RSP, KL(OK_RSP), SMTP_MULTI_DELIMS) > 0) + { + messagex(ctx, LOG_DEBUG, "intercepting host response"); + + if(write_data(ctx, &(ctx->client), SMTP_EHLO_RSP) == -1) + RETURN(-1); + + continue; + } } /* @@ -880,7 +894,7 @@ static int smtp_passthru(clamsmtp_context_t* ctx) */ if(filter_ehlo) { - if((r = check_first_word(ctx->line, OK_RSP, KL(OK_RSP), SMTP_DELIMS)) > 0) + if((r = check_first_word(ctx->line, OK_RSP, KL(OK_RSP), SMTP_MULTI_DELIMS)) > 0) { char* p = ctx->line + r; if(is_first_word(p, ESMTP_PIPELINE, KL(ESMTP_PIPELINE)) || @@ -1079,7 +1093,6 @@ static int read_server_response(clamsmtp_context_t* ctx) static int connect_clam(clamsmtp_context_t* ctx) { - int r, len = -1; int ret = 0; ASSERT(ctx); @@ -1349,11 +1362,8 @@ cleanup: static int transfer_from_file(clamsmtp_context_t* ctx, const char* filename) { FILE* file = NULL; - const char* t; - const char* e; int header = 0; int ret = 0; - int len, r; file = fopen(filename, "r"); if(file == NULL) diff --git a/common/sock_any.c b/common/sock_any.c index 0018318..03621ff 100644 --- a/common/sock_any.c +++ b/common/sock_any.c @@ -36,12 +36,15 @@ * */ -#include <stdlib.h> -#include <errno.h> #include <sys/types.h> #include <sys/socket.h> + +#include <ctype.h> +#include <stdlib.h> +#include <errno.h> #include <netdb.h> #include <string.h> +#include <stdio.h> #include "sock_any.h" diff --git a/common/stringx.c b/common/stringx.c index a2bc90d..02e89f3 100644 --- a/common/stringx.c +++ b/common/stringx.c @@ -38,11 +38,16 @@ #include <sys/types.h> +#include <ctype.h> #include <syslog.h> #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <errno.h> +#include <alloca.h> +#include <err.h> +#include <stdarg.h> +#include <strings.h> #include "usuals.h" #include "compat.h" @@ -62,7 +67,6 @@ static void vmessage(clamsmtp_context_t* ctx, int level, int err, size_t len; char* m; int e = errno; - int x; if(g_daemonized) { @@ -132,7 +136,6 @@ void log_fd_data(clamsmtp_context_t* ctx, const char* data, int* fd, int read) #define ptrdiff(o, t) char prefix[16]; - const char* t; ASSERT(ctx); ASSERT(ismember(ctx, fd)); |