Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/usr.bin/passwd Pull up revision 1.23 (requested by jona...



details:   https://anonhg.NetBSD.org/src/rev/dd78b40b89da
branches:  netbsd-1-5
changeset: 492898:dd78b40b89da
user:      he <he%NetBSD.org@localhost>
date:      Tue Feb 26 22:09:34 2002 +0000

description:
Pull up revision 1.23 (requested by jonathan):
  Add support for local MD5-encrypted passwords.

diffstat:

 usr.bin/passwd/yp_passwd.c |  22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)

diffs (50 lines):

diff -r 175bcda1b712 -r dd78b40b89da usr.bin/passwd/yp_passwd.c
--- a/usr.bin/passwd/yp_passwd.c        Tue Feb 26 22:09:31 2002 +0000
+++ b/usr.bin/passwd/yp_passwd.c        Tue Feb 26 22:09:34 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: yp_passwd.c,v 1.22 2000/02/14 04:36:21 aidan Exp $     */
+/*     $NetBSD: yp_passwd.c,v 1.22.4.1 2002/02/26 22:09:34 he Exp $    */
 
 /*
  * Copyright (c) 1988, 1990, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "from:  @(#)local_passwd.c    8.3 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: yp_passwd.c,v 1.22 2000/02/14 04:36:21 aidan Exp $");
+__RCSID("$NetBSD: yp_passwd.c,v 1.22.4.1 2002/02/26 22:09:34 he Exp $");
 #endif
 #endif /* not lint */
 
@@ -242,8 +242,8 @@
        int tries;
        char *p, *t;
        static char buf[_PASSWORD_LEN+1];
-       char salt[9];
-       
+       char salt[_PASSWORD_LEN+1];
+
        (void)printf("Changing YP password for %s.\n", pw->pw_name);
 
        if (old_pass) {
@@ -284,15 +284,11 @@
                        break;
                (void)printf("Mismatch; try again, EOF to quit.\n");
        }
-       /* grab a random printable character that isn't a colon */
-       (void)srandom((int)time((time_t *)NULL));
-#ifdef NEWSALT
-       salt[0] = _PASSWORD_EFMT1;
-       to64(&salt[1], (long)(29 * 25), 4);
-       to64(&salt[5], random(), 4);
-#else
-       to64(&salt[0], random(), 2);
-#endif
+
+        if(!pwd_gensalt(salt, _PASSWORD_LEN, pw, 'y' )) {
+                (void)printf("Couldn't generate salt.\n");
+                pw_error(NULL, 0, 0);
+        }
        return(strdup(crypt(buf, salt)));
 }
 



Home | Main Index | Thread Index | Old Index