git://git.exim.org
/
exim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
48f1c85
)
receive with DKIM
author
Jeremy Harris
<jgh146exb@wizmail.org>
Mon, 1 Aug 2016 17:38:22 +0000
(18:38 +0100)
committer
Jeremy Harris
<jgh146exb@wizmail.org>
Tue, 2 Aug 2016 15:46:31 +0000
(16:46 +0100)
src/src/dkim.c
patch
|
blob
|
history
src/src/functions.h
patch
|
blob
|
history
src/src/globals.c
patch
|
blob
|
history
src/src/globals.h
patch
|
blob
|
history
src/src/smtp_in.c
patch
|
blob
|
history
src/src/tls-gnu.c
patch
|
blob
|
history
src/src/tls-openssl.c
patch
|
blob
|
history
test/stderr/0487
patch
|
blob
|
history
diff --git
a/src/src/dkim.c
b/src/src/dkim.c
index 24de2bc332f090d317ed9a5f66bf20f510cef232..a09ec7ecae62d60c9a35dc4eb1d5427aa619d9a0 100644
(file)
--- a/
src/src/dkim.c
+++ b/
src/src/dkim.c
@@
-88,6
+88,9
@@
if (dkim_verify_ctx)
dkim_verify_ctx = pdkim_init_verify(&dkim_exim_query_dns_txt);
dkim_collect_input = !!dkim_verify_ctx;
dkim_verify_ctx = pdkim_init_verify(&dkim_exim_query_dns_txt);
dkim_collect_input = !!dkim_verify_ctx;
+/* Start feed up with any cached data */
+receive_get_cache();
+
store_pool = dkim_verify_oldpool;
}
store_pool = dkim_verify_oldpool;
}
diff --git
a/src/src/functions.h
b/src/src/functions.h
index 260b365df1fc602cd45135527a691bb4c8494b97..8d47a0da185ef677dd9795be097be8e600d57d30 100644
(file)
--- a/
src/src/functions.h
+++ b/
src/src/functions.h
@@
-56,6
+56,7
@@
extern int tls_feof(void);
extern int tls_ferror(void);
extern void tls_free_cert(void **);
extern int tls_getc(void);
extern int tls_ferror(void);
extern void tls_free_cert(void **);
extern int tls_getc(void);
+extern void tls_get_cache(void);
extern int tls_import_cert(const uschar *, void **);
extern int tls_read(BOOL, uschar *, size_t);
extern int tls_server_start(const uschar *);
extern int tls_import_cert(const uschar *, void **);
extern int tls_read(BOOL, uschar *, size_t);
extern int tls_server_start(const uschar *);
@@
-390,6
+391,7
@@
extern BOOL smtp_get_interface(uschar *, int, address_item *,
uschar **, uschar *);
extern BOOL smtp_get_port(uschar *, address_item *, int *, uschar *);
extern int smtp_getc(void);
uschar **, uschar *);
extern BOOL smtp_get_port(uschar *, address_item *, int *, uschar *);
extern int smtp_getc(void);
+extern void smtp_get_cache(void);
extern int smtp_handle_acl_fail(int, int, uschar *, uschar *);
extern void smtp_log_no_mail(void);
extern void smtp_message_code(uschar **, int *, uschar **, uschar **, BOOL);
extern int smtp_handle_acl_fail(int, int, uschar *, uschar *);
extern void smtp_log_no_mail(void);
extern void smtp_message_code(uschar **, int *, uschar **, uschar **, BOOL);
diff --git
a/src/src/globals.c
b/src/src/globals.c
index 987c717fc7b5d99d9964711ea9ede0bf8b27b97a..ba1336633c0ae7e505099210bd2a03254c74a169 100644
(file)
--- a/
src/src/globals.c
+++ b/
src/src/globals.c
@@
-188,6
+188,7
@@
stand-alone tests. */
int (*lwr_receive_getc)(void) = stdin_getc;
int (*lwr_receive_ungetc)(int) = stdin_ungetc;
int (*receive_getc)(void) = stdin_getc;
int (*lwr_receive_getc)(void) = stdin_getc;
int (*lwr_receive_ungetc)(int) = stdin_ungetc;
int (*receive_getc)(void) = stdin_getc;
+void (*receive_get_cache)(void)= NULL;
int (*receive_ungetc)(int) = stdin_ungetc;
int (*receive_feof)(void) = stdin_feof;
int (*receive_ferror)(void) = stdin_ferror;
int (*receive_ungetc)(int) = stdin_ungetc;
int (*receive_feof)(void) = stdin_feof;
int (*receive_ferror)(void) = stdin_ferror;
diff --git
a/src/src/globals.h
b/src/src/globals.h
index 86ece2f3065358ac450ff2d5b9a8f4c683b0c09d..f9af38ef5b1fc6ec78b06a9fd624f828f980e3d4 100644
(file)
--- a/
src/src/globals.h
+++ b/
src/src/globals.h
@@
-141,6
+141,7
@@
incoming TCP/IP. */
extern int (*lwr_receive_getc)(void);
extern int (*lwr_receive_ungetc)(int);
extern int (*receive_getc)(void);
extern int (*lwr_receive_getc)(void);
extern int (*lwr_receive_ungetc)(int);
extern int (*receive_getc)(void);
+extern void (*receive_get_cache)(void);
extern int (*receive_ungetc)(int);
extern int (*receive_feof)(void);
extern int (*receive_ferror)(void);
extern int (*receive_ungetc)(int);
extern int (*receive_feof)(void);
extern int (*receive_ferror)(void);
diff --git
a/src/src/smtp_in.c
b/src/src/smtp_in.c
index 3144b39ad79d7ba688df0f85cd1d21d2bdcf4983..8994c6edb8d2b242861987c97be2f6c4a54aca20 100644
(file)
--- a/
src/src/smtp_in.c
+++ b/
src/src/smtp_in.c
@@
-352,6
+352,15
@@
if (smtp_inptr >= smtp_inend)
return *smtp_inptr++;
}
return *smtp_inptr++;
}
+#ifndef DISABLE_DKIM
+void
+smtp_get_cache(void)
+{
+int n = smtp_inend - smtp_inptr;
+if (n > 0)
+ dkim_exim_verify_feed(smtp_inptr, n);
+}
+#endif
/* Get a byte from the smtp input, in CHUNKING mode. Handle ack of the
/* Get a byte from the smtp input, in CHUNKING mode. Handle ack of the
@@
-386,10
+395,14
@@
for(;;)
/* If not the last, ack the received chunk. The last response is delayed
until after the data ACL decides on it */
/* If not the last, ack the received chunk. The last response is delayed
until after the data ACL decides on it */
- /*XXX find that "last response" and append the chunk size */
if (chunking_state == CHUNKING_LAST)
if (chunking_state == CHUNKING_LAST)
+ {
+#ifndef DISABLE_DKIM
+ dkim_exim_verify_feed(".\r\n", 3); /* for consistency with .-term MAIL */
+#endif
return EOD;
return EOD;
+ }
chunking_state = CHUNKING_OFFERED;
smtp_printf("250 %u byte chunk received\r\n", chunking_datasize);
chunking_state = CHUNKING_OFFERED;
smtp_printf("250 %u byte chunk received\r\n", chunking_datasize);
@@
-2051,6
+2064,7
@@
smtp_inbuffer = (uschar *)malloc(in_buffer_size);
if (smtp_inbuffer == NULL)
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "malloc() failed for SMTP input buffer");
receive_getc = smtp_getc;
if (smtp_inbuffer == NULL)
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "malloc() failed for SMTP input buffer");
receive_getc = smtp_getc;
+receive_get_cache = smtp_get_cache;
receive_ungetc = smtp_ungetc;
receive_feof = smtp_feof;
receive_ferror = smtp_ferror;
receive_ungetc = smtp_ungetc;
receive_feof = smtp_feof;
receive_ferror = smtp_ferror;
diff --git
a/src/src/tls-gnu.c
b/src/src/tls-gnu.c
index c7c6b267440a81b88cf67717e4aeafcfc39f07e1..0774850cae8f77947c2e72a02ecbb136f9c6c8fa 100644
(file)
--- a/
src/src/tls-gnu.c
+++ b/
src/src/tls-gnu.c
@@
-1879,6
+1879,7
@@
and initialize appropriately. */
state->xfer_buffer = store_malloc(ssl_xfer_buffer_size);
receive_getc = tls_getc;
state->xfer_buffer = store_malloc(ssl_xfer_buffer_size);
receive_getc = tls_getc;
+receive_get_cache = tls_get_cache;
receive_ungetc = tls_ungetc;
receive_feof = tls_feof;
receive_ferror = tls_ferror;
receive_ungetc = tls_ungetc;
receive_feof = tls_feof;
receive_ferror = tls_ferror;
@@
-2179,6
+2180,7
@@
if (state->xfer_buffer_lwm >= state->xfer_buffer_hwm)
DEBUG(D_tls) debug_printf("Got TLS_EOF\n");
receive_getc = smtp_getc;
DEBUG(D_tls) debug_printf("Got TLS_EOF\n");
receive_getc = smtp_getc;
+ receive_get_cache = smtp_get_cache;
receive_ungetc = smtp_ungetc;
receive_feof = smtp_feof;
receive_ferror = smtp_ferror;
receive_ungetc = smtp_ungetc;
receive_feof = smtp_feof;
receive_ferror = smtp_ferror;
@@
-2217,6
+2219,17
@@
if (state->xfer_buffer_lwm >= state->xfer_buffer_hwm)
return state->xfer_buffer[state->xfer_buffer_lwm++];
}
return state->xfer_buffer[state->xfer_buffer_lwm++];
}
+#ifndef DISABLE_DKIM
+void
+tls_get_cache()
+{
+exim_gnutls_state_st * state = &state_server;
+int n = state->xfer_buffer_hwm - state->xfer_buffer_lwm;
+if (n > 0)
+ dkim_exim_verify_feed(state->xfer_buffer+state->xfer_buffer_lwm, n);
+}
+#endif
+
diff --git
a/src/src/tls-openssl.c
b/src/src/tls-openssl.c
index c24eb45445a484caabede61d5b084dbf1b27f5cb..242394f95ccc72be30c404888ce7106e64d2f1f2 100644
(file)
--- a/
src/src/tls-openssl.c
+++ b/
src/src/tls-openssl.c
@@
-1943,6
+1943,7
@@
ssl_xfer_buffer_lwm = ssl_xfer_buffer_hwm = 0;
ssl_xfer_eof = ssl_xfer_error = 0;
receive_getc = tls_getc;
ssl_xfer_eof = ssl_xfer_error = 0;
receive_getc = tls_getc;
+receive_get_cache = tls_get_cache;
receive_ungetc = tls_ungetc;
receive_feof = tls_feof;
receive_ferror = tls_ferror;
receive_ungetc = tls_ungetc;
receive_feof = tls_feof;
receive_ferror = tls_ferror;
@@
-2313,6
+2314,7
@@
if (ssl_xfer_buffer_lwm >= ssl_xfer_buffer_hwm)
DEBUG(D_tls) debug_printf("Got SSL_ERROR_ZERO_RETURN\n");
receive_getc = smtp_getc;
DEBUG(D_tls) debug_printf("Got SSL_ERROR_ZERO_RETURN\n");
receive_getc = smtp_getc;
+ receive_get_cache = smtp_get_cache;
receive_ungetc = smtp_ungetc;
receive_feof = smtp_feof;
receive_ferror = smtp_ferror;
receive_ungetc = smtp_ungetc;
receive_feof = smtp_feof;
receive_ferror = smtp_ferror;
@@
-2358,6
+2360,16
@@
if (ssl_xfer_buffer_lwm >= ssl_xfer_buffer_hwm)
return ssl_xfer_buffer[ssl_xfer_buffer_lwm++];
}
return ssl_xfer_buffer[ssl_xfer_buffer_lwm++];
}
+#ifndef DISABLE_DKIM
+void
+tls_get_cache()
+{
+int n = ssl_xfer_buffer_hwm - ssl_xfer_buffer_lwm;
+if (n > 0)
+ dkim_exim_verify_feed(ssl_xfer_buffer+ssl_xfer_buffer_lwm, n);
+}
+#endif
+
/*************************************************
/*************************************************
diff --git
a/test/stderr/0487
b/test/stderr/0487
index b332f7f8071c0b661cd12508f86f66b97c926998..7f2ad50638f388b23994e99baedb369ca5014279 100644
(file)
--- a/
test/stderr/0487
+++ b/
test/stderr/0487
@@
-39,6
+39,7
@@
DSN: orcpt: NULL flags: 0
SMTP<< data
SMTP>> 354 Enter message, ending with "." on a line by itself
search_tidyup called
SMTP<< data
SMTP>> 354 Enter message, ending with "." on a line by itself
search_tidyup called
+PDKIM >> Body data for hash, canonicalized >>>>>>>>>>>>>>>>>>>>>>
>>Headers received:
From: unqualified
>>Headers received:
From: unqualified