Make code more readable by removing some more casts forgotten in

previous commit.
This commit is contained in:
elad 2006-09-22 15:37:57 +00:00
parent e18c6496f6
commit 38810515e0
2 changed files with 11 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: secmodel_bsd44_securelevel.c,v 1.5 2006/09/19 21:42:30 elad Exp $ */
/* $NetBSD: secmodel_bsd44_securelevel.c,v 1.6 2006/09/22 15:37:57 elad Exp $ */
/*-
* Copyright (c) 2006 Elad Efrat <elad@NetBSD.org>
* All rights reserved.
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: secmodel_bsd44_securelevel.c,v 1.5 2006/09/19 21:42:30 elad Exp $");
__KERNEL_RCSID(0, "$NetBSD: secmodel_bsd44_securelevel.c,v 1.6 2006/09/22 15:37:57 elad Exp $");
#ifdef _KERNEL_OPT
#include "opt_insecure.h"
@ -399,12 +399,14 @@ secmodel_bsd44_securelevel_machdep_cb(kauth_cred_t cred, kauth_action_t action,
void *cookie, void *arg0, void *arg1, void *arg2, void *arg3)
{
int result;
enum kauth_machdep_req req;
result = KAUTH_RESULT_DENY;
req = (enum kauth_machdep_req)arg0;
switch (action) {
case KAUTH_MACHDEP_X86:
switch ((u_long)arg0) {
switch (req) {
case KAUTH_REQ_MACHDEP_X86_IOPL:
case KAUTH_REQ_MACHDEP_X86_IOPERM:
if (securelevel < 2)

View File

@ -1,4 +1,4 @@
/* $NetBSD: secmodel_bsd44_suser.c,v 1.3 2006/09/19 21:42:30 elad Exp $ */
/* $NetBSD: secmodel_bsd44_suser.c,v 1.4 2006/09/22 15:37:57 elad Exp $ */
/*-
* Copyright (c) 2006 Elad Efrat <elad@NetBSD.org>
* All rights reserved.
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: secmodel_bsd44_suser.c,v 1.3 2006/09/19 21:42:30 elad Exp $");
__KERNEL_RCSID(0, "$NetBSD: secmodel_bsd44_suser.c,v 1.4 2006/09/22 15:37:57 elad Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -360,13 +360,15 @@ secmodel_bsd44_suser_machdep_cb(kauth_cred_t cred, kauth_action_t action,
{
boolean_t isroot;
int result;
enum kauth_machdep_req req;
isroot = (kauth_cred_geteuid(cred) == 0);
result = KAUTH_RESULT_DENY;
req = (enum kauth_machdep_req)arg0;
switch (action) {
case KAUTH_MACHDEP_X86:
switch ((u_long)arg0) {
switch (req) {
case KAUTH_REQ_MACHDEP_X86_IOPL:
case KAUTH_REQ_MACHDEP_X86_IOPERM:
case KAUTH_REQ_MACHDEP_X86_MTRR_SET:
@ -381,7 +383,7 @@ secmodel_bsd44_suser_machdep_cb(kauth_cred_t cred, kauth_action_t action,
break;
case KAUTH_MACHDEP_X86_64:
switch ((u_long)arg0) {
switch (req) {
case KAUTH_REQ_MACHDEP_X86_64_MTRR_GET:
if (isroot)
result = KAUTH_RESULT_ALLOW;