additional debugging statements
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Tue, 9 Nov 1993 01:46:34 +0000 (17:46 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Tue, 9 Nov 1993 01:46:34 +0000 (17:46 -0800)
SCCS-vsn: usr.sbin/sendmail/src/recipient.c 8.22

usr/src/usr.sbin/sendmail/src/recipient.c

index b2984a4..1b0d8ab 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)recipient.c        8.21 (Berkeley) %G%";
+static char sccsid[] = "@(#)recipient.c        8.22 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -366,7 +366,7 @@ recipient(a, sendq, e)
                        a->q_flags |= QBADADDR;
                        usrerr("550 Cannot mail directly to files");
                }
                        a->q_flags |= QBADADDR;
                        usrerr("550 Cannot mail directly to files");
                }
-               else if ((stat(buf, &stb) >= 0) ? (!writable(&stb)) :
+               else if ((stat(buf, &stb) >= 0) ? (!writable(buf, &stb)) :
                    (*p = '\0', safefile(buf, RealUid, RealGid, NULL, TRUE, S_IWRITE|S_IEXEC) != 0))
                {
                        a->q_flags |= QBADADDR;
                    (*p = '\0', safefile(buf, RealUid, RealGid, NULL, TRUE, S_IWRITE|S_IEXEC) != 0))
                {
                        a->q_flags |= QBADADDR;
@@ -389,7 +389,6 @@ recipient(a, sendq, e)
        if (!bitset(QDONTSEND|QNOTREMOTE|QVERIFIED, a->q_flags))
        {
                extern int udbexpand();
        if (!bitset(QDONTSEND|QNOTREMOTE|QVERIFIED, a->q_flags))
        {
                extern int udbexpand();
-               extern int errno;
 
                if (udbexpand(a, sendq, e) == EX_TEMPFAIL)
                {
 
                if (udbexpand(a, sendq, e) == EX_TEMPFAIL)
                {
@@ -625,13 +624,16 @@ finduser(name, fuzzyp)
 */
 
 bool
 */
 
 bool
-writable(s)
+writable(filename, s)
+       char *filename;
        register struct stat *s;
 {
        uid_t euid;
        gid_t egid;
        int bits;
 
        register struct stat *s;
 {
        uid_t euid;
        gid_t egid;
        int bits;
 
+       if (tTd(29, 5))
+               printf("writable(%s) mode=%o\n", filename, s->st_mode);
        if (bitset(0111, s->st_mode))
                return (FALSE);
        euid = RealUid;
        if (bitset(0111, s->st_mode))
                return (FALSE);
        euid = RealUid;
@@ -644,6 +646,10 @@ writable(s)
                        egid = s->st_gid;
        }
 
                        egid = s->st_gid;
        }
 
+       if (tTd(29, 5))
+               printf("\teu/gid=%d/%d, st_u/gid=%d/%d\n",
+                       euid, egid, s->st_uid, s->st_gid);
+
        if (euid == 0)
                return (TRUE);
        bits = S_IWRITE;
        if (euid == 0)
                return (TRUE);
        bits = S_IWRITE;