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

Diff for /src/usr.bin/lock/lock.c between version 1.6 and 1.7

version 1.6, 1996/09/06 01:57:15 version 1.7, 1996/10/16 00:09:20
Line 72 
Line 72 
 #include <termios.h>  #include <termios.h>
 #include <unistd.h>  #include <unistd.h>
   
   #ifdef SKEY
   #include <skey.h>
   #endif
   
 #define TIMEOUT 15  #define TIMEOUT 15
   
 void quit(), bye(), hi();  void quit(), bye(), hi();
Line 87 
Line 91 
         int argc;          int argc;
         char **argv;          char **argv;
 {  {
         extern char *optarg;  
         struct passwd *pw;          struct passwd *pw;
         struct timeval timval;          struct timeval timval;
         struct itimerval ntimer, otimer;          struct itimerval ntimer, otimer;
Line 96 
Line 99 
         int ch, sectimeout, usemine;          int ch, sectimeout, usemine;
         char *ap, *mypw, *ttynam, *tzn;          char *ap, *mypw, *ttynam, *tzn;
         char hostname[MAXHOSTNAMELEN], s[BUFSIZ], s1[BUFSIZ];          char hostname[MAXHOSTNAMELEN], s[BUFSIZ], s1[BUFSIZ];
         char *crypt();  
   
         sectimeout = TIMEOUT;          sectimeout = TIMEOUT;
         mypw = NULL;          mypw = NULL;
Line 126 
Line 128 
         }          }
         timeout.tv_sec = sectimeout * 60;          timeout.tv_sec = sectimeout * 60;
   
         setuid(getuid());               /* discard privs */          seteuid(getuid());              /* discard what privs we can */
   
         if (tcgetattr(0, &tty) < 0)     /* get information for header */          if (tcgetattr(0, &tty) < 0)     /* get information for header */
                 exit(1);                  exit(1);
Line 159 
Line 161 
                 (void)fgets(s1, sizeof(s1), stdin);                  (void)fgets(s1, sizeof(s1), stdin);
                 (void)putchar('\n');                  (void)putchar('\n');
                 if (strcmp(s1, s)) {                  if (strcmp(s1, s)) {
                         (void)printf("\alock: passwords didn't match.\n");                          (void)puts("\alock: passwords didn't match.");
                         (void)tcsetattr(0, TCSADRAIN, &tty);                          (void)tcsetattr(0, TCSADRAIN, &tty);
                         exit(1);                          exit(1);
                 }                  }
Line 198 
Line 200 
                         s[strlen(s) - 1] = '\0';                          s[strlen(s) - 1] = '\0';
 #ifdef SKEY  #ifdef SKEY
                         if (strcasecmp(s, "s/key") == 0) {                          if (strcasecmp(s, "s/key") == 0) {
                                 if (skey_auth(pw->pw_name))                                  /* S/Key lookup needs to be done as root */
                                   seteuid(0);
                                   ch = skey_auth(pw->pw_name);
                                   seteuid(getuid());
                                   if (ch)
                                         break;                                          break;
                         }                          }
 #endif  #endif
Line 224 
Line 230 
 skey_auth(user)  skey_auth(user)
         char *user;          char *user;
 {  {
         char s[128], *ask, *skey_keyinfo __P((char *name));          char s[256], *ask;
         int ret = 0;          int ret = 0;
   
         if (!skey_haskey(user) && (ask = skey_keyinfo(user))) {          if (!skey_haskey(user) && (ask = skey_keyinfo(user))) {
                 printf("\n[%s]\nResponse: ", ask);                  printf("\n%s\nResponse: ", ask);
                 if (!fgets(s, sizeof(s), stdin) || *s == '\n')                  if (!fgets(s, sizeof(s), stdin) || *s == '\n')
                         clearerr(stdin);                          clearerr(stdin);
                 else {                  else {

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7