summaryrefslogtreecommitdiff
path: root/usr.sbin/pwd_mkdb
diff options
context:
space:
mode:
authorBill Paul <wpaul@FreeBSD.org>1996-10-22 03:18:11 +0000
committerBill Paul <wpaul@FreeBSD.org>1996-10-22 03:18:11 +0000
commit8839484b4789d681c1c19109135a27ce8a68bd6b (patch)
treeda5886c89d80d96d74e19203f4391fa329e253b7 /usr.sbin/pwd_mkdb
parentb9ab560398a81f9a6ec0663c99d9444299d66baf (diff)
downloadsrc-test2-8839484b4789d681c1c19109135a27ce8a68bd6b.tar.gz
src-test2-8839484b4789d681c1c19109135a27ce8a68bd6b.zip
Notes
Diffstat (limited to 'usr.sbin/pwd_mkdb')
-rw-r--r--usr.sbin/pwd_mkdb/pwd_mkdb.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.c b/usr.sbin/pwd_mkdb/pwd_mkdb.c
index 03d24b977c44..5b9fe280f44a 100644
--- a/usr.sbin/pwd_mkdb/pwd_mkdb.c
+++ b/usr.sbin/pwd_mkdb/pwd_mkdb.c
@@ -373,10 +373,18 @@ main(argc, argv)
}
}
/* Create original format password file entry */
- if (makeold)
- (void)fprintf(oldfp, "%s:*:%d:%d:%s:%s:%s\n",
- pwd.pw_name, pwd.pw_uid, pwd.pw_gid, pwd.pw_gecos,
- pwd.pw_dir, pwd.pw_shell);
+ if (makeold) {
+ char uidstr[20];
+ char gidstr[20];
+
+ snprintf(uidstr, sizeof(uidstr), "%d", pwd.pw_uid);
+ snprintf(gidstr, sizeof(gidstr), "%d", pwd.pw_gid);
+
+ (void)fprintf(oldfp, "%s:*:%s:%s:%s:%s:%s\n",
+ pwd.pw_name, pwd.pw_fields & _PWF_UID ? uidstr : "",
+ pwd.pw_fields & _PWF_GID ? gidstr : "",
+ pwd.pw_gecos, pwd.pw_dir, pwd.pw_shell);
+ }
}
/* If YP enabled, set flag. */
if (yp_enabled) {