[success] Re: [vmailmgr] probable vmailmgr bug (only under freebsd?) with vchforwards

Olivier Mueller <[email protected]> Fri, 19 Nov 2010 16:55:24 +0100
Newsgroups gmane.mail.vmailmgr
Message-ID <[email protected]>
Re-hello,

On Fri, 2010-11-19 at 16:29 +0100, Olivier Mueller wrote:
> I'm around the next hours/days to test again if you have some other
> suggestions. Probably there is just an include missing somewhere ? 

Self-answer, just couldn't wait, sorry :) Adding this line :
#include <errno.h>
after the other includes at the beginning
of  /usr/ports/mail/vmailmgr/work/vmailmgr-0.97/lib/misc/maildir.cc
helped here.

And it seems to fix the issue with vchforwards too: 

Before:

[o1a2@omicron ~]$ vchforwards test1 [email protected]
vchforwards: Could not change user 'test1':
  Can't create the mail directory './users/test1'

After:

[o1a2@omicron
~]$ /usr/ports/mail/vmailmgr/work/vmailmgr-0.97/commands/vchforwards
test1 [email protected]
vchforwards: User 'test1' successfully changed.


[o1a2@omicron ~]$ listvdomain test1
User Mailbox Aliases
test1 Yes [email protected]


I did some tests with the other v-commands and everything looks fine
now.    Should this be "fixed" on the original vmailmgr-0.97.tar.gz
distribution, or directly in the freebsd ports tree?  Adding the port
maintainer as CC:, maybe he will have something to say? :)

regards & a nice week-end to you,
Olivier


PS:  the patch is now:

--- vmailmgr-orig/work/vmailmgr-0.97/lib/misc/maildir.cc	2010-11-19 16:52:32.000000000 +0100
+++ vmailmgr/work/vmailmgr-0.97/lib/misc/maildir.cc	2010-11-19 16:41:54.000000000 +0100
@@ -21,6 +21,7 @@
 #include "ac/dirent.h"
 #include "stat_fns.h"
 #include "mystring/mystring.h"
+#include <errno.h>
 
 static inline int rmdir(const mystring& n)
 {
@@ -46,18 +47,18 @@
   if(mkdirp(dirname, 0700))
     return false;
   mystring curdir = dirname + "/cur";
-  if(mkdir(curdir.c_str(), 0755)) {
+  if(mkdir(curdir.c_str(), 0755) && (errno != EEXIST)) {
     rmdir(dirname);
     return false;
   }
   mystring newdir = dirname + "/new";
-  if(mkdir(newdir.c_str(), 0755)) {
+  if(mkdir(newdir.c_str(), 0755) && (errno != EEXIST)) {
     rmdir(curdir);
     rmdir(dirname);
     return false;
   }
   mystring tmpdir = dirname + "/tmp";
-  if(mkdir(tmpdir.c_str(), 0755)) {
+  if(mkdir(tmpdir.c_str(), 0755) && (errno != EEXIST)) {
     rmdir(newdir);
     rmdir(curdir);
     rmdir(dirname);






---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]