PERFORCE change 90813 for review

Robert Watson rwatson at FreeBSD.org
Tue Jan 31 09:58:13 PST 2006


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

Change 90813 by rwatson at rwatson_zoo on 2006/01/31 17:57:23

	Integrate TrustedBSD audit3 branch from TrustedBSD OpenBSM branch:
	
	- Comment parsing for class, user configuration files.
	- Cleanup.

Affected files ...

.. //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_class.c#8 integrate
.. //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_control.c#7 integrate
.. //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_event.c#8 integrate
.. //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_user.c#6 integrate

Differences ...

==== //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_class.c#8 (text+ko) ====

@@ -27,7 +27,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $P4: //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_class.c#7 $
+ * $P4: //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_class.c#8 $
  */
 
 #include <bsm/libbsm.h>
@@ -104,19 +104,21 @@
 	while (1) {
 		if (fgets(linestr, AU_LINE_MAX, fp) == NULL)
 			return (NULL);
-		if (linestr[0] != '#')
-			break;
-	}
 
-	/* Remove trailing new line character. */
-	if ((nl = strrchr(linestr, '\n')) != NULL)
-		*nl = '\0';
+		/* Skip comments. */
+		if (linestr[0] == '#')
+			continue;
 
-	tokptr = linestr;
+		/* Remove trailing new line character. */
+		if ((nl = strrchr(linestr, '\n')) != NULL)
+			*nl = '\0';
 
-	/* Parse tokptr to au_class_ent components. */
-	if (classfromstr(tokptr, c) == NULL)
-		return (NULL);
+		/* Parse tokptr to au_class_ent components. */
+		tokptr = linestr;
+		if (classfromstr(tokptr, c) == NULL)
+			return (NULL);
+		break;
+	}
 
 	return (c);
 }

==== //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_control.c#7 (text+ko) ====

@@ -26,7 +26,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $P4: //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_control.c#6 $
+ * $P4: //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_control.c#7 $
  */
 
 #include <bsm/libbsm.h>
@@ -78,7 +78,6 @@
 		if (linestr[0] == '#')
 			continue;
 
-
 		/* Remove trailing new line character. */
 		if ((nl = strrchr(linestr, '\n')) != NULL)
 			*nl = '\0';

==== //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_event.c#8 (text+ko) ====

@@ -27,7 +27,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $P4: //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_event.c#7 $
+ * $P4: //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_event.c#8 $
  */
 
 #include <bsm/libbsm.h>
@@ -145,13 +145,7 @@
 		if (linestr[0] == '#')
 			continue;
 
-		/*
-		 * Get the next event structure.
-		 *
-		 * XXXRW: Perhaps we should keep reading lines until we find
-		 * a valid one, rather than stopping when we hit an invalid
-		 * one?
-		 */
+		/* Get the next event structure. */
 		if (eventfromstr(linestr, e) == NULL)
 			return (NULL);
 		break;

==== //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_user.c#6 (text+ko) ====

@@ -27,7 +27,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $P4: //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_user.c#5 $
+ * $P4: //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_user.c#6 $
  */
 
 #include <bsm/libbsm.h>
@@ -122,16 +122,23 @@
 	if ((fp == NULL) && ((fp = fopen(AUDIT_USER_FILE, "r")) == NULL))
 		return (NULL);
 
-	if (fgets(linestr, AU_LINE_MAX, fp) == NULL)
-		return (NULL);
+	while (1) {
+		if (fgets(linestr, AU_LINE_MAX, fp) == NULL)
+			return (NULL);
+
+		/* Remove new lines. */
+		if ((nl = strrchr(linestr, '\n')) != NULL)
+			*nl = '\0';
 
-	/* Remove new lines. */
-	if ((nl = strrchr(linestr, '\n')) != NULL)
-		*nl = '\0';
+		/* Skip comments. */
+		if (linestr[0] == '#')
+			continue;
 
-	/* Get the next structure. */
-	if (userfromstr(linestr, u) == NULL)
-		return (NULL);
+		/* Get the next structure. */
+		if (userfromstr(linestr, u) == NULL)
+			return (NULL);
+		break;
+	}
 
 	return (u);
 }


More information about the p4-projects mailing list