From ebb6e6d5b13e114b1c101e6215ab84d995b5b12f Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Thu, 7 Apr 2005 10:10:01 +0000 Subject: [PATCH] Change 4.50/80 broke the handling of negative uids and gids in spool files. Negative gids are sometimes used. Allow for both to be negative. --- doc/doc-txt/ChangeLog | 6 +++++- src/ACKNOWLEDGMENTS | 3 ++- src/src/spool_in.c | 13 +++++++------ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 3a18813c0..8befccba9 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.120 2005/04/07 10:02:02 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.121 2005/04/07 10:10:01 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -202,6 +202,10 @@ PH/32 Add the sender address, as F=<...>, to the log line when logging a PH/33 Sieve envelope tests were broken for match types other than :is. I have applied a patch sanctioned by the Sieve maintainer. +PH/34 Change 4.50/80 broke Exim in that it could no longer handle cases where + the uid or gid is negative. A case of a negative gid caused this to be + noticed. The fix allows for either to be negative. + A note about Exim versions 4.44 and 4.50 ---------------------------------------- diff --git a/src/ACKNOWLEDGMENTS b/src/ACKNOWLEDGMENTS index e2ec4982c..8b7b704fb 100644 --- a/src/ACKNOWLEDGMENTS +++ b/src/ACKNOWLEDGMENTS @@ -1,4 +1,4 @@ -$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.21 2005/04/07 10:02:02 ph10 Exp $ +$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.22 2005/04/07 10:10:01 ph10 Exp $ EXIM ACKNOWLEDGEMENTS @@ -154,6 +154,7 @@ Pierre Humblet Continued Cygwin support Peter Ilieve Suggested patch for lookup search bug John Jetmore Writing and maintaining the 'exipick' utility Bob Johannessen Patch for Sieve envelope tests bug + Patch for negative uid/gid bug Christian Kellner Patch for LDAP dereferencing Alex Kiernan Patch for libradius Diagnosis of milliwait clock-backwards bug diff --git a/src/src/spool_in.c b/src/src/spool_in.c index fb03d58b0..8deb73eb6 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.9 2005/03/08 15:32:02 tom Exp $ */ +/* $Cambridge: exim/src/src/spool_in.c,v 1.10 2005/04/07 10:10:01 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -323,9 +323,10 @@ if (Ustrlen(big_buffer) != MESSAGE_ID_LENGTH + 3 || /* The next three lines in the header file are in a fixed format. The first contains the login, uid, and gid of the user who caused the file to be written. -The second contains the mail address of the message's sender, enclosed in <>. -The third contains the time the message was received, and the number of warning -messages for delivery delays that have been sent. */ +There are known cases where a negative gid is used, so we allow for both +negative uids and gids. The second contains the mail address of the message's +sender, enclosed in <>. The third contains the time the message was received, +and the number of warning messages for delivery delays that have been sent. */ if (Ufgets(big_buffer, big_buffer_size, f) == NULL) goto SPOOL_READ_ERROR; @@ -333,12 +334,12 @@ 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--; +while (p > big_buffer && (isdigit(p[-1]) || '-' == 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--; +while (p > big_buffer && (isdigit(p[-1]) || '-' == p[-1])) p--; uid = Uatoi(p); if (p <= big_buffer || *(--p) != ' ') goto SPOOL_FORMAT_ERROR; *p = 0; -- 2.25.1