| 1 | /* |
| 2 | * Copyright 2010 Red Hat Inc., Durham, North Carolina. |
| 3 | * All Rights Reserved. |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Lesser General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2.1 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Lesser General Public |
| 16 | * License along with this library; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | * |
| 19 | * Authors: |
| 20 | * "Daniel Kopecek" <[email protected]> |
| 21 | */ |
| 22 | #ifndef OVAL_FTS_H |
| 23 | #define OVAL_FTS_Hcxx . . $ `src/OVAL/probes/oval_fts.h:23:9`! |
| 24 | |
| 25 | #include "oscap_platforms.h"cxx . . $ `<file>/compat/oscap_platforms.h`/ |
| 26 | |
| 27 | #include <sexp.h>cxx . . $ `<file>/src/OVAL/probes/SEAP/public/sexp.h`/ |
| 28 | #if defined(OS_SOLARIS) || defined(OS_AIX) |
| 29 | #include "fts_sun.h" |
| 30 | #else |
| 31 | #include <fts.h> |
| 32 | #endif |
| 33 | #include "fsdev.h"cxx . . $ `<file>/src/OVAL/probes/fsdev.h`/ |
| 34 | #include "common/oscap_pcre.h"cxx . . $ `<file>/src/common/oscap_pcre.h`/ |
| 35 | |
| 36 | #define ENT_GET_AREFcxx . . $ `src/OVAL/probes/oval_fts.h:36:9`!(ent, dst, attr_name, mandatory) \ |
| 37 | do { \ |
| 38 | if (((dst) = probe_ent_getattrval(ent, attr_name)) == NULL) { \ |
| 39 | if (mandatory) { \ |
| 40 | _F("Attribute `%s' is missing!\n", attr_name); \ |
| 41 | return (NULL); \ |
| 42 | } \ |
| 43 | } \ |
| 44 | } while(0) |
| 45 | |
| 46 | #define ENT_GET_STRVALcxx . . $ `src/OVAL/probes/oval_fts.h:46:9`!(ent, dst, dstlen, zerolen_exp) \ |
| 47 | do { \ |
| 48 | SEXP_t *___r; \ |
| 49 | \ |
| 50 | if ((___r = probe_ent_getval(ent)) == NULL) { \ |
| 51 | dW("entity has no value!"); \ |
| 52 | return (NULL); \ |
| 53 | } else { \ |
| 54 | if (!SEXP_stringp(___r)) { \ |
| 55 | _F("invalid type\n"); \ |
| 56 | SEXP_free(___r); \ |
| 57 | return (NULL); \ |
| 58 | } \ |
| 59 | if (SEXP_string_length(___r) == 0) { \ |
| 60 | SEXP_free(___r); \ |
| 61 | zerolen_exp; \ |
| 62 | } else { \ |
| 63 | SEXP_string_cstr_r(___r, dst, dstlen); \ |
| 64 | SEXP_free(___r); \ |
| 65 | } \ |
| 66 | } \ |
| 67 | } while (0) |
| 68 | |
| 69 | typedef structcxx . . $ $anonymous_type_ebdee0feb58b991e_0# { |
| 70 | /* oval_fts_read_match_path() state */ |
| 71 | FTScxx . . $ FTS# *ofts_match_path_ftscxx . . $ $anonymous_type_ebdee0feb58b991e_0#ofts_match_path_fts.; |
| 72 | FTSENTcxx . . $ FTSENT# *ofts_match_path_fts_entcxx . . $ $anonymous_type_ebdee0feb58b991e_0#ofts_match_path_fts_ent.; |
| 73 | /* oval_fts_read_recurse_path() state */ |
| 74 | FTScxx . . $ FTS# *ofts_recurse_path_ftscxx . . $ $anonymous_type_ebdee0feb58b991e_0#ofts_recurse_path_fts.; |
| 75 | int ofts_recurse_path_fts_optscxx . . $ $anonymous_type_ebdee0feb58b991e_0#ofts_recurse_path_fts_opts.; |
| 76 | int ofts_recurse_path_curdepthcxx . . $ $anonymous_type_ebdee0feb58b991e_0#ofts_recurse_path_curdepth.; |
| 77 | char *ofts_recurse_path_pthcpycxx . . $ $anonymous_type_ebdee0feb58b991e_0#ofts_recurse_path_pthcpy.; |
| 78 | char *ofts_recurse_path_curpthcxx . . $ $anonymous_type_ebdee0feb58b991e_0#ofts_recurse_path_curpth.; |
| 79 | dev_tcxx . . $ dev_t# ofts_recurse_path_devidcxx . . $ $anonymous_type_ebdee0feb58b991e_0#ofts_recurse_path_devid.; |
| 80 | |
| 81 | oscap_pcre_tcxx . . $ oscap_pcre_t# *ofts_path_regexcxx . . $ $anonymous_type_ebdee0feb58b991e_0#ofts_path_regex.; |
| 82 | uint32_tcxx . . $ uint32_t# ofts_path_opcxx . . $ $anonymous_type_ebdee0feb58b991e_0#ofts_path_op.; |
| 83 | |
| 84 | SEXP_tcxx . . $ SEXP_t# *ofts_spathcxx . . $ $anonymous_type_ebdee0feb58b991e_0#ofts_spath.; |
| 85 | SEXP_tcxx . . $ SEXP_t# *ofts_sfilenamecxx . . $ $anonymous_type_ebdee0feb58b991e_0#ofts_sfilename.; |
| 86 | SEXP_tcxx . . $ SEXP_t# *ofts_sfilepathcxx . . $ $anonymous_type_ebdee0feb58b991e_0#ofts_sfilepath.; |
| 87 | SEXP_tcxx . . $ SEXP_t# *resultcxx . . $ $anonymous_type_ebdee0feb58b991e_0#result.; |
| 88 | |
| 89 | int max_depthcxx . . $ $anonymous_type_ebdee0feb58b991e_0#max_depth.; |
| 90 | int directioncxx . . $ $anonymous_type_ebdee0feb58b991e_0#direction.; |
| 91 | int recursecxx . . $ $anonymous_type_ebdee0feb58b991e_0#recurse.; |
| 92 | int filesystemcxx . . $ $anonymous_type_ebdee0feb58b991e_0#filesystem.; |
| 93 | int followingcxx . . $ $anonymous_type_ebdee0feb58b991e_0#following.; |
| 94 | |
| 95 | fsdev_tcxx . . $ fsdev_t# *localdevscxx . . $ $anonymous_type_ebdee0feb58b991e_0#localdevs.; |
| 96 | const char *prefixcxx . . $ $anonymous_type_ebdee0feb58b991e_0#prefix.; |
| 97 | } OVAL_FTScxx . . $ OVAL_FTS#; |
| 98 | |
| 99 | #define OVAL_RECURSE_DIRECTION_NONEcxx . . $ `src/OVAL/probes/oval_fts.h:99:9`! 0 /* default */ |
| 100 | #define OVAL_RECURSE_DIRECTION_DOWNcxx . . $ `src/OVAL/probes/oval_fts.h:100:9`! 1 |
| 101 | #define OVAL_RECURSE_DIRECTION_UPcxx . . $ `src/OVAL/probes/oval_fts.h:101:9`! 2 |
| 102 | |
| 103 | #define OVAL_RECURSE_FILEScxx . . $ `src/OVAL/probes/oval_fts.h:103:9`! 0x01 |
| 104 | #define OVAL_RECURSE_DIRScxx . . $ `src/OVAL/probes/oval_fts.h:104:9`! 0x02 |
| 105 | #define OVAL_RECURSE_SYMLINKScxx . . $ `src/OVAL/probes/oval_fts.h:105:9`! 0x04 |
| 106 | |
| 107 | #define OVAL_RECURSE_SYMLINKS_AND_DIRScxx . . $ `src/OVAL/probes/oval_fts.h:107:9`! (OVAL_RECURSE_SYMLINKScxx . . $ `src/OVAL/probes/oval_fts.h:105:9`!|OVAL_RECURSE_DIRScxx . . $ `src/OVAL/probes/oval_fts.h:104:9`!) /* default */ |
| 108 | #define OVAL_RECURSE_FILES_AND_DIRScxx . . $ `src/OVAL/probes/oval_fts.h:108:9`! (OVAL_RECURSE_FILEScxx . . $ `src/OVAL/probes/oval_fts.h:103:9`!|OVAL_RECURSE_SYMLINKScxx . . $ `src/OVAL/probes/oval_fts.h:105:9`!) |
| 109 | |
| 110 | #define OVAL_RECURSE_FS_LOCALcxx . . $ `src/OVAL/probes/oval_fts.h:110:9`! 0 |
| 111 | #define OVAL_RECURSE_FS_DEFINEDcxx . . $ `src/OVAL/probes/oval_fts.h:111:9`! 1 |
| 112 | #define OVAL_RECURSE_FS_ALLcxx . . $ `src/OVAL/probes/oval_fts.h:112:9`! 2 /* default */ |
| 113 | |
| 114 | typedef structcxx . . $ $anonymous_type_ebdee0feb58b991e_1# { |
| 115 | char *filecxx . . $ $anonymous_type_ebdee0feb58b991e_1#file.; |
| 116 | size_t file_lencxx . . $ $anonymous_type_ebdee0feb58b991e_1#file_len.; |
| 117 | char *pathcxx . . $ $anonymous_type_ebdee0feb58b991e_1#path.; |
| 118 | size_t path_lencxx . . $ $anonymous_type_ebdee0feb58b991e_1#path_len.; |
| 119 | unsigned int fts_infocxx . . $ $anonymous_type_ebdee0feb58b991e_1#fts_info.; |
| 120 | } OVAL_FTSENTcxx . . $ OVAL_FTSENT#; |
| 121 | |
| 122 | /* |
| 123 | * OVAL FTS public API |
| 124 | */ |
| 125 | OVAL_FTScxx . . $ OVAL_FTS# *oval_fts_open_prefixedcxx . . $ oval_fts_open_prefixed(d2d91f0fe545c5d7).(const char *prefix, SEXP_tcxx . . $ SEXP_t# *path, SEXP_tcxx . . $ SEXP_t# *filename, SEXP_tcxx . . $ SEXP_t# *filepath, SEXP_tcxx . . $ SEXP_t# *behaviors, SEXP_tcxx . . $ SEXP_t#* result); |
| 126 | OVAL_FTScxx . . $ OVAL_FTS# *oval_fts_opencxx . . $ oval_fts_open(ec388d9c23d3f6cb).(SEXP_tcxx . . $ SEXP_t# *path, SEXP_tcxx . . $ SEXP_t# *filename, SEXP_tcxx . . $ SEXP_t# *filepath, SEXP_tcxx . . $ SEXP_t# *behaviors, SEXP_tcxx . . $ SEXP_t#* result); |
| 127 | OVAL_FTSENTcxx . . $ OVAL_FTSENT# *oval_fts_readcxx . . $ oval_fts_read(592d87f37bbdbe51).(OVAL_FTScxx . . $ OVAL_FTS# *ofts); |
| 128 | int oval_fts_closecxx . . $ oval_fts_close(cd898f79c195c42c).(OVAL_FTScxx . . $ OVAL_FTS# *ofts); |
| 129 | |
| 130 | void oval_ftsent_freecxx . . $ oval_ftsent_free(7e09326da17d8ab0).(OVAL_FTSENTcxx . . $ OVAL_FTSENT# *ofts_ent); |
| 131 | |
| 132 | #endif /* OVAL_FTS_H */ |