From owner-p4-projects@FreeBSD.ORG Thu Feb 9 20:03:32 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 01A2016A423; Thu, 9 Feb 2006 20:03:31 +0000 (GMT) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8DD4616A420 for ; Thu, 9 Feb 2006 20:03:31 +0000 (GMT) (envelope-from deker@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 522D243D46 for ; Thu, 9 Feb 2006 20:03:31 +0000 (GMT) (envelope-from deker@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k19K3VdG030430 for ; Thu, 9 Feb 2006 20:03:31 GMT (envelope-from deker@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k19K3Umm030427 for perforce@freebsd.org; Thu, 9 Feb 2006 20:03:30 GMT (envelope-from deker@FreeBSD.org) Date: Thu, 9 Feb 2006 20:03:30 GMT Message-Id: <200602092003.k19K3Umm030427@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to deker@FreeBSD.org using -f From: Rob Deker To: Perforce Change Reviews Cc: Subject: PERFORCE change 91456 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Feb 2006 20:03:33 -0000 http://perforce.freebsd.org/chv.cgi?CH=91456 Change 91456 by deker@deker_build1.columbia.sparta.com on 2006/02/09 20:02:57 per millert: "Document the -m flag. Remove some lint." Submitted by: millert Affected files ... .. //depot/projects/trustedbsd/sedarwin7/src/sedarwin/programs/loadpolicy/Makefile#4 edit .. //depot/projects/trustedbsd/sedarwin7/src/sedarwin/programs/loadpolicy/sebsd_loadpolicy.8#3 edit .. //depot/projects/trustedbsd/sedarwin7/src/sedarwin/programs/loadpolicy/sebsd_loadpolicy.c#3 edit Differences ... ==== //depot/projects/trustedbsd/sedarwin7/src/sedarwin/programs/loadpolicy/Makefile#4 (text+ko) ==== @@ -6,7 +6,7 @@ OBJS= sebsd_loadpolicy.o -CFLAGS+= -I$(SOURCE_ROOT)/sedarwin +CFLAGS+= -Wall -I$(SOURCE_ROOT)/sedarwin LDADD+= -L$(SOURCE_ROOT)/sedarwin/libselinux/src LDADD+= -lselinux $(LIBMAC) ==== //depot/projects/trustedbsd/sedarwin7/src/sedarwin/programs/loadpolicy/sebsd_loadpolicy.8#3 (text+ko) ==== @@ -1,3 +1,4 @@ +.\" Copyright (c) 2005 SPARTA, Inc. .\" Copyright (c) 2002 Networks Associates Technology, Inc. .\" All rights reserved. .\" @@ -29,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD: $ -.Dd August 27, 2003 +.Dd December 28, 2005 .Dt SEBSD_LOADPOLICY 8 .Os .Sh NAME @@ -37,10 +38,23 @@ .Nd Re-load the sebsd policy .Sh SYNOPSIS .Nm sebsd_loadpolicy -.Ar policyfile +.Op Fl m Ar migscsfile +.Ar policy_file .Sh DESCRIPTION The .Nm sebsd_loadpolicy -utility loads a new security policy for the SEBSD module. The new policy file is specified in -.Ar policyfile . - +utility loads a new security policy for the SEBSD module. +The new policy file is specified in +.Ar policy_file . +.Pp +The options are as follows: +.Bl -tag -width Ds +.It Fl m Ar migscsfile +Load +.Ar migscsfile , +a mapping of security classes to MiG subsystem IDs, +in addition to +.Ar policy_file . +.Sh SEE ALSO +.Xr mac 4 , +.Xr selinux 8 ==== //depot/projects/trustedbsd/sedarwin7/src/sedarwin/programs/loadpolicy/sebsd_loadpolicy.c#3 (text+ko) ==== @@ -1,12 +1,7 @@ /*- - * Copyright (c) 2003 Networks Associates Technology, Inc. + * Copyright (c) 2005 SPARTA, Inc. * All rights reserved. * - * This software was developed for the FreeBSD Project by and Network - * Associates Laboratories, the Security Research Division of Network - * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), - * as part of the DARPA CHATS research program. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -27,31 +22,57 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ -#include +#include +#include #include #include +#include + +#include /* XXX - not used */ -int main(int argc, char **argv) +void usage(void); + +int +main(int argc, char **argv) { - int ret_val; + int ch, error; + char *migscs = NULL; - if (argc != 2) { - printf("usage: %s path\n", argv[0]); - exit(1); + while ((ch = getopt(argc, argv, "m:")) != -1) { + switch (ch) { + case 'm': + migscs = optarg; + break; + default: + usage(); + break; + } } + argc -= optind; + argv += optind; - ret_val = sebsd_load_policy(argv[1]); + if (argc != 1) + usage(); - if (ret_val) { - perror("security_load_policy"); - exit(2); + if (migscs != NULL) { + error = sebsd_load_migscs(migscs); + if (error) + err(1, "%s", migscs); } + error = sebsd_load_policy(argv[0]); + if (error) + err(1, "%s", argv[0]); - printf("\nSuccess\n"); + exit(0); +} + +void +usage(void) +{ + extern char *__progname; - exit(0); + fprintf(stderr, "usage: %s [-m migscs_file] policy_file\n", __progname); + exit(1); }