summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2018-01-07 15:03:25 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2018-01-07 15:51:43 +0000
commit0b8f4f1a0c68bd48a98fb033039bac7d88182b6f (patch)
tree1168866e692bd1176bf91109a6bbd38928c481a4 /src
parent2c47372fad0f829ddfa29d04095f57a70206469c (diff)
DKIM: permit dkim_private_key to override dkim_strict on signing. Bug 2220
Diffstat (limited to 'src')
-rw-r--r--src/src/dkim.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/src/dkim.c b/src/src/dkim.c
index 746a7a6b7..8c03d48ce 100644
--- a/src/src/dkim.c
+++ b/src/src/dkim.c
@@ -540,8 +540,12 @@ switch (what)
}
-/* Generate signatures for the given file, returning a string.
+/* Generate signatures for the given file.
If a prefix is given, prepend it to the file for the calculations.
+
+Return:
+ NULL: error; error string written
+ string: signature header(s), or a zero-length string (not an error)
*/
gstring *
@@ -711,9 +715,15 @@ while ((dkim_signing_domain = string_nextinlist(&dkim_domain, &sep, NULL, 0)))
}
}
}
+if (!ctx.sig)
+ {
+ DEBUG(D_transport) debug_printf("DKIM: no viable signatures to use\n");
+ sigbuf = string_get(1); /* return a zero-len string */
+ goto CLEANUP;
+ }
-if (prefix)
- pdkim_feed(&ctx, prefix, Ustrlen(prefix));
+if (prefix && (pdkim_feed(&ctx, prefix, Ustrlen(prefix))) != PDKIM_OK)
+ goto pk_bad;
if (lseek(fd, off, SEEK_SET) < 0)
sread = -1;
@@ -738,9 +748,8 @@ if ((pdkim_rc = pdkim_feed_finish(&ctx, &sig, errstr)) != PDKIM_OK)
for (sigbuf = NULL; sig; sig = sig->next)
sigbuf = string_append(sigbuf, 2, US sig->signature_header, US"\r\n");
-(void) string_from_gstring(sigbuf);
-
CLEANUP:
+ (void) string_from_gstring(sigbuf);
store_pool = old_pool;
errno = save_errno;
return sigbuf;