PERFORCE change 47606 for review

Robert Watson rwatson at FreeBSD.org
Wed Feb 25 03:10:05 GMT 2004


http://perforce.freebsd.org/chv.cgi?CH=47606

Change 47606 by rwatson at rwatson_paprika on 2004/02/24 19:09:55

	Modify bsde_add_rule() to return the rule number it used when
	adding a new rule.
	
	Document bsde_add_rule().

Affected files ...

.. //depot/projects/trustedbsd/mac/lib/libugidfw/Makefile#7 edit
.. //depot/projects/trustedbsd/mac/lib/libugidfw/bsde_get_rule.3#3 edit
.. //depot/projects/trustedbsd/mac/lib/libugidfw/libugidfw.3#3 edit
.. //depot/projects/trustedbsd/mac/lib/libugidfw/ugidfw.c#10 edit
.. //depot/projects/trustedbsd/mac/lib/libugidfw/ugidfw.h#6 edit

Differences ...

==== //depot/projects/trustedbsd/mac/lib/libugidfw/Makefile#7 (text+ko) ====

@@ -8,6 +8,7 @@
 MAN+=		bsde_get_rule.3 bsde_get_rule_count.3 bsde_parse_rule.3 \
 		bsde_rule_to_string.3 libugidfw.3
 
+MLINKS= 	bsde_get_rule.3 bsde_add_rule.3
 MLINKS= 	bsde_get_rule.3 bsde_delete_rule.3
 MLINKS+=	bsde_get_rule.3 bsde_set_rule.3
 MLINKS+=	bsde_get_rule_count.3 bsde_get_rule_slots.3

==== //depot/projects/trustedbsd/mac/lib/libugidfw/bsde_get_rule.3#3 (text+ko) ====

@@ -1,4 +1,4 @@
-.\" Copyright (c) 2003 Networks Associates Technology, Inc.
+.\" Copyright (c) 2003-2004 Networks Associates Technology, Inc.
 .\" All rights reserved.
 .\"
 .\" This software was developed for the FreeBSD Project by Chris
@@ -30,10 +30,11 @@
 .\"
 .\" $FreeBSD: src/lib/libugidfw/bsde_get_rule.3,v 1.2 2003/06/01 19:41:49 ru Exp $
 .\"
-.Dd January 7, 2003
+.Dd February 24, 2004
 .Os
 .Dt BSDE_GET_RULE 3
 .Sh NAME
+.Nm bsde_add_rule ,
 .Nm bsde_get_rule ,
 .Nm bsde_set_rule ,
 .Nm bsde_delete_rule
@@ -43,6 +44,11 @@
 .Sh SYNOPSIS
 .In ugidfw.h
 .Ft int
+.Fo bsde_add_rule
+.Fa "int *rulenum" "struct mac_bsdextended_rule *rule"
+.Fa "size_t buflen" "char *errstr"
+.Fc
+.Ft int
 .Fo bsde_get_rule
 .Fa "int rulenum" "struct mac_bsdextended_rule *rule"
 .Fa "size_t errlen" "char *errstr"
@@ -56,6 +62,27 @@
 .Fn bsde_delete_rule "int rulenum" "size_t errlen" "char *errstr"
 .Sh DESCRIPTION
 The
+.Fn bsde_add_rule
+function fills the next available
+rule (in
+.Vt "struct mac_bsdextended_rule"
+form, either from
+.Fn bsde_get_rule
+or
+.Xr bsde_parse_rule 3 ) .
+If an error occurs,
+.Fa *errstr
+is filled with the error string
+(up to
+.Fa errlen
+characters, including the terminating
+.Dv NUL ) .
+If successful and
+.Fa rulenum
+is non-NULL, the rule number used will be returned in
+.Fa *rulenum .
+.Pp
+The
 .Fn bsde_get_rule
 function fills in
 .Fa *rule

==== //depot/projects/trustedbsd/mac/lib/libugidfw/libugidfw.3#3 (text+ko) ====

@@ -96,6 +96,10 @@
 module and applies it;
 see
 .Xr bsde_set_rule 3 .
+.It Fn bsde_add_rule
+Upload the rule to the module, automatically selecting the next available
+rule number; see
+.Xr bsde_add_rule 3 .
 .El
 .Sh SEE ALSO
 .Xr bsde_delete_rule 3 ,

==== //depot/projects/trustedbsd/mac/lib/libugidfw/ugidfw.c#10 (text+ko) ====

@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2002 Networks Associates Technology, Inc.
+ * Copyright (c) 2002, 2004 Networks Associates Technology, Inc.
  * All rights reserved.
  *
  * This software was developed for the FreeBSD Project by Network Associates
@@ -710,7 +710,8 @@
 }
 
 int
-bsde_add_rule(struct mac_bsdextended_rule *rule, size_t buflen, char *errstr)
+bsde_add_rule(int *rulenum, struct mac_bsdextended_rule *rule, size_t buflen,
+    char *errstr)
 {
 	char charstr[BUFSIZ];
 	int name[10];
@@ -743,5 +744,8 @@
 		return (-1);
 	}
 
+	if (rulenum != NULL)
+		rule_slots;
+
 	return (0);
 }

==== //depot/projects/trustedbsd/mac/lib/libugidfw/ugidfw.h#6 (text+ko) ====

@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2002 Networks Associates Technology, Inc.
+ * Copyright (c) 2002, 2004 Networks Associates Technology, Inc.
  * All rights reserved.
  *
  * This software was developed for the FreeBSD Project by Network Associates
@@ -54,8 +54,8 @@
 int	bsde_delete_rule(int rulenum, size_t buflen, char *errstr);
 int	bsde_set_rule(int rulenum, struct mac_bsdextended_rule *rule,
 	    size_t buflen, char *errstr);
-int	bsde_add_rule(struct mac_bsdextended_rule *rule, size_t buflen,
-	    char *errstr);
+int	bsde_add_rule(int *rulename, struct mac_bsdextended_rule *rule,
+	    size_t buflen, char *errstr);
 __END_DECLS
 
 #endif
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list