[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.40 and 1.41

version 1.40, 2001/06/25 21:29:31 version 1.41, 2001/09/18 04:41:09
Line 34 
Line 34 
  */   */
   
 #ifndef lint  #ifndef lint
 char copyright[] =  static const char copyright[] =
 "@(#) Copyright (c) 1988 The Regents of the University of California.\n\  "@(#) Copyright (c) 1988 The Regents of the University of California.\n\
  All rights reserved.\n";   All rights reserved.\n";
 #endif /* not lint */  #endif /* not lint */
   
 #ifndef lint  #ifndef lint
 /*static char sccsid[] = "from: @(#)su.c        5.26 (Berkeley) 7/6/91";*/  #if 0
 static char rcsid[] = "$OpenBSD$";  static const char sccsid[] = "from: @(#)su.c    5.26 (Berkeley) 7/6/91";
   #else
   static const char rcsid[] = "$OpenBSD$";
   #endif
 #endif /* not lint */  #endif /* not lint */
   
 #include <sys/param.h>  #include <sys/param.h>
Line 87 
Line 90 
         int asme, asthem, authok, ch, fastlogin, prio;          int asme, asthem, authok, ch, fastlogin, prio;
         char *class, *style, *p, **g;          char *class, *style, *p, **g;
         char *user, *shell, *avshell, *username, **np, *fullname;          char *user, *shell, *avshell, *username, **np, *fullname;
         char shellbuf[MAXPATHLEN], avshellbuf[MAXPATHLEN];          char avshellbuf[MAXPATHLEN];
   
         iscsh = UNSET;          iscsh = UNSET;
         class = shell = style = NULL;          class = shell = style = NULL;
Line 144 
Line 147 
         ruid = getuid();          ruid = getuid();
         username = getlogin();          username = getlogin();
   
         if(username != NULL)          if (username != NULL)
                 auth_setoption(as, "invokinguser", username);                  auth_setoption(as, "invokinguser", username);
   
         if (username == NULL || (pwd = getpwnam(username)) == NULL ||          if (username == NULL || (pwd = getpwnam(username)) == NULL ||
Line 153 
Line 156 
         if (pwd == NULL)          if (pwd == NULL)
                 auth_errx(as, 1, "who are you?");                  auth_errx(as, 1, "who are you?");
         if ((username = strdup(pwd->pw_name)) == NULL)          if ((username = strdup(pwd->pw_name)) == NULL)
                 auth_err(as, 1, "can't allocate memory");                  auth_errx(as, 1, "can't allocate memory");
         if (asme) {          if (asme) {
                 if (pwd->pw_shell && *pwd->pw_shell) {                  if (pwd->pw_shell && *pwd->pw_shell) {
                         strlcpy(shellbuf, pwd->pw_shell, sizeof(shellbuf));                          shell = strdup(pwd->pw_shell);
                         shell = shellbuf;  
                 } else {                  } else {
                         shell = _PATH_BSHELL;                          shell = _PATH_BSHELL;
                         iscsh = NO;                          iscsh = NO;
Line 170 
Line 172 
   
         if ((pwd = getpwnam(user)) == NULL)          if ((pwd = getpwnam(user)) == NULL)
                 auth_errx(as, 1, "unknown login %s", user);                  auth_errx(as, 1, "unknown login %s", user);
         if ((user = strdup(pwd->pw_name)) == NULL)          if ((pwd = pw_dup(pwd)) == NULL)
                 auth_err(as, 1, "can't allocate memory");                  auth_errx(as, 1, "can't allocate memory");
           user = pwd->pw_name;
   
         /* If the user specified a login class and we are root, use it */          /* If the user specified a login class and we are root, use it */
         if (ruid && class)          if (ruid && class)

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