From owner-svn-src-all@freebsd.org Sat Aug 1 12:18:50 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9010A9AE57C; Sat, 1 Aug 2015 12:18:50 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 73F38138B; Sat, 1 Aug 2015 12:18:50 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t71CIoFj025626; Sat, 1 Aug 2015 12:18:50 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t71CInhD025620; Sat, 1 Aug 2015 12:18:49 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201508011218.t71CInhD025620@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 1 Aug 2015 12:18:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286156 - head/usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 12:18:50 -0000 Author: bapt Date: Sat Aug 1 12:18:48 2015 New Revision: 286156 URL: https://svnweb.freebsd.org/changeset/base/286156 Log: Partial revert of r286152 More work needed on the cli validation Modified: head/usr.sbin/pw/pw.c head/usr.sbin/pw/pw_conf.c head/usr.sbin/pw/pw_user.c head/usr.sbin/pw/pwupd.h Modified: head/usr.sbin/pw/pw.c ============================================================================== --- head/usr.sbin/pw/pw.c Sat Aug 1 11:52:48 2015 (r286155) +++ head/usr.sbin/pw/pw.c Sat Aug 1 12:18:48 2015 (r286156) @@ -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; Modified: head/usr.sbin/pw/pw_conf.c ============================================================================== --- head/usr.sbin/pw/pw_conf.c Sat Aug 1 11:52:48 2015 (r286155) +++ head/usr.sbin/pw/pw_conf.c Sat Aug 1 12:18:48 2015 (r286156) @@ -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) { Modified: head/usr.sbin/pw/pw_user.c ============================================================================== --- head/usr.sbin/pw/pw_user.c Sat Aug 1 11:52:48 2015 (r286155) +++ head/usr.sbin/pw/pw_user.c Sat Aug 1 12:18:48 2015 (r286156) @@ -418,14 +418,14 @@ pw_user(int mode, char *name, long id, s 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 */ Modified: head/usr.sbin/pw/pwupd.h ============================================================================== --- head/usr.sbin/pw/pwupd.h Sat Aug 1 11:52:48 2015 (r286155) +++ head/usr.sbin/pw/pwupd.h Sat Aug 1 12:18:48 2015 (r286156) @@ -86,8 +86,6 @@ struct pwconf { char *newname; char *config; char *gecos; - int expire_days; - int password_days; int fd; int rootfd; int which;