[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.23 and 1.24

version 1.23, 2006/04/26 02:35:08 version 1.24, 2009/09/18 20:58:35
Line 91 
Line 91 
         char hostname[MAXHOSTNAMELEN], s[BUFSIZ], s1[BUFSIZ], date[256];          char hostname[MAXHOSTNAMELEN], s[BUFSIZ], s1[BUFSIZ], date[256];
         char *p, *style, *nstyle, *ttynam;          char *p, *style, *nstyle, *ttynam;
         struct itimerval ntimer, otimer;          struct itimerval ntimer, otimer;
         int ch, sectimeout, usemine;          int ch, sectimeout, usemine, cnt, tries = 10, backoff = 3;
         const char *errstr;          const char *errstr;
         struct passwd *pw;          struct passwd *pw;
         struct tm *timp;          struct tm *timp;
Line 107 
Line 107 
                 errx(1, "unknown uid %u.", getuid());                  errx(1, "unknown uid %u.", getuid());
   
         lc = login_getclass(pw->pw_class);          lc = login_getclass(pw->pw_class);
           if (lc != NULL) {
                   /*
                    * We allow "login-tries" attempts to login but start
                    * slowing down after "login-backoff" attempts.
                    */
                   tries = (int)login_getcapnum(lc, "login-tries", 10, 10);
                   backoff = (int)login_getcapnum(lc, "login-backoff", 3, 3);
           }
   
         while ((ch = getopt(argc, argv, "a:npt:")) != -1)          while ((ch = getopt(argc, argv, "a:npt:")) != -1)
                 switch (ch) {                  switch (ch) {
                 case 'a':                  case 'a':
Line 186 
Line 194 
                     __progname, ttynam, hostname, sectimeout, date);                      __progname, ttynam, hostname, sectimeout, date);
         }          }
   
         for (;;) {          for (cnt = 0;;) {
                 if (!readpassphrase("Key: ", s, sizeof(s), RPP_ECHO_OFF) ||                  if (!readpassphrase("Key: ", s, sizeof(s), RPP_ECHO_OFF) ||
                     *s == '\0') {                      *s == '\0') {
                         hi(0);                          hi(0);
Line 209 
Line 217 
                 } else if (strcmp(s, s1) == 0)                  } else if (strcmp(s, s1) == 0)
                         break;                          break;
                 (void)putc('\a', stderr);                  (void)putc('\a', stderr);
                   cnt %= tries;
                   if (++cnt > backoff) {
                           sigset_t set, oset;
                           sigfillset(&set);
                           sigprocmask(SIG_BLOCK, &set, &oset);
                           sleep((u_int)((cnt - backoff) * tries / 2));
                           sigprocmask(SIG_SETMASK, &oset, NULL);
                   }
         }          }
   
         exit(0);          exit(0);

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