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