From owner-p4-projects@FreeBSD.ORG Wed Mar 15 18:03:01 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 23AB516A424; Wed, 15 Mar 2006 18:03:01 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DB4F016A422 for ; Wed, 15 Mar 2006 18:03:00 +0000 (UTC) (envelope-from millert@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 98B0C43D4C for ; Wed, 15 Mar 2006 18:03:00 +0000 (GMT) (envelope-from millert@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k2FI30io074965 for ; Wed, 15 Mar 2006 18:03:00 GMT (envelope-from millert@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k2FI30vG074962 for perforce@freebsd.org; Wed, 15 Mar 2006 18:03:00 GMT (envelope-from millert@freebsd.org) Date: Wed, 15 Mar 2006 18:03:00 GMT Message-Id: <200603151803.k2FI30vG074962@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to millert@freebsd.org using -f From: Todd Miller To: Perforce Change Reviews Cc: Subject: PERFORCE change 93353 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Mar 2006 18:03:01 -0000 http://perforce.freebsd.org/chv.cgi?CH=93353 Change 93353 by millert@millert_g5tower on 2006/03/15 18:02:08 Don't call mac_check_vnode_access() for the existence check (flags == 0) as it is just a no-op. This is consistent with what FreeBSD does and makes for a simpler diff against the vendor code. Affected files ... .. //depot/projects/trustedbsd/sedarwin7/src/darwin/xnu/bsd/vfs/vfs_syscalls.c#4 edit Differences ... ==== //depot/projects/trustedbsd/sedarwin7/src/darwin/xnu/bsd/vfs/vfs_syscalls.c#4 (text+ko) ==== @@ -1792,30 +1792,22 @@ vp = nd.ni_vp; /* Flags == 0 means only check for existence. */ - flags = 0; if (uap->flags) { + flags = 0; if (uap->flags & R_OK) flags |= VREAD; if (uap->flags & W_OK) flags |= VWRITE; if (uap->flags & X_OK) flags |= VEXEC; +#ifdef MAC + error = mac_check_vnode_access(cred, vp, flags); + if (error) + return (error); +#endif if ((flags & VWRITE) == 0 || (error = vn_writechk(vp)) == 0) error = VOP_ACCESS(vp, flags, cred, p); } -#ifdef MAC - /* - * Override DAC error value with MAC error value unless - * MAC returns OK and DAC returns error. - */ - { - int mac_error; - - mac_error = mac_check_vnode_access(cred, vp, flags); - if (mac_error) - error = mac_error; - } -#endif vput(vp); out1: cred->cr_uid = t_uid;