Skip to content

Commit

Permalink
Move "SIZE" capabilities text into the counters plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
bruceg committed Jul 13, 2011
1 parent d31184d commit b48301d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
10 changes: 10 additions & 0 deletions plugin-counters.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ static const response* init(void)
return 0;
}

static const response* helo(str* hostname, str* capabilities)
{
if (!str_cats(capabilities, "SIZE ")) return &resp_oom;
if (!str_catu(capabilities, session_getnum("maxdatabytes", 0))) return &resp_oom;
if (!str_catc(capabilities, '\n')) return &resp_oom;
return 0;
(void)hostname;
}

static const response* reset(void)
{
minenv("maxdatabytes", "DATABYTES");
Expand Down Expand Up @@ -145,6 +154,7 @@ static const response* end(int fd)
struct plugin plugin = {
.version = PLUGIN_VERSION,
.init = init,
.helo = helo,
.reset = reset,
.sender = sender,
.recipient = recipient,
Expand Down
5 changes: 1 addition & 4 deletions protocol-smtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,7 @@ static int init(void)
return 1;
}

if (!str_copys(&init_capabilities, "SIZE ")
|| !str_catu(&init_capabilities, session_getnum("maxdatabytes", 0))
|| !str_catc(&init_capabilities, '\n')
|| !str_cats(&init_capabilities, "8BITMIME\nENHANCEDSTATUSCODES\nPIPELINING")) {
if (!str_cats(&init_capabilities, "8BITMIME\nENHANCEDSTATUSCODES\nPIPELINING")) {
respond(&resp_oom);
return 1;
}
Expand Down
2 changes: 0 additions & 2 deletions tests/plugin-reject
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ EOF
220 local.host mailfront ESMTP^M
250 local.host^M
250-local.host^M
250-SIZE 0^M
250-8BITMIME^M
250-ENHANCEDSTATUSCODES^M
250 PIPELINING^M
Expand All @@ -23,7 +22,6 @@ EOF
220 local.host mailfront ESMTP^M
250 local.host^M
250-local.host^M
250-SIZE 0^M
250-8BITMIME^M
250-ENHANCEDSTATUSCODES^M
250 PIPELINING^M
Expand Down

0 comments on commit b48301d

Please sign in to comment.