diff options
author | bapt <bapt@FreeBSD.org> | 2015-08-01 10:25:55 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2015-08-01 10:25:55 +0000 |
commit | 9a71628c9f96d9d0a64d5e4708d4ba4709c2c421 (patch) | |
tree | 06f499ddf3f646c290ee74968ae8970d44338ffb /usr.sbin/pw/pw.c | |
parent | 10ba8e17a1929665721680c955d5c520867a4503 (diff) | |
download | FreeBSD-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.c')
-rw-r--r-- | usr.sbin/pw/pw.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/usr.sbin/pw/pw.c b/usr.sbin/pw/pw.c index 88c83db..bca6715 100644 --- a/usr.sbin/pw/pw.c +++ b/usr.sbin/pw/pw.c @@ -262,6 +262,11 @@ 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); @@ -321,6 +326,11 @@ 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; |