Blame include/gen_list.h

Packit 762fc5
/* aide, Advanced Intrusion Detection Environment
Packit 762fc5
 *
Packit 762fc5
 * Copyright (C) 1999-2002,2006,2010,2016 Rami Lehti,Pablo Virolainen,
Packit 762fc5
 * Richard van den Berg, Hannes von Haugwitz
Packit 762fc5
 * $Header$
Packit 762fc5
 *
Packit 762fc5
 * This program is free software; you can redistribute it and/or
Packit 762fc5
 * modify it under the terms of the GNU General Public License as
Packit 762fc5
 * published by the Free Software Foundation; either version 2 of the
Packit 762fc5
 * License, or (at your option) any later version.
Packit 762fc5
 *
Packit 762fc5
 * This program is distributed in the hope that it will be useful, but
Packit 762fc5
 * WITHOUT ANY WARRANTY; without even the implied warranty of  
Packit 762fc5
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Packit 762fc5
 * General Public License for more details.
Packit 762fc5
 *
Packit 762fc5
 * You should have received a copy of the GNU General Public License
Packit 762fc5
 * along with this program; if not, write to the Free Software
Packit 762fc5
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
Packit 762fc5
 */
Packit 762fc5
Packit 762fc5
#ifndef _GEN_LIST_H_INCLUDED
Packit 762fc5
#define _GEN_LIST_H_INCLUDED
Packit 762fc5
#include <pcre.h>
Packit 762fc5
#include "seltree.h"
Packit 762fc5
#include "list.h"
Packit 762fc5
Packit 762fc5
#define RESTRICTION_TYPE unsigned int
Packit 762fc5
#define RESTRICTION_FT_REG   (1U<<0) /* file */
Packit 762fc5
#define RESTRICTION_FT_DIR   (1U<<1) /* dir */
Packit 762fc5
#define RESTRICTION_FT_FIFO  (1U<<2) /* fifo */
Packit 762fc5
#define RESTRICTION_FT_LNK   (1U<<3) /* link */
Packit 762fc5
#define RESTRICTION_FT_BLK   (1U<<4) /* block device */
Packit 762fc5
#define RESTRICTION_FT_CHR   (1U<<5) /* char device */
Packit 762fc5
#define RESTRICTION_FT_SOCK  (1U<<6) /* socket */
Packit 762fc5
#define RESTRICTION_FT_DOOR  (1U<<7) /* door */
Packit 762fc5
#define RESTRICTION_FT_PORT  (1U<<8) /* port */
Packit 762fc5
#define RESTRICTION_NULL 0U
Packit 762fc5
Packit 762fc5
/* DB_FOO are anded together to form rx_rule's attr */
Packit 762fc5
Packit 762fc5
typedef struct rx_rule {
Packit 762fc5
  char* rx; /* Regular expression in text form */
Packit 762fc5
  pcre* crx; /* Compiled regexp */
Packit 762fc5
  DB_ATTR_TYPE attr; /* Which attributes to save */
Packit 762fc5
  long  conf_lineno; /* line no. of rule definition*/
Packit 762fc5
  RESTRICTION_TYPE restriction;
Packit 762fc5
} rx_rule;
Packit 762fc5
Packit 762fc5
int compare_node_by_path(const void *n1, const void *n2);
Packit 762fc5
Packit 762fc5
/* 
Packit 762fc5
 * gen_tree()
Packit 762fc5
 * Generates the file tree
Packit 762fc5
 * from rx_rule's
Packit 762fc5
 */
Packit 762fc5
seltree* gen_tree(list* prxlist,list* nrxlist,list* erxlist);
Packit 762fc5
Packit 762fc5
/* 
Packit 762fc5
 * populate_tree()
Packit 762fc5
 * Populate tree with data from disk and db 
Packit 762fc5
 * Also do comparing while adding to the tree
Packit 762fc5
 */
Packit 762fc5
void populate_tree(seltree* tree);
Packit 762fc5
Packit 762fc5
/*
Packit 762fc5
 * strrxtok()
Packit 762fc5
 * return a pointer to a copy of the non-regexp path part of the argument
Packit 762fc5
 */
Packit 762fc5
Packit 762fc5
char* strrxtok(char*);
Packit 762fc5
Packit 762fc5
int check_rxtree(char* filename,seltree* tree, DB_ATTR_TYPE* attr, mode_t perm);
Packit 762fc5
Packit 762fc5
db_line* get_file_attrs(char* filename,DB_ATTR_TYPE attr, struct AIDE_STAT_TYPE *fs);
Packit 762fc5
Packit 762fc5
seltree* get_seltree_node(seltree* tree,char* path);
Packit 762fc5
Packit 762fc5
#endif /*_GEN_LIST_H_INCLUDED*/