On Mon, 26 Mar 2007, Matthew B. Brookover wrote:
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.

A better patch is:

*** tmail/tmail.c       2007/01/26 22:52:17     1.7
--- tmail/tmail.c       2007/03/26 23:53:35
***************
*** 512,535 ****
    else if (sbuf->st_uid != uid)    /* unsafe if UID does not match */
      sprintf (tmp + strlen (tmp),"uid mismatch (%ld != %ld)",
             (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");
!                               /* unsafe if setgid */
!     else if (type & S_ISGID) strcat (tmp,"setgid file");
!     else switch (type) {
!     case S_IFCHR: strcat (tmp,"character special"); break;
!     case S_IFBLK: strcat (tmp,"block special"); break;
!     case S_IFLNK: strcat (tmp,"symbolic link"); break;
!     case S_IFSOCK: strcat (tmp,"socket"); break;
!     default:
!       sprintf (tmp + strlen (tmp),"file type %07o",(unsigned int) type);
!     }
    }
-   else return NIL;            /* OK to deliver */
    return fail (tmp,EX_CANTCREAT);
  }

--- 512,534 ----
    else if (sbuf->st_uid != uid)    /* unsafe if UID does not match */
      sprintf (tmp + strlen (tmp),"uid mismatch (%ld != %ld)",
             (long) sbuf->st_uid,(long) uid);
!                               /* check file type */
!   else switch (sbuf->st_mode & S_IFMT) {
!   case S_IFDIR:                       /* directory is always OK */
!     return NIL;
!   case S_IFREG:                       /* file is unsafe if setuid */
!     if (sbuf->st_mode & S_ISUID) strcat (tmp,"setuid file");
!                               /* or setgid */
!     else if (sbuf->st_mode & S_ISGID) strcat (tmp,"setgid file");
!     else return NIL;          /* otherwise safe */
!     break;
!   case S_IFCHR: strcat (tmp,"character special"); break;
!   case S_IFBLK: strcat (tmp,"block special"); break;
!   case S_IFLNK: strcat (tmp,"symbolic link"); break;
!   case S_IFSOCK: strcat (tmp,"socket"); break;
!   default:
!     sprintf (tmp + strlen (tmp),"file type %07o",(unsigned int) type);
    }
    return fail (tmp,EX_CANTCREAT);
  }



-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.
_______________________________________________
Imap-uw mailing list
[email protected]
https://mailman1.u.washington.edu/mailman/listinfo/imap-uw

Reply via email to