From owner-p4-projects@FreeBSD.ORG Mon Jun 21 03:20:32 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0ADA4106566C; Mon, 21 Jun 2010 03:20:32 +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 B9AAC106564A for ; Mon, 21 Jun 2010 03:20:31 +0000 (UTC) (envelope-from ligregni@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id A66478FC08 for ; Mon, 21 Jun 2010 03:20:31 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5L3KVE7034353 for ; Mon, 21 Jun 2010 03:20:31 GMT (envelope-from ligregni@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5L3KVv8034351 for perforce@freebsd.org; Mon, 21 Jun 2010 03:20:31 GMT (envelope-from ligregni@FreeBSD.org) Date: Mon, 21 Jun 2010 03:20:31 GMT Message-Id: <201006210320.o5L3KVv8034351@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to ligregni@FreeBSD.org using -f From: Sergio Ligregni To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180027 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jun 2010 03:20:32 -0000 http://p4web.freebsd.org/@@180027?ac=10 Change 180027 by ligregni@ligPhenom on 2010/06/21 03:19:59 Implemented MD5, the socket work file created, also included a Makefile to simplify development and using Affected files ... .. //depot/projects/soc2010/disaudit/Makefile#1 add .. //depot/projects/soc2010/disaudit/ideas.txt#4 edit .. //depot/projects/soc2010/disaudit/shipd.c#4 edit .. //depot/projects/soc2010/disaudit/shipd.h#4 edit .. //depot/projects/soc2010/disaudit/ssocket_work.c#1 add .. //depot/projects/soc2010/disaudit/ssocket_work.h#1 add Differences ... ==== //depot/projects/soc2010/disaudit/ideas.txt#4 (text+ko) ==== @@ -8,6 +8,7 @@ PARAMETERS (the main idea is to get them from /etc/security/audit_control) disaudit_type:master # none, master, slave, obviouslly depending on this to use the following parameters +disaudit_port:53686 /* SLAVE */ ==== //depot/projects/soc2010/disaudit/shipd.c#4 (text+ko) ==== @@ -28,6 +28,7 @@ /*** INCLUDES ***/ #include "shipd.h" +#include "ssocket_work.h" #include #include #include @@ -35,6 +36,7 @@ #include #include #include +#include #include /*** DECLARATIONS ***/ @@ -52,6 +54,9 @@ /* Two main things to be set by this variable, if daemonize or not, and the destination of the messages */ int debug; +/* Port number */ +int port_number; + main (int argc, char *argv[]) { char cl_opt; @@ -118,6 +123,7 @@ fscanf(fpars, "%s", master_host); fscanf(fpars, "%d", &panic_level); fscanf(fpars, "%d", &msec_freq); + fscanf(fpars, "%d", &port_number); return 0; } @@ -131,6 +137,10 @@ syslog(LOG_ERR, "%s", message); } +/* + * Look for the last closed trail and + * send it + */ void do_last() { @@ -153,6 +163,11 @@ } } +/* + * Used by do_last() function, this get the last + * closed trail in meaning of lexicographic + * order (that is also a chronological one) + */ int get_last_trail(char *path) { @@ -206,6 +221,12 @@ return 0; } +/* + * When exploring /var/audit/ (or the directory + * where the trails are), not all files are trails + * so we must ensure we will only deal with the ones + * that are trails + */ int is_audit_trail(char *path) { @@ -324,8 +345,11 @@ qsort(trail_paths, n_elements, sizeof(*trail_paths), cmp_trails); for (i=0; id_name) ) /* It's not other file */ - if ( !is_in_master(dirp->d_name) ) + if ( !is_in_master(dirp->d_name, fullpath) ) if (send_trail(fullpath) == -1) { sprintf(message, "ERROR Sending \"%s\" to %s", fullpath, master_host); ==== //depot/projects/soc2010/disaudit/shipd.h#4 (text+ko) ==== @@ -44,7 +44,7 @@ int send_trail(char *); void do_daemon_date(); int cmp_trails(const void *, const void *); -int is_in_master(char *); +int is_in_master(char *, char *); void do_daemon_all();