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

Diff for /src/usr.bin/login/login.c between version 1.23 and 1.24

version 1.23, 1997/11/04 19:01:05 version 1.24, 1998/03/26 20:28:11
Line 75 
Line 75 
 #include <unistd.h>  #include <unistd.h>
 #include <utmp.h>  #include <utmp.h>
 #include <util.h>  #include <util.h>
   #include <skey.h>
   
 #include "pathnames.h"  #include "pathnames.h"
   
Line 94 
Line 95 
 int      klogin __P((struct passwd *, char *, char *, char *));  int      klogin __P((struct passwd *, char *, char *, char *));
 void     kdestroy __P((void));  void     kdestroy __P((void));
 void     dofork __P((void));  void     dofork __P((void));
   void     kgettokens __P((char *));
 #endif  #endif
   
 extern void login __P((struct utmp *));  extern void login __P((struct utmp *));
Line 388 
Line 390 
   
         if (pwd->pw_change || pwd->pw_expire)          if (pwd->pw_change || pwd->pw_expire)
                 (void)gettimeofday(&tp, (struct timezone *)NULL);                  (void)gettimeofday(&tp, (struct timezone *)NULL);
         if (pwd->pw_change)          if (pwd->pw_change) {
                 if (tp.tv_sec >= pwd->pw_change) {                  if (tp.tv_sec >= pwd->pw_change) {
                         (void)printf("Sorry -- your password has expired.\n");                          (void)printf("Sorry -- your password has expired.\n");
                         sleepexit(1);                          sleepexit(1);
Line 396 
Line 398 
                     2 * DAYSPERWEEK * SECSPERDAY && !quietlog)                      2 * DAYSPERWEEK * SECSPERDAY && !quietlog)
                         (void)printf("Warning: your password expires on %s",                          (void)printf("Warning: your password expires on %s",
                             ctime(&pwd->pw_change));                              ctime(&pwd->pw_change));
         if (pwd->pw_expire)          }
           if (pwd->pw_expire) {
                 if (tp.tv_sec >= pwd->pw_expire) {                  if (tp.tv_sec >= pwd->pw_expire) {
                         (void)printf("Sorry -- your account has expired.\n");                          (void)printf("Sorry -- your account has expired.\n");
                         sleepexit(1);                          sleepexit(1);
Line 404 
Line 407 
                     2 * DAYSPERWEEK * SECSPERDAY && !quietlog)                      2 * DAYSPERWEEK * SECSPERDAY && !quietlog)
                         (void)printf("Warning: your account expires on %s",                          (void)printf("Warning: your account expires on %s",
                             ctime(&pwd->pw_expire));                              ctime(&pwd->pw_expire));
           }
   
         /* Nothing else left to fail -- really log in. */          /* Nothing else left to fail -- really log in. */
         (void)signal(SIGHUP, SIG_DFL);          (void)signal(SIGHUP, SIG_DFL);
Line 437 
Line 441 
                 pwd->pw_shell = _PATH_BSHELL;                  pwd->pw_shell = _PATH_BSHELL;
   
         /* Destroy environment unless user has requested its preservation. */          /* Destroy environment unless user has requested its preservation. */
         if (!pflag)          if (!pflag) {
                 if ((environ = calloc(1, sizeof (char *))) == NULL)                  if ((environ = calloc(1, sizeof (char *))) == NULL)
                         err(1, "calloc");                          err(1, "calloc");
         else {          } else {
                 char **cpp, **cpp2;                  char **cpp, **cpp2;
   
                 for (cpp2 = cpp = environ; *cpp; cpp++) {                  for (cpp2 = cpp = environ; *cpp; cpp++) {
Line 472 
Line 476 
 #endif  #endif
   
         /* If fflag is on, assume caller/authenticator has logged root login. */          /* If fflag is on, assume caller/authenticator has logged root login. */
         if (rootlogin && fflag == 0)          if (rootlogin && fflag == 0) {
                 if (hostname)                  if (hostname)
                         syslog(LOG_NOTICE, "ROOT LOGIN (%s) ON %s FROM %s%s%s",                          syslog(LOG_NOTICE, "ROOT LOGIN (%s) ON %s FROM %s%s%s",
                             username, tty, rusername ? rusername : "",                              username, tty, rusername ? rusername : "",
                             rusername ? "@" : "", hostname);                              rusername ? "@" : "", hostname);
                 else                  else
                         syslog(LOG_NOTICE, "ROOT LOGIN (%s) ON %s", username, tty);                          syslog(LOG_NOTICE, "ROOT LOGIN (%s) ON %s", username, tty);
           }
   
 #if defined(KERBEROS) || defined(KERBEROS5)  #if defined(KERBEROS) || defined(KERBEROS5)
         if (!quietlog && notickets == 1)          if (!quietlog && notickets == 1)
Line 520 
Line 525 
                 (void) seteuid(pwd->pw_uid);                  (void) seteuid(pwd->pw_uid);
                 (void) setuid(pwd->pw_uid);                  (void) setuid(pwd->pw_uid);
         }          }
   #ifdef KERBEROS
           kgettokens(pwd->pw_dir);
   #endif
   
         execlp(pwd->pw_shell, tbuf, 0);          execlp(pwd->pw_shell, tbuf, 0);
         err(1, "%s", pwd->pw_shell);          err(1, "%s", pwd->pw_shell);
Line 589 
Line 597 
                         if (p < nbuf + (NBUFSIZ - 1))                          if (p < nbuf + (NBUFSIZ - 1))
                                 *p++ = ch;                                  *p++ = ch;
                 }                  }
                 if (p > nbuf)                  if (p > nbuf) {
                         if (nbuf[0] == '-')                          if (nbuf[0] == '-')
                                 (void)fprintf(stderr,                                  (void)fprintf(stderr,
                                     "login names may not start with '-'.\n");                                      "login names may not start with '-'.\n");
Line 598 
Line 606 
                                 username = nbuf;                                  username = nbuf;
                                 break;                                  break;
                         }                          }
                   }
         }          }
 }  }
   

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24