Deleted Added
full compact
mac_lomac.c (126097) mac_lomac.c (126121)
1/*-
2 * Copyright (c) 1999-2002 Robert N. M. Watson
3 * Copyright (c) 2001-2003 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 NAI Labs,

--- 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-2002 Robert N. M. Watson
3 * Copyright (c) 2001-2003 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 NAI Labs,

--- 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_lomac/mac_lomac.c 126097 2004-02-22 00:33:12Z rwatson $
34 * $FreeBSD: head/sys/security/mac_lomac/mac_lomac.c 126121 2004-02-22 12:31:44Z pjd $
35 */
36
37/*
38 * Developed by the TrustedBSD Project.
39 * Low-watermark floating label mandatory integrity policy.
40 */
41
42#include <sys/types.h>

--- 2015 unchanged lines hidden (view full) ---

2058
2059 if (!mac_lomac_high_single(obj))
2060 return (EACCES);
2061
2062 return (0);
2063}
2064
2065static int
35 */
36
37/*
38 * Developed by the TrustedBSD Project.
39 * Low-watermark floating label mandatory integrity policy.
40 */
41
42#include <sys/types.h>

--- 2015 unchanged lines hidden (view full) ---

2058
2059 if (!mac_lomac_high_single(obj))
2060 return (EACCES);
2061
2062 return (0);
2063}
2064
2065static int
2066mac_lomac_check_system_sysctl(struct ucred *cred, int *name, u_int namelen,
2067 void *old, size_t *oldlenp, int inkernel, void *new, size_t newlen)
2066mac_lomac_check_system_sysctl(struct ucred *cred, struct sysctl_oid *oidp,
2067 void *arg1, int arg2, struct sysctl_req *req)
2068{
2069 struct mac_lomac *subj;
2070
2071 if (!mac_lomac_enabled)
2072 return (0);
2073
2074 subj = SLOT(cred->cr_label);
2075
2076 /*
2068{
2069 struct mac_lomac *subj;
2070
2071 if (!mac_lomac_enabled)
2072 return (0);
2073
2074 subj = SLOT(cred->cr_label);
2075
2076 /*
2077 * In general, treat sysctl variables as lomac/high, but also
2078 * require privilege to change them, since they are a
2079 * communications channel between grades. Exempt MIB
2080 * queries from this due to undocmented sysctl magic.
2081 * XXXMAC: This probably requires some more review.
2077 * Treat sysctl variables without CTLFLAG_ANYBODY flag as
2078 * lomac/high, but also require privilege to change them.
2082 */
2079 */
2083 if (new != NULL) {
2084 if (namelen > 0 && name[0] == 0)
2085 return (0);
2086
2080 if (req->newptr != NULL && (oidp->oid_kind & CTLFLAG_ANYBODY) == 0) {
2087#ifdef notdef
2088 if (!mac_lomac_subject_dominate_high(subj))
2089 return (EACCES);
2090#endif
2091
2092 if (mac_lomac_subject_privileged(subj))
2093 return (EPERM);
2094 }

--- 664 unchanged lines hidden ---
2081#ifdef notdef
2082 if (!mac_lomac_subject_dominate_high(subj))
2083 return (EACCES);
2084#endif
2085
2086 if (mac_lomac_subject_privileged(subj))
2087 return (EPERM);
2088 }

--- 664 unchanged lines hidden ---