On Tue, 15 Nov 2005, Richard van den Berg wrote:

Virolainen Pablo wrote:
Well.. Someone might implement it.

Thanks, but this is not a clean patch against the current aide source. 3
chunks fail, but even when I apply them by hand, there are still errors:

gen_list.c: In function `add_file_to_tree':
gen_list.c:1105: error: `DB_RMFILE' undeclared (first use in this function)
gen_list.c:1105: error: (Each undeclared identifier is reported only once
gen_list.c:1105: error: for each function it appears in.)
gen_list.c:1125: error: `NODE_ALLOW_NEW' undeclared (first use in this
function)gen_list.c:1130: error: `NODE_ALLOW_RM' undeclared (first use
in this function)
make[2]: *** [gen_list.o] Error 1

Please post a patch against the current CVS or aide 0.11-rc2.

Ok. Lets try again.

Duke NEMO / C.O.M.A
alias pablo the pallo virolainen
diff -ru aide/src/Makefile.am aide-with-ARF/src/Makefile.am
--- aide/src/Makefile.am        Tue Nov 15 17:45:40 2005
+++ aide-with-ARF/src/Makefile.am       Tue Nov 15 13:40:08 2005
@@ -68,6 +68,8 @@
 conf_yacc.c:conf_yacc.y
        ${YACC} ${YFLAGS} -d -p conf -o conf_yacc.c 
$(top_srcdir)/src/conf_yacc.y
 
+conf_yacc.h: conf_yacc.c
+
 conf_lex2.c:conf_lex.c
 
 conf_lex.c:conf_lex.l
diff -ru aide/src/aide.c aide-with-ARF/src/aide.c
--- aide/src/aide.c     Tue Nov 15 17:45:40 2005
+++ aide-with-ARF/src/aide.c    Tue Nov 15 13:40:57 2005
@@ -330,6 +330,7 @@
   conf->start_time=time(&(conf->start_time));
 
   do_groupdef("ANF",DB_NEWFILE);
+  do_groupdef("ARF",DB_RMFILE);
   do_groupdef("p",DB_PERM);
   do_groupdef("i",DB_INODE);
   do_groupdef("I",DB_CHECKINODE);
diff -ru aide/src/base64.c aide-with-ARF/src/base64.c
--- aide/src/base64.c   Tue Nov 15 17:45:40 2005
+++ aide-with-ARF/src/base64.c  Tue Nov 15 13:50:53 2005
@@ -267,7 +267,7 @@
   error(210, "decode base64\n");
   /* Exit on empty input */
   if (!ssize||src==NULL)
-    return NULL;
+    return 0;
 
 
 
@@ -290,7 +290,7 @@
        case FAIL:
          error(3, "length_base64: Illegal character: %c\n", *inb);
          error(230, "length_base64: Illegal line:\n%s\n", src);
-         return NULL;
+         return 0; 
          break;
        case SKIP:
          break;
diff -ru aide/src/compare_db.c aide-with-ARF/src/compare_db.c
--- aide/src/compare_db.c       Tue Nov 15 17:45:41 2005
+++ aide-with-ARF/src/compare_db.c      Tue Nov 15 13:46:22 2005
@@ -690,8 +690,8 @@
     }else {
       int localignorelist=old->attr ^ ((db_line*)r->data)->attr;
       
-      if (localignorelist!=0) {
-       error(2,"File %s in databases has different attributes, 
%i,%i\n",old->filename,old->attr,((db_line*)r->data)->attr);
+      if ((localignorelist&(~(DB_NEWFILE|DB_RMFILE)))!=0) {
+       error(2,"File %s in databases has different attributes, 
%i,%i\n",old->filename,old->attr,((db_line*)r->data)->attr);
       }
       
       localignorelist|=ignorelist;
@@ -822,14 +822,14 @@
       }else if(!(node->checked&DB_OLD)&&(node->checked&DB_NEW)){
        /* File is in new db but not old. (ADDED) */
        /* unless it was moved in */
-       if(!(node->checked&NODE_MOVED_IN)){
+       if((!(node->checked&NODE_MOVED_IN))&&(!node->checked&NODE_ALLOW_NEW)){
          stat[2]++;
          node->checked|=NODE_ADDED;
        }
       }else if((node->checked&DB_OLD)&&!(node->checked&DB_NEW)){
        /* File is in old db but not new. (REMOVED) */
        /* unless it was moved out */
-       if(!(node->checked&NODE_MOVED_OUT)) {
+       if(!(node->checked&NODE_MOVED_OUT)&&(!node->checked&NODE_ALLOW_RM)) {
          stat[3]++;
          node->checked|=NODE_REMOVED;
        }
@@ -839,10 +839,10 @@
        if(!(node->checked&(NODE_MOVED_IN|NODE_MOVED_OUT))){
          stat[4]++;
          node->checked|=NODE_CHANGED;
-       }else if(!(node->checked&NODE_MOVED_IN)) {
+       }else 
if((!(node->checked&NODE_MOVED_IN))&&(!node->checked&NODE_ALLOW_NEW)) {
          stat[2]++;
          node->checked|=NODE_ADDED;
-       }else if(!(node->checked&NODE_MOVED_OUT)) {
+       }else 
if((!(node->checked&NODE_MOVED_OUT))&&(!node->checked&NODE_ALLOW_RM)) {
          stat[3]++;
          node->checked|=NODE_REMOVED;
        }
diff -ru aide/src/gen_list.c aide-with-ARF/src/gen_list.c
--- aide/src/gen_list.c Tue Nov 15 17:45:41 2005
+++ aide-with-ARF/src/gen_list.c        Tue Nov 15 13:45:57 2005
@@ -1058,7 +1058,7 @@
   if((node->checked&DB_OLD)&&(node->checked&DB_NEW)){
     localignorelist=(node->new_data->attr^node->old_data->attr);
     if (localignorelist!=0) {
-      error(2,"File %s in databases has different attributes, 
%i,%i\n",node->old_data->filename,node->old_data->attr,node->new_data->attr);
+      error(2,"File %s in databases has different attributes, 
%i,%i\n",node->old_data->filename,node->old_data->attr,node->new_data->attr);
     }
     
     localignorelist|=ignorelist;
@@ -1102,11 +1102,11 @@
         oldData = node->old_data;
       }
 
-      localignorelist=(oldData->attr^newData->attr);
+      localignorelist=(oldData->attr^newData->attr)&(~(DB_NEWFILE|DB_RMFILE));
 
       if (localignorelist!=0) {
-        error(5,"File %s in databases has different attributes, %i,%i\n",
-           oldData->filename,oldData->attr,newData->attr);
+        error(5,"File \"%s\" \"%s\" in databases has different attributes 
(here3), %i,%i\n",
+           newData->filename,oldData->filename,oldData->attr,newData->attr);
       }
     
       localignorelist|=ignorelist|DB_CTIME;
@@ -1120,9 +1120,13 @@
   }
   if( (db == DB_NEW) &&
       (file->attr & DB_NEWFILE) && 
-      (node->new_data!=NULL) &&
-      (node->old_data==NULL)) {
-        node->checked|=DB_NEW;
+      (node->new_data!=NULL) ){
+        node->checked|=NODE_ALLOW_NEW;
+  }
+  if( (db == DB_OLD) &&
+      (file->attr & DB_RMFILE) &&
+      (node->old_data!=NULL) ){
+         node->checked|=NODE_ALLOW_RM;
   }
 }
 
diff -ru aide/include/db.h aide-with-ARF/include/db.h
--- aide/include/db.h   Tue Nov 15 17:45:42 2005
+++ aide-with-ARF/include/db.h  Tue Nov 15 13:49:48 2005
@@ -52,6 +52,7 @@
 #define NODE_CHECKED      (1<<10)
 #define NODE_MOVED_OUT    (1<<11)
 #define NODE_MOVED_IN     (1<<12)
-
+#define NODE_ALLOW_NEW    (1<<13)
+#define NODE_ALLOW_RM    (1<<14)
 
 #endif
diff -ru aide/include/db_config.h aide-with-ARF/include/db_config.h
--- aide/include/db_config.h    Tue Nov 15 17:45:42 2005
+++ aide-with-ARF/include/db_config.h   Tue Nov 15 13:42:20 2005
@@ -103,6 +103,7 @@
    db_dev,                      /* "dev"      */
    db_checkmask,                /* "checkmask"*/
    db_allownewfile,            /* "allownewfile */
+   db_allowrmfile,             /* "allowrmfile" */
    db_unknown } DB_FIELD;      /* "unknown"  */
 
 /* db_unknown must be last because it is used to determine size of
@@ -144,6 +145,7 @@
 #define DB_SIZEG     (1<<26)   /* "unknown"  */
 #define DB_CHECKINODE (1<<27) /* "checkinode"*/
 #define DB_NEWFILE    (1<<28) /* "allow new file" */
+#define DB_RMFILE     (1<<29) /* "allot rm file" */
 
 #define DB_HASHES    (DB_MD5|DB_SHA1|DB_RMD160|DB_TIGER|DB_CRC32|DB_HAVAL| \
                      DB_GOST|DB_CRC32B)
@@ -206,6 +208,7 @@
    db_dev,              /* "dev"      */
    db_checkmask,       /* "checkmask" */
    db_allownewfile,    /* "allownewfile" */
+   db_allowrmfile,     /* "allowrmfile" */
    db_unknown };       /* "unknown"  */
 
 /* db_namealias && db_aliasvalue are here to support earlier database 
_______________________________________________
Aide mailing list
Aide@cs.tut.fi
https://mailman.cs.tut.fi/mailman/listinfo/aide

Reply via email to