summaryrefslogtreecommitdiffstats
path: root/usr.bin/passwd
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1995-06-24 17:47:51 +0000
committerwpaul <wpaul@FreeBSD.org>1995-06-24 17:47:51 +0000
commit81948f780489478cb8f53b0ed85e472e229013ba (patch)
treeb277ec358c83a7fac630cd7f748e1bdda9965569 /usr.bin/passwd
parent57c30762f204af5a91ffe26eb72134e15da55f09 (diff)
downloadFreeBSD-src-81948f780489478cb8f53b0ed85e472e229013ba.zip
FreeBSD-src-81948f780489478cb8f53b0ed85e472e229013ba.tar.gz
getnewyppasswd() in yp_passwd.c doesn't generate correct encrypted
password strings when DES isn't used; somehow the encrypted password is corrupted and it winds up containing control chars, which yppasswdd subsequently rejects. This breaks yppasswd on non-DES FreeBSD systems using NIS. Fix: scrap getnewyppasswd() entirely and use getnewpasswd() from local_password.c, since it already works properly and is virtually identical to getnewyppasswd() anyway. (Wish I'd noticed this sooner.) This fixes a problem just reported on comp.unix.bsd.freebsd.misc.
Diffstat (limited to 'usr.bin/passwd')
-rw-r--r--usr.bin/passwd/yp_passwd.c44
1 files changed, 2 insertions, 42 deletions
diff --git a/usr.bin/passwd/yp_passwd.c b/usr.bin/passwd/yp_passwd.c
index 92f612b..d4abb23 100644
--- a/usr.bin/passwd/yp_passwd.c
+++ b/usr.bin/passwd/yp_passwd.c
@@ -50,47 +50,7 @@ uid_t uid;
static unsigned char itoa64[] = /* 0 ... 63 => ascii - 64 */
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-char *getnewyppasswd(struct passwd *);
-
-char *
-getnewyppasswd(register struct passwd *pw)
-{
- char *buf;
- char salt[9], *p=NULL;
- int tries = 0;
-
- buf = (char *) malloc(30);
-
- printf("Changing YP password for %s.\n", pw->pw_name);
-
- buf[0] = '\0';
- while(1) {
- p = getpass("Please enter new password:");
- if(*p == '\0') {
- printf("Password unchanged.\n");
- return NULL;
- }
-#ifndef DEBUG
- if (strlen(p) <= 5 && (uid != 0 || ++tries < 2)) {
- printf("Please enter a longer password.\n");
- continue;
- }
-#endif
- strcpy(buf, p);
- p = getpass("Please retype new password:");
- if( strcmp(buf, p) == 0) {
- break;
- } else {
- printf("Mismatch - password unchanged.\n");
- return NULL;
- }
- }
-
- /* grab a random printable character that isn't a colon */
- srandom((int)time((time_t *)NULL));
- to64(&salt[0], random(), 2);
- return strdup(crypt(buf, salt));
-}
+extern char *getnewpasswd __P(( struct passwd * ));
char *
getfield(char *gecos, char *field, int size)
@@ -303,7 +263,7 @@ yp_passwd(char *user)
}
if (use_yp_passwd) {
- if ((s = getnewyppasswd(pw)) == NULL)
+ if ((s = getnewpasswd(pw)) == NULL)
exit (1);
yppasswd.newpw.pw_passwd = s;
}
OpenPOWER on IntegriCloud