PERFORCE change 30690 for review

Chris Vance cvance at FreeBSD.org
Wed May 7 13:17:24 GMT 2003


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

Change 30690 by cvance at cvance_demo on 2003/05/07 06:16:32

	Allow ugidfw to add rules without requiring a rule number, 
	just use the next empty slot.

Affected files ...

.. //depot/projects/trustedbsd/mac/lib/libugidfw/ugidfw.c#9 edit
.. //depot/projects/trustedbsd/mac/lib/libugidfw/ugidfw.h#5 edit

Differences ...

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

@@ -708,3 +708,40 @@
 
 	return (0);
 }
+
+int
+bsde_add_rule(struct mac_bsdextended_rule *rule, size_t buflen, char *errstr)
+{
+	char charstr[BUFSIZ];
+	int name[10];
+	size_t len, size;
+	int error, rule_slots;
+
+	len = 10;
+	error = bsde_get_mib(MIB ".rules", name, &len);
+	if (error) {
+		len = snprintf(errstr, buflen, "%s: %s", MIB ".rules",
+		    strerror(errno));
+		return (-1);
+	}
+
+	rule_slots = bsde_get_rule_slots(BUFSIZ, charstr);
+	if (rule_slots == -1) {
+		len = snprintf(errstr, buflen, "unable to get rule slots: %s",
+		    strerror(errno));
+		return (-1);
+	}
+
+	name[len] = rule_slots;
+	len++;
+
+	size = sizeof(*rule);
+	error = sysctl(name, len, NULL, NULL, rule, size);
+	if (error) {
+		len = snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules",
+		    rule_slots, strerror(errno));
+		return (-1);
+	}
+
+	return (0);
+}

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

@@ -54,6 +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);
 __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