mac_test.c (180031) | mac_test.c (180059) |
---|---|
1/*- 2 * Copyright (c) 1999-2002, 2007 Robert N. M. Watson 3 * Copyright (c) 2001-2005 McAfee, Inc. 4 * Copyright (c) 2006 SPARTA, Inc. 5 * All rights reserved. 6 * 7 * This software was developed by Robert Watson for the TrustedBSD Project. 8 * --- 21 unchanged lines hidden (view full) --- 30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * | 1/*- 2 * Copyright (c) 1999-2002, 2007 Robert N. M. Watson 3 * Copyright (c) 2001-2005 McAfee, Inc. 4 * Copyright (c) 2006 SPARTA, Inc. 5 * All rights reserved. 6 * 7 * This software was developed by Robert Watson for the TrustedBSD Project. 8 * --- 21 unchanged lines hidden (view full) --- 30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * |
38 * $FreeBSD: head/sys/security/mac_test/mac_test.c 180031 2008-06-26 13:49:32Z jhb $ | 38 * $FreeBSD: head/sys/security/mac_test/mac_test.c 180059 2008-06-27 05:39:04Z jhb $ |
39 */ 40 41/* 42 * Developed by the TrustedBSD Project. 43 * 44 * MAC Test policy - tests MAC Framework labeling by assigning object class 45 * magic numbers to each label and validates that each time an object label 46 * is passed into the policy, it has a consistent object type, catching --- 960 unchanged lines hidden (view full) --- 1007 LABEL_CHECK(cred->cr_label, MAGIC_CRED); 1008 LABEL_CHECK(pplabel, MAGIC_PIPE); 1009 LABEL_CHECK(newlabel, MAGIC_PIPE); 1010 COUNTER_INC(pipe_relabel); 1011} 1012 1013COUNTER_DECL(posixsem_check_getvalue); 1014static int | 39 */ 40 41/* 42 * Developed by the TrustedBSD Project. 43 * 44 * MAC Test policy - tests MAC Framework labeling by assigning object class 45 * magic numbers to each label and validates that each time an object label 46 * is passed into the policy, it has a consistent object type, catching --- 960 unchanged lines hidden (view full) --- 1007 LABEL_CHECK(cred->cr_label, MAGIC_CRED); 1008 LABEL_CHECK(pplabel, MAGIC_PIPE); 1009 LABEL_CHECK(newlabel, MAGIC_PIPE); 1010 COUNTER_INC(pipe_relabel); 1011} 1012 1013COUNTER_DECL(posixsem_check_getvalue); 1014static int |
1015test_posixsem_check_getvalue(struct ucred *cred, struct ksem *ks, 1016 struct label *kslabel) | 1015test_posixsem_check_getvalue(struct ucred *active_cred, struct ucred *file_cred, 1016 struct ksem *ks, struct label *kslabel) |
1017{ 1018 | 1017{ 1018 |
1019 LABEL_CHECK(cred->cr_label, MAGIC_CRED); | 1019 LABEL_CHECK(active_cred->cr_label, MAGIC_CRED); 1020 LABEL_CHECK(file_cred->cr_label, MAGIC_CRED); |
1020 LABEL_CHECK(kslabel, MAGIC_POSIX_SEM); 1021 COUNTER_INC(posixsem_check_getvalue); 1022 1023 return (0); 1024} 1025 1026COUNTER_DECL(posixsem_check_open); 1027static int --- 5 unchanged lines hidden (view full) --- 1033 LABEL_CHECK(kslabel, MAGIC_POSIX_SEM); 1034 COUNTER_INC(posixsem_check_open); 1035 1036 return (0); 1037} 1038 1039COUNTER_DECL(posixsem_check_post); 1040static int | 1021 LABEL_CHECK(kslabel, MAGIC_POSIX_SEM); 1022 COUNTER_INC(posixsem_check_getvalue); 1023 1024 return (0); 1025} 1026 1027COUNTER_DECL(posixsem_check_open); 1028static int --- 5 unchanged lines hidden (view full) --- 1034 LABEL_CHECK(kslabel, MAGIC_POSIX_SEM); 1035 COUNTER_INC(posixsem_check_open); 1036 1037 return (0); 1038} 1039 1040COUNTER_DECL(posixsem_check_post); 1041static int |
1041test_posixsem_check_post(struct ucred *cred, struct ksem *ks, 1042 struct label *kslabel) | 1042test_posixsem_check_post(struct ucred *active_cred, struct ucred *file_cred, 1043 struct ksem *ks, struct label *kslabel) |
1043{ 1044 | 1044{ 1045 |
1045 LABEL_CHECK(cred->cr_label, MAGIC_CRED); | 1046 LABEL_CHECK(active_cred->cr_label, MAGIC_CRED); 1047 LABEL_CHECK(file_cred->cr_label, MAGIC_CRED); |
1046 LABEL_CHECK(kslabel, MAGIC_POSIX_SEM); 1047 COUNTER_INC(posixsem_check_post); 1048 1049 return (0); 1050} 1051 | 1048 LABEL_CHECK(kslabel, MAGIC_POSIX_SEM); 1049 COUNTER_INC(posixsem_check_post); 1050 1051 return (0); 1052} 1053 |
1054COUNTER_DECL(posixsem_check_stat); 1055static int 1056test_posixsem_check_stat(struct ucred *active_cred, 1057 struct ucred *file_cred, struct ksem *ks, struct label *kslabel) 1058{ 1059 1060 LABEL_CHECK(active_cred->cr_label, MAGIC_CRED); 1061 LABEL_CHECK(file_cred->cr_label, MAGIC_CRED); 1062 LABEL_CHECK(kslabel, MAGIC_POSIX_SEM); 1063 COUNTER_INC(posixsem_check_stat); 1064 return (0); 1065} 1066 |
|
1052COUNTER_DECL(posixsem_check_unlink); 1053static int 1054test_posixsem_check_unlink(struct ucred *cred, struct ksem *ks, 1055 struct label *kslabel) 1056{ 1057 1058 LABEL_CHECK(cred->cr_label, MAGIC_CRED); 1059 LABEL_CHECK(kslabel, MAGIC_POSIX_SEM); 1060 COUNTER_INC(posixsem_check_unlink); 1061 1062 return (0); 1063} 1064 1065COUNTER_DECL(posixsem_check_wait); 1066static int | 1067COUNTER_DECL(posixsem_check_unlink); 1068static int 1069test_posixsem_check_unlink(struct ucred *cred, struct ksem *ks, 1070 struct label *kslabel) 1071{ 1072 1073 LABEL_CHECK(cred->cr_label, MAGIC_CRED); 1074 LABEL_CHECK(kslabel, MAGIC_POSIX_SEM); 1075 COUNTER_INC(posixsem_check_unlink); 1076 1077 return (0); 1078} 1079 1080COUNTER_DECL(posixsem_check_wait); 1081static int |
1067test_posixsem_check_wait(struct ucred *cred, struct ksem *ks, 1068 struct label *kslabel) | 1082test_posixsem_check_wait(struct ucred *active_cred, struct ucred *file_cred, 1083 struct ksem *ks, struct label *kslabel) |
1069{ 1070 | 1084{ 1085 |
1071 LABEL_CHECK(cred->cr_label, MAGIC_CRED); | 1086 LABEL_CHECK(active_cred->cr_label, MAGIC_CRED); 1087 LABEL_CHECK(file_cred->cr_label, MAGIC_CRED); |
1072 LABEL_CHECK(kslabel, MAGIC_POSIX_SEM); 1073 COUNTER_INC(posixsem_check_wait); 1074 1075 return (0); 1076} 1077 1078COUNTER_DECL(posixsem_create); 1079static void --- 1796 unchanged lines hidden (view full) --- 2876 .mpo_pipe_externalize_label = test_pipe_externalize_label, 2877 .mpo_pipe_init_label = test_pipe_init_label, 2878 .mpo_pipe_internalize_label = test_pipe_internalize_label, 2879 .mpo_pipe_relabel = test_pipe_relabel, 2880 2881 .mpo_posixsem_check_getvalue = test_posixsem_check_getvalue, 2882 .mpo_posixsem_check_open = test_posixsem_check_open, 2883 .mpo_posixsem_check_post = test_posixsem_check_post, | 1088 LABEL_CHECK(kslabel, MAGIC_POSIX_SEM); 1089 COUNTER_INC(posixsem_check_wait); 1090 1091 return (0); 1092} 1093 1094COUNTER_DECL(posixsem_create); 1095static void --- 1796 unchanged lines hidden (view full) --- 2892 .mpo_pipe_externalize_label = test_pipe_externalize_label, 2893 .mpo_pipe_init_label = test_pipe_init_label, 2894 .mpo_pipe_internalize_label = test_pipe_internalize_label, 2895 .mpo_pipe_relabel = test_pipe_relabel, 2896 2897 .mpo_posixsem_check_getvalue = test_posixsem_check_getvalue, 2898 .mpo_posixsem_check_open = test_posixsem_check_open, 2899 .mpo_posixsem_check_post = test_posixsem_check_post, |
2900 .mpo_posixsem_check_stat = test_posixsem_check_stat, |
|
2884 .mpo_posixsem_check_unlink = test_posixsem_check_unlink, 2885 .mpo_posixsem_check_wait = test_posixsem_check_wait, 2886 .mpo_posixsem_create = test_posixsem_create, 2887 .mpo_posixsem_destroy_label = test_posixsem_destroy_label, 2888 .mpo_posixsem_init_label = test_posixsem_init_label, 2889 2890 .mpo_posixshm_check_mmap = test_posixshm_check_mmap, 2891 .mpo_posixshm_check_open = test_posixshm_check_open, --- 142 unchanged lines hidden --- | 2901 .mpo_posixsem_check_unlink = test_posixsem_check_unlink, 2902 .mpo_posixsem_check_wait = test_posixsem_check_wait, 2903 .mpo_posixsem_create = test_posixsem_create, 2904 .mpo_posixsem_destroy_label = test_posixsem_destroy_label, 2905 .mpo_posixsem_init_label = test_posixsem_init_label, 2906 2907 .mpo_posixshm_check_mmap = test_posixshm_check_mmap, 2908 .mpo_posixshm_check_open = test_posixshm_check_open, --- 142 unchanged lines hidden --- |