procmail
[Top] [All Lists]

BOGUS when using symlink for mbox

2005-11-30 00:31:42
Hi all,

First post! :)

Having a bit of a problem with the new method of mbox handling by procmail.

On my system, a users mbox may be a symlink; since I use OpenWebmail.

Works like this.
In ~username, you'll see

mail/saved-messages
mail/sent-messages (etc,etc)
mbox -> mail/saved-messages

With 3.15, a mail would come in, procmail would try and deliver it, mbox?
--> go to mail/saved-messages. Deliver there.
No problem.

There was a small patch for this. I tried to make it 3.15->3.22 compatible.
So just to give you an idea:
---------------------
--- procmail-3.22/src/foldinfo.c        2001-09-11 06:57:32.000000000 +0200
+++ procmail-3.22/src/foldinfo.c.new    2005-11-22 09:55:31.000000000 +0100
@@ -237,11 +237,26 @@
      */
      ;{ int checkiter=1;
        for(;;)
-        { if(stbuf.st_uid!=uid||                     /* recipient not owner
*/
+        {
+
+          /* some cobalt hackiness. check to see if the file's a
+           * symlink. if it is, make sure that we can use it. */
+          if (S_ISLNK(stbuf.st_mode)) {
+             struct stat st;
+
+            memset(buf, 0, sizeof(buf));
+            readlink(chp, buf, sizeof(buf));
+            if (stat(chp, &st)) {
+              xcreat(buf, 0600, (time_t*)0, doCHECK);
+              chown(buf, stbuf.st_uid, stbuf.st_gid);
+            }
+            chp = buf;
+          }
+
+           if(stbuf.st_uid!=uid||                    /* recipient not owner
*/
              !(stbuf.st_mode&S_IWUSR)||             /* recipient can write?
*/
-             S_ISLNK(stbuf.st_mode)||                  /* no symbolic links
*/
              (S_ISDIR(stbuf.st_mode)?        /* directories, yes, hardlinks
*/
-               !(stbuf.st_mode&S_IXUSR):stbuf.st_nlink!=1))           /* no
*/
+               !(stbuf.st_mode&S_IXUSR))              /* no */
             /*
              * If another procmail is about to create the new
              * mailbox, and has just made the link, st_nlink==2
---------------------

Now, this does not work.
Still, the following happens:

Symlink exists.
Mail comes in.
Uh-oh! Symlink for an mbox file.
Move it to BOGUS.username.blabla, create a new mbox file.
Write mail to new mbox file.

Now, this is a problem for me since it renders OpenWebmail useless.

Does anyone have a clue what to do to take this option out? So it does not
check for symlinks, or at least allows them?

I would greatly appreciate any help!!

Leslie



____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>