From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 24 15:39:17 2007 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EBCCE16A468 for ; Tue, 24 Jul 2007 15:39:17 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (grnl-static-02-0046.dsl.iowatelecom.net [69.66.56.110]) by mx1.freebsd.org (Postfix) with ESMTP id 90DB213C45E for ; Tue, 24 Jul 2007 15:39:17 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.13.8/8.13.8) with ESMTP id l6OFAZwE019536; Tue, 24 Jul 2007 10:10:35 -0500 (CDT) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.13.8/8.13.8/Submit) id l6OFAXrE019535; Tue, 24 Jul 2007 10:10:33 -0500 (CDT) (envelope-from brooks) Date: Tue, 24 Jul 2007 10:10:33 -0500 From: Brooks Davis To: Ben Kaduk Message-ID: <20070724151033.GA19358@lor.one-eyed-alien.net> References: <200707232052.58485.dmw@unete.cl> <46A577BB.5020400@bitfreak.org> <47d0403c0707232237t272f4e7exb0f55c21bbd097c7@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="oyUTqETQ0mS9luUI" Content-Disposition: inline In-Reply-To: <47d0403c0707232237t272f4e7exb0f55c21bbd097c7@mail.gmail.com> User-Agent: Mutt/1.5.15 (2007-04-06) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (lor.one-eyed-alien.net [127.0.0.1]); Tue, 24 Jul 2007 10:10:36 -0500 (CDT) Cc: Darren Pilgrim , dmw@unete.cl, FreeBSD Hackers Subject: Re: A few questions... X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jul 2007 15:39:18 -0000 --oyUTqETQ0mS9luUI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 24, 2007 at 12:37:53AM -0500, Ben Kaduk wrote: > On 7/23/07, Darren Pilgrim wrote: > > Daniel Molina Wegener wrote: > > > Hello, > > > > > > I need information about few things, I hope someone can help > > > me and thanks in advance. > > > > > > a) Is there any function or variable that tells me which is the > > > root user UID in the system, or root always have 0 and it's > > > an "elegant" option to compare the variables or structure > > > members against zero. > > > > Root is always UID 0. Checking UID =3D=3D 0 is the common practice for > > determining if the effective UID has root priveleges. >=20 > But should it be common practice? What of suser(9) and priv(9)? In userspace it's what you have to do if you're going to check privleges. In general though, you shouldn't check at all and just attempt the operation and let the kernel decide (there are of course exceptions to this rule). In the kernel you should use priv(9). -- Brooks --oyUTqETQ0mS9luUI Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (FreeBSD) iD8DBQFGphZpXY6L6fI4GtQRAoZHAJ9n47/ixv0cfA8LRZO2J9k1ENSHpwCeObT8 Q0pN+Xi90Fwf8BH+9mkudpo= =Yane -----END PGP SIGNATURE----- --oyUTqETQ0mS9luUI--