X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fsrc%2Fdkim_transport.c;h=c09c5059b871e5477204ababd9202a4b650f363b;hb=6f585046cf0b00509f0ff7c8f8a48b9cf7c2ab75;hp=11458680348c105af464222fb7f068c763ee5631;hpb=dde9989b7d8e04baa017b2537cc2614f75b4362f;p=exim.git diff --git a/src/src/dkim_transport.c b/src/src/dkim_transport.c index 114586803..c09c5059b 100644 --- a/src/src/dkim_transport.c +++ b/src/src/dkim_transport.c @@ -21,8 +21,8 @@ if (dkim->dkim_strict) uschar * dkim_strict_result = expand_string(dkim->dkim_strict); if (dkim_strict_result) - if ( (strcmpic(dkim->dkim_strict, US"1") == 0) || - (strcmpic(dkim->dkim_strict, US"true") == 0) ) + if ( strcmpic(dkim_strict_result, US"1") == 0 + || strcmpic(dkim_strict_result, US"true") == 0) { /* Set errno to something halfway meaningful */ *errp = EACCES; @@ -56,7 +56,7 @@ DEBUG(D_transport) debug_printf("send file fd=%d\n", out_fd); to the socket. However only if we don't use TLS, as then there's another layer of indirection before the data finally hits the socket. */ -if (tls_out.active != out_fd) +if (tls_out.active.sock != out_fd) { ssize_t copied = 0; @@ -83,9 +83,9 @@ else while (sread) { -#ifdef SUPPORT_TLS - wwritten = tls_out.active == out_fd - ? tls_write(FALSE, p, sread, FALSE) +#ifndef DISABLE_TLS + wwritten = tls_out.active.sock == out_fd + ? tls_write(tls_out.active.tls_ctx, p, sread, FALSE) : write(out_fd, CS p, sread); #else wwritten = write(out_fd, CS p, sread); @@ -124,12 +124,11 @@ dkt_direct(transport_ctx * tctx, struct ob_dkim * dkim, { int save_fd = tctx->u.fd; int save_options = tctx->options; -BOOL save_wireformat = spool_file_wireformat; +BOOL save_wireformat = f.spool_file_wireformat; uschar * hdrs; gstring * dkim_signature; int hsize; const uschar * errstr; -uschar * verrstr; BOOL rc; DEBUG(D_transport) debug_printf("dkim signing direct-mode\n"); @@ -155,7 +154,10 @@ if (!rc) return FALSE; arc_sign_init(); #endif -dkim->dot_stuffed = !!(save_options & topt_end_dot); +/* The dotstuffed status of the datafile depends on whether it was stored +in wireformat. */ + +dkim->dot_stuffed = f.spool_file_wireformat; if (!(dkim_signature = dkim_exim_sign(deliver_datafile, SPOOL_DATA_START_OFFSET, hdrs, dkim, &errstr))) if (!(rc = dkt_sign_fail(dkim, &errno))) @@ -166,12 +168,14 @@ if (!(dkim_signature = dkim_exim_sign(deliver_datafile, SPOOL_DATA_START_OFFSET, #ifdef EXPERIMENTAL_ARC if (dkim->arc_signspec) /* Prepend ARC headers */ - if (!(dkim_signature = - arc_sign(dkim->arc_signspec, dkim_signature, &verrstr))) + { + uschar * e; + if (!(dkim_signature = arc_sign(dkim->arc_signspec, dkim_signature, &e))) { - *err = verrstr; + *err = e; return FALSE; } + } #endif /* Write the signature and headers into the deliver-out-buffer. This should @@ -182,7 +186,7 @@ having already been done - but we have to say we want CRLF output format, and temporarily set the marker for possible already-CRLF input. */ tctx->options &= ~topt_escape_headers; -spool_file_wireformat = TRUE; +f.spool_file_wireformat = TRUE; transport_write_reset(0); if ( ( dkim_signature && dkim_signature->ptr > 0 @@ -192,7 +196,7 @@ if ( ( dkim_signature ) return FALSE; -spool_file_wireformat = save_wireformat; +f.spool_file_wireformat = save_wireformat; tctx->options = save_options | topt_no_headers | topt_continuation; if (!(transport_write_message(tctx, 0))) @@ -271,7 +275,9 @@ if (!rc) arc_sign_init(); #endif -/* Feed the file to the goats^W DKIM lib */ +/* Feed the file to the goats^W DKIM lib. At this point the dotstuffed +status of the file depends on the output of transport_write_message() just +above, which should be the result of the end_dot flag in tctx->options. */ dkim->dot_stuffed = !!(options & topt_end_dot); if (!(dkim_signature = dkim_exim_sign(dkim_fd, 0, NULL, dkim, &errstr)))