From owner-svn-src-head@freebsd.org Sat Aug 1 13:36:33 2015 Return-Path: Delivered-To: svn-src-head@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 B73439B0434; Sat, 1 Aug 2015 13:36:33 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mailhost.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B114117E; Sat, 1 Aug 2015 13:36:33 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id BFC86358C66; Sat, 1 Aug 2015 15:36:29 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 94A8928494; Sat, 1 Aug 2015 15:36:29 +0200 (CEST) Date: Sat, 1 Aug 2015 15:36:29 +0200 From: Jilles Tjoelker To: Bruce Evans Cc: Baptiste Daroussin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r285985 - in head/usr.sbin/pw: . tests Message-ID: <20150801133629.GA94932@stack.nl> References: <201507282110.t6SLAx0k035167@repo.freebsd.org> <20150729080932.S5059@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150729080932.S5059@besplex.bde.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 13:36:33 -0000 On Wed, Jul 29, 2015 at 08:52:52AM +1000, Bruce Evans wrote: > On Tue, 28 Jul 2015, Baptiste Daroussin wrote: > > Added: head/usr.sbin/pw/tests/pw_groupadd.sh > > ============================================================================== > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > +++ head/usr.sbin/pw/tests/pw_groupadd.sh Tue Jul 28 21:10:58 2015 (r285985) > > @@ -0,0 +1,15 @@ > > +# $FreeBSD$ > > + > > +# Import helper functions > > +. $(atf_get_srcdir)/helper_functions.shin > > + > > +atf_test_case group_add_gid_too_large > > +group_add_gid_too_large_body() { > > + populate_etc_skel > > + atf_check -s exit:64 -e inline:"pw: Bad id '9999999999999': too large\n" \ > > + ${PW} groupadd -n test1 -g 9999999999999 > > +} > Check for large valid ids on i386 (should succeed, but currently fail), > negative ids (require failure), magic ids like (uid_t)-1 and (uid_t)-2 > (should fail, but currently succeed on amd64), and the hex ids (should > succeed, but currently fail). (uid_t)-1 is special for some syscalls, > so shouldn't be permitted for users. (uid_t)-2 special for nfs (see > exports(5)). The magic ids are hard to spell without using hex, but > pw is too broken to accept that. For 32-bit ids, the above number > should be replaced by 0x100000000 when pw supports hex. Also check > that 0xffffffff and 0xfffffffe are not too large, but reserved, and > that 0xfffffffd is not too large and not reserved. These values are easily written using arithmetic expansion, for example largeid=$((0x100000000)). When using strtol() or similar functions, accepting hex typically implies accepting octal as well, which causes confusing and POSIX-violating results like 010 interpreted as eight. -- Jilles Tjoelker