[BACK]Return to su.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / su

Diff for /src/usr.bin/su/su.c between version 1.39 and 1.40

version 1.39, 2001/06/25 16:18:38 version 1.40, 2001/06/25 21:29:31
Line 143 
Line 143 
         /* get current login name and shell */          /* get current login name and shell */
         ruid = getuid();          ruid = getuid();
         username = getlogin();          username = getlogin();
   
           if(username != NULL)
                   auth_setoption(as, "invokinguser", username);
   
         if (username == NULL || (pwd = getpwnam(username)) == NULL ||          if (username == NULL || (pwd = getpwnam(username)) == NULL ||
             pwd->pw_uid != ruid)              pwd->pw_uid != ruid)
                 pwd = getpwuid(ruid);                  pwd = getpwuid(ruid);
Line 187 
Line 191 
                 if ((pwd->pw_uid || !style || strcmp(style, LOGIN_DEFSTYLE)) &&                  if ((pwd->pw_uid || !style || strcmp(style, LOGIN_DEFSTYLE)) &&
                     (style = login_getstyle(lc, style, "auth-su")) == NULL)                      (style = login_getstyle(lc, style, "auth-su")) == NULL)
                         auth_errx(as, 1, "invalid authentication type");                          auth_errx(as, 1, "invalid authentication type");
                 if (pwd->pw_uid || strcmp(user, "root") != 0)                  fullname = user;
                         fullname = user;  
                 else {  
                         if ((fullname =  
                             malloc(strlen(username) + 6)) == NULL)  
                                 auth_err(as, 1, NULL);  
                         (void)sprintf(fullname, "%s.root", username);  
                 }  
                 /*                  /*
                  * Let the authentication program know whether they are                   * Let the authentication program know whether they are
                  * in group wheel or not (if trying to become super user)                   * in group wheel or not (if trying to become super user)

Legend:
Removed from v.1.39  
changed lines
  Added in v.1.40