On Tue, Jul 13, 2004 at 11:56:42AM +0200, Aiko Barz wrote:
> Solution:
> Donnow, since qmail-remote.c uses the sender for the AUTH-field it's
> probably its duty to convert the stuff?!
> But this is up to you. :-P

I see now, that it was up to me... ;)
Finally, i found some time and wrote a patch to fix the BUG. I guess,
that you want to create some subfunctions and do some struct-magic.

I only wrote the encrypt stuff. The decrypt-functions are still
missing and will be necessary some day...

At least my mailinglists are up and working again.

Bis denne,
        Aiko
-- 
  .~.    Aiko Barz
  /v\    
 // \\   Mail: [EMAIL PROTECTED]
/( _ )\  Web:  http://www.chroot.de
 ^^ ^^   PGP:  http://www.chroot.de/index.php?navi=GnuPG

--- /root/qmail-remote.c        2004-07-15 19:07:51.000000000 +0200
+++ qmail-remote.c      2004-07-19 17:46:12.405548672 +0200
@@ -455,6 +455,13 @@
 
   flagtls = 0;
 #endif
+  /* RFC 2554 */
+  char *auth_code;
+  char *auth_p;
+  unsigned int code_len;
+  char *auth_plain = NULL;
+  unsigned int plain_len;
+  int char_x;
 
   code = smtpcode();
   if (code >= 500) quit("DConnected to "," but greeting failed");
@@ -629,9 +636,40 @@
     substdio_put(&smtpto,num,fmt_ulong(num,len+1));
   }
   if (flagauth) {
+    /*******
+     *
+     * RFC 2554 - MAIL FROM:<[EMAIL PROTECTED]> AUTH=<[EMAIL PROTECTED]>
+     *
+     */
+    /* Allocate memory */
+    auth_plain = sender.s;
+    plain_len = sender.len;
+    code_len = 0;
+    while (plain_len-- > 0)
+    {
+        code_len += ((char_x = *auth_plain++) < 33 || char_x > 127 || char_x == '+' 
|| char_x == '=') ? 3 : 1;
+    }
+    auth_code = (char *) malloc(code_len * sizeof(char));
+    /* Encode AUTH */
+    auth_plain = sender.s;
+    plain_len = sender.len;
+    auth_p = auth_code;
+    while (plain_len-- > 0)
+    {   
+        if ((char_x = *auth_plain++) < 33 || char_x > 127 || char_x == '+' || char_x 
== '=')
+        {   
+            sprintf(auth_p, "+%.02x", char_x);
+            auth_p += 3;
+        }
+        else
+        {
+            *auth_p++ = char_x;
+        }
+    }
     substdio_puts(&smtpto, " AUTH=<");
-    substdio_put(&smtpto,sender.s,sender.len);
+    substdio_put(&smtpto,auth_code,code_len);
     substdio_puts(&smtpto,">");
+    free(auth_code);
   }
   substdio_puts(&smtpto,"\r\n");
   substdio_flush(&smtpto);

Attachment: pgpS7mG3IvFzl.pgp
Description: PGP signature

Reply via email to