mac_partition.c (122524) | mac_partition.c (123173) |
---|---|
1/*- 2 * Copyright (c) 1999, 2000, 2001, 2002 Robert N. M. Watson 3 * Copyright (c) 2001, 2002 Networks Associates Technology, Inc. 4 * All rights reserved. 5 * 6 * This software was developed by Robert Watson for the TrustedBSD Project. 7 * 8 * This software was developed for the FreeBSD Project in part by Network --- 17 unchanged lines hidden (view full) --- 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * | 1/*- 2 * Copyright (c) 1999, 2000, 2001, 2002 Robert N. M. Watson 3 * Copyright (c) 2001, 2002 Networks Associates Technology, Inc. 4 * All rights reserved. 5 * 6 * This software was developed by Robert Watson for the TrustedBSD Project. 7 * 8 * This software was developed for the FreeBSD Project in part by Network --- 17 unchanged lines hidden (view full) --- 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * |
34 * $FreeBSD: head/sys/security/mac_partition/mac_partition.c 122524 2003-11-12 03:14:31Z rwatson $ | 34 * $FreeBSD: head/sys/security/mac_partition/mac_partition.c 123173 2003-12-06 21:48:03Z rwatson $ |
35 */ 36 37/* 38 * Developed by the TrustedBSD Project. 39 * Experiment with a partition-like model. 40 */ 41 42#include <sys/types.h> --- 53 unchanged lines hidden (view full) --- 96 97static void 98mac_partition_destroy_label(struct label *label) 99{ 100 101 SLOT(label) = 0; 102} 103 | 35 */ 36 37/* 38 * Developed by the TrustedBSD Project. 39 * Experiment with a partition-like model. 40 */ 41 42#include <sys/types.h> --- 53 unchanged lines hidden (view full) --- 96 97static void 98mac_partition_destroy_label(struct label *label) 99{ 100 101 SLOT(label) = 0; 102} 103 |
104static void 105mac_partition_copy_label(struct label *src, struct label *dest) 106{ 107 108 SLOT(dest) = SLOT(src); 109} 110 |
|
104static int 105mac_partition_externalize_label(struct label *label, char *element_name, 106 struct sbuf *sb, int *claimed) 107{ 108 109 if (strcmp(MAC_PARTITION_LABEL_NAME, element_name) != 0) 110 return (0); 111 --- 14 unchanged lines hidden (view full) --- 126 return (0); 127 128 (*claimed)++; 129 SLOT(label) = strtol(element_data, NULL, 10); 130 return (0); 131} 132 133static void | 111static int 112mac_partition_externalize_label(struct label *label, char *element_name, 113 struct sbuf *sb, int *claimed) 114{ 115 116 if (strcmp(MAC_PARTITION_LABEL_NAME, element_name) != 0) 117 return (0); 118 --- 14 unchanged lines hidden (view full) --- 133 return (0); 134 135 (*claimed)++; 136 SLOT(label) = strtol(element_data, NULL, 10); 137 return (0); 138} 139 140static void |
134mac_partition_create_cred(struct ucred *cred_parent, struct ucred *cred_child) 135{ 136 137 SLOT(cred_child->cr_label) = SLOT(cred_parent->cr_label); 138} 139 140static void | |
141mac_partition_create_proc0(struct ucred *cred) 142{ 143 144 SLOT(cred->cr_label) = 0; 145} 146 147static void 148mac_partition_create_proc1(struct ucred *cred) --- 117 unchanged lines hidden (view full) --- 266 return (0); 267} 268 269static struct mac_policy_ops mac_partition_ops = 270{ 271 .mpo_init = mac_partition_init, 272 .mpo_init_cred_label = mac_partition_init_label, 273 .mpo_destroy_cred_label = mac_partition_destroy_label, | 141mac_partition_create_proc0(struct ucred *cred) 142{ 143 144 SLOT(cred->cr_label) = 0; 145} 146 147static void 148mac_partition_create_proc1(struct ucred *cred) --- 117 unchanged lines hidden (view full) --- 266 return (0); 267} 268 269static struct mac_policy_ops mac_partition_ops = 270{ 271 .mpo_init = mac_partition_init, 272 .mpo_init_cred_label = mac_partition_init_label, 273 .mpo_destroy_cred_label = mac_partition_destroy_label, |
274 .mpo_copy_cred_label = mac_partition_copy_label, |
|
274 .mpo_externalize_cred_label = mac_partition_externalize_label, 275 .mpo_internalize_cred_label = mac_partition_internalize_label, | 275 .mpo_externalize_cred_label = mac_partition_externalize_label, 276 .mpo_internalize_cred_label = mac_partition_internalize_label, |
276 .mpo_create_cred = mac_partition_create_cred, | |
277 .mpo_create_proc0 = mac_partition_create_proc0, 278 .mpo_create_proc1 = mac_partition_create_proc1, 279 .mpo_relabel_cred = mac_partition_relabel_cred, 280 .mpo_check_cred_relabel = mac_partition_check_cred_relabel, 281 .mpo_check_cred_visible = mac_partition_check_cred_visible, 282 .mpo_check_proc_debug = mac_partition_check_proc_debug, 283 .mpo_check_proc_sched = mac_partition_check_proc_sched, 284 .mpo_check_proc_signal = mac_partition_check_proc_signal, 285 .mpo_check_socket_visible = mac_partition_check_socket_visible, 286 .mpo_check_vnode_exec = mac_partition_check_vnode_exec, 287}; 288 289MAC_POLICY_SET(&mac_partition_ops, mac_partition, "TrustedBSD MAC/Partition", 290 MPC_LOADTIME_FLAG_UNLOADOK, &partition_slot); | 277 .mpo_create_proc0 = mac_partition_create_proc0, 278 .mpo_create_proc1 = mac_partition_create_proc1, 279 .mpo_relabel_cred = mac_partition_relabel_cred, 280 .mpo_check_cred_relabel = mac_partition_check_cred_relabel, 281 .mpo_check_cred_visible = mac_partition_check_cred_visible, 282 .mpo_check_proc_debug = mac_partition_check_proc_debug, 283 .mpo_check_proc_sched = mac_partition_check_proc_sched, 284 .mpo_check_proc_signal = mac_partition_check_proc_signal, 285 .mpo_check_socket_visible = mac_partition_check_socket_visible, 286 .mpo_check_vnode_exec = mac_partition_check_vnode_exec, 287}; 288 289MAC_POLICY_SET(&mac_partition_ops, mac_partition, "TrustedBSD MAC/Partition", 290 MPC_LOADTIME_FLAG_UNLOADOK, &partition_slot); |