From owner-p4-projects@FreeBSD.ORG Tue Mar 7 16:53:17 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 1641E16A423; Tue, 7 Mar 2006 16:53:17 +0000 (GMT) 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 E354816A420 for ; Tue, 7 Mar 2006 16:53:16 +0000 (GMT) (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 AE8CA43D49 for ; Tue, 7 Mar 2006 16:53:16 +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 k27GrG19014193 for ; Tue, 7 Mar 2006 16:53:16 GMT (envelope-from millert@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k27GrGnd014190 for perforce@freebsd.org; Tue, 7 Mar 2006 16:53:16 GMT (envelope-from millert@freebsd.org) Date: Tue, 7 Mar 2006 16:53:16 GMT Message-Id: <200603071653.k27GrGnd014190@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 92924 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: Tue, 07 Mar 2006 16:53:17 -0000 http://perforce.freebsd.org/chv.cgi?CH=92924 Change 92924 by millert@millert_ibook on 2006/03/07 16:53:08 In file_mask_to_av() return FILE__ACCESS for an empty mask. That way a call to access() with flags == F_OK (aka 0) will map to the "access" permission rather than a zero access_vector_t (which confuses the avc). We don't allow a file mode of 0 in sebsd_check_vnode_open() but it is legal for sebsd_check_vnode_access(). Affected files ... .. //depot/projects/trustedbsd/sedarwin7/src/sedarwin/sedarwin/sebsd.c#35 edit Differences ... ==== //depot/projects/trustedbsd/sedarwin7/src/sedarwin/sedarwin/sebsd.c#35 (text+ko) ==== @@ -306,6 +306,10 @@ { access_vector_t av = 0; + /* per access(2), mask == 0 means only check for existence */ + if (mask == 0) + return FILE__ACCESS; + if (vt != VDIR) { if (mask & VEXEC) av |= FILE__EXECUTE; @@ -1701,14 +1705,12 @@ static int sebsd_check_vnode_access(struct ucred *cred, struct vnode *vp, - struct label *label, int acc_mode) + struct label *filelabel, int acc_mode) { - if (!acc_mode) - return 0; - + /* NOTE: acc_mode == 0 is legal for access(2) */ return (vnode_has_perm(cred, vp, file_mask_to_av(vp->v_type, acc_mode), - NULL)); + NULL)); } static int