Correct for the getlogin problem in username()
authorMiriam Amos Nihart <miriam@ucbvax.Berkeley.EDU>
Thu, 2 May 1985 07:44:09 +0000 (23:44 -0800)
committerMiriam Amos Nihart <miriam@ucbvax.Berkeley.EDU>
Thu, 2 May 1985 07:44:09 +0000 (23:44 -0800)
SCCS-vsn: usr.sbin/sendmail/src/conf.c 4.7

usr/src/usr.sbin/sendmail/src/conf.c

index 2cdbef7..3ec1e32 100644 (file)
@@ -34,7 +34,7 @@
 
 
 
 
 
 
-SCCSID(@(#)conf.c      4.6             %G%);
+SCCSID(@(#)conf.c      4.7             %G%);
 \f/*
 **  Header info table
 **     Final (null) entry contains the flags used for any other field.
 \f/*
 **  Header info table
 **     Final (null) entry contains the flags used for any other field.
@@ -326,6 +326,16 @@ username()
                        if (pw != NULL)
                                myname = pw->pw_name;
                }
                        if (pw != NULL)
                                myname = pw->pw_name;
                }
+               else {
+                       register struct passwd *pw;
+                       extern struct passwd *getpwuid();
+
+                       pw = getpwnam(myname);
+                       if(getuid() != pw->pw_uid) {
+                               pw = getpwuid(getuid());
+                               myname = pw->pw_name;
+                       }
+               }
                if (myname == NULL || myname[0] == '\0')
                {
                        syserr("Who are you?");
                if (myname == NULL || myname[0] == '\0')
                {
                        syserr("Who are you?");