I've extended the little patch I wrote earlier to make qmail fully RFC
1870 compliant, including the extended MAIL FROM ... SIZE syntax.
You can also get it from my website, http://will.harris.ch.
regards,
Will
*** qmail-smtpd.c.orig Mon May 29 11:54:41 2000
--- qmail-smtpd.c Wed May 31 11:44:21 2000
***************
*** 52,57 ****
--- 52,58 ----
void err_bmf() { out("553 sorry, your envelope sender is in my badmailfrom list
(#5.7.1)\r\n"); }
void err_nogateway() { out("553 sorry, that domain isn't in my list of allowed
rcpthosts (#5.7.1)\r\n"); }
void err_unimpl() { out("502 unimplemented (#5.5.1)\r\n"); }
+ void err_size() { out("552 sorry, that message size exceeds my databytes limit
+(#5.3.4)\r\n"); }
void err_syntax() { out("555 syntax error (#5.5.4)\r\n"); }
void err_wantmail() { out("503 MAIL first (#5.5.1)\r\n"); }
void err_wantrcpt() { out("503 RCPT first (#5.5.1)\r\n"); }
***************
*** 197,202 ****
--- 198,239 ----
return 1;
}
+ int sizelimit(arg)
+ char *arg;
+ {
+ int i;
+ long r;
+ unsigned long sizebytes = 0;
+
+ if (r < 0) return 0;
+
+ i = str_chr(arg,'<');
+ if (arg[i])
+ arg += i + 1;
+ else {
+ arg += str_chr(arg,':');
+ if (*arg == ':') ++arg;
+ while (*arg == ' ') ++arg;
+ }
+
+ arg += str_chr(arg,' ');
+ if (*arg == ' ') while (*arg == ' ') ++arg;
+ else return 1;
+
+ i = str_chr(arg,'=');
+ arg[i] = 0;
+ if (case_equals(arg,"SIZE")) {
+ arg += i;
+ while (*++arg && *arg > 47 && *arg < 58) {
+ sizebytes *= 10;
+ sizebytes += *arg - 48;
+ }
+ r = databytes - sizebytes;
+ if (r < 0) return 0;
+ }
+ return 1;
+ }
+
int bmfcheck()
{
int j;
***************
*** 227,235 ****
smtp_greet("250 "); out("\r\n");
seenmail = 0; dohelo(arg);
}
void smtp_ehlo(arg) char *arg;
{
! smtp_greet("250-"); out("\r\n250-PIPELINING\r\n250 8BITMIME\r\n");
seenmail = 0; dohelo(arg);
}
void smtp_rset()
--- 264,279 ----
smtp_greet("250 "); out("\r\n");
seenmail = 0; dohelo(arg);
}
+ char size_buf[FMT_ULONG];
+ void smtp_size()
+ {
+ size_buf[fmt_ulong(size_buf,(unsigned long) databytes)] = 0;
+ out("250 SIZE "); out(size_buf); out("\r\n");
+ }
void smtp_ehlo(arg) char *arg;
{
! smtp_greet("250-"); out("\r\n250-PIPELINING\r\n250-8BITMIME\r\n");
! smtp_size();
seenmail = 0; dohelo(arg);
}
void smtp_rset()
***************
*** 240,245 ****
--- 284,290 ----
void smtp_mail(arg) char *arg;
{
if (!addrparse(arg)) { err_syntax(); return; }
+ if (!sizelimit(arg)) { err_size(); return; }
flagbarf = bmfcheck();
seenmail = 1;
if (!stralloc_copys(&rcptto,"")) die_nomem();