[Aide] Allow ARF as opposite to ANF? (was: How to properly use ANF?)

Virolainen Pablo pablo at cs.tut.fi
Tue Nov 15 13:57:44 EET 2005


On Tue, 15 Nov 2005, Marc Haber wrote:

> [re-send with proper subject]
>
> Since ANF now seems to work, and the clutter in the outputs has
> vanished, it became evident that the opposite function (ARF, Allow
> removed Files) is needed for the other side of a log rotation chain
> where a file (foo.$HIGHNUM.gz) is deleted.
>
> Is it possible to have that implemented as well?

Well.. Someone might implement it.

Duke NEMO / C.O.M.A
alias pablo the pallo virolainen
-------------- next part --------------
diff -Nru aide/src/aide.c aide-with-ARF/src/aide.c
--- aide/src/aide.c	Sat Nov 12 14:45:48 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 -Nru aide/src/base64.c aide-with-ARF/src/base64.c
--- aide/src/base64.c	Wed Apr  6 12:50:25 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 -Nru aide/src/compare_db.c aide-with-ARF/src/compare_db.c
--- aide/src/compare_db.c	Sun Nov 13 21:33:19 2005
+++ aide-with-ARF/src/compare_db.c	Tue Nov 15 13:46:22 2005
@@ -690,7 +690,7 @@
     }else {
       int localignorelist=old->attr ^ ((db_line*)r->data)->attr;
       
-      if ((localignorelist&(~DB_NEWFILE))!=0) {
+      if ((localignorelist&(~(DB_NEWFILE|DB_RMFILE)))!=0) {
 	error(2,"File %s in databases has different attributes (here?), %i,%i\n",old->filename,old->attr,((db_line*)r->data)->attr);
       }
       
@@ -829,7 +829,7 @@
       }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;
 	}
@@ -842,7 +842,7 @@
 	}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 -Nru aide/src/gen_list.c aide-with-ARF/src/gen_list.c
--- aide/src/gen_list.c	Sun Nov 13 21:42:39 2005
+++ aide-with-ARF/src/gen_list.c	Tue Nov 15 13:45:57 2005
@@ -1102,7 +1102,7 @@
         oldData = node->old_data;
       }
 
-      localignorelist=(oldData->attr^newData->attr)&(~DB_NEWFILE);
+      localignorelist=(oldData->attr^newData->attr)&(~(DB_NEWFILE|DB_RMFILE));
 
       if (localignorelist!=0) {
         error(5,"File \"%s\" \"%s\" in databases has different attributes (here3), %i,%i\n",
@@ -1122,6 +1122,11 @@
       (file->attr & DB_NEWFILE) && 
       (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;
   }
 }
 


More information about the Aide mailing list