From a25394718fcec2b1422b872e24e54ad5c7ae69af Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Sat, 1 Aug 2015 10:25:55 +0000 Subject: Validate expiration days and password days from commmand line and pw.conf --- pw/pw.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'pw/pw.c') diff --git a/pw/pw.c b/pw/pw.c index 88c83db..bca6715 100644 --- a/pw/pw.c +++ b/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; -- cgit v1.2.3