[Imap-uw] MIX INBOX directory is set gid by default

Matthew B. Brookover mbrookov at mines.edu
Mon Mar 26 13:06:26 PDT 2007


I am setting up tmail as a delivery agent for sendmail.  I would like to
have new mail delivered to a MIX inbox.  I ran into a bit of a sang with
the set gid flag on the directory.

Mar 26 10:44:36 twooften tmail[11632]: Verifying safe delivery to /u/us/fl/testub/INBOX by UID 11195
Mar 26 10:44:36 twooften tmail[11632]: delivery to /u/us/fl/testub/INBOX unsafe: can't deliver to setgid file
Mar 26 10:44:36 twooften tmail[11632]: error in delivery
Mar 26 10:44:36 twooften sendmail[11631]: l2QGgSof011573: to=<testub at twooften.Mines.EDU>, ctladdr=<root at twooften.Mines.EDU> (0/0), delay=00:02:08, xdelay=00:00:00, mailer=local, pri=210577, dsn=4.0.0, stat=Deferred: local mailer (/usr/local/sbin/tmail) exited with EX_TEMPFAIL

The set gid flag is propagated from the parent directory when the INBOX
directory is created.  The inbox create works, but the delivery fails in
the delivery_unsafe function.  This quick hack on tmail.c seems to fix
it.  Is this the best way to allow an INBOX directory to have the set
gid flag set?

[mbrookov at threeoften ~]$ diff -c tmp/imap-2006f/src/tmail/tmail.c imap-2006f/src/tmail/tmail.c
*** tmp/imap-2006f/src/tmail/tmail.c    2007-01-26 15:47:03.000000000 -0700
--- imap-2006f/src/tmail/tmail.c        2007-03-26 13:31:55.000000000 -0600
***************
*** 514,520 ****
             (long) sbuf->st_uid,(long) uid);
                                /* unsafe if not a regular file */
    else if (((type = sbuf->st_mode & (S_IFMT | S_ISUID | S_ISGID)) != S_IFREG)&&
!          (type != S_IFDIR)) {
      strcat (tmp,"can't deliver to ");
                                /* unsafe if setuid */
      if (type & S_ISUID) strcat (tmp,"setuid file");
--- 514,520 ----
             (long) sbuf->st_uid,(long) uid);
                                /* unsafe if not a regular file */
    else if (((type = sbuf->st_mode & (S_IFMT | S_ISUID | S_ISGID)) != S_IFREG)&&
!          ((type != S_IFDIR) && (type != S_IFDIR & S_ISGID))) {
      strcat (tmp,"can't deliver to ");
                                /* unsafe if setuid */
      if (type & S_ISUID) strcat (tmp,"setuid file");
[mbrookov at threeoften ~]$


Thank you,


Matt

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman1.u.washington.edu/pipermail/imap-uw/attachments/20070326/921d3daf/attachment.htm


More information about the Imap-uw mailing list