diff options
author | Stef Walter <stef@memberwebs.com> | 2004-10-12 16:26:19 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2004-10-12 16:26:19 +0000 |
commit | bc1291991f7f9feef10f7a41be050654011f5bfe (patch) | |
tree | 3842b73ac627f29e2b3da6495ad314a435460fcd | |
parent | 46a9ccefc1595da1afbb7a2a9279311a987ff53f (diff) |
Don't send lines that are too long to syslog
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | common/smtppass.c | 8 | ||||
-rw-r--r-- | common/smtppass.h | 9 |
3 files changed, 12 insertions, 8 deletions
@@ -1,3 +1,6 @@ +0.9.7 + - Don't send lines that are too long to syslog [Ben Mesman] + 0.9.6 - Fixed problem when filtering the last of a list of EHLO responses - Send NOOPs to the server when receiving data slowly from client diff --git a/common/smtppass.c b/common/smtppass.c index e00f7a1..3205026 100644 --- a/common/smtppass.c +++ b/common/smtppass.c @@ -1094,16 +1094,16 @@ void sp_add_log(spctx_t* ctx, char* prefix, char* line) int l = strlen(t); int x; - ASSERT(l <= SP_LINE_LENGTH); + ASSERT(l <= SP_LOG_LINE_LEN); /* Add up necessary lengths */ x = 2 + strlen(prefix) + strlen(line) + 1; - if(l + x >= SP_LINE_LENGTH) - l = SP_LINE_LENGTH - x; + if(l + x >= SP_LOG_LINE_LEN) + l = SP_LOG_LINE_LEN - x; t += l; - l = SP_LINE_LENGTH - l; + l = SP_LOG_LINE_LEN - l; *t = 0; diff --git a/common/smtppass.h b/common/smtppass.h index e7fc780..34758ba 100644 --- a/common/smtppass.h +++ b/common/smtppass.h @@ -108,6 +108,10 @@ unsigned int spio_select(struct spctx* ctx, ...); * SMTP PASS THROUGH FUNCTIONALITY */ +/* Log lines have to be under roughly 900 chars otherwise + * they get truncated by syslog. */ +#define SP_LOG_LINE_LEN 768 + typedef struct spctx { unsigned int id; /* Identifier for the connection */ @@ -117,15 +121,12 @@ typedef struct spctx FILE* cachefile; /* The file handle for the cached file */ char cachename[MAXPATHLEN]; /* The name of the file that we cache into */ - char logline[SP_LINE_LENGTH]; /* Log line */ + char logline[SP_LOG_LINE_LEN]; /* Log line */ char* sender; /* The email of the sender */ char* recipients; /* The email of the recipients */ int _crlf; /* Private data */ - char _l1[SP_LINE_LENGTH]; - char _l2[SP_LINE_LENGTH]; - time_t _tm; } spctx_t; |