[tpop3d-discuss]Segv when a maildir mailbox doesnt exist

Chris Lightfoot chris at ex-parrot.com
Tue, 27 Jul 2004 19:39:40 +0100


On Tue, Jul 27, 2004 at 02:22:24PM -0400, Kevin Bonner wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Tuesday 27 July 2004 12:44, Simon Loader wrote:
> > For simplicity we dont create a mailbox when a user does not exist.
> > Older versions of tpop3d always didnt care 1.5.3 does.
> 
> Do you have maildir-exclusive-lock enabled in your config?  This is what 
> causes the lock and unlock stuff to be called.
> 
> If you want an exclusive lock for maildirs, I'd just modify the maildir_unlock 
> functions to return if dirname == NULL.  Adding a similar check to 
> maildir_lock to return 0 is probably desirable as well.  Much nicer, IMO, 
> than surrounding all lines in a function with an if statement.

here's a simpler patch (which is now in CVS):

diff -u -r1.24 maildir.c
--- maildir.c   3 Feb 2004 19:52:03 -0000       1.24
+++ maildir.c   27 Jul 2004 18:37:44 -0000
@@ -255,8 +255,10 @@
 
 fail:
     if (M) {
-        if (locked) maildir_unlock(M->name);
-        if (M->name) xfree(M->name);
+        if (M->name) {
+            if (locked) maildir_unlock(M->name);
+            xfree(M->name);
+        }
         if (M->index) xfree(M->index);
         xfree(M);
     }

-- 
``...we must explain to our friends and allies, as well as Russia, ....''
  (George W. Bush)