diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2001-06-07 16:21:50 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2001-06-07 16:21:50 +0000 |
commit | cc9a568f7b54ff94c69b575a9034d36b5c88739c (patch) | |
tree | d11b3c060df116116a92d1f2138a032c7a9886d6 /usr.sbin/pwd_mkdb/pwd_mkdb.c | |
parent | 92e01a4632d76bd6b6ac64e57b66cc610d8531c3 (diff) |
Close PR 1854; mpech@prosoft.org.lv
o use correct db pointers
o don't try to star out an empty password
Diffstat (limited to 'usr.sbin/pwd_mkdb/pwd_mkdb.c')
-rw-r--r-- | usr.sbin/pwd_mkdb/pwd_mkdb.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.c b/usr.sbin/pwd_mkdb/pwd_mkdb.c index 575d7859aaa..f8b1eb27519 100644 --- a/usr.sbin/pwd_mkdb/pwd_mkdb.c +++ b/usr.sbin/pwd_mkdb/pwd_mkdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pwd_mkdb.c,v 1.23 2000/11/26 19:35:46 millert Exp $ */ +/* $OpenBSD: pwd_mkdb.c,v 1.24 2001/06/07 16:21:49 millert Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -45,7 +45,7 @@ static char copyright[] = #if 0 static char sccsid[] = "from: @(#)pwd_mkdb.c 8.5 (Berkeley) 4/20/94"; #else -static char *rcsid = "$OpenBSD: pwd_mkdb.c,v 1.23 2000/11/26 19:35:46 millert Exp $"; +static char *rcsid = "$OpenBSD: pwd_mkdb.c,v 1.24 2001/06/07 16:21:49 millert Exp $"; #endif #endif /* not lint */ @@ -285,7 +285,7 @@ main(argc, argv) data.data = (u_char *)NULL; data.size = 0; - if ((dp->put)(edp, &key, &data, R_NOOVERWRITE) == -1) + if ((edp->put)(edp, &key, &data, R_NOOVERWRITE) == -1) error("put"); if ((dp->put)(dp, &key, &data, R_NOOVERWRITE) == -1) error("put"); @@ -538,7 +538,7 @@ db_store(fp, oldfp, edp, dp, pw, keytype, username, olduid) tbuf[0] = _PW_KEYBYUID; memcpy(tbuf + 1, &olduid, sizeof(olduid)); key.size = sizeof(olduid) + 1; - (edp->del)(dp, &key, 0); + (edp->del)(edp, &key, 0); (dp->del)(dp, &key, 0); } /* XXX - should check to see if line number changed. */ @@ -586,7 +586,7 @@ db_store(fp, oldfp, edp, dp, pw, keytype, username, olduid) data.size = p - buf; /* Write the secure record. */ - if ((dp->put)(edp, &key, &data, dbmode) == -1) + if ((edp->put)(edp, &key, &data, dbmode) == -1) error("put"); /* Star out password to make insecure record. */ @@ -594,7 +594,8 @@ db_store(fp, oldfp, edp, dp, pw, keytype, username, olduid) len = strlen(pw->pw_passwd); memset(p, 0, len); /* zero pw_passwd */ t = p + len + 1; /* skip pw_passwd */ - *p++ = '*'; + if (len != 0) + *p++ = '*'; *p++ = '\0'; memmove(p, t, data.size - (t - buf)); data.size -= len - 1; |