Deleted Added
full compact
mac_biba.c (126097) mac_biba.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 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-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 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_biba/mac_biba.c 126097 2004-02-22 00:33:12Z rwatson $
34 * $FreeBSD: head/sys/security/mac_biba/mac_biba.c 126121 2004-02-22 12:31:44Z pjd $
35 */
36
37/*
38 * Developed by the TrustedBSD Project.
39 * Biba fixed label mandatory integrity policy.
40 */
41
42#include <sys/types.h>

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

1968 error = mac_biba_subject_privileged(subj);
1969 if (error)
1970 return (error);
1971
1972 return (0);
1973}
1974
1975static int
35 */
36
37/*
38 * Developed by the TrustedBSD Project.
39 * Biba fixed label mandatory integrity policy.
40 */
41
42#include <sys/types.h>

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

1968 error = mac_biba_subject_privileged(subj);
1969 if (error)
1970 return (error);
1971
1972 return (0);
1973}
1974
1975static int
1976mac_biba_check_system_sysctl(struct ucred *cred, int *name, u_int namelen,
1977 void *old, size_t *oldlenp, int inkernel, void *new, size_t newlen)
1976mac_biba_check_system_sysctl(struct ucred *cred, struct sysctl_oid *oidp,
1977 void *arg1, int arg2, struct sysctl_req *req)
1978{
1979 struct mac_biba *subj;
1980 int error;
1981
1982 if (!mac_biba_enabled)
1983 return (0);
1984
1985 subj = SLOT(cred->cr_label);
1986
1987 /*
1978{
1979 struct mac_biba *subj;
1980 int error;
1981
1982 if (!mac_biba_enabled)
1983 return (0);
1984
1985 subj = SLOT(cred->cr_label);
1986
1987 /*
1988 * In general, treat sysctl variables as biba/high, but also
1989 * require privilege to change them, since they are a
1990 * communications channel between grades. Exempt MIB
1991 * queries from this due to undocmented sysctl magic.
1992 * XXXMAC: This probably requires some more review.
1988 * Treat sysctl variables without CTLFLAG_ANYBODY flag as
1989 * biba/high, but also require privilege to change them.
1993 */
1990 */
1994 if (new != NULL) {
1995 if (namelen > 0 && name[0] == 0)
1996 return (0);
1997
1991 if (req->newptr != NULL && (oidp->oid_kind & CTLFLAG_ANYBODY) == 0) {
1998 if (!mac_biba_subject_dominate_high(subj))
1999 return (EACCES);
2000
2001 error = mac_biba_subject_privileged(subj);
2002 if (error)
2003 return (error);
2004 }
2005

--- 784 unchanged lines hidden ---
1992 if (!mac_biba_subject_dominate_high(subj))
1993 return (EACCES);
1994
1995 error = mac_biba_subject_privileged(subj);
1996 if (error)
1997 return (error);
1998 }
1999

--- 784 unchanged lines hidden ---