Date: Sat, 25 Aug 2007 05:25:57 GMT From: dongmei <dongmei@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 125654 for review Message-ID: <200708250525.l7P5PvB1002197@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <gram@alumni.rice.edu> - * - * 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 <bsm/libbsm.h> #include "exceptions.h" #include "gtk/tree_view.h" +#include "file_wrappers.h" + #include <stdbool.h> /* 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200708250525.l7P5PvB1002197>