PERFORCE change 90808 for review

Robert Watson rwatson at FreeBSD.org
Tue Jan 31 17:49:54 GMT 2006


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

Change 90808 by rwatson at rwatson_zoo on 2006/01/31 17:48:53

	Permit audit_user file to have comments in it.

Affected files ...

.. //depot/projects/trustedbsd/openbsm/libbsm/bsm_user.c#14 edit

Differences ...

==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_user.c#14 (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_user.c#13 $
+ * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_user.c#14 $
  */
 
 #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);
 }
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