From owner-p4-projects@FreeBSD.ORG Tue Mar 7 16:52:16 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 7626316A424; Tue, 7 Mar 2006 16:52:15 +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 4A1E516A420 for ; Tue, 7 Mar 2006 16:52:15 +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 017A443D53 for ; Tue, 7 Mar 2006 16:52:15 +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 k27GqEsL014168 for ; Tue, 7 Mar 2006 16:52:14 GMT (envelope-from millert@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k27GqE2c014165 for perforce@freebsd.org; Tue, 7 Mar 2006 16:52:14 GMT (envelope-from millert@freebsd.org) Date: Tue, 7 Mar 2006 16:52:14 GMT Message-Id: <200603071652.k27GqE2c014165@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 92923 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:52:16 -0000 http://perforce.freebsd.org/chv.cgi?CH=92923 Change 92923 by millert@millert_ibook on 2006/03/07 16:51:39 In access(), do not pass uninitialized flags variable to mac_check_vnode_access(). Don't clobber non-zero error value from DAC check with a zero error value from the MAC check. Affected files ... .. //depot/projects/trustedbsd/sedarwin7/src/darwin/xnu/bsd/vfs/vfs_syscalls.c#3 edit Differences ... ==== //depot/projects/trustedbsd/sedarwin7/src/darwin/xnu/bsd/vfs/vfs_syscalls.c#3 (text+ko) ==== @@ -1792,8 +1792,8 @@ 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) @@ -1804,7 +1804,17 @@ error = VOP_ACCESS(vp, flags, cred, p); } #ifdef MAC - error = mac_check_vnode_access(cred, vp, flags); + /* + * 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: