On Wed, Nov 02, 2005 at 02:58:49PM +0100, Richard van den Berg wrote: > Virolainen Pablo wrote: > > I can. There is an typo in the original patch I send (which is fixed in > > http://ipi.fi/~pablo/aide.tar.gz) > > Can you tell me what the typo is? I could sync CVS with your version, > but I'd rather wait with the http stuff until aide 0.11 is finalized.
I have diffed pablo's source with yours, and because of diff size have restrained myself to only diff the files that pablo touched in his original patch. The patch he suggested to aide.h is not present any more in his current source, and the resulting patch against aide 0.11rc2 is attached. include/db_config.h | 7 +++++-- src/aide.c | 2 +- src/gen_list.c | 52 +++++++++++++++++++++++++++++++--------------------- 3 files changed, 37 insertions(+), 24 deletions(-) The resulting binary does not segfault in the situation on my "productive test" system where the last patched version used to segfault. I hope that's a good sign. Disclaimer: By creating this patch, I have probably proven that I do not exactly know what I'm doing here. Please review before applying. Greetings Marc -- ----------------------------------------------------------------------------- Marc Haber | "I don't trust Computers. They | Mailadresse im Header Mannheim, Germany | lose things." Winona Ryder | Fon: *49 621 72739834 Nordisch by Nature | How to make an American Quilt | Fax: *49 621 72739835
#! /bin/sh /usr/share/dpatch/dpatch-run ## 30-allow-new-files.dpatch by Marc Haber <[EMAIL PROTECTED]> ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: No description. @DPATCH@ diff -urNad aide~/include/db_config.h aide/include/db_config.h --- aide~/include/db_config.h 2005-04-28 10:53:05.000000000 +0000 +++ aide/include/db_config.h 2005-11-04 17:34:22.000000000 +0000 @@ -102,6 +102,7 @@ db_rdev, /* "rdev" */ db_dev, /* "dev" */ db_checkmask, /* "checkmask"*/ + db_allownewfile, /* "allownewfile */ db_unknown } DB_FIELD; /* "unknown" */ /* db_unknown must be last because it is used to determine size of @@ -142,7 +143,7 @@ #define DB_CHECKMASK (1<<25) /* "checkmask"*/ #define DB_SIZEG (1<<26) /* "unknown" */ #define DB_CHECKINODE (1<<27) /* "checkinode"*/ - +#define DB_NEWFILE (1<<28) /* "allow new file" */ #define DB_HASHES (DB_MD5|DB_SHA1|DB_RMD160|DB_TIGER|DB_CRC32|DB_HAVAL| \ DB_GOST|DB_CRC32B) @@ -174,7 +175,8 @@ "rdev", "dev", "checkmask", - "unknown" } ; + "unknown", + "allownewfiles"} ; const static int db_value[] = { db_filename, /* "name", */ @@ -203,6 +205,7 @@ db_rdev, /* "rdev" */ db_dev, /* "dev" */ db_checkmask, /* "checkmask" */ + db_allownewfile, /* "allownewfile" */ db_unknown }; /* "unknown" */ /* db_namealias && db_aliasvalue are here to support earlier database diff -urNad aide~/src/aide.c aide/src/aide.c --- aide~/src/aide.c 2005-10-25 12:29:05.000000000 +0000 +++ aide/src/aide.c 2005-11-04 17:34:03.000000000 +0000 @@ -329,7 +329,7 @@ conf->start_time=time(&(conf->start_time)); - + do_groupdef("ANF",DB_NEWFILE); do_groupdef("p",DB_PERM); do_groupdef("i",DB_INODE); do_groupdef("I",DB_CHECKINODE); diff -urNad aide~/src/gen_list.c aide/src/gen_list.c --- aide~/src/gen_list.c 2005-11-03 11:18:06.000000000 +0000 +++ aide/src/gen_list.c 2005-11-04 17:34:30.000000000 +0000 @@ -1087,37 +1087,47 @@ /* Check if file was moved (same inode, different name in the other DB)*/ db_line *oldData; db_line *newData; - seltree* moved_node=get_seltree_inode(tree,file,db==DB_OLD?DB_NEW:DB_OLD); + seltree* moved_node; - if(moved_node == NULL || moved_node == node) { + moved_node=get_seltree_inode(tree,file,db==DB_OLD?DB_NEW:DB_OLD); + if(!(moved_node == NULL || moved_node == node)) { /* There's mo match for inode or it matches the node with the same name. * In first case we don't have a match to compare with. * In the second - we already compared those files. */ - return; - } + if(db == DB_NEW) { + newData = node->new_data; + oldData = moved_node->old_data; + } else { + newData = moved_node->new_data; + oldData = node->old_data; + } - if(db == DB_NEW) { - newData = node->new_data; - oldData = moved_node->old_data; - } else { - newData = moved_node->new_data; - oldData = node->old_data; - } + localignorelist=(oldData->attr^newData->attr); - localignorelist=(oldData->attr^newData->attr); - if (localignorelist!=0) { - error(5,"File %s in databases has different attributes, %i,%i\n", - oldData->filename,oldData->attr,newData->attr); - } + if (localignorelist!=0) { + error(5,"File %s in databases has different attributes, %i,%i\n", + oldData->filename,oldData->attr,newData->attr); + } - localignorelist|=ignorelist|DB_CTIME; + localignorelist|=ignorelist|DB_CTIME; - /* Free the data if same else leave as is for report_tree */ - if(compare_dbline(oldData, newData, localignorelist)==RETOK){ - node->checked |= db==DB_NEW ? NODE_MOVED_IN : NODE_MOVED_OUT; - moved_node->checked |= db==DB_NEW ? NODE_MOVED_OUT : NODE_MOVED_IN; + /* Free the data if same else leave as is for report_tree */ + if(compare_dbline(oldData, newData, localignorelist)==RETOK){ + node->checked |= db==DB_NEW ? NODE_MOVED_IN : NODE_MOVED_OUT; + moved_node->checked |= db==DB_NEW ? NODE_MOVED_OUT : NODE_MOVED_IN; + } } } + + /* Check if new file is allowed.. */ + if( (db == DB_NEW) && + (file->attr & DB_NEWFILE) && + (node->new_data!=NULL) && + (node->old_data==NULL)) { + free_db_line(node->new_data); + node->new_data=NULL; + node->checked=DB_OLD|DB_NEW|NODE_TRAVERSE; + } } int check_rxtree(char* filename,seltree* tree,int* attr)
_______________________________________________ Aide mailing list Aide@cs.tut.fi https://mailman.cs.tut.fi/mailman/listinfo/aide