From owner-p4-projects@FreeBSD.ORG Sat Aug 25 05:25:58 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 747C216A41A; Sat, 25 Aug 2007 05:25:58 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3582416A419 for ; Sat, 25 Aug 2007 05:25:58 +0000 (UTC) (envelope-from dongmei@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 24F4513C45D for ; Sat, 25 Aug 2007 05:25:58 +0000 (UTC) (envelope-from dongmei@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l7P5PwIV002202 for ; Sat, 25 Aug 2007 05:25:58 GMT (envelope-from dongmei@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l7P5PvB1002197 for perforce@freebsd.org; Sat, 25 Aug 2007 05:25:57 GMT (envelope-from dongmei@FreeBSD.org) Date: Sat, 25 Aug 2007 05:25:57 GMT Message-Id: <200708250525.l7P5PvB1002197@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to dongmei@FreeBSD.org using -f From: dongmei To: Perforce Change Reviews Cc: Subject: PERFORCE change 125654 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: Sat, 25 Aug 2007 05:25:58 -0000 http://perforce.freebsd.org/chv.cgi?CH=125654 Change 125654 by dongmei@dongmei2007 on 2007/08/25 05:25:01 check some error of closing file and read file Affected files ... .. //depot/projects/soc2007/dongmei-auditanalyzer/README#2 edit .. //depot/projects/soc2007/dongmei-auditanalyzer/bsm/audit.h#1 add .. //depot/projects/soc2007/dongmei-auditanalyzer/bsm/audit_filter.h#1 add .. //depot/projects/soc2007/dongmei-auditanalyzer/bsm/audit_internal.h#1 add .. //depot/projects/soc2007/dongmei-auditanalyzer/bsm/audit_kevents.h#1 add .. //depot/projects/soc2007/dongmei-auditanalyzer/bsm/audit_record.h#1 add .. //depot/projects/soc2007/dongmei-auditanalyzer/bsm/audit_uevents.h#1 add .. //depot/projects/soc2007/dongmei-auditanalyzer/bsm/libbsm.h#1 add .. //depot/projects/soc2007/dongmei-auditanalyzer/buffer.h#2 edit .. //depot/projects/soc2007/dongmei-auditanalyzer/file_access.c#3 edit .. //depot/projects/soc2007/dongmei-auditanalyzer/tfile.c#5 edit Differences ... ==== //depot/projects/soc2007/dongmei-auditanalyzer/README#2 (text+ko) ==== @@ -1,1 +1,11 @@ My task in this summer is to write a GUI audit analyzer based on trustedBSD audit3 branch. The whole work is refer to WireShark-0.99.5. Thanks Robert Watson and the FreeBSD mentor organization give me this chance. Thanks again. +20070824 +This program can run under: +Gtk-2.8.9 +Glib-2.8.4 +To compile and run this program,please: +1. install gtk-2.8.x and glib-2.8.x +2. cp bsm /usr/inlcude/ +3. cd /usr/src/contrib/openbsm/lib/libbsm + make + make install ==== //depot/projects/soc2007/dongmei-auditanalyzer/buffer.h#2 (text+ko) ==== @@ -2,22 +2,6 @@ * * $Id: buffer.h 11400 2004-07-18 00:24:25Z guy $ * - * Wiretap Library - * Copyright (c) 1998 by Gilbert Ramirez - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ ==== //depot/projects/soc2007/dongmei-auditanalyzer/file_access.c#3 (text+ko) ==== @@ -13,8 +13,7 @@ allows the application to do random-access I/O without moving the seek offset for sequential I/O, which is used to display the token tree when a record are selected. */ -tsess* tsess_open_offline(const char *filename, int *err, char **err_info, - gboolean do_random) +tsess* tsess_open_offline(const char *filename, int *err, char **err_info,gboolean do_random) { struct stat statb; tsess *ts; @@ -97,8 +96,8 @@ /* initialization */ ts->data_offset = 0; - ts->record_buffer = g_malloc(sizeof(struct Buffer)); - buffer_init(ts->record_buffer, 1500); +/* ts->record_buffer = g_malloc(sizeof(struct Buffer)); + buffer_init(ts->record_buffer, 1500);*/ return ts; } /* Opens auditpipe and prepares a tsess struct. @@ -165,7 +164,7 @@ } if (!(ts->fh = filed_open(ts->fd, "rb"))) { *err = errno; - eth_close(ts->fd); + eth_close(ts->fh); g_free(ts); return NULL; } ==== //depot/projects/soc2007/dongmei-auditanalyzer/tfile.c#5 (text+ko) ==== @@ -8,6 +8,8 @@ #include #include "exceptions.h" #include "gtk/tree_view.h" +#include "file_wrappers.h" + #include /* Update the progress bar this many times when reading a file. */ @@ -65,6 +67,17 @@ clear_tree_view_rows(); /* We have no file open. */ tf->state = FILE_CLOSED; + if (tf->rlist_chunk) + g_mem_chunk_destroy(tf->rlist_chunk); + if (tf->ts) + { + if (tf->ts->fh!=NULL) + { + printf("close fh\n"); + file_close(tf->ts->fh); + } + g_free(tf->ts); + } } tf_status_t @@ -73,14 +86,13 @@ gchar *err_info; tsess *ts; + tf_reset_state(tf); + ts=tsess_open_offline(fname,err,&err_info,TRUE); if (ts==NULL) goto fail; - - tf_reset_state(tf); /* We're about to start reading the file. */ tf->state = FILE_READ_IN_PROGRESS; - tf->f_datalen = 0; /* Set the file name because we need it to set the follow stream filter. @@ -103,7 +115,7 @@ g_assert(tf->rlist_chunk); tf->ts=ts; return CF_OK; - + fail: return CF_ERROR; @@ -329,7 +341,7 @@ int reclen; data_offset=0; - while ((reclen = au_read_rec(tf->ts->random_fh, &buf)) != -1) { + while ((reclen = au_read_rec(tf->ts->fh, &buf)) != -1) { data_offset = data_offset+reclen; TRY { printf("%d\n",reclen);