From 20b85c03e751b4876fa3c92040464e483172b746 Mon Sep 17 00:00:00 2001 From: Jannis Hoffmann Date: Wed, 3 Jul 2024 19:03:11 +0200 Subject: manual format adjustment --- src/qmail-dkverify.c | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) (limited to 'src/qmail-dkverify.c') diff --git a/src/qmail-dkverify.c b/src/qmail-dkverify.c index 3d64e51..6a546e9 100644 --- a/src/qmail-dkverify.c +++ b/src/qmail-dkverify.c @@ -30,18 +30,18 @@ #define WHO "qmail-dkverify" -/** @file qmail-dkverify.c - @brief stub routine for DKIM signature verification and indication in received message - - Steps: - ------ - a) Store message with CRLF - b) Get DKIM signature from message - if given: - c) Call qmail-dkim for verification - d) Include results as appended header - e) Queue the message for processing - - */ +/** + @file qmail-dkverify.c + @brief stub routine for DKIM signature verification and indication in received message + + Steps: + ------ + a) Store message with CRLF + b) Get DKIM signature from message - if given: + c) Call qmail-dkim for verification + d) Include results as appended header + e) Queue the message for processing +*/ char bufin[1024]; // RFC 5322: 998 chars - why? buffer bi = BUFFER_INIT(read, 0, bufin, sizeof(bufin)); // read buffer @@ -52,28 +52,34 @@ void die(int e) { _exit(e); } + void die_pipe(char *fn) { unlink(fn); die(53); } + void die_write(char *fn) { unlink(fn); die(53); } + void die_read() { die(54); } + void out(char *s) { if (buffer_puts(&bo, s) == -1) _exit(111); } + void zero() { if (buffer_put(&bo, "\0", 1) == -1) _exit(111); } + void zerodie() { zero(); @@ -86,31 +92,37 @@ void temp_nomem() out("ZOut of memory. (#4.3.0)\n"); zerodie(); } + void temp_chdir() { out("ZUnable to switch to target directory. (#4.3.0)\n"); zerodie(); } + void temp_create() { out("ZUnable to create DKIM stage file. (#4.3.0)\n"); zerodie(); } + void temp_unlink() { out("ZUnable to unlink DKIM stage file. (#4.3.0)\n"); zerodie(); } + void temp_read() { out("ZUnable to read message. (#4.3.0)\n"); zerodie(); } + void temp_socket() { out("ZUnable to crate socket pair. (#4.3.0)\n"); zerodie(); } + void temp_control() { out("ZUnable to read control files. (#4.3.0)\n"); @@ -272,8 +284,9 @@ int dkim_result(const char *me) if (result.len > 2) { if (case_starts(result.s, "pass")) r = 0; if (case_starts(result.s, "fail")) r = 35; - } else if (!stralloc_copys(&result, "unknown")) + } else if (!stralloc_copys(&result, "unknown")) { temp_nomem(); + } if (!stralloc_copys(&dkheader, "X-Authentication-Results: ")) temp_nomem(); if (!stralloc_cats(&dkheader, senddomain.s)) temp_nomem(); -- cgit v1.2.3