PERFORCE change 90741 for review

Robert Watson rwatson at FreeBSD.org
Mon Jan 30 15:42:20 PST 2006


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

Change 90741 by rwatson at rwatson_zoo on 2006/01/30 23:41:37

	Allow comments in /etc/security/audit_event.  A good idea if we
	ship a demo audit_event file with comments in it.

Affected files ...

.. //depot/projects/trustedbsd/openbsm/libbsm/bsm_event.c#10 edit

Differences ...

==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_event.c#10 (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/openbsm/libbsm/bsm_event.c#9 $
+ * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_event.c#10 $
  */
 
 #include <bsm/libbsm.h>
@@ -133,21 +133,29 @@
 	if ((fp == NULL) && ((fp = fopen(AUDIT_EVENT_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 event structure.
-	 *
-	 * XXXRW: Perhaps we should keep reading lines until we find a valid
-	 * one, rather than stopping when we hit an invalid one?
-	 */
-	if (eventfromstr(linestr, e) == NULL)
-		return (NULL);
+		/*
+		 * 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?
+		 */
+		if (eventfromstr(linestr, e) == NULL)
+			return (NULL);
+		break;
+	}
 
 	return (e);
 }


More information about the p4-projects mailing list