From owner-p4-projects@FreeBSD.ORG Wed Aug 16 18:42:15 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 905B416A4E0; Wed, 16 Aug 2006 18:42:15 +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 6AA0816A4DA for ; Wed, 16 Aug 2006 18:42:15 +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 597EF43D77 for ; Wed, 16 Aug 2006 18:42:12 +0000 (GMT) (envelope-from millert@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k7GIgCud009217 for ; Wed, 16 Aug 2006 18:42:12 GMT (envelope-from millert@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k7GIgCsi009214 for perforce@freebsd.org; Wed, 16 Aug 2006 18:42:12 GMT (envelope-from millert@freebsd.org) Date: Wed, 16 Aug 2006 18:42:12 GMT Message-Id: <200608161842.k7GIgCsi009214@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 104271 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, 16 Aug 2006 18:42:15 -0000 http://perforce.freebsd.org/chv.cgi?CH=104271 Change 104271 by millert@millert_macbook on 2006/08/16 18:41:28 Just treat the return value of mac_check_service_access() as 0 or non-zero instead of trying to interpret BSD errno values (which are not visible here). Affected files ... .. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/kern/security.c#2 edit Differences ... ==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/kern/security.c#2 (text+ko) ==== @@ -124,15 +124,7 @@ mac_destroy_task_label(&subjl); mac_destroy_task_label(&objl); - switch (rc) { - case 0: - return KERN_SUCCESS; - case 22: - /* EINVAL */ - return KERN_INVALID_ARGUMENT; - default: - return KERN_NO_ACCESS; - } + return rc ? KERN_NO_ACCESS : KERN_SUCCESS; } kern_return_t @@ -191,15 +183,7 @@ io_unlock (objp); mac_destroy_task_label(&subjl); - switch (rc) { - case 0: - return KERN_SUCCESS; - case 22: - /* EINVAL */ - return KERN_INVALID_ARGUMENT; - default: - return KERN_NO_ACCESS; - } + return rc ? KERN_NO_ACCESS : KERN_SUCCESS; } kern_return_t @@ -248,15 +232,7 @@ io_unlock(objp); ipc_port_multiple_unlock(); - switch (rc) { - case 0: - return KERN_SUCCESS; - case 22: - /* EINVAL */ - return KERN_INVALID_ARGUMENT; - default: - return KERN_NO_ACCESS; - } + return rc ? KERN_NO_ACCESS : KERN_SUCCESS; errout: io_unlocklabel(subp); @@ -314,19 +290,7 @@ io_unlock(objp); ipc_port_multiple_unlock(); - switch (rc) { - case 0: - kr = labelh_new_user(space, &outl, outlabel); - break; - case 22: - /* EINVAL */ - kr = KERN_INVALID_ARGUMENT; - break; - default: - kr = KERN_NO_ACCESS; - break; - } - + kr = rc ? KERN_NO_ACCESS : KERN_SUCCESS; if (kr != KERN_SUCCESS) mac_destroy_port_label(&outl);