A simple patch to Russell Nelson's qmail-dk that makes it easier to
work with clients that auth.

qmail-dk-0.54-auth.patch - 2006050201

Jeremy Kister
http://jeremy.kister.net/
######################################################################


--- ../qmail-1.03.dk-0.54/qmail-dk.8	2006-05-02 21:58:08.553756000 -0400
+++ qmail-dk.8	2006-05-02 21:54:01.612831000 -0400
@@ -16,6 +16,14 @@
 For another way, you can rename qmail-queue to qmail-queue.orig, and set DKQUEUE=bin/qmail-queue.orig.
 
 .B qmail-dk
+has been patched with
+.BR qmail-dk-0.54-auth.patch ,
+which sets up a bit of automatic behavior.  If RELAYCLIENT is found in
+the environment, qmail-dk imports the DKSIGN environment variable and
+tries to sign the mail.  If RELAYCLIENT is not found in the environment,
+DKVERIFY is imported, and we attempt to verify the mail.
+
+.B qmail-dk
 supports DomainKey signing and verification.  It uses the libdomainkey
 and OpenSSL libraries.  To sign a message, set the
 .B DKSIGN
--- ../qmail-1.03.dk-0.54/qmail-dk.c	2006-05-02 21:58:08.623738000 -0400
+++ qmail-dk.c	2006-05-02 21:54:01.632826000 -0400
@@ -96,6 +96,7 @@
 
 char tmp[FMT_ULONG];
 
+char *relayclient;
 char *dksign = 0;
 stralloc dksignature = {0};
 stralloc dkoutput = {0};
@@ -170,10 +171,14 @@
  sig_blocknone();
  umask(033);
 
- dksign = env_get("DKSIGN");
- dkverify = env_get("DKVERIFY");
- if (!dksign && !dkverify)
+ relayclient = env_get("RELAYCLIENT");
+ if(relayclient){
+  dksign = env_get("DKSIGN");
+  if(! dksign)
    dksign = "/etc/domainkeys/%/default";
+ }else{
+  dkverify = env_get("DKVERIFY");
+ }
 
  dkqueue = env_get("DKQUEUE");
  if (dkqueue && *dkqueue) binqqargs[0] = dkqueue;
