Skip to content

Commit

Permalink
Fixed a bug in the counters plugin that triggered a problem in the
Browse files Browse the repository at this point in the history
SMTP protocol when handling the SIZE=# parameter.
  • Loading branch information
bruceg committed Sep 7, 2006
1 parent 522c616 commit dbc421f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 14 deletions.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
-------------------------------------------------------------------------------
Changes in version 1.01

- Fixed a bug in the counters plugin that triggered a problem in the
SMTP protocol when handling the SIZE=# parameter.

- Reversed the order of cvm-validate and qmail-validate in the wrapper
scripts (and documentation) due to the semantics of the two plugins.

Expand Down
28 changes: 14 additions & 14 deletions plugin-counters.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,6 @@ static unsigned linepos; /* The number of bytes since the last LF */
static int in_rec; /* True if we might be seeing Received: */
static int in_dt; /* True if we might be seeing Delivered-To: */

static const response* init(void)
{
/* This MUST be done in the init section to make sure the SMTP
* greeting displays the current value. */
session_setnum("maxdatabytes", session_getenvu("DATABYTES"));
return 0;
}

static const response* reset(void)
{
rcpt_count = 0;
return 0;
}

static unsigned long minenv(const char* sname, const char* name)
{
unsigned long u;
Expand All @@ -41,6 +27,20 @@ static unsigned long minenv(const char* sname, const char* name)
return u;
}

static const response* init(void)
{
/* This MUST be done in the init section to make sure the SMTP
* greeting displays the current value. */
minenv("maxdatabytes", "DATABYTES");
return 0;
}

static const response* reset(void)
{
rcpt_count = 0;
return 0;
}

static const response* sender(str* r)
{
/* This MUST be done as a sender match to make sure SMTP "MAIL FROM"
Expand Down
19 changes: 19 additions & 0 deletions tests/smtpfront-databytes
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
PLUGINS=counters:accept

unset DATABYTES
sfecho <<EOF
EHLO hostname
MAIL FROM:<[email protected]>
MAIL FROM:<[email protected]> SIZE
MAIL FROM:<[email protected]> SIZE=
MAIL FROM:<[email protected]> SIZE=100
EOF

DATABYTES=123
export DATABYTES

sfecho <<EOF
EHLO hostname
Expand All @@ -14,6 +24,15 @@ RCPT TO:<nobody@nowhere>
EOF
<result>
250-unknown^M
250-SIZE 0^M
250-8BITMIME^M
250-ENHANCEDSTATUSCODES^M
250 PIPELINING^M
250 Sender='[email protected]'.^M
250 Sender='[email protected]'.^M
250 Sender='[email protected]'.^M
250 Sender='[email protected]'.^M
250-unknown^M
250-SIZE 123^M
250-8BITMIME^M
250-ENHANCEDSTATUSCODES^M
Expand Down

0 comments on commit dbc421f

Please sign in to comment.