[1] | 1 | /* SAMHAIN file system integrity testing */
|
---|
| 2 | /* Copyright (C) 1999, 2000 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 | #ifndef SH_FILES_H
|
---|
| 21 | #define SH_FILES_H
|
---|
| 22 |
|
---|
[373] | 23 | void sh_audit_mark (const char * file);
|
---|
[415] | 24 | void sh_audit_commit ();
|
---|
[294] | 25 | void sh_audit_delete_all ();
|
---|
| 26 | char * sh_audit_fetch (char * file, time_t time, char * result, size_t rsize);
|
---|
| 27 |
|
---|
[131] | 28 | struct sh_dirent {
|
---|
| 29 | char * sh_d_name;
|
---|
| 30 | struct sh_dirent * next;
|
---|
| 31 | };
|
---|
| 32 |
|
---|
[457] | 33 | /* Check whether a file is in the config
|
---|
| 34 | */
|
---|
| 35 | char * sh_files_findfile(const char * path);
|
---|
[294] | 36 |
|
---|
[457] | 37 | /* Find the most specific directory in the config
|
---|
| 38 | */
|
---|
| 39 | char * sh_files_find_mostspecific_dir(const char * path);
|
---|
| 40 |
|
---|
[131] | 41 | /* free a directory listing
|
---|
| 42 | */
|
---|
| 43 | void kill_sh_dirlist (struct sh_dirent * dirlist);
|
---|
| 44 |
|
---|
[138] | 45 | #ifdef NEED_ADD_DIRENT
|
---|
[131] | 46 | /* add an entry to a directory listing
|
---|
| 47 | */
|
---|
| 48 | struct sh_dirent * addto_sh_dirlist (struct dirent * thisEntry,
|
---|
| 49 | struct sh_dirent * dirlist);
|
---|
[138] | 50 | #endif
|
---|
| 51 |
|
---|
[1] | 52 | /* register exceptions to hardlink check
|
---|
| 53 | */
|
---|
[22] | 54 | int sh_files_hle_reg (const char * str);
|
---|
[1] | 55 |
|
---|
[371] | 56 | /* Check for new files/dirs matching configured glob patterns.
|
---|
[256] | 57 | */
|
---|
| 58 | void sh_files_check_globPatterns();
|
---|
| 59 |
|
---|
[371] | 60 | /* Check for new files (only) matching configured glob patterns.
|
---|
| 61 | */
|
---|
| 62 | void sh_files_check_globFilePatterns();
|
---|
| 63 |
|
---|
[1] | 64 | /* check the setup
|
---|
| 65 | */
|
---|
| 66 | int sh_files_test_setup (void);
|
---|
| 67 |
|
---|
| 68 | /* check if allignore
|
---|
| 69 | */
|
---|
| 70 | int sh_files_is_allignore (char * str);
|
---|
| 71 |
|
---|
| 72 | /* activate hardlink check
|
---|
| 73 | */
|
---|
[22] | 74 | int sh_files_check_hardlinks (const char * opt);
|
---|
[1] | 75 |
|
---|
[254] | 76 | /* check rsrc fork (Mac OS X)
|
---|
| 77 | */
|
---|
| 78 | int sh_files_use_rsrc(const char * str);
|
---|
| 79 |
|
---|
[1] | 80 | /* set recursion depth
|
---|
| 81 | */
|
---|
| 82 | int sh_files_setrec (void);
|
---|
| 83 |
|
---|
| 84 | /* report only once
|
---|
| 85 | */
|
---|
[22] | 86 | int sh_files_reportonce(const char * c);
|
---|
[1] | 87 |
|
---|
| 88 | /* report full details
|
---|
| 89 | */
|
---|
[22] | 90 | int sh_files_fulldetail(const char * c);
|
---|
[1] | 91 |
|
---|
| 92 | /* reset the 'checked' flag
|
---|
| 93 | */
|
---|
| 94 | void sh_dirs_reset(void);
|
---|
| 95 |
|
---|
| 96 | /* reset the 'checked' flag
|
---|
| 97 | */
|
---|
| 98 | void sh_files_reset(void);
|
---|
| 99 |
|
---|
| 100 | /* set maximum recursion level
|
---|
| 101 | */
|
---|
[20] | 102 | int sh_files_setrecursion (const char * flag_s);
|
---|
[1] | 103 |
|
---|
| 104 | /* select a directory stack 2=Two, else One (standard)
|
---|
| 105 | */
|
---|
| 106 | int set_dirList (int which);
|
---|
| 107 |
|
---|
| 108 | /* push a directory on the stack USER0
|
---|
| 109 | */
|
---|
[22] | 110 | int sh_files_pushdir_user0 (const char * dirName);
|
---|
[1] | 111 |
|
---|
| 112 | /* push a directory on the stack USER1
|
---|
| 113 | */
|
---|
[22] | 114 | int sh_files_pushdir_user1 (const char * dirName);
|
---|
[1] | 115 |
|
---|
[27] | 116 | /* push a directory on the stack USER2
|
---|
| 117 | */
|
---|
| 118 | int sh_files_pushdir_user2 (const char * dirName);
|
---|
| 119 |
|
---|
| 120 | /* push a directory on the stack USER3
|
---|
| 121 | */
|
---|
| 122 | int sh_files_pushdir_user3 (const char * dirName);
|
---|
| 123 |
|
---|
| 124 | /* push a directory on the stack USER4
|
---|
| 125 | */
|
---|
| 126 | int sh_files_pushdir_user4 (const char * dirName);
|
---|
| 127 |
|
---|
[1] | 128 | /* push a directory on the stack PRELINK
|
---|
| 129 | */
|
---|
[22] | 130 | int sh_files_pushdir_prelink (const char * dirName);
|
---|
[1] | 131 |
|
---|
| 132 | /* push a directory on the stack ATTR
|
---|
| 133 | */
|
---|
[22] | 134 | int sh_files_pushdir_attr (const char * dirName);
|
---|
[1] | 135 |
|
---|
| 136 | /* push a directory on the stack READONLY
|
---|
| 137 | */
|
---|
[22] | 138 | int sh_files_pushdir_ro (const char * dirName);
|
---|
[1] | 139 |
|
---|
| 140 | /* push a directory on the stack LOGFILE
|
---|
| 141 | */
|
---|
[22] | 142 | int sh_files_pushdir_log (const char * dirName);
|
---|
[1] | 143 |
|
---|
| 144 | /* push a directory on the stack GROWING LOGFILE
|
---|
| 145 | */
|
---|
[22] | 146 | int sh_files_pushdir_glog (const char * dirName);
|
---|
[1] | 147 |
|
---|
| 148 | /* push a directory on the stack IGNORE NONE
|
---|
| 149 | */
|
---|
[22] | 150 | int sh_files_pushdir_noig (const char * dirName);
|
---|
[1] | 151 |
|
---|
| 152 | /* push a directory on the stack IGNORE ALL
|
---|
| 153 | */
|
---|
[22] | 154 | int sh_files_pushdir_allig (const char * dirName);
|
---|
[1] | 155 |
|
---|
| 156 |
|
---|
| 157 | /* push a file on the stack USER0
|
---|
| 158 | */
|
---|
[22] | 159 | int sh_files_pushfile_user0 (const char * dirName);
|
---|
[1] | 160 |
|
---|
| 161 | /* push a file on the stack USER1
|
---|
| 162 | */
|
---|
[22] | 163 | int sh_files_pushfile_user1 (const char * dirName);
|
---|
[1] | 164 |
|
---|
[27] | 165 | /* push a file on the stack USER2
|
---|
| 166 | */
|
---|
| 167 | int sh_files_pushfile_user2 (const char * dirName);
|
---|
| 168 |
|
---|
| 169 | /* push a file on the stack USER3
|
---|
| 170 | */
|
---|
| 171 | int sh_files_pushfile_user3 (const char * dirName);
|
---|
| 172 |
|
---|
| 173 | /* push a file on the stack USER4
|
---|
| 174 | */
|
---|
| 175 | int sh_files_pushfile_user4 (const char * dirName);
|
---|
| 176 |
|
---|
[1] | 177 | /* push a file on the stack PRELINK
|
---|
| 178 | */
|
---|
[22] | 179 | int sh_files_pushfile_prelink (const char * dirName);
|
---|
[1] | 180 |
|
---|
| 181 | /* push a file on the stack ATTR
|
---|
| 182 | */
|
---|
[22] | 183 | int sh_files_pushfile_attr (const char * dirName);
|
---|
[1] | 184 |
|
---|
| 185 | /* push a file on the stack READONLY
|
---|
| 186 | */
|
---|
[22] | 187 | int sh_files_pushfile_ro (const char * dirName);
|
---|
[1] | 188 |
|
---|
| 189 | /* push a file on the stack LOGFILE
|
---|
| 190 | */
|
---|
[22] | 191 | int sh_files_pushfile_log (const char * dirName);
|
---|
[1] | 192 |
|
---|
| 193 | /* push a file on the stack GROWING LOGFILE
|
---|
| 194 | */
|
---|
[22] | 195 | int sh_files_pushfile_glog (const char * dirName);
|
---|
[1] | 196 |
|
---|
| 197 | /* push a file on the stack IGNORE NONE
|
---|
| 198 | */
|
---|
[22] | 199 | int sh_files_pushfile_noig (const char * dirName);
|
---|
[1] | 200 |
|
---|
| 201 | /* push a file on the stack IGNORE ALL
|
---|
| 202 | */
|
---|
[22] | 203 | int sh_files_pushfile_allig (const char * dirName);
|
---|
[1] | 204 |
|
---|
| 205 |
|
---|
| 206 | /* check directories on the stack
|
---|
| 207 | */
|
---|
| 208 | unsigned long sh_dirs_chk (int which);
|
---|
| 209 |
|
---|
| 210 | /* check files on the stack
|
---|
| 211 | */
|
---|
| 212 | unsigned long sh_files_chk (void);
|
---|
| 213 |
|
---|
[256] | 214 | int sh_files_delglobstack (void);
|
---|
| 215 |
|
---|
[1] | 216 | int sh_files_deldirstack (void);
|
---|
| 217 |
|
---|
| 218 | int sh_files_delfilestack (void);
|
---|
| 219 |
|
---|
| 220 | /* redefine policies
|
---|
| 221 | */
|
---|
[22] | 222 | int sh_files_redef_user0(const char * str);
|
---|
| 223 | int sh_files_redef_user1(const char * str);
|
---|
[27] | 224 | int sh_files_redef_user2(const char * str);
|
---|
| 225 | int sh_files_redef_user3(const char * str);
|
---|
| 226 | int sh_files_redef_user4(const char * str);
|
---|
[22] | 227 | int sh_files_redef_prelink(const char * str);
|
---|
| 228 | int sh_files_redef_readonly(const char * str);
|
---|
| 229 | int sh_files_redef_loggrow(const char * str);
|
---|
| 230 | int sh_files_redef_logfiles(const char * str);
|
---|
| 231 | int sh_files_redef_attributes(const char * str);
|
---|
| 232 | int sh_files_redef_noignore(const char * str);
|
---|
| 233 | int sh_files_redef_allignore(const char * str);
|
---|
[1] | 234 |
|
---|
[367] | 235 | ShFileType sh_files_filecheck (int class, unsigned long check_mask,
|
---|
[373] | 236 | const char * dirName,
|
---|
| 237 | const char * infileName,
|
---|
[367] | 238 | int * reported,
|
---|
| 239 | int rsrcflag);
|
---|
[1] | 240 |
|
---|
[373] | 241 | int sh_files_checkdir (int iclass, unsigned long check_mask,
|
---|
| 242 | int idepth, char * iname,
|
---|
| 243 | char * relativeName);
|
---|
[367] | 244 |
|
---|
[373] | 245 | int sh_files_search_file(char * name, int * class,
|
---|
| 246 | unsigned long *check_mask, int * reported);
|
---|
| 247 | int sh_files_search_dir(char * name, int * class,
|
---|
| 248 | unsigned long *check_mask, int *reported,
|
---|
| 249 | int * rdepth);
|
---|
| 250 | void sh_files_set_file_reported(const char * name);
|
---|
| 251 | void sh_files_clear_file_reported(const char * name);
|
---|
| 252 |
|
---|
[1] | 253 | #endif
|
---|
| 254 |
|
---|
| 255 |
|
---|
| 256 |
|
---|
| 257 |
|
---|