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

Diff for /src/usr.bin/passwd/Attic/yp_passwd.c between version 1.13 and 1.14

version 1.13, 2000/06/30 16:00:20 version 1.14, 2000/08/01 22:27:51
Line 60 
Line 60 
 #define _PASSWORD_LEN PASS_MAX  #define _PASSWORD_LEN PASS_MAX
 #endif  #endif
   
   extern  int pwd_gensalt __P(( char *, int, struct passwd *, char));
   extern  int pwd_check __P((struct passwd *, char *));
   extern  int pwd_gettries __P((struct passwd *));
   
 static char *getnewpasswd();  static char *getnewpasswd();
 static struct passwd *ypgetpwnam();  static struct passwd *ypgetpwnam();
   
Line 181 
Line 185 
 {  {
         static char buf[_PASSWORD_LEN+1];          static char buf[_PASSWORD_LEN+1];
         register char *p, *t;          register char *p, *t;
         int tries;          int tries, pwd_tries;
         char salt[_PASSWORD_LEN], *crypt(), *getpass();          char salt[_PASSWORD_LEN], *crypt(), *getpass();
         int pwd_gensalt __P(( char *, int, struct passwd *, char));  
   
         printf("Changing YP password for %s.\n", pw->pw_name);          printf("Changing YP password for %s.\n", pw->pw_name);
   
Line 201 
Line 204 
                 *old_pass = strdup(p);                  *old_pass = strdup(p);
         }          }
   
           pwd_tries = pwd_gettries(pw);
   
         for (buf[0] = '\0', tries = 0;;) {          for (buf[0] = '\0', tries = 0;;) {
                 p = getpass("New password:");                  p = getpass("New password:");
                 if (!*p) {                  if (!*p) {
Line 211 
Line 216 
                         printf("That password collides with a system feature. Choose another.\n");                          printf("That password collides with a system feature. Choose another.\n");
                         continue;                          continue;
                 }                  }
                 if (strlen(p) <= 5 && ++tries < 2) {                  if ((tries++ < pwd_tries || pwd_tries == 0)
                         printf("Please enter a longer password.\n");                      && pwd_check(pw, p) == 0)
                         continue;                          continue;
                 }  
                 for (t = p; *t && islower(*t); ++t)  
                         ;  
                 if (!*t && ++tries < 2) {  
                         printf("Please don't use an all-lower case password.\nUnusual capitalization, control characters or digits are suggested.\n");  
                         continue;  
                 }  
                 strncpy(buf, p, sizeof buf-1);                  strncpy(buf, p, sizeof buf-1);
                 buf[sizeof buf-1] = '\0';                  buf[sizeof buf-1] = '\0';
                 if (!strcmp(buf, getpass("Retype new password:")))                  if (!strcmp(buf, getpass("Retype new password:")))

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14