PERFORCE change 14753 for review
Robert Watson
rwatson at freebsd.org
Tue Jul 23 01:51:14 GMT 2002
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=14753
Change 14753 by rwatson at 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 at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message
More information about the trustedbsd-cvs
mailing list