summaryrefslogtreecommitdiffstats
path: root/include/sh_files.h
blob: 15ad5518235cd81fb28303bf741e1160cf56a7f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
/* SAMHAIN file system integrity testing                                   */
/* Copyright (C) 1999, 2000 Rainer Wichmann                                */
/*                                                                         */
/*  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., 675 Mass Ave, Cambridge, MA 02139, USA.              */

#ifndef SH_FILES_H
#define SH_FILES_H

void sh_audit_mark (const char * file);
void sh_audit_commit ();
void sh_audit_delete_all ();
int  sh_audit_set_flags(const char * str);
char * sh_audit_fetch (char * file, time_t mtime, time_t ctime, time_t atime, char * result, size_t rsize);

struct sh_dirent {
  char             * sh_d_name;
  struct sh_dirent * next;
};

/* Fix the check flags
 */
void sh_files_fixup_mask (int class, unsigned long * check_flags);

/* Dequote a filename in the config file
 */
char * sh_files_parse_input(const char * str_s, size_t * len);

/* Check whether a file is in the config 
 */
char * sh_files_findfile(const char * path);

/* Find the most specific directory in the config
 */
char * sh_files_find_mostspecific_dir(const char * path);

/* free a directory listing
 */
void kill_sh_dirlist (struct sh_dirent * dirlist);

#ifdef NEED_ADD_DIRENT
/* add an entry to a directory listing
 */
struct sh_dirent * addto_sh_dirlist (struct dirent * thisEntry, 
				     struct sh_dirent * dirlist);
#endif

/* register exceptions to hardlink check
 */
int sh_files_hle_reg (const char * str);

/* Check for new files/dirs matching configured glob patterns.
 */
void sh_files_check_globPatterns();

/* Check for new files (only) matching configured glob patterns.
 */
void sh_files_check_globFilePatterns();

/* check the setup
 */
int sh_files_test_setup (void);

/* check if allignore
 */
int sh_files_is_allignore (char * str);

/* activate hardlink check
 */
int sh_files_check_hardlinks (const char * opt);

/* check  rsrc fork (Mac OS X)
 */
int sh_files_use_rsrc(const char * str);

/* set recursion depth
 */
int sh_files_setrec (void);

/* report only once
 */
int sh_files_reportonce(const char * c);

/* report full details
 */
int sh_files_fulldetail(const char * c);

/* reset the 'checked' flag
 */
void sh_dirs_reset(void);

/* reset the 'checked' flag
 */
void sh_files_reset(void);

/* set maximum recursion level
 */
int sh_files_setrecursion (const char * flag_s);

/* select a directory stack 2=Two, else One (standard)
 */
int set_dirList (int which);

/* push a directory on the stack USER0
 */
int  sh_files_pushdir_user0 (const char * dirName);

/* push a directory on the stack USER1
 */
int  sh_files_pushdir_user1 (const char * dirName);

/* push a directory on the stack USER2
 */
int  sh_files_pushdir_user2 (const char * dirName);

/* push a directory on the stack USER3
 */
int  sh_files_pushdir_user3 (const char * dirName);

/* push a directory on the stack USER4
 */
int  sh_files_pushdir_user4 (const char * dirName);

/* push a directory on the stack PRELINK
 */
int  sh_files_pushdir_prelink (const char * dirName);

/* push a directory on the stack ATTR
 */
int  sh_files_pushdir_attr (const char * dirName);

/* push a directory on the stack READONLY
 */
int  sh_files_pushdir_ro (const char * dirName);

/* push a directory on the stack LOGFILE
 */
int  sh_files_pushdir_log (const char * dirName);

/* push a directory on the stack GROWING LOGFILE
 */
int  sh_files_pushdir_glog (const char * dirName);

/* push a directory on the stack IGNORE NONE
 */
int  sh_files_pushdir_noig (const char * dirName);

/* push a directory on the stack IGNORE ALL 
 */
int  sh_files_pushdir_allig (const char * dirName);


/* push a file on the stack USER0
 */
int  sh_files_pushfile_user0 (const char * dirName);

/* push a file on the stack USER1
 */
int  sh_files_pushfile_user1 (const char * dirName);

/* push a file on the stack USER2
 */
int  sh_files_pushfile_user2 (const char * dirName);

/* push a file on the stack USER3
 */
int  sh_files_pushfile_user3 (const char * dirName);

/* push a file on the stack USER4
 */
int  sh_files_pushfile_user4 (const char * dirName);

/* push a file on the stack PRELINK
 */
int  sh_files_pushfile_prelink (const char * dirName);

/* push a file on the stack ATTR
 */
int  sh_files_pushfile_attr (const char * dirName);

/* push a file on the stack READONLY
 */
int  sh_files_pushfile_ro (const char * dirName);

/* push a file on the stack LOGFILE
 */
int  sh_files_pushfile_log (const char * dirName);

/* push a file on the stack GROWING LOGFILE
 */
int  sh_files_pushfile_glog (const char * dirName);

/* push a file on the stack IGNORE NONE
 */
int  sh_files_pushfile_noig (const char * dirName);

/* push a file on the stack IGNORE ALL
 */
int  sh_files_pushfile_allig (const char * dirName);


/* check directories on the stack
 */
unsigned long sh_dirs_chk       (int which);

/* check files on the stack
 */
unsigned long sh_files_chk       (void);

int sh_files_delglobstack (void);

int sh_files_deldirstack (void);

int sh_files_delfilestack (void);

/* redefine policies
 */
int sh_files_redef_user0(const char * str);
int sh_files_redef_user1(const char * str);
int sh_files_redef_user2(const char * str);
int sh_files_redef_user3(const char * str);
int sh_files_redef_user4(const char * str);
int sh_files_redef_prelink(const char * str);
int sh_files_redef_readonly(const char * str);
int sh_files_redef_loggrow(const char * str);
int sh_files_redef_logfiles(const char * str);
int sh_files_redef_attributes(const char * str);
int sh_files_redef_noignore(const char * str);
int sh_files_redef_allignore(const char * str);

ShFileType sh_files_filecheck (int class, unsigned long check_flags,
			       const char * dirName, 
			       const char * infileName,
			       int * reported, 
			       int rsrcflag);

int sh_files_checkdir (int iclass, unsigned long check_flags, 
		       int idepth, char * iname, 
		       char * relativeName);

int sh_files_search_file(char * name, int * class, 
			 unsigned long *check_flags, int * reported);
int sh_files_search_dir(char * name, int * class, 
			unsigned long *check_flags, int *reported,
			int * rdepth);
void sh_files_set_file_reported(const char * name);
void sh_files_clear_file_reported(const char * name);

#endif