]> code.citadel.org Git - citadel.git/blobdiff - citadel/server/modules/smtp/serv_smtpclient.c
more work on alerting
[citadel.git] / citadel / server / modules / smtp / serv_smtpclient.c
index 3332cf4a5ce6555d43d923ca824a644be1e32096..03f54b108b0725c794e0fb2f6c5b8dcbf4bdd5ca 100644 (file)
@@ -244,17 +244,12 @@ int smtp_attempt_delivery(long msgid, char *recp, char *envelope_from, char *sou
                && !IsEmptyStr(dkim_private_key)                // Do we have a private signing key?
                && !IsEmptyStr(dkim_selector)                   // and a selector to go with it?
        ) {
-               char *pkey = strdup(dkim_private_key);          // If you answered "yes" to all of the above questions,
-               if (pkey) {                                     // congratulations!  We get to DKIM-sign the message!
-                       char *sp;
-                       while (sp = strchr(pkey, '_')) {        // The dkim_private_key record contains our RSA private key,
-                               *sp = '\n';                     // but we have to convert all the newlines back to underscores.
-                       }
-                       syslog(LOG_DEBUG, "smtpclient: dkim-signing with private key for selector <%s> domain <%s>",
-                               dkim_selector, dkim_from_domain);
-                       dkim_sign(s.TheMessage, pkey, dkim_from_domain, dkim_selector);
-                       free(pkey);
-               }
+               // If you answered "yes" to all of the above questions, congratulations!  We get to sign the message!
+               syslog(LOG_DEBUG, "smtpclient: dkim-signing for selector <%s> in domain <%s>", dkim_selector, dkim_from_domain);
+
+               // Remember, the dkim_sign() function is capable of handling a PEM-encoded PKCS#7 private key that
+               // has had all of its newlines replaced by underscores -- which is exactly how we store it.
+               dkim_sign(s.TheMessage,dkim_private_key, dkim_from_domain, dkim_selector);
        }
 
        // Prepare the buffer for transmittal