summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pw/pw_user.c
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2015-08-01 10:25:55 +0000
committerbapt <bapt@FreeBSD.org>2015-08-01 10:25:55 +0000
commit9a71628c9f96d9d0a64d5e4708d4ba4709c2c421 (patch)
tree06f499ddf3f646c290ee74968ae8970d44338ffb /usr.sbin/pw/pw_user.c
parent10ba8e17a1929665721680c955d5c520867a4503 (diff)
downloadFreeBSD-src-9a71628c9f96d9d0a64d5e4708d4ba4709c2c421.zip
FreeBSD-src-9a71628c9f96d9d0a64d5e4708d4ba4709c2c421.tar.gz
Validate expiration days and password days from commmand line and pw.conf
Diffstat (limited to 'usr.sbin/pw/pw_user.c')
-rw-r--r--usr.sbin/pw/pw_user.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c
index eca8235..6e07f1f 100644
--- a/usr.sbin/pw/pw_user.c
+++ b/usr.sbin/pw/pw_user.c
@@ -418,14 +418,14 @@ pw_user(int mode, char *name, long id, struct cargs * args)
errx(EX_OSFILE, "root home `%s' is not a directory", cnf->home);
}
- if ((arg = getarg(args, 'e')) != NULL)
- cnf->expire_days = atoi(arg->val);
+ if (conf.expire_days > 0)
+ cnf->expire_days = conf.expire_days;
if ((arg = getarg(args, 'y')) != NULL)
cnf->nispasswd = arg->val;
- if ((arg = getarg(args, 'p')) != NULL && arg->val)
- cnf->password_days = atoi(arg->val);
+ if (conf.password_days > 0)
+ cnf->password_days = conf.password_days;
if ((arg = getarg(args, 'g')) != NULL) {
if (!*(p = arg->val)) /* Handle empty group list specially */
OpenPOWER on IntegriCloud