diff options
author | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-18 15:15:18 +0200 |
---|---|---|
committer | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-18 15:15:18 +0200 |
commit | 7b4d3ab22988d021d5f12b81aec746f7e486fa52 (patch) | |
tree | 651e78e316411a39baadadb1cfaca450e1351c7f /src/qmail-dkverify.c | |
parent | 25f74781424d5e13f0211c08cce8c2a1d60b9aec (diff) |
update to 4.3.09
Diffstat (limited to 'src/qmail-dkverify.c')
-rw-r--r-- | src/qmail-dkverify.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/qmail-dkverify.c b/src/qmail-dkverify.c index be73a80..8e4d51e 100644 --- a/src/qmail-dkverify.c +++ b/src/qmail-dkverify.c @@ -8,6 +8,7 @@ #include "buffer.h" #include "error.h" #include "auto_qmail.h" +#include "auto_queue.h" #include "str.h" #include "exit.h" #include "uint_t.h" @@ -47,8 +48,8 @@ char outbuf[BUFSIZE_MESS]; buffer bo = BUFFER_INIT(write,1,outbuf,sizeof(outbuf)); // output message 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_pipe(char *fn) { unlink(fn); die(54); }; +void die_write(char *fn) { unlink(fn); die(62); }; 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); } @@ -112,6 +113,8 @@ void dkim_stage() struct stat st; char tmpbuf[BUFSIZE_MESS + 2]; + if (chdir(auto_queue) == -1) temp_chdir(); + if (!stralloc_ready(&fndkin,FMTQFN)) temp_nomem(); if (!stralloc_ready(&fndkout,FMTQFN)) temp_nomem(); @@ -159,8 +162,8 @@ int mess_dkim() buffer_init(&bi,read,fd,inbuf,sizeof(inbuf)); if (!stralloc_copys(&senddomain,"")) temp_nomem(); - - for (;;) { + + for (;;) { if (getln(&bi,&line,&match,'\n') == -1) temp_read(); if (case_starts(line.s,"DKIM-Signature: ")) r = 1; if (r == 1) { @@ -170,7 +173,11 @@ int mess_dkim() end = str_chr(line.s,'\n'); // From: user@senddomain\n ket = str_chr(line.s,'>'); // From: User <user@senddomain> len = (ket < end) ? ket : end; - if (!stralloc_copyb(&senddomain,line.s + at + 1,len - at - 1)) temp_nomem(); + len -= at - 1; // From: User <user@> + if (len > 0) { + if (!stralloc_copyb(&senddomain,line.s + at + 1,len)) temp_nomem(); + } else + if (!stralloc_copys(&senddomain,"unknown")) temp_nomem(); r = 2; } } @@ -326,8 +333,6 @@ int qmail_queue() case 10: return 1; default: return 0; } - - return 0; } void dkim_unlink() |