summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-mail/qmail/files/1.03-r14/qmail-smtpd-esmtp-size-gentoo.patch')
-rw-r--r--net-mail/qmail/files/1.03-r14/qmail-smtpd-esmtp-size-gentoo.patch81
1 files changed, 81 insertions, 0 deletions
diff --git a/net-mail/qmail/files/1.03-r14/qmail-smtpd-esmtp-size-gentoo.patch b/net-mail/qmail/files/1.03-r14/qmail-smtpd-esmtp-size-gentoo.patch
new file mode 100644
index 000000000000..3409116d57ab
--- /dev/null
+++ b/net-mail/qmail/files/1.03-r14/qmail-smtpd-esmtp-size-gentoo.patch
@@ -0,0 +1,81 @@
+diff -ur qmail-1.03.orig/qmail-smtpd.c qmail-1.03/qmail-smtpd.c
+--- qmail-1.03.orig/qmail-smtpd.c 2003-09-01 21:47:32.000000000 -0700
++++ qmail-1.03/qmail-smtpd.c 2003-09-01 21:48:36.000000000 -0700
+@@ -117,6 +117,7 @@
+ void err_nogwcert() { out("553 no valid cert for gatewaying (#5.7.1)\r\n"); }
+ #endif
+ 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"); }
+@@ -296,6 +297,40 @@
+ return 1;
+ }
+
++int sizelimit(arg)
++char *arg;
++{
++ int i;
++ long r;
++ unsigned long sizebytes = 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 bmcheck(which) int which;
+ {
+ int i = 0;
+@@ -351,6 +386,12 @@
+ 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("\r\n250-SIZE "); out(size_buf);
++}
+ void smtp_ehlo(arg) char *arg;
+ {
+ smtp_greet("250-");
+@@ -364,6 +405,7 @@
+ #ifdef TLS
+ if (!ssl) out("\r\n250-STARTTLS");
+ #endif
++ smtp_size();
+ out("\r\n250-PIPELINING\r\n250 8BITMIME\r\n");
+ seenmail = 0; dohelo(arg);
+ }
+@@ -375,6 +417,7 @@
+ void smtp_mail(arg) char *arg;
+ {
+ if (!addrparse(arg)) { err_syntax(); return; }
++ if (databytes && !sizelimit(arg)) { err_size(); return; }
+ if (bmfok) flagbarfbmf = bmcheck(BMCHECK_BMF);
+ seenmail = 1;
+ if (!stralloc_copys(&rcptto,"")) die_nomem();