mac_seeotheruids.c (172955) | mac_seeotheruids.c (173138) |
---|---|
1/*- 2 * Copyright (c) 1999-2002, 2007 Robert N. M. Watson 3 * Copyright (c) 2001-2002 Networks Associates Technology, 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-2002 Networks Associates Technology, 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_seeotheruids/mac_seeotheruids.c 172955 2007-10-25 11:31:11Z rwatson $ | 38 * $FreeBSD: head/sys/security/mac_seeotheruids/mac_seeotheruids.c 173138 2007-10-29 13:33:06Z rwatson $ |
39 */ 40 41/* 42 * Developed by the TrustedBSD Project. 43 * 44 * Prevent processes owned by a particular uid from seeing various transient 45 * kernel objects associated with other uids. 46 */ --- 74 unchanged lines hidden (view full) --- 121 if (priv_check_cred(cr1, PRIV_SEEOTHERUIDS, 0) == 0) 122 return (0); 123 } 124 125 return (ESRCH); 126} 127 128static int | 39 */ 40 41/* 42 * Developed by the TrustedBSD Project. 43 * 44 * Prevent processes owned by a particular uid from seeing various transient 45 * kernel objects associated with other uids. 46 */ --- 74 unchanged lines hidden (view full) --- 121 if (priv_check_cred(cr1, PRIV_SEEOTHERUIDS, 0) == 0) 122 return (0); 123 } 124 125 return (ESRCH); 126} 127 128static int |
129seeotheruids_cred_check_visible(struct ucred *cr1, struct ucred *cr2) | 129seeotheruids_proc_check_debug(struct ucred *cred, struct proc *p) |
130{ 131 | 130{ 131 |
132 return (seeotheruids_check(cr1, cr2)); | 132 return (seeotheruids_check(cred, p->p_ucred)); |
133} 134 135static int | 133} 134 135static int |
136seeotheruids_proc_check_signal(struct ucred *cred, struct proc *p, 137 int signum) | 136seeotheruids_proc_check_sched(struct ucred *cred, struct proc *p) |
138{ 139 140 return (seeotheruids_check(cred, p->p_ucred)); 141} 142 143static int | 137{ 138 139 return (seeotheruids_check(cred, p->p_ucred)); 140} 141 142static int |
144seeotheruids_proc_check_sched(struct ucred *cred, struct proc *p) | 143seeotheruids_proc_check_signal(struct ucred *cred, struct proc *p, 144 int signum) |
145{ 146 147 return (seeotheruids_check(cred, p->p_ucred)); 148} 149 150static int | 145{ 146 147 return (seeotheruids_check(cred, p->p_ucred)); 148} 149 150static int |
151seeotheruids_proc_check_debug(struct ucred *cred, struct proc *p) | 151seeotheruids_cred_check_visible(struct ucred *cr1, struct ucred *cr2) |
152{ 153 | 152{ 153 |
154 return (seeotheruids_check(cred, p->p_ucred)); | 154 return (seeotheruids_check(cr1, cr2)); |
155} 156 157static int 158seeotheruids_socket_check_visible(struct ucred *cred, struct socket *so, 159 struct label *solabel) 160{ 161 162 return (seeotheruids_check(cred, so->so_cred)); 163} 164 165static struct mac_policy_ops seeotheruids_ops = 166{ | 155} 156 157static int 158seeotheruids_socket_check_visible(struct ucred *cred, struct socket *so, 159 struct label *solabel) 160{ 161 162 return (seeotheruids_check(cred, so->so_cred)); 163} 164 165static struct mac_policy_ops seeotheruids_ops = 166{ |
167 .mpo_cred_check_visible = seeotheruids_cred_check_visible, | |
168 .mpo_proc_check_debug = seeotheruids_proc_check_debug, 169 .mpo_proc_check_sched = seeotheruids_proc_check_sched, 170 .mpo_proc_check_signal = seeotheruids_proc_check_signal, | 167 .mpo_proc_check_debug = seeotheruids_proc_check_debug, 168 .mpo_proc_check_sched = seeotheruids_proc_check_sched, 169 .mpo_proc_check_signal = seeotheruids_proc_check_signal, |
170 .mpo_cred_check_visible = seeotheruids_cred_check_visible, |
|
171 .mpo_socket_check_visible = seeotheruids_socket_check_visible, 172}; 173 174MAC_POLICY_SET(&seeotheruids_ops, mac_seeotheruids, 175 "TrustedBSD MAC/seeotheruids", MPC_LOADTIME_FLAG_UNLOADOK, NULL); | 171 .mpo_socket_check_visible = seeotheruids_socket_check_visible, 172}; 173 174MAC_POLICY_SET(&seeotheruids_ops, mac_seeotheruids, 175 "TrustedBSD MAC/seeotheruids", MPC_LOADTIME_FLAG_UNLOADOK, NULL); |