Re: applying SMTP SIZE patch

2000-06-01 Thread Jon Rust

bash-2.03$ uname -a
FreeBSD host.vcnet.com 3.3-RELEASE FreeBSD 3.3-RELEASE #1: Wed Oct 20 
20:43:43 PDT 1999 
[EMAIL PROTECTED]:/usr/src/sys/compile/CUSTKERN  i386
bash-2.03$ patch -v
Patch version 2.1

jon

At 12:03 AM + 6/2/00, Jim Breton wrote:
>On Thu, Jun 01, 2000 at 04:58:14PM -0700, Jon Rust wrote:
>>  FWIW, I used the patch as posted to this list (below) and had no
>>  problems applying it.
>
>What OS, and what version of "patch" do you use, if you don't mind my
>asking?




Re: applying SMTP SIZE patch

2000-06-01 Thread Jon Rust

FWIW, I used the patch as posted to this list (below) and had no 
problems applying it.

jon

At 12:38 AM +0200 6/2/00, Einar Bordewich wrote:
>I had the same problem, so I patched it manually. Her it is with the patch
>applied.
>If you rename your old file to qmail-smtpd.c.orig and do a "diff -c
>qmail-smtpd.c.orig qmail-smtpd.c |more", you should see output quite equal
>to the patch.
>
>BTW: The initial size on qmail-smtpd.c was 11262 bytes.
>--

Delivered-To: [EMAIL PROTECTED]
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Delivered-To: mailing list [EMAIL PROTECTED]
X-Remote-IP: 130.60.48.21
Date: Wed, 31 May 2000 12:08:34 +0200 (MET DST)
From: Will Harris <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: SMTP SIZE command revisited (new patch)
Status:  U

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();



Re: applying SMTP SIZE patch

2000-06-01 Thread Einar Bordewich

I had the same problem, so I patched it manually. Her it is with the patch
applied.
If you rename your old file to qmail-smtpd.c.orig and do a "diff -c
qmail-smtpd.c.orig qmail-smtpd.c |more", you should see output quite equal
to the patch.

BTW: The initial size on qmail-smtpd.c was 11262 bytes.
--

IDG New Media Einar Bordewich
Technical Manager  Phone: +47 2336 1420
E-Mail:   [EMAIL PROTECTED]


- Original Message -
From: "Jim Breton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 01, 2000 7:52 PM
Subject: applying SMTP SIZE patch


: Hi, sorry for the lame thread, but I'm having a hard time applying the
: patch:
:
: http://will.harris.ch/qmail-smtpd.c.diff
:
: to qmail-smtpd.c.
:
: Note that I downloaded the patch using "wget" and it did not insert any
: extraneous carriage returns, etc. into the file.
:
: The diff, after I download it, is 2463 bytes.  My qmail-smtpd.c is the
: original, unpatched version, and it is 11262 bytes.
:
: Here is the error I get:
:
: $ patch --verbose < qmail-smtpd.c.diff
: Hmm...  Looks like a new-style context diff to me...
: The text leading up to this was:
: --
: |*** qmail-smtpd.c.orig Mon May 29 11:54:41 2000
: |--- qmail-smtpd.c  Wed May 31 11:44:21 2000
: --
: Patching file `qmail-smtpd.c' using Plan A...
: Hunk #1 succeeded at 52.
: patch:  unexpected end of hunk at line 56
:
:
: System is Debian GNU/Linux, potato.  patch --version reports:
:
: $ patch --version
: patch 2.5
: Copyright 1988 Larry Wall
: Copyright 1997 Free Software Foundation, Inc.
:
: This program comes with NO WARRANTY, to the extent permitted by law.
: You may redistribute copies of this program
: under the terms of the GNU General Public License.
: For more information about these matters, see the file named COPYING.
:
: written by Larry Wall with lots o' patches by Paul Eggert
:
:
: I have tried various command-line arguments to patch (including -R) with
: no success.  Would someone be kind enough to send me his copy of the
: patched qmail-smtpd.c so I can generate my own diff?
:
: Also if anyone could tell me why this is happening, it would help.  The
: diff itself looks fine to my eyes.
:
: I started applying the patch by hand, which was fine for the first
: (non-mail-rejecting) patch, but this one is getting under my skin with
: the combination of changing line numbers, and the fact that I have no
: idea what "!" signifies at the beginning of a diff line, and that the
: line looks exactly the same as the original, etc..  (My frustration
: tolerance is quite low today.)  ;)
:
: Thanks.
:
:

 qmail-smtpd.c.size-patched.tar.gz