Thanks to Henning Brauer for pointing out, that there must be a
mistake in the license-header. ;)
So, let's try it again and have a look at what happens next.

Bis denne,
        Aiko

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

diff -Nur qmail-1.03.orig/Makefile qmail-1.03/Makefile
--- qmail-1.03.orig/Makefile    2004-08-18 20:37:29.000000000 +0200
+++ qmail-1.03/Makefile 2004-08-18 20:37:39.425163584 +0200
@@ -1948,12 +1948,13 @@
 load qmail-remote.o control.o constmap.o timeoutread.o timeoutwrite.o \
 timeoutconn.o tcpto.o now.o dns.o ip.o ipalloc.o ipme.o quote.o base64.o \
 ndelay.a case.a sig.a open.a lock.a seek.a getln.a stralloc.a alloc.a \
-strerr.a substdio.a error.a str.a fs.a auto_qmail.o dns.lib socket.lib
+strerr.a substdio.a error.a str.a fs.a auto_qmail.o dns.lib socket.lib \
+xtext.o
        ./load qmail-remote control.o constmap.o timeoutread.o \
        timeoutwrite.o timeoutconn.o tcpto.o now.o dns.o ip.o \
        ipalloc.o ipme.o quote.o base64.o ndelay.a case.a sig.a \
        open.a lock.a seek.a getln.a stralloc.a alloc.a strerr.a \
-       substdio.a error.a str.a fs.a auto_qmail.o \
+       substdio.a error.a str.a fs.a auto_qmail.o xtext.o \
        `cat dns.lib` `cat socket.lib` $(TLSLIBS) $(ZLIB)
 
 qmail-remote.0: \
@@ -1965,7 +1966,7 @@
 subfd.h substdio.h scan.h case.h error.h auto_qmail.h control.h dns.h \
 alloc.h quote.h ip.h ipalloc.h ip.h gen_alloc.h ipme.h ip.h ipalloc.h \
 gen_alloc.h gen_allocdefs.h str.h now.h datetime.h exit.h constmap.h \
-tcpto.h readwrite.h timeoutconn.h timeoutread.h timeoutwrite.h
+tcpto.h readwrite.h timeoutconn.h timeoutread.h timeoutwrite.h xtext.h
        ./compile $(LDAPFLAGS) $(TLS) $(TLSINCLUDES) $(ZINCLUDES) \
        qmail-remote.c
 
@@ -2741,6 +2742,10 @@
 compile wait_pid.c error.h haswaitp.h
        ./compile wait_pid.c
 
+xtext.o: \
+compile xtext.h
+       ./compile xtext.c
+
 cert:
        $(OPENSSLBIN) req -new -x509 -nodes \
        -out `head -n 1 conf-qmail`/control/cert.pem -days 366 \
diff -Nur qmail-1.03.orig/qmail-remote.c qmail-1.03/qmail-remote.c
--- qmail-1.03.orig/qmail-remote.c      2004-08-18 20:37:29.000000000 +0200
+++ qmail-1.03/qmail-remote.c   2004-08-18 20:37:39.122209640 +0200
@@ -33,6 +33,7 @@
 #include "timeoutread.h"
 #include "timeoutwrite.h"
 #include "base64.h"
+#include "xtext.h"
 #ifdef TLS_REMOTE /* openssl/ssh.h needs to be included befor zlib.h else ... */
 #include <sys/stat.h>
 #include <openssl/ssl.h>
@@ -455,6 +456,8 @@
 
   flagtls = 0;
 #endif
+  unsigned long xtextlen;
+  char *xtext;
 
   code = smtpcode();
   if (code >= 500) quit("DConnected to "," but greeting failed");
@@ -629,9 +632,11 @@
     substdio_put(&smtpto,num,fmt_ulong(num,len+1));
   }
   if (flagauth) {
+    xtext    = xtext_malloc(sender.s,sender.len);
     substdio_puts(&smtpto, " AUTH=<");
-    substdio_put(&smtpto,sender.s,sender.len);
+    substdio_put(&smtpto,xtext_encode(xtext,sender.s,sender.len),sender.len);
     substdio_puts(&smtpto,">");
+    xtext_free(xtext);
   }
   substdio_puts(&smtpto,"\r\n");
   substdio_flush(&smtpto);
diff -Nur qmail-1.03.orig/xtext.c qmail-1.03/xtext.c
--- qmail-1.03.orig/xtext.c     1970-01-01 01:00:00.000000000 +0100
+++ qmail-1.03/xtext.c  2004-08-18 20:53:56.735589816 +0200
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2004 Aiko Barz <[EMAIL PROTECTED]>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, 
+ * and/or sell copies of the Software, and to permit persons to whom the 
+ * Software is furnished to do so, subject to the following conditions:
+ * The above copyright notice and this permission notice shall be included 
+ * in all copies or substantial portions of the Software. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+#include <stdio.h>
+
+char *xtext_malloc(char *auth_plain, unsigned long counter)
+{
+    char *plain             = auth_plain;
+    char *xtext_code        = NULL;
+    unsigned long xtext_len = 0;
+    int x;
+
+    while (counter-- > 0)
+    {
+        xtext_len += ((x = *plain++) < 33 || x > 127 || x == '+' || x == '=') ? 3 : 1;
+    }
+
+    xtext_code = (char *) malloc(xtext_len * sizeof(char));
+    
+    return(xtext_code);
+}
+
+
+char *xtext_encode(char *xtext_code, char *auth_plain, unsigned long counter)
+{
+    char *plain             = auth_plain;
+    char *p;
+    int x;
+
+    if (xtext_code == NULL)
+    {
+        return(NULL);
+    }
+
+    /*******
+     *
+     * RFC 2554:
+     * MAIL FROM:<[EMAIL PROTECTED]> AUTH=<[EMAIL PROTECTED]>
+     *
+     */
+    p = xtext_code;
+    while (counter-- > 0)
+    {   
+        if ((x = *plain++) < 33 || x > 127 || x == '+' || x == '=')
+        {   
+            sprintf(p, "+%.02x", x);
+            p += 3;
+        }
+        else
+        {
+            *p++ = x;
+        }
+    }
+
+    return(xtext_code);
+}
+
+
+void xtext_free(char *xtext_code)
+{
+    free(xtext_code);
+}
diff -Nur qmail-1.03.orig/xtext.h qmail-1.03/xtext.h
--- qmail-1.03.orig/xtext.h     1970-01-01 01:00:00.000000000 +0100
+++ qmail-1.03/xtext.h  2004-08-18 20:46:39.205104560 +0200
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2004 Aiko Barz <[EMAIL PROTECTED]>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, 
+ * and/or sell copies of the Software, and to permit persons to whom the 
+ * Software is furnished to do so, subject to the following conditions:
+ * The above copyright notice and this permission notice shall be included 
+ * in all copies or substantial portions of the Software. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+char *xtext_malloc(char *auth_plain, unsigned long counter);
+char *xtext_encode(char *xtext_code, char *auth_plain, unsigned long auth_length);
+void xtext_free(char *xtext_code);

Attachment: pgpcfcWC5KcDA.pgp
Description: PGP signature

Reply via email to