Hello,

 Although Mark doesn't maintain the library any more, I hope this small
patch is still going to be useful to someone. It fixes a rare problem (but
which does happen as it just did do a user of my program) in smtp_close()
which reads like this in the latest version I have:

  if (stream) {                 /* send "QUIT" */
    if (stream->netstream) {    /* do close actions if have netstream */
      smtp_send (stream,"QUIT",NIL);
      net_close (stream->netstream);
    }
  ...

The problem is that the connection could be lost inside smtp_send() in
which case netstream is reset to NIL in smtp_fake() and the call to
net_close() crashes. The following trivial patch fixes it:

Index: lib/imap/src/c-client/smtp.c
===================================================================
--- lib/imap/src/c-client/smtp.c        (revision 7536)
+++ lib/imap/src/c-client/smtp.c        (revision 7537)
@@ -396,7 +396,8 @@

   if (stream) {                        /* send "QUIT" */
     if (stream->netstream) {   /* do close actions if have netstream */
       smtp_send (stream,"QUIT",NIL);
-      net_close (stream->netstream);
+      if (stream->netstream)   /* could have been closed during "QUIT" */
+        net_close (stream->netstream);
     }
                                /* clean up */
     if (stream->host) fs_give ((void **) &stream->host);

 HTH,
VZ

Attachment: pgp96ahIOEib6.pgp
Description: PGP signature

_______________________________________________
Imap-uw mailing list
[email protected]
http://mailman2.u.washington.edu/mailman/listinfo/imap-uw

Reply via email to