From owner-p4-projects@FreeBSD.ORG Tue Jan 31 17:58:12 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 502FE16A423; Tue, 31 Jan 2006 17:58:12 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F039816A420 for ; Tue, 31 Jan 2006 17:58:11 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 58CC643D6D for ; Tue, 31 Jan 2006 17:58:08 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k0VHw8RO060816 for ; Tue, 31 Jan 2006 17:58:08 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k0VHw6Hr060813 for perforce@freebsd.org; Tue, 31 Jan 2006 17:58:06 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Tue, 31 Jan 2006 17:58:06 GMT Message-Id: <200601311758.k0VHw6Hr060813@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 90813 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2006 17:58:13 -0000 http://perforce.freebsd.org/chv.cgi?CH=90813 Change 90813 by rwatson@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 @@ -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 @@ -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 @@ -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 @@ -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); }