From owner-p4-projects Mon Jul 22 18:51:25 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 92A0F37B401; Mon, 22 Jul 2002 18:51:15 -0700 (PDT) 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 20D2437B400 for ; Mon, 22 Jul 2002 18:51:15 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id C86E443E65 for ; Mon, 22 Jul 2002 18:51:14 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from freefall.freebsd.org (perforce@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g6N1pEJU039544 for ; Mon, 22 Jul 2002 18:51:14 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g6N1pE7l039541 for perforce@freebsd.org; Mon, 22 Jul 2002 18:51:14 -0700 (PDT) Date: Mon, 22 Jul 2002 18:51:14 -0700 (PDT) Message-Id: <200207230151.g6N1pE7l039541@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson Subject: PERFORCE change 14753 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://people.freebsd.org/~peter/p4db/chv.cgi?CH=14753 Change 14753 by rwatson@rwatson_tislabs on 2002/07/22 18:50:36 Use a SLOT() macro as with other policies. Affected files ... .. //depot/projects/trustedbsd/mac/sys/security/mac_partition/mac_partition.c#2 edit Differences ... ==== //depot/projects/trustedbsd/mac/sys/security/mac_partition/mac_partition.c#2 (text+ko) ==== @@ -76,6 +76,7 @@ &mac_partition_enabled, 0, "Enforce partition policy"); static int partition_slot; +#define SLOT(l) (SLOT((l))) static void mac_partition_init(struct mac_policy_conf *conf) @@ -87,35 +88,35 @@ mac_partition_init_subject(struct ucred *ucred, struct label *label) { - LABEL_TO_SLOT(label, partition_slot).l_long = 0; + SLOT(label) = 0; } static void mac_partition_init_temp(struct label *label) { - LABEL_TO_SLOT(label, partition_slot).l_long = 0; + SLOT(label) = 0; } static void mac_partition_destroy_subject(struct ucred *ucred, struct label *label) { - LABEL_TO_SLOT(label, partition_slot).l_long = 0; + SLOT(label) = 0; } static void mac_partition_destroy_temp(struct label *label) { - LABEL_TO_SLOT(label, partition_slot).l_long = 0; + SLOT(label) = 0; } static int mac_partition_externalize(struct label *label, struct mac *extmac) { - extmac->m_sebsd.ms_psid = LABEL_TO_SLOT(label, partition_slot).l_long; + extmac->m_sebsd.ms_psid = SLOT(label); return (0); } @@ -124,7 +125,7 @@ mac_partition_internalize(struct label *label, struct mac *extmac) { - LABEL_TO_SLOT(label, partition_slot).l_long = extmac->m_sebsd.ms_psid; + SLOT(label) = extmac->m_sebsd.ms_psid; return (0); } @@ -134,31 +135,29 @@ struct ucred *cred_child) { - LABEL_TO_SLOT(&cred_child->cr_label, partition_slot).l_long = - LABEL_TO_SLOT(&cred_parent->cr_label, partition_slot).l_long; + SLOT(&cred_child->cr_label) = SLOT(&cred_parent->cr_label); } static void mac_partition_create_proc0(struct ucred *cred) { - LABEL_TO_SLOT(&cred->cr_label, partition_slot).l_long = 0; + SLOT(&cred->cr_label) = 0; } static void mac_partition_create_proc1(struct ucred *cred) { - LABEL_TO_SLOT(&cred->cr_label, partition_slot).l_long = 0; + SLOT(&cred->cr_label) = 0; } static void mac_partition_relabel_subject(struct ucred *cred, struct label *newlabel) { - if (LABEL_TO_SLOT(newlabel, partition_slot).l_long != 0) - LABEL_TO_SLOT(&cred->cr_label, partition_slot).l_long = - LABEL_TO_SLOT(newlabel, partition_slot).l_long; + if (SLOT(newlabel) != 0) + SLOT(&cred->cr_label) = SLOT(newlabel); } static int @@ -168,11 +167,10 @@ if (mac_partition_enabled == 0) return (0); - if (LABEL_TO_SLOT(subject, partition_slot).l_long == 0) + if (SLOT(subject) == 0) return (0); - if (LABEL_TO_SLOT(subject, partition_slot).l_long == - LABEL_TO_SLOT(object, partition_slot).l_long) + if (SLOT(subject) == SLOT(object)) return (0); return (EPERM); @@ -205,7 +203,7 @@ { /* If in a partition, can't re-partition. */ - if (LABEL_TO_SLOT(&cred->cr_label, partition_slot).l_long != 0) + if (SLOT(&cred->cr_label) != 0) return (EPERM); /* If not in a partition, must have privilege */ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message