From: Philip Hazel Date: Wed, 16 Feb 2005 16:28:36 +0000 (+0000) Subject: Fix problems with the spool file that arise when the local username X-Git-Tag: exim-4_50~7 X-Git-Url: https://git.exim.org/users/heiko/exim.git/commitdiff_plain/1e70f85bc1b5cebe658c167e7392e66a7ab440fc?ds=sidebyside 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. --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index b88fbea69..9941ed9ec 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.79 2005/02/16 15:24:21 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.80 2005/02/16 16:28:36 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -375,6 +375,15 @@ Exim version 4.50 else would have woken the daemon, and it would have reaped the completed process earlier. +80. If a message was submitted locally by a user whose login name contained one + or more spaces (ugh!), the spool file that Exim wrote was not re-readable. + It caused a spool format error. I have fixed the spool reading code. A + related problem was that the "from" clause in the Received: line became + illegal because of the space(s). It is now covered by ${quote_local_part. + +81. Included the latest eximstats from Steve (adds average sizes to HTML Top + tables). + ---------------------------------------------------- See the note above about the 4.44 and 4.50 releases. 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;