From owner-svn-src-all@FreeBSD.ORG Mon Jan 26 16:50:44 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 10DD0957; Mon, 26 Jan 2015 16:50:44 +0000 (UTC) Received: from svn.freebsd.org (svn.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 D6BF7CAE; Mon, 26 Jan 2015 16:50:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0QGohWT044146; Mon, 26 Jan 2015 16:50:43 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0QGohSI044141; Mon, 26 Jan 2015 16:50:43 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201501261650.t0QGohSI044141@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 26 Jan 2015 16:50:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r277764 - in head/usr.sbin/pw: . tests 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.18-1 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: Mon, 26 Jan 2015 16:50:44 -0000 Author: bapt Date: Mon Jan 26 16:50:42 2015 New Revision: 277764 URL: https://svnweb.freebsd.org/changeset/base/277764 Log: Revert r277652 uid and gid are never and should never be negative. The pw(8) manpage clearly states the -u and -g arguments are for uids/gids, hence using negative values is abusing a bug in former versions of pw(8) Deleted: head/usr.sbin/pw/tests/pw_groupshow.sh head/usr.sbin/pw/tests/pw_usershow.sh Modified: head/usr.sbin/pw/pw_group.c head/usr.sbin/pw/pw_user.c head/usr.sbin/pw/tests/Makefile Modified: head/usr.sbin/pw/pw_group.c ============================================================================== --- head/usr.sbin/pw/pw_group.c Mon Jan 26 16:32:41 2015 (r277763) +++ head/usr.sbin/pw/pw_group.c Mon Jan 26 16:50:42 2015 (r277764) @@ -68,11 +68,7 @@ pw_group(struct userconf * cnf, int mode }; if (a_gid != NULL) { - const char *teststr; - teststr = a_gid->val; - if (*teststr == '-') - teststr++; - if (strspn(teststr, "0123456789") != strlen(teststr)) + if (strspn(a_gid->val, "0123456789") != strlen(a_gid->val)) errx(EX_USAGE, "-g expects a number"); } Modified: head/usr.sbin/pw/pw_user.c ============================================================================== --- head/usr.sbin/pw/pw_user.c Mon Jan 26 16:32:41 2015 (r277763) +++ head/usr.sbin/pw/pw_user.c Mon Jan 26 16:50:42 2015 (r277764) @@ -322,10 +322,7 @@ pw_user(struct userconf * cnf, int mode, a_name = NULL; } } else { - const char *teststr = a_uid->val; - if (*teststr == '-') - teststr++; - if (strspn(teststr, "0123456789") != strlen(teststr)) + if (strspn(a_uid->val, "0123456789") != strlen(a_uid->val)) errx(EX_USAGE, "-u expects a number"); } Modified: head/usr.sbin/pw/tests/Makefile ============================================================================== --- head/usr.sbin/pw/tests/Makefile Mon Jan 26 16:32:41 2015 (r277763) +++ head/usr.sbin/pw/tests/Makefile Mon Jan 26 16:50:42 2015 (r277764) @@ -9,11 +9,9 @@ ATF_TESTS_SH= pw_etcdir \ pw_lock \ pw_groupdel \ pw_groupmod \ - pw_groupshow \ pw_useradd \ pw_userdel \ - pw_usermod \ - pw_usershow + pw_usermod .for tp in ${ATF_TESTS_SH} TEST_METADATA.${tp}+= required_user="root"