source: trunk/include/sh_hash.h@ 358

Last change on this file since 358 was 356, checked in by katerina, 13 years ago

Patch for ticket #261: show policy for checked files in verbose mode.

File size: 4.8 KB
RevLine 
[1]1/* SAMHAIN file system integrity testing */
2/* Copyright (C) 1999 Rainer Wichmann */
3/* */
4/* This program is free software; you can redistribute it */
5/* and/or modify */
6/* it under the terms of the GNU General Public License as */
7/* published by */
8/* the Free Software Foundation; either version 2 of the License, or */
9/* (at your option) any later version. */
10/* */
11/* This program is distributed in the hope that it will be useful, */
12/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
13/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
14/* GNU General Public License for more details. */
15/* */
16/* You should have received a copy of the GNU General Public License */
17/* along with this program; if not, write to the Free Software */
18/* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20
21#ifndef SH_HASH_H
22#define SH_HASH_H
23
24#include <limits.h>
25
26#include "samhain.h"
27#include "sh_unix.h"
28#include "sh_error.h"
29
[356]30/* convert to policy string
31 */
32const char * sh_hash_getpolicy(int class);
33
[1]34/* format a uint64
35 */
[170]36char * sh_hash_size_format(void);
[1]37
38/* report on a missing file
39 */
40int hashreport_missing( char *fullpath, int level);
41
[305]42/* remove internal db record for a file
43 */
44void sh_hash_remove (const char * path);
45
[1]46/* write database to stdout
47 */
[20]48int sh_hash_pushdata_stdout (const char * str);
[1]49
50/* version string for database
51 */
[22]52int sh_hash_version_string(const char * str);
[1]53
[205]54/* Dont report on ctm/mtm change for directories
55 */
56int sh_hash_loosedircheck(const char * str);
57
[1]58/* List database content
59 */
[20]60int sh_hash_list_db (const char * db_file);
[1]61
[169]62/* List database content for a single file
63 */
64int set_list_file (const char * c);
65
[1]66/* List database content with full detail
67 */
[20]68int set_full_detail (const char * c);
[1]69
70/* List database content with full detail, comma delimited
71 */
[20]72int set_list_delimited (const char * c);
[1]73
74/* Read the database from disk.
75 */
76void sh_hash_init (void);
77
78/* Check whether a file is present in the database.
79 */
[294]80int sh_hash_have_it (const char * newname);
[1]81
82/* Get a file if it is present in the database.
[294]83 * If fileHash != NULL also return checksum.
[1]84 */
[294]85int sh_hash_get_it (const char * newname, file_type * tmpFile, char * fileHash);
[1]86
87/* Delete the database from memory.
88 */
89void sh_hash_hashdelete (void);
90
91/* Insert a file into the database.
92 */
93void sh_hash_pushdata (file_type * buf, char * fileHash);
94
95/* reset sh_hash_pushdata to use 'update' in daemon mode
96 */
[170]97void sh_hash_pushdata_reset (void);
[1]98
99/* Insert a file into the in-memory database.
100 */
101void sh_hash_pushdata_memory (file_type * theFile, char * fileHash);
102
[115]103/* Get file flags from in-memory database
104 */
105int sh_hash_getflags (char * filename);
106
107/* Set file flags in in-memory database
108 */
109int sh_hash_setflags (char * filename, int flags);
110
111/* Set a file flag in in-memory database
112 */
113void sh_hash_addflag (char * filename, int flag);
114
[1]115/* Compare a file with its status in the database.
116 */
117int sh_hash_compdata (int class, file_type * theFile, char * fileHash,
118 char * policy_override, int severity_override);
119
120/* Search for files in the database that have been deleted from disk.
121 */
122void sh_hash_unvisited (ShErrLevel level);
123
[294]124/* Search for unvisited entries in the database, custom error handler.
125 */
126void sh_hash_unvisited_custom (char prefix, void(*handler)(const char * key));
127
[1]128/* Set a file's status to 'visited'. This is required for
129 * files that should be ignored, and may be present in the
130 * database, but not on disk.
131 */
132int sh_hash_set_visited (char * newname);
133
134/* As above, but only set the 'visited' flag
135 */
136int sh_hash_set_visited_true (char * newname);
137
138/* cause the record to be deleted without a 'missing' message
139 */
140int sh_hash_set_missing (char * newname);
141
142/* Make a complete directory tree invisible
143 */
144int hash_remove_tree (char * s);
145
146/* Make every entry visible
147 */
148int hash_full_tree (void);
149
[294]150/* Insert data.
151 * 'key' -> path
152 * 'str' -> binary with size 'size'
[1]153 */
[294]154struct store2db {
155 UINT64 val0;
156 UINT64 val1;
157 UINT64 val2;
158 UINT64 val3;
159 char checksum[KEY_LEN+1];
160 unsigned char * str;
161 int size;
162};
[1]163
[294]164void sh_hash_push2db (const char * key, struct store2db * save);
165
166
[1]167/* Retrieve data
168 */
[294]169char * sh_hash_db2pop (const char * key, struct store2db * get);
[1]170
[294]171
[1]172/* Write out database
173 */
[170]174int sh_hash_writeout(void);
[1]175#endif
Note: See TracBrowser for help on using the repository browser.