📄 compare_db.c
字号:
/* aide, Advanced Intrusion Detection Environment * * Copyright (C) 1999,2000,2001,2002 Rami Lehti, Pablo Virolainen * $Header: /cvs-root-aide/aide2/src/compare_db.c,v 1.9 2002/05/30 09:42:46 pablo Exp $ * * 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 */#include <stdlib.h>#include <string.h>#include <time.h>#include <sys/stat.h>#include "base64.h"#include "report.h"#include "db_config.h"#include "aide.h"#include "gnu_regex.h"#include "gen_list.h"#include "list.h"#include "db.h"#include "util.h"#include "commandconf.h"#include "gen_list.h"/*for locale support*/#include "locale-aide.h"/*for locale support*/#include "md.h"/*************//* contruction area for report lines */const int old_col = 12; const int new_col = 40; const int part_len = 40; /* usable length of line[] */char oline[40];char nline[40];const char* entry_format=" %-9s: %-34s, %-34s\n";/*************/list* find_line_match(db_line* line,list* l){ list*r=NULL; /* Filename cannot be NULL. Or if it is NULL then we have done something completly wrong. So we don't check if filename if null. db_line:s sould also be non null */ for(r=l;r;r=r->next){ if(strcmp(line->filename,((db_line*)r->data)->filename)==0){ return r; } } if(l!=NULL){ for(r=l->prev;r;r=r->prev){ if(strcmp(line->filename,((db_line*)r->data)->filename)==0){ return r; } } } return NULL;}#ifdef WITH_ACLint compare_single_acl(aclent_t* a1,aclent_t* a2) { if (a1->a_type!=a2->a_type || a1->a_id!=a2->a_id || a1->a_perm!=a2->a_perm) { return RETFAIL; } return RETOK;}int compare_acl(acl_type* a1,acl_type* a2) { int i; if (a1==NULL && a2==NULL) { return RETOK; } if (a1==NULL || a2==NULL) { return RETFAIL; } if (a1->entries!=a2->entries) { return RETFAIL; } /* Sort em up. */ aclsort(a1->entries,0,a1->acl); aclsort(a2->entries,0,a2->acl); for(i=0;i<a1->entries;i++){ if (compare_single_acl(a1->acl+i,a2->acl+i)==RETFAIL) { return RETFAIL; } } return RETOK;}#endifint compare_md_entries(byte* e1,byte* e2,int len){ error(255,"Debug, compare_md_entreis %p %p\n",e1,e2); if(e1!=NULL && e2!=NULL){ if(strncmp(e1,e2,len)!=0){ return RETFAIL; }else{ return RETOK; } } else { /* At least the other is NULL */ if(e1==NULL && e2==NULL){ return RETOK; }else{ return RETFAIL; } } return RETFAIL;}/* We assume - no null parameters - same filename - something else? - ignorelist kertoo mit
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -