Date: Mon, 30 Jan 2006 23:43:20 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 90743 for review Message-ID: <200601302343.k0UNhK2V068485@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=90743 Change 90743 by rwatson@rwatson_zoo on 2006/01/30 23:42:57 Integrate change to support comments in /etc/audit_event from the TrustedBSD OpenBSM branch to the TrustedBSD audit3 branch. Affected files ... .. //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_event.c#7 integrate Differences ... ==== //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_event.c#7 (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#6 $ + * $P4: //depot/projects/trustedbsd/audit3/contrib/openbsm/libbsm/bsm_event.c#7 $ */ #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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200601302343.k0UNhK2V068485>