3 Bugfix: the SMTP server now separates the message size check
4 from the queue space check, so that the size check can be
5 done before an SMTPD proxy filter. Files: smtpd/smtpd.c,
8 diff -ur postfix-2.2.3/src/smtpd/smtpd.c postfix-2.2.3-size/src/smtpd/smtpd.c
9 --- postfix-2.2.3/src/smtpd/smtpd.c 2005-03-09 21:07:43.000000000 +0100
10 +++ postfix-2.2.3-size/src/smtpd/smtpd.c 2005-09-07 01:57:23.933600904 +0200
11 @@ -1555,6 +1555,10 @@
15 + if ((err = smtpd_check_size(state, state->msg_size)) != 0) {
16 + smtpd_chat_reply(state, "%s", err);
19 if (verp_delims && argv[2].strval[0] == 0) {
20 smtpd_chat_reply(state, "503 Error: %s requires non-null sender",
23 * Check the queue file space, if applicable.
25 if (!USE_SMTPD_PROXY(state)) {
26 - if ((err = smtpd_check_size(state, state->msg_size)) != 0) {
27 + if ((err = smtpd_check_queue(state)) != 0) {
28 smtpd_chat_reply(state, "%s", err);
31 diff -ur postfix-2.2.3/src/smtpd/smtpd_check.c postfix-2.2.3-size/src/smtpd/smtpd_check.c
32 --- postfix-2.2.3/src/smtpd/smtpd_check.c 2005-03-05 02:13:10.000000000 +0100
33 +++ postfix-2.2.3-size/src/smtpd/smtpd_check.c 2005-09-07 02:04:32.193697648 +0200
36 /* char *smtpd_check_eod(state)
37 /* SMTPD_STATE *state;
39 +/* char *smtpd_check_size(state, size)
40 +/* SMTPD_STATE *state;
43 +/* char *smtpd_check_queue(state)
44 +/* SMTPD_STATE *state;
46 /* This module implements additional checks on SMTP client requests.
47 /* A client request is validated in the context of the session state.
50 /* smtpd_check_size() checks if a message with the given size can
51 /* be received (zero means that the message size is unknown). The
52 -/* message is rejected when:
54 -/* The message size exceeds the non-zero bound specified with the
55 +/* message is rejected when
56 +/* the message size exceeds the non-zero bound specified with the
57 /* \fImessage_size_limit\fR configuration parameter. This is a
60 +/* smtpd_check_queue() checks the available queue file system
61 +/* space. The message is rejected when:
63 /* The available queue file system space is less than the amount
64 /* specified with the \fImin_queue_free\fR configuration parameter.
67 char *smtpd_check_size(SMTPD_STATE *state, off_t size)
69 - char *myname = "smtpd_check_size";
70 - struct fsspace fsbuf;
74 @@ -4127,16 +4134,38 @@
75 return (status == SMTPD_CHECK_REJECT ? STR(error_text) : 0);
78 - * Avoid overflow/underflow when comparing message size against available
80 + * Check against file size limit.
82 -#define BLOCKS(x) ((x) / fsbuf.block_size)
84 if (var_message_limit > 0 && size > var_message_limit) {
85 (void) smtpd_check_reject(state, MAIL_ERROR_POLICY,
86 "552 Message size exceeds fixed limit");
87 return (STR(error_text));
92 +/* smtpd_check_queue - check queue space */
94 +char *smtpd_check_queue(SMTPD_STATE *state)
96 + char *myname = "smtpd_check_queue";
97 + struct fsspace fsbuf;
101 + * Return here in case of serious trouble.
103 + SMTPD_CHECK_RESET();
104 + if ((status = setjmp(smtpd_check_buf)) != 0)
105 + return (status == SMTPD_CHECK_REJECT ? STR(error_text) : 0);
108 + * Avoid overflow/underflow when comparing message size against available
111 +#define BLOCKS(x) ((x) / fsbuf.block_size)
113 fsspace(".", &fsbuf);
115 msg_info("%s: blocks %lu avail %lu min_free %lu msg_size_limit %lu",
116 diff -ur postfix-2.2.3/src/smtpd/smtpd_check.h postfix-2.2.3-size/src/smtpd/smtpd_check.h
117 --- postfix-2.2.3/src/smtpd/smtpd_check.h 2004-11-19 14:23:23.000000000 +0100
118 +++ postfix-2.2.3-size/src/smtpd/smtpd_check.h 2005-09-07 02:02:10.668212792 +0200
120 extern char *smtpd_check_helo(SMTPD_STATE *, char *);
121 extern char *smtpd_check_mail(SMTPD_STATE *, char *);
122 extern char *smtpd_check_size(SMTPD_STATE *, off_t);
123 +extern char *smtpd_check_queue(SMTPD_STATE *);
124 extern char *smtpd_check_rcpt(SMTPD_STATE *, char *);
125 extern char *smtpd_check_etrn(SMTPD_STATE *, char *);
126 extern char *smtpd_check_data(SMTPD_STATE *);