From owner-p4-projects@FreeBSD.ORG Mon Jan 30 23:42:20 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 9ACB616A423; Mon, 30 Jan 2006 23:42:19 +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 5893916A420 for ; Mon, 30 Jan 2006 23:42:19 +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 1B4FD43D53 for ; Mon, 30 Jan 2006 23:42:19 +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 k0UNgI1b068448 for ; Mon, 30 Jan 2006 23:42:19 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 k0UNgI1B068443 for perforce@freebsd.org; Mon, 30 Jan 2006 23:42:18 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Mon, 30 Jan 2006 23:42:18 GMT Message-Id: <200601302342.k0UNgI1B068443@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 90741 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: Mon, 30 Jan 2006 23:42:20 -0000 http://perforce.freebsd.org/chv.cgi?CH=90741 Change 90741 by rwatson@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 @@ -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); }