diff options
author | Philip Hazel <ph10@hermes.cam.ac.uk> | 2005-02-16 16:28:36 +0000 |
---|---|---|
committer | Philip Hazel <ph10@hermes.cam.ac.uk> | 2005-02-16 16:28:36 +0000 |
commit | 1e70f85bc1b5cebe658c167e7392e66a7ab440fc (patch) | |
tree | 1b28335179516f1de1965c93f6ccefeafd65c329 /src | |
parent | 8408f763aff7631e2834ba90aacfd682cd893734 (diff) |
Fix problems with the spool file that arise when the local username
contains a space. Also, ensure that the Received: line item is
appropriately quoted in this circumstance.
Diffstat (limited to 'src')
-rw-r--r-- | src/src/globals.c | 4 | ||||
-rw-r--r-- | src/src/spool_in.c | 22 |
2 files changed, 19 insertions, 7 deletions
diff --git a/src/src/globals.c b/src/src/globals.c index 129923063..9594c9003 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/globals.c,v 1.15 2005/01/25 14:16:33 ph10 Exp $ */ +/* $Cambridge: exim/src/src/globals.c,v 1.16 2005/02/16 16:28:36 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -788,7 +788,7 @@ date will be automatically added on the end. */ uschar *received_header_text = US "Received: " "${if def:sender_rcvhost {from $sender_rcvhost\n\t}" - "{${if def:sender_ident {from $sender_ident }}" + "{${if def:sender_ident {from ${quote_local_part:$sender_ident} }}" "${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}" "by $primary_hostname " "${if def:received_protocol {with $received_protocol}} " diff --git a/src/src/spool_in.c b/src/src/spool_in.c index 0e4297114..77609a682 100644 --- a/src/src/spool_in.c +++ b/src/src/spool_in.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/spool_in.c,v 1.6 2005/01/25 14:16:33 ph10 Exp $ */ +/* $Cambridge: exim/src/src/spool_in.c,v 1.7 2005/02/16 16:28:36 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -230,7 +230,7 @@ int n; int rcount = 0; long int uid, gid; BOOL inheader = FALSE; -uschar originator[64]; +uschar *p; /* Reset all the global variables to their default values. However, there is one exception. DO NOT change the default value of dont_deliver, because it may @@ -325,9 +325,21 @@ messages for delivery delays that have been sent. */ if (Ufgets(big_buffer, big_buffer_size, f) == NULL) goto SPOOL_READ_ERROR; -if (sscanf(CS big_buffer, "%s %ld %ld", originator, &uid, &gid) != 3) - goto SPOOL_FORMAT_ERROR; -originator_login = string_copy(originator); +p = big_buffer + Ustrlen(big_buffer); +while (p > big_buffer && isspace(p[-1])) p--; +*p = 0; +if (!isdigit(p[-1])) goto SPOOL_FORMAT_ERROR; +while (p > big_buffer && isdigit(p[-1])) p--; +gid = Uatoi(p); +if (p <= big_buffer || *(--p) != ' ') goto SPOOL_FORMAT_ERROR; +*p = 0; +if (!isdigit(p[-1])) goto SPOOL_FORMAT_ERROR; +while (p > big_buffer && isdigit(p[-1])) p--; +uid = Uatoi(p); +if (p <= big_buffer || *(--p) != ' ') goto SPOOL_FORMAT_ERROR; +*p = 0; + +originator_login = string_copy(big_buffer); originator_uid = (uid_t)uid; originator_gid = (gid_t)gid; |