<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">*** qmail-1.03.orig/qmail-remote.c	Mon Jun 15 03:53:16 1998
--- qmail-1.03/qmail-remote.c	Wed Jan 26 23:45:36 2000
***************
*** 43,48 ****
--- 43,50 ----
  struct constmap maproutes;
  stralloc host = {0};
  stralloc sender = {0};
+ stralloc auth_smtp_user = {0};
+ stralloc auth_smtp_pass = {0};
  
  saa reciplist = {0};
  
***************
*** 223,239 ****
    int i;
   
    if (smtpcode() != 220) quit("ZConnected to "," but greeting failed");
!  
!   substdio_puts(&amp;smtpto,"HELO ");
    substdio_put(&amp;smtpto,helohost.s,helohost.len);
    substdio_puts(&amp;smtpto,"\r\n");
    substdio_flush(&amp;smtpto);
!   if (smtpcode() != 250) quit("ZConnected to "," but my name was rejected");
!  
!   substdio_puts(&amp;smtpto,"MAIL FROM:&lt;");
!   substdio_put(&amp;smtpto,sender.s,sender.len);
!   substdio_puts(&amp;smtpto,"&gt;\r\n");
!   substdio_flush(&amp;smtpto);
    code = smtpcode();
    if (code &gt;= 500) quit("DConnected to "," but sender was rejected");
    if (code &gt;= 400) quit("ZConnected to "," but sender was rejected");
--- 225,269 ----
    int i;
   
    if (smtpcode() != 220) quit("ZConnected to "," but greeting failed");
! 
!   substdio_puts(&amp;smtpto,"EHLO ");
    substdio_put(&amp;smtpto,helohost.s,helohost.len);
    substdio_puts(&amp;smtpto,"\r\n");
    substdio_flush(&amp;smtpto);
!   if (smtpcode() != 250) {
!     substdio_puts(&amp;smtpto,"HELO ");
!     substdio_put(&amp;smtpto,helohost.s,helohost.len);
!     substdio_puts(&amp;smtpto,"\r\n");
!     substdio_flush(&amp;smtpto);
!     if (smtpcode() != 250) quit("ZConnected to "," but my name was rejected");
!   }
!   i = 0; 
!   while((i += str_chr(smtptext.s+i,'\n') + 1) &amp;&amp; (i+14 &lt; smtptext.len) &amp;&amp;
!         str_diffn(smtptext.s+i+4,"AUTH=LOGIN\n",11));
!   if ((i+14 &lt; smtptext.len) &amp;&amp; auth_smtp_user.len &amp;&amp; auth_smtp_pass.len)  {
!     substdio_puts(&amp;smtpto,"AUTH LOGIN\r\n");
!     substdio_flush(&amp;smtpto);
!     if (smtpcode() != 334) quit("ZConnected to "," but authentication was rejected (AUTH LOGIN)");
!     substdio_put(&amp;smtpto,auth_smtp_user.s,auth_smtp_user.len);
!     substdio_puts(&amp;smtpto,"\r\n");
!     substdio_flush(&amp;smtpto);
!     if (smtpcode() != 334) quit("ZConnected to "," but authentication was rejected (username)");
!     substdio_put(&amp;smtpto,auth_smtp_pass.s,auth_smtp_pass.len);
!     substdio_puts(&amp;smtpto,"\r\n");
!     substdio_flush(&amp;smtpto);
!     if (smtpcode() != 235) quit("ZConnected to "," but authentication was rejected (password)");
!     substdio_puts(&amp;smtpto,"MAIL FROM:&lt;");
!     substdio_put(&amp;smtpto,sender.s,sender.len);
!     substdio_puts(&amp;smtpto,"&gt; AUTH=&lt;");
!     substdio_put(&amp;smtpto,sender.s,sender.len);
!     substdio_puts(&amp;smtpto,"&gt;\r\n");
!     substdio_flush(&amp;smtpto);
!   } else {
!     substdio_puts(&amp;smtpto,"MAIL FROM:&lt;");
!     substdio_put(&amp;smtpto,sender.s,sender.len);
!     substdio_puts(&amp;smtpto,"&gt;\r\n");
!     substdio_flush(&amp;smtpto);
!   }
    code = smtpcode();
    if (code &gt;= 500) quit("DConnected to "," but sender was rejected");
    if (code &gt;= 400) quit("ZConnected to "," but sender was rejected");
***************
*** 331,337 ****
  char **argv;
  {
    static ipalloc ip = {0};
!   int i;
    unsigned long random;
    char **recips;
    unsigned long prefme;
--- 361,367 ----
  char **argv;
  {
    static ipalloc ip = {0};
!   int i,j;
    unsigned long random;
    char **recips;
    unsigned long prefme;
***************
*** 347,352 ****
--- 377,385 ----
   
    if (!stralloc_copys(&amp;host,argv[1])) temp_nomem();
   
+   if (!stralloc_copys(&amp;auth_smtp_user,"")) temp_nomem();
+   if (!stralloc_copys(&amp;auth_smtp_pass,"")) temp_nomem();
+ 
    relayhost = 0;
    for (i = 0;i &lt;= host.len;++i)
      if ((i == 0) || (i == host.len) || (host.s[i] == '.'))
***************
*** 355,360 ****
--- 388,403 ----
    if (relayhost &amp;&amp; !*relayhost) relayhost = 0;
   
    if (relayhost) {
+     i = str_chr(relayhost,' ');
+     if (relayhost[i]) {
+       j = str_chr(relayhost + i + 1,' ');
+       if (relayhost[j]) {
+ 	relayhost[i] = 0;
+ 	relayhost[i + j + 1] = 0;
+ 	if (!stralloc_copys(&amp;auth_smtp_user,relayhost + i + 1)) temp_nomem();
+ 	if (!stralloc_copys(&amp;auth_smtp_pass,relayhost + i + j + 2)) temp_nomem();
+       }
+     }
      i = str_chr(relayhost,':');
      if (relayhost[i]) {
        scan_ulong(relayhost + i + 1,&amp;port);
</pre></body></html>