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