From 38810515e078821592de28c17a7b36539ae21fdb Mon Sep 17 00:00:00 2001 From: elad Date: Fri, 22 Sep 2006 15:37:57 +0000 Subject: [PATCH] Make code more readable by removing some more casts forgotten in previous commit. --- sys/secmodel/bsd44/secmodel_bsd44_securelevel.c | 8 +++++--- sys/secmodel/bsd44/secmodel_bsd44_suser.c | 10 ++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/sys/secmodel/bsd44/secmodel_bsd44_securelevel.c b/sys/secmodel/bsd44/secmodel_bsd44_securelevel.c index 29f7263b80e2..40789ecbfefe 100644 --- a/sys/secmodel/bsd44/secmodel_bsd44_securelevel.c +++ b/sys/secmodel/bsd44/secmodel_bsd44_securelevel.c @@ -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 * All rights reserved. @@ -38,7 +38,7 @@ */ #include -__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) diff --git a/sys/secmodel/bsd44/secmodel_bsd44_suser.c b/sys/secmodel/bsd44/secmodel_bsd44_suser.c index 6328b6ce2504..f2edc7fa2525 100644 --- a/sys/secmodel/bsd44/secmodel_bsd44_suser.c +++ b/sys/secmodel/bsd44/secmodel_bsd44_suser.c @@ -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 * All rights reserved. @@ -43,7 +43,7 @@ */ #include -__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 #include @@ -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;