diff options
Diffstat (limited to 'usr.sbin/pw')
-rw-r--r-- | usr.sbin/pw/pw.c | 10 | ||||
-rw-r--r-- | usr.sbin/pw/pw_conf.c | 2 | ||||
-rw-r--r-- | usr.sbin/pw/pw_user.c | 8 | ||||
-rw-r--r-- | usr.sbin/pw/pwupd.h | 2 |
4 files changed, 6 insertions, 16 deletions
diff --git a/usr.sbin/pw/pw.c b/usr.sbin/pw/pw.c index bca6715..88c83db 100644 --- a/usr.sbin/pw/pw.c +++ b/usr.sbin/pw/pw.c @@ -262,11 +262,6 @@ main(int argc, char *argv[]) case 'c': conf.gecos = pw_checkname(optarg, 1); break; - case 'e': - conf.expire_days = strtonum(optarg, 0, INT_MAX, &errstr); - if (errstr) - errx(EX_USAGE, "Invalid expired days: %s", optarg); - break; case 'g': if (which == 0) { /* for user* */ addarg(&arglist, 'g', optarg); @@ -326,11 +321,6 @@ main(int argc, char *argv[]) case 'o': conf.checkduplicate = false; break; - case 'p': - conf.password_days = strtonum(optarg, 0, INT_MAX, &errstr); - if (errstr) - errx(EX_USAGE, "Invalid password days: %s", optarg); - break; case 'q': conf.quiet = true; break; diff --git a/usr.sbin/pw/pw_conf.c b/usr.sbin/pw/pw_conf.c index b723c31..8ba8c07 100644 --- a/usr.sbin/pw/pw_conf.c +++ b/usr.sbin/pw/pw_conf.c @@ -367,6 +367,8 @@ read_userconfig(char const * file) warnx("Invalid expire days:" " '%s'; ignoring", q); } + if ((q = unquote(q)) != NULL && isdigit(*q)) + config.expire_days = atoi(q); break; case _UC_PASSWORD: if ((q = unquote(q)) != NULL) { diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c index 6e07f1f..eca8235 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 (conf.expire_days > 0) - cnf->expire_days = conf.expire_days; + if ((arg = getarg(args, 'e')) != NULL) + cnf->expire_days = atoi(arg->val); if ((arg = getarg(args, 'y')) != NULL) cnf->nispasswd = arg->val; - if (conf.password_days > 0) - cnf->password_days = conf.password_days; + if ((arg = getarg(args, 'p')) != NULL && arg->val) + cnf->password_days = atoi(arg->val); if ((arg = getarg(args, 'g')) != NULL) { if (!*(p = arg->val)) /* Handle empty group list specially */ diff --git a/usr.sbin/pw/pwupd.h b/usr.sbin/pw/pwupd.h index 9685bea..054c5a5 100644 --- a/usr.sbin/pw/pwupd.h +++ b/usr.sbin/pw/pwupd.h @@ -86,8 +86,6 @@ struct pwconf { char *newname; char *config; char *gecos; - int expire_days; - int password_days; int fd; int rootfd; int which; |