summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pwd_mkdb/pwd_mkdb.c
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2015-06-04 07:24:56 +0000
committerdelphij <delphij@FreeBSD.org>2015-06-04 07:24:56 +0000
commit82c0d88211238b97e97ab1f5e112a21400d164bf (patch)
tree0a359f02c4a03130702dc245f82d1746c49fff1d /usr.sbin/pwd_mkdb/pwd_mkdb.c
parent32346ec843783a039a28e950e4ebaf328c78ee65 (diff)
downloadFreeBSD-src-82c0d88211238b97e97ab1f5e112a21400d164bf.zip
FreeBSD-src-82c0d88211238b97e97ab1f5e112a21400d164bf.tar.gz
In r113596, version 4 of entries have been added but pwd_mkdb have
been generating both new (machine independent) and legacy version entries (endianness sensitive). The base system have been using the new format for quite some time, so disable the generation by default. An interim option, -l, have been added to re-enable old behavior. The -l, -B and -L options are considered deprecated and will be removed in FreeBSD 12.0 release.
Diffstat (limited to 'usr.sbin/pwd_mkdb/pwd_mkdb.c')
-rw-r--r--usr.sbin/pwd_mkdb/pwd_mkdb.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.c b/usr.sbin/pwd_mkdb/pwd_mkdb.c
index 0ba68a5..12d34da 100644
--- a/usr.sbin/pwd_mkdb/pwd_mkdb.c
+++ b/usr.sbin/pwd_mkdb/pwd_mkdb.c
@@ -112,15 +112,15 @@ main(int argc, char *argv[])
char sbuf2[MAXPATHLEN];
char *username;
u_int method, methoduid;
- int Cflag, dflag, iflag;
+ int Cflag, dflag, iflag, lflag;
int nblock = 0;
- iflag = dflag = Cflag = 0;
+ iflag = dflag = Cflag = lflag = 0;
strcpy(prefix, _PATH_PWD);
makeold = 0;
username = NULL;
oldfp = NULL;
- while ((ch = getopt(argc, argv, "BCLNd:ips:u:v")) != -1)
+ while ((ch = getopt(argc, argv, "BCLlNd:ips:u:v")) != -1)
switch(ch) {
case 'B': /* big-endian output */
openinfo.lorder = BIG_ENDIAN;
@@ -128,6 +128,9 @@ main(int argc, char *argv[])
case 'C': /* verify only */
Cflag = 1;
break;
+ case 'l': /* generate legacy entries */
+ lflag = 1;
+ break;
case 'L': /* little-endian output */
openinfo.lorder = LITTLE_ENDIAN;
break;
@@ -465,6 +468,7 @@ main(int argc, char *argv[])
error("put");
}
+ if (lflag) {
/* Create insecure data. (legacy version) */
p = buf;
COMPACT(pwd.pw_name);
@@ -555,6 +559,7 @@ main(int argc, char *argv[])
error("put");
}
}
+ }
/* Create original format password file entry */
if (is_comment && makeold){ /* copy comments */
if (fprintf(oldfp, "%s\n", line) < 0)
@@ -583,6 +588,7 @@ main(int argc, char *argv[])
error("put");
if ((sdp->put)(sdp, &key, &data, method) == -1)
error("put");
+ if (lflag) {
tbuf[0] = LEGACY_VERSION(_PW_KEYYPENABLED);
key.size = 1;
if ((dp->put)(dp, &key, &data, method) == -1)
@@ -590,6 +596,7 @@ main(int argc, char *argv[])
if ((sdp->put)(sdp, &key, &data, method) == -1)
error("put");
}
+ }
if ((dp->close)(dp) == -1)
error("close");
OpenPOWER on IntegriCloud