ugidfw.c (157986) | ugidfw.c (186480) |
---|---|
1/*- 2 * Copyright (c) 2002, 2004 Networks Associates Technology, Inc. 3 * All rights reserved. 4 * 5 * This software was developed for the FreeBSD Project by NAI Labs, the 6 * Security Research Division of Network Associates, Inc. under 7 * DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA 8 * CHATS research program. --- 16 unchanged lines hidden (view full) --- 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 */ 31 32#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2002, 2004 Networks Associates Technology, Inc. 3 * All rights reserved. 4 * 5 * This software was developed for the FreeBSD Project by NAI Labs, the 6 * Security Research Division of Network Associates, Inc. under 7 * DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA 8 * CHATS research program. --- 16 unchanged lines hidden (view full) --- 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/usr.sbin/ugidfw/ugidfw.c 157986 2006-04-23 17:06:18Z dwmalone $"); | 33__FBSDID("$FreeBSD: head/usr.sbin/ugidfw/ugidfw.c 186480 2008-12-24 22:40:13Z rwatson $"); |
34 35#include <sys/param.h> 36#include <sys/errno.h> 37#include <sys/mount.h> 38#include <sys/time.h> 39#include <sys/sysctl.h> 40 41#include <security/mac_bsdextended/mac_bsdextended.h> --- 24 unchanged lines hidden (view full) --- 66 fprintf(stderr, " ugidfw remove rulenum\n"); 67 68 exit(1); 69} 70 71void 72add_rule(int argc, char *argv[]) 73{ | 34 35#include <sys/param.h> 36#include <sys/errno.h> 37#include <sys/mount.h> 38#include <sys/time.h> 39#include <sys/sysctl.h> 40 41#include <security/mac_bsdextended/mac_bsdextended.h> --- 24 unchanged lines hidden (view full) --- 66 fprintf(stderr, " ugidfw remove rulenum\n"); 67 68 exit(1); 69} 70 71void 72add_rule(int argc, char *argv[]) 73{ |
74 char errstr[BUFSIZ]; | 74 char errstr[BUFSIZ], charstr[BUFSIZ]; |
75 struct mac_bsdextended_rule rule; 76 int error, rulenum; 77 78 error = bsde_parse_rule(argc, argv, &rule, BUFSIZ, errstr); 79 if (error) { 80 warnx("%s", errstr); 81 return; 82 } 83 84 error = bsde_add_rule(&rulenum, &rule, BUFSIZ, errstr); 85 if (error) { 86 warnx("%s", errstr); 87 return; 88 } | 75 struct mac_bsdextended_rule rule; 76 int error, rulenum; 77 78 error = bsde_parse_rule(argc, argv, &rule, BUFSIZ, errstr); 79 if (error) { 80 warnx("%s", errstr); 81 return; 82 } 83 84 error = bsde_add_rule(&rulenum, &rule, BUFSIZ, errstr); 85 if (error) { 86 warnx("%s", errstr); 87 return; 88 } |
89 printf("Added rule %d\n", rulenum); | 89 if (bsde_rule_to_string(&rule, charstr, BUFSIZ) == -1) 90 warnx("Added rule, but unable to print string."); 91 else 92 printf("%d %s\n", rulenum, charstr); |
90} 91 92void 93list_rules(void) 94{ 95 char errstr[BUFSIZ], charstr[BUFSIZ]; 96 struct mac_bsdextended_rule rule; 97 int error, i, rule_count, rule_slots; --- 114 unchanged lines hidden --- | 93} 94 95void 96list_rules(void) 97{ 98 char errstr[BUFSIZ], charstr[BUFSIZ]; 99 struct mac_bsdextended_rule rule; 100 int error, i, rule_count, rule_slots; --- 114 unchanged lines hidden --- |