Problematic error checking in lmtpd.c
Rob Siemborski
rjs3 at andrew.cmu.edu
Wed Oct 1 14:20:39 EDT 2003
On Wed, 1 Oct 2003, Michael Bacon wrote:
> The following is a diff against 2.0.17, just because it was what I had
> handy, but the code appears to be roughly the same in the current CVS.
> This seems to fix it, but there may be better ways to go about it that I
> haven't considered.
Yeah, this is a bug.
I'm going to change the fix though -- instead I'm going to have
open_sendmail set sm to NULL if sm_pid < 0. That way there's still only
one error condition for the caller to check... Though probably it should
always return -1 in case of failure and we should check that instead.
Patch will be in CVS shortly.
-Rob
Index: lmtpd.c
===================================================================
RCS file: /afs/andrew.cmu.edu/system/cvs/src/cyrus/imap/lmtpd.c,v
retrieving revision 1.118
diff -u -r1.118 lmtpd.c
--- lmtpd.c 13 Aug 2003 18:39:38 -0000 1.118
+++ lmtpd.c 1 Oct 2003 18:15:53 -0000
@@ -384,7 +384,14 @@
printf("451 lmtpd: didn't exec?!?\r\n");
fatal("couldn't exec", EC_OSERR);
}
- /* i'm the parent */
+
+ if(p < 0) {
+ /* failure */
+ *sm = NULL;
+ return p;
+ }
+
+ /* parent */
close(fds[0]);
ret = fdopen(fds[1], "w");
*sm = ret;
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Rob Siemborski * Andrew Systems Group * Cyert Hall 207 * 412-268-7456
Research Systems Programmer * /usr/contributed Gatekeeper
More information about the Info-cyrus
mailing list