On Tue, Nov 29, 2005 at 10:11:31AM +0100, Mikkel Kruse Johnsen wrote:
> Hi John and others
> 
> Did you ever come up with at good solution for the RELAYCLIENT not being
> set (as ENV) after a succesfully authentication ?
> 
> My problem is that qmail-dk (patched with auth) is not importing DKSIGN
> because RELAYCLIENT is not set.
> 
> My solution was to change the dk-auth patch to include:
> 
> ---
> diff -uN qmail-1.03.dk/qmail-smtpd.c qmail-1.03.dk-auth/qmail-smtpd.c
> --- qmail-1.03.dk/qmail-smtpd.c 2005-11-29 10:00:00.000000000 +0100
> +++ qmail-1.03.dk-auth/qmail-smtpd.c    2005-11-29 10:03:14.000000000
> +0100
> @@ -851,8 +851,10 @@
>    }
> 
>    /* check if we are authenticated, if yes enable relaying */
> -  if (flagauthok && relayclient == 0)
> +  if (flagauthok && relayclient == 0) {
>      relayclient = "";
> +    if (!env_put("RELAYCLIENT=")) die_nomem();
> +  }
> 
>    /* smtp size check */
>    if (databytes && !sizelimit(arg))
> ---
> 
> This allows qmail-dk to sign the messages.
> 
> Don't know if there is any problems with that ?

I added this plus a bit more (cleaning up on RSET).
See attached patch.

-- 
:wq Claudio

Index: qmail-smtpd.c
===================================================================
RCS file: /home/cvs-djbware/CVS/qmail-ldap/qmail-smtpd.c,v
retrieving revision 1.118
diff -u -p -r1.118 qmail-smtpd.c
--- qmail-smtpd.c       14 Jun 2005 11:16:14 -0000      1.118
+++ qmail-smtpd.c       29 Nov 2005 14:30:35 -0000
@@ -819,6 +819,8 @@ void smtp_ehlo(char *arg)
 void smtp_rset(char *arg)
 {
   seenmail = 0;
+  if (relayclient != NULL && relayok == NULL)
+         env_unset("RELAYCLIENT");
   relayclient = relayok; /* restore original relayclient setting */
   out("250 flushed\r\n");
   logline(4,"remote rset");
@@ -851,8 +853,10 @@ void smtp_mail(char *arg)
   }
 
   /* check if we are authenticated, if yes enable relaying */
-  if (flagauthok && relayclient == 0)
+  if (flagauthok && relayclient == 0) {
     relayclient = "";
+    if (!env_put("RELAYCLIENT=")) die_nomem();
+  }
 
   /* smtp size check */
   if (databytes && !sizelimit(arg))
@@ -934,6 +938,7 @@ void smtp_mail(char *arg)
   if (!relayclient) {
     if (rmfcheck()) {
       relayclient = "";
+      if (!env_put("RELAYCLIENT=")) die_nomem();
       logline(4,"relaying allowed via relaymailfrom");
     }
   }

Reply via email to