| 1 | /** |
| 2 | * @file xmlfilecontent_probe.c |
| 3 | * @brief xmlfilecontent probe |
| 4 | * @author "Tomas Heinrich" <[email protected]> |
| 5 | * |
| 6 | * 2010/06/13 [email protected] |
| 7 | * This probe is able to process an xmlfilecontent_object as defined in OVAL 5.4 and 5.5. |
| 8 | * |
| 9 | */ |
| 10 | |
| 11 | /* |
| 12 | * Copyright 2009 Red Hat Inc., Durham, North Carolina. |
| 13 | * All Rights Reserved. |
| 14 | * |
| 15 | * This library is free software; you can redistribute it and/or |
| 16 | * modify it under the terms of the GNU Lesser General Public |
| 17 | * License as published by the Free Software Foundation; either |
| 18 | * version 2.1 of the License, or (at your option) any later version. |
| 19 | * |
| 20 | * This library is distributed in the hope that it will be useful, |
| 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 23 | * Lesser General Public License for more details. |
| 24 | * |
| 25 | * You should have received a copy of the GNU Lesser General Public |
| 26 | * License along with this library; if not, write to the Free Software |
| 27 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 28 | * |
| 29 | * Authors: |
| 30 | * "Tomas Heinrich" <[email protected]> |
| 31 | */ |
| 32 | |
| 33 | /* |
| 34 | * xmlfilecontent probe: |
| 35 | * |
| 36 | * xmlfilecontent_object |
| 37 | * xmlfilecontentbehaviors behaviors |
| 38 | * string path |
| 39 | * string filename |
| 40 | * string xpath |
| 41 | * |
| 42 | * xmlfilecontent_item |
| 43 | * attrs |
| 44 | * id |
| 45 | * status_enum status |
| 46 | * string path |
| 47 | * string filename |
| 48 | * string xpath |
| 49 | * string value_of |
| 50 | */ |
| 51 | |
| 52 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`! |
| 53 | #include <config.h>cxx . . $ `<file>/build/config.h`/ |
| 54 | #endif |
| 55 | |
| 56 | #include <stdlib.h> |
| 57 | #include <string.h> |
| 58 | #include <limits.h> |
| 59 | |
| 60 | #include <libxml/tree.h> |
| 61 | #include <libxml/parser.h> |
| 62 | #include <libxml/xpath.h> |
| 63 | #include <libxml/xpathInternals.h> |
| 64 | #include <libxslt/xslt.h> |
| 65 | #include <libxslt/xsltInternals.h> |
| 66 | #include <libxslt/transform.h> |
| 67 | #include <libxslt/xsltutils.h> |
| 68 | |
| 69 | #include "_seap.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/_seap.h`/ |
| 70 | #include <probe-api.h>cxx . . $ `<file>/src/OVAL/probes/public/probe-api.h`/ |
| 71 | #include <probe/probe.h>cxx . . $ `<file>/src/OVAL/probes/probe/probe.h`/ |
| 72 | #include <probe/option.h>cxx . . $ `<file>/src/OVAL/probes/probe/option.h`/ |
| 73 | #include <oval_fts.h>cxx . . $ `<file>/src/OVAL/probes/oval_fts.h`/ |
| 74 | #include <common/debug_priv.h>cxx . . $ `<file>/src/common/debug_priv.h`/ |
| 75 | #include "xmlfilecontent_probe.h"cxx . . $ `<file>/src/OVAL/probes/independent/xmlfilecontent_probe.h`/ |
| 76 | |
| 77 | #define FILE_SEPARATORcxx . . $ `src/OVAL/probes/independent/xmlfilecontent_probe.c:77:9`! '/' |
| 78 | |
| 79 | struct pfdatacxx . . $ pfdata# { |
| 80 | SEXP_tcxx . . $ SEXP_t# *filename_entcxx . . $ pfdata#filename_ent.; |
| 81 | char *xpathcxx . . $ pfdata#xpath.; |
| 82 | probe_ctxcxx . . $ probe_ctx# *ctxcxx . . $ pfdata#ctx.; |
| 83 | }; |
| 84 | |
| 85 | static void dummy_err_funccxx . . $ dummy_err_func(1ac911bdc4e9a14d).(void * ctx, const char * msg, ...) |
| 86 | { |
| 87 | } |
| 88 | |
| 89 | int xmlfilecontent_probe_offline_mode_supportedcxx . . $ xmlfilecontent_probe_offline_mode_supported(b126dc7c1de90089).() |
| 90 | { |
| 91 | return PROBE_OFFLINE_OWNcxx . . $ PROBE_OFFLINE_OWN.; |
| 92 | } |
| 93 | |
| 94 | void *xmlfilecontent_probe_initcxx . . $ xmlfilecontent_probe_init(50c7df7de5344ebb).(void) |
| 95 | { |
| 96 | /* init libxml */ |
| 97 | //LIBXML_TEST_VERSION; |
| 98 | xmlInitParsercxx . . $ xmlInitParser(49f6e7a06ebc5aa8).(); |
| 99 | xmlSetGenericErrorFunccxx . . $ xmlSetGenericErrorFunc(ca1e9f6422436c5e).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, dummy_err_funccxx . . $ dummy_err_func(1ac911bdc4e9a14d).); |
| 100 | |
| 101 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 102 | } |
| 103 | |
| 104 | void xmlfilecontent_probe_finicxx . . $ xmlfilecontent_probe_fini(5d22bdacc48458e8).(void *arg) |
| 105 | { |
| 106 | (void)arg; |
| 107 | /* deinit libxml */ |
| 108 | xmlCleanupParsercxx . . $ xmlCleanupParser(49f6e7a06ebc5aa8).(); |
| 109 | } |
| 110 | |
| 111 | static xmlDocPtrcxx . . $ xmlDocPtr# strip_nscxx . . $ strip_ns(60addf61d8ba0c25).(xmlDocPtrcxx . . $ xmlDocPtr# doc) |
| 112 | { |
| 113 | const char template[] = |
| 114 | "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">" |
| 115 | " <xsl:template match=\"*\">" |
| 116 | " <xsl:element name=\"{local-name()}\">" |
| 117 | " <xsl:apply-templates select=\"node()|@*\"/>" |
| 118 | " </xsl:element>" |
| 119 | " </xsl:template>" |
| 120 | " <xsl:template match=\"@*\">" |
| 121 | " <xsl:attribute name=\"{local-name()}\">" |
| 122 | " <xsl:value-of select=\".\"/>" |
| 123 | " </xsl:attribute>" |
| 124 | " </xsl:template>" |
| 125 | "</xsl:stylesheet>"; |
| 126 | xmlDocPtrcxx . . $ xmlDocPtr# stylesheet_doc = xmlParseMemorycxx . . $ xmlParseMemory(48704c96f88d9177).(template, strlencxx . . $ strlen(751346f8406fd082).(template)); |
| 127 | if (stylesheet_doc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 128 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Can't parse the XSLT template\n"); |
| 129 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 130 | } |
| 131 | xsltStylesheetPtrcxx . . $ xsltStylesheetPtr# stylesheet = xsltParseStylesheetDoccxx . . $ xsltParseStylesheetDoc(6cecd8817736918e).(stylesheet_doc); |
| 132 | if (stylesheet == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 133 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Can't parse the XSLT stylesheet\n"); |
| 134 | xmlFreeDoccxx . . $ xmlFreeDoc(42de24d0ab3f771).(stylesheet_doc); |
| 135 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 136 | } |
| 137 | xmlDocPtrcxx . . $ xmlDocPtr# result = xsltApplyStylesheetcxx . . $ xsltApplyStylesheet(c492d5bb45bcb5f1).(stylesheet, doc, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 138 | if (result == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 139 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Can't apply XSLT on the document\n"); |
| 140 | } |
| 141 | xsltFreeStylesheetcxx . . $ xsltFreeStylesheet(a1c2d48010b0ec33).(stylesheet); |
| 142 | return result; |
| 143 | } |
| 144 | |
| 145 | static int process_filecxx . . $ process_file(a09588dd745e1c63).(const char *prefix, const char *path, const char *filename, struct pfdatacxx . . $ pfdata# *pfd, struct oscap_listcxx . . $ oscap_list# *blocked_paths) |
| 146 | { |
| 147 | int ret = 0, path_len, filename_len; |
| 148 | char *whole_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 149 | xmlDoccxx . . $ xmlDoc# *doc = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 150 | xmlDoccxx . . $ xmlDoc# *doc_no_ns = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 151 | xmlXPathContextcxx . . $ xmlXPathContext# *xpath_ctx = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 152 | xmlXPathObjectcxx . . $ xmlXPathObject# *xpath_obj = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 153 | SEXP_tcxx . . $ SEXP_t# *item = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 154 | SEXP_tcxx . . $ SEXP_t# *r0; |
| 155 | char filepath[PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!+1]; |
| 156 | |
| 157 | if (filename == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 158 | goto cleanup; |
| 159 | |
| 160 | path_len = strlencxx . . $ strlen(751346f8406fd082).(path); |
| 161 | filename_len = strlencxx . . $ strlen(751346f8406fd082).(filename); |
| 162 | whole_path = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof (char) * (path_len + filename_len + 2)); |
| 163 | |
| 164 | memcpycxx . . $ memcpy(cc817cb175f282d). (whole_path, path, sizeof (char) * path_len); |
| 165 | |
| 166 | if (whole_path[path_len - 1] != FILE_SEPARATORcxx . . $ `src/OVAL/probes/independent/xmlfilecontent_probe.c:77:9`!) { |
| 167 | whole_path[path_len] = FILE_SEPARATORcxx . . $ `src/OVAL/probes/independent/xmlfilecontent_probe.c:77:9`!; |
| 168 | ++path_len; |
| 169 | } |
| 170 | |
| 171 | memcpycxx . . $ memcpy(cc817cb175f282d).(whole_path + path_len, filename, filename_len + 1); |
| 172 | |
| 173 | if (probe_path_is_blockedcxx . . $ probe_path_is_blocked(6f786adec44f4a13).(whole_path, blocked_paths)) { |
| 174 | goto cleanup; |
| 175 | } |
| 176 | |
| 177 | if (prefix == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 178 | doc = xmlParseFilecxx . . $ xmlParseFile(c66d212a4d76caed).(whole_path); |
| 179 | } else { |
| 180 | char *path_with_prefix = oscap_path_joincxx . . $ oscap_path_join(a713fe7b9a57cf96).(prefix, whole_path); |
| 181 | doc = xmlParseFilecxx . . $ xmlParseFile(c66d212a4d76caed).(path_with_prefix); |
| 182 | freecxx . . $ free(5d22bdacc48458e8).(path_with_prefix); |
| 183 | } |
| 184 | |
| 185 | if (doc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 186 | SEXP_tcxx . . $ SEXP_t# *msg; |
| 187 | msg = probe_msg_creatfcxx . . $ probe_msg_creatf(2da488f08a70551b).(OVAL_MESSAGE_LEVEL_ERRORcxx . . $ OVAL_MESSAGE_LEVEL_ERROR., "Can't parse '%s'.", whole_path); |
| 188 | probe_cobj_add_msgcxx . . $ probe_cobj_add_msg(ef7ee42b5817e0be).(probe_ctx_getresultcxx . . $ probe_ctx_getresult(4299b6b53fa804a5).(pfd->ctxcxx . . $ pfdata#ctx.), msg); |
| 189 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(msg); |
| 190 | probe_cobj_set_flagcxx . . $ probe_cobj_set_flag(644bab5dffe689c).(probe_ctx_getresultcxx . . $ probe_ctx_getresult(4299b6b53fa804a5).(pfd->ctxcxx . . $ pfdata#ctx.), SYSCHAR_FLAG_ERRORcxx . . $ SYSCHAR_FLAG_ERROR.); |
| 191 | |
| 192 | ret = -1; |
| 193 | goto cleanup; |
| 194 | } |
| 195 | |
| 196 | /* Remove the namespace from the examined document. The XPath expressions |
| 197 | * will be evaluated as if the namespace is ignored. Even though the |
| 198 | * xmlfilecontent should use standardized XPath, existing content expects |
| 199 | * this behavior. |
| 200 | */ |
| 201 | doc_no_ns = strip_nscxx . . $ strip_ns(60addf61d8ba0c25).(doc); |
| 202 | if (doc_no_ns == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 203 | SEXP_tcxx . . $ SEXP_t# *msg; |
| 204 | msg = probe_msg_creatfcxx . . $ probe_msg_creatf(2da488f08a70551b).(OVAL_MESSAGE_LEVEL_ERRORcxx . . $ OVAL_MESSAGE_LEVEL_ERROR., |
| 205 | "Can't remove namespaces from '%s'.", whole_path); |
| 206 | probe_cobj_add_msgcxx . . $ probe_cobj_add_msg(ef7ee42b5817e0be).(probe_ctx_getresultcxx . . $ probe_ctx_getresult(4299b6b53fa804a5).(pfd->ctxcxx . . $ pfdata#ctx.), msg); |
| 207 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(msg); |
| 208 | probe_cobj_set_flagcxx . . $ probe_cobj_set_flag(644bab5dffe689c).(probe_ctx_getresultcxx . . $ probe_ctx_getresult(4299b6b53fa804a5).(pfd->ctxcxx . . $ pfdata#ctx.), SYSCHAR_FLAG_ERRORcxx . . $ SYSCHAR_FLAG_ERROR.); |
| 209 | ret = -1; |
| 210 | goto cleanup; |
| 211 | } |
| 212 | |
| 213 | /* evaluate xpath */ |
| 214 | xpath_ctx = xmlXPathNewContextcxx . . $ xmlXPathNewContext(87a056aba6f65ba7).(doc_no_ns); |
| 215 | if (xpath_ctx == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 216 | SEXP_tcxx . . $ SEXP_t# *msg; |
| 217 | msg = probe_msg_creatfcxx . . $ probe_msg_creatf(2da488f08a70551b).(OVAL_MESSAGE_LEVEL_ERRORcxx . . $ OVAL_MESSAGE_LEVEL_ERROR., "xmlXPathNewContext() error."); |
| 218 | probe_cobj_add_msgcxx . . $ probe_cobj_add_msg(ef7ee42b5817e0be).(probe_ctx_getresultcxx . . $ probe_ctx_getresult(4299b6b53fa804a5).(pfd->ctxcxx . . $ pfdata#ctx.), msg); |
| 219 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(msg); |
| 220 | probe_cobj_set_flagcxx . . $ probe_cobj_set_flag(644bab5dffe689c).(probe_ctx_getresultcxx . . $ probe_ctx_getresult(4299b6b53fa804a5).(pfd->ctxcxx . . $ pfdata#ctx.), SYSCHAR_FLAG_ERRORcxx . . $ SYSCHAR_FLAG_ERROR.); |
| 221 | |
| 222 | ret = -2; |
| 223 | goto cleanup; |
| 224 | } |
| 225 | |
| 226 | xpath_obj = xmlXPathEvalExpressioncxx . . $ xmlXPathEvalExpression(217f200a3c77f61d).(BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! pfd->xpathcxx . . $ pfdata#xpath., xpath_ctx); |
| 227 | if (xpath_obj == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 228 | SEXP_tcxx . . $ SEXP_t# *msg; |
| 229 | msg = probe_msg_creatfcxx . . $ probe_msg_creatf(2da488f08a70551b).(OVAL_MESSAGE_LEVEL_ERRORcxx . . $ OVAL_MESSAGE_LEVEL_ERROR., "xmlXPathEvalExpression() error"); |
| 230 | probe_cobj_add_msgcxx . . $ probe_cobj_add_msg(ef7ee42b5817e0be).(probe_ctx_getresultcxx . . $ probe_ctx_getresult(4299b6b53fa804a5).(pfd->ctxcxx . . $ pfdata#ctx.), msg); |
| 231 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(msg); |
| 232 | probe_cobj_set_flagcxx . . $ probe_cobj_set_flag(644bab5dffe689c).(probe_ctx_getresultcxx . . $ probe_ctx_getresult(4299b6b53fa804a5).(pfd->ctxcxx . . $ pfdata#ctx.), SYSCHAR_FLAG_ERRORcxx . . $ SYSCHAR_FLAG_ERROR.); |
| 233 | |
| 234 | ret = -3; |
| 235 | goto cleanup; |
| 236 | } |
| 237 | |
| 238 | /* Avoid 2 slashes */ |
| 239 | if (path_len >= 1 && path[path_len - 1] == FILE_SEPARATORcxx . . $ `src/OVAL/probes/independent/xmlfilecontent_probe.c:77:9`!) { |
| 240 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(filepath, PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!, "%s%s", path, filename); |
| 241 | } else { |
| 242 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(filepath, PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!, "%s%c%s", path, FILE_SEPARATORcxx . . $ `src/OVAL/probes/independent/xmlfilecontent_probe.c:77:9`!, filename); |
| 243 | } |
| 244 | |
| 245 | item = probe_item_createcxx . . $ probe_item_create(36b16a6622050a9c).(OVAL_INDEPENDENT_XML_FILE_CONTENTcxx . . $ OVAL_INDEPENDENT_XML_FILE_CONTENT., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 246 | "filepath", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., filepath, |
| 247 | "path", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., path, |
| 248 | "filename", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., filename, |
| 249 | "xpath", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., pfd->xpathcxx . . $ pfdata#xpath., |
| 250 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 251 | |
| 252 | dDcxx . . $ `src/common/debug_priv.h:64:9`!("xpath obj type: %d.", xpath_obj->type); |
| 253 | switch(xpath_obj->typecxx . . $ _xmlXPathObject#type.) { |
| 254 | case XPATH_BOOLEANcxx . . $ XPATH_BOOLEAN.: |
| 255 | { |
| 256 | SEXP_tcxx . . $ SEXP_t# *val; |
| 257 | int b; |
| 258 | |
| 259 | b = xmlXPathCastToBooleancxx . . $ xmlXPathCastToBoolean(bdff1aa12b1e9a18).(xpath_obj); |
| 260 | val = SEXP_number_newbcxx . . $ SEXP_number_newb(f1e7d218d08e4133).(b); |
| 261 | probe_item_ent_addcxx . . $ probe_item_ent_add(9f488d3b029fc9d1).(item, "value_of", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, val); |
| 262 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(val); |
| 263 | break; |
| 264 | } |
| 265 | case XPATH_NUMBERcxx . . $ XPATH_NUMBER.: |
| 266 | { |
| 267 | SEXP_tcxx . . $ SEXP_t# *val; |
| 268 | double d; |
| 269 | |
| 270 | d = xmlXPathCastToNumbercxx . . $ xmlXPathCastToNumber(6cdc9d181d3bb68c).(xpath_obj); |
| 271 | val = SEXP_number_newi_32cxx . . $ SEXP_number_newi_32(ac44525e09ce977a).(d); |
| 272 | probe_item_ent_addcxx . . $ probe_item_ent_add(9f488d3b029fc9d1).(item, "value_of", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, val); |
| 273 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(val); |
| 274 | break; |
| 275 | } |
| 276 | case XPATH_STRINGcxx . . $ XPATH_STRING.: |
| 277 | { |
| 278 | SEXP_tcxx . . $ SEXP_t# *val; |
| 279 | char *s; |
| 280 | |
| 281 | s = (char *) xmlXPathCastToStringcxx . . $ xmlXPathCastToString(1e1d1fd8c30d15b2).(xpath_obj); |
| 282 | val = SEXP_string_newfcxx . . $ SEXP_string_newf(b2137ed863725962).("%s", s); |
| 283 | xmlFreecxx . . $ xmlFree.(s); |
| 284 | probe_item_ent_addcxx . . $ probe_item_ent_add(9f488d3b029fc9d1).(item, "value_of", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, val); |
| 285 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(val); |
| 286 | break; |
| 287 | } |
| 288 | case XPATH_NODESETcxx . . $ XPATH_NODESET.: |
| 289 | { |
| 290 | int node_cnt, i; |
| 291 | xmlNodeSetcxx . . $ xmlNodeSet# *nodes; |
| 292 | xmlNodecxx . . $ xmlNode# *cur_node, **node_tab; |
| 293 | |
| 294 | nodes = xpath_obj->nodesetvalcxx . . $ _xmlXPathObject#nodesetval.; |
| 295 | if (nodes == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 296 | ret = -4; |
| 297 | goto cleanup; |
| 298 | } |
| 299 | |
| 300 | node_cnt = nodes->nodeNrcxx . . $ _xmlNodeSet#nodeNr.; |
| 301 | dDcxx . . $ `src/common/debug_priv.h:64:9`!("node_cnt: %d.", node_cnt); |
| 302 | if (node_cnt <= 0) { |
| 303 | ret = -5; |
| 304 | goto cleanup; |
| 305 | } else { |
| 306 | node_tab = nodes->nodeTabcxx . . $ _xmlNodeSet#nodeTab.; |
| 307 | for (i = 0; i < node_cnt; ++i) { |
| 308 | cur_node = node_tab[i]; |
| 309 | dDcxx . . $ `src/common/debug_priv.h:64:9`!("node[%d] line: %ld, name: '%s', type: %d.", |
| 310 | i, XML_GET_LINEcxx . . $ `<external>/15370075748625258712/tree.h:48:9`!(cur_node), cur_node->name, cur_node->type); |
| 311 | if (cur_node->typecxx . . $ _xmlNode#type. == XML_ATTRIBUTE_NODEcxx . . $ XML_ATTRIBUTE_NODE. |
| 312 | || cur_node->typecxx . . $ _xmlNode#type. == XML_TEXT_NODEcxx . . $ XML_TEXT_NODE.) { |
| 313 | xmlCharcxx . . $ xmlChar# *value; |
| 314 | |
| 315 | value = xmlNodeGetContentcxx . . $ xmlNodeGetContent(cadd6f62b3cc3aeb).(cur_node); |
| 316 | probe_item_ent_addcxx . . $ probe_item_ent_add(9f488d3b029fc9d1).(item, "value_of", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 317 | r0 = SEXP_string_newfcxx . . $ SEXP_string_newf(b2137ed863725962). ("%s", (char *) value)); |
| 318 | xmlFreecxx . . $ xmlFree.(value); |
| 319 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4). (r0); |
| 320 | } |
| 321 | } |
| 322 | } |
| 323 | break; |
| 324 | } |
| 325 | default: |
| 326 | probe_item_setstatuscxx . . $ probe_item_setstatus(112b785eb420e6c0).(item, SYSCHAR_STATUS_DOES_NOT_EXISTcxx . . $ SYSCHAR_STATUS_DOES_NOT_EXIST.); |
| 327 | break; |
| 328 | } |
| 329 | |
| 330 | probe_item_collectcxx . . $ probe_item_collect(11bb80e0c30650d7).(pfd->ctxcxx . . $ pfdata#ctx., item); |
| 331 | item = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 332 | cleanup: |
| 333 | if (item != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 334 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(item); |
| 335 | if (xpath_obj != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 336 | xmlXPathFreeObjectcxx . . $ xmlXPathFreeObject(35c1f2c3aee015e6).(xpath_obj); |
| 337 | if (xpath_ctx != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 338 | xmlXPathFreeContextcxx . . $ xmlXPathFreeContext(a63b128a98dd7774).(xpath_ctx); |
| 339 | if (doc != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 340 | xmlFreeDoccxx . . $ xmlFreeDoc(42de24d0ab3f771).(doc); |
| 341 | if (doc_no_ns != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 342 | xmlFreeDoccxx . . $ xmlFreeDoc(42de24d0ab3f771).(doc_no_ns); |
| 343 | if (whole_path != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 344 | freecxx . . $ free(5d22bdacc48458e8).(whole_path); |
| 345 | |
| 346 | return ret; |
| 347 | } |
| 348 | |
| 349 | int xmlfilecontent_probe_maincxx . . $ xmlfilecontent_probe_main(470536d3ffacaf10).(probe_ctxcxx . . $ probe_ctx# *ctx, void *arg) |
| 350 | { |
| 351 | SEXP_tcxx . . $ SEXP_t# *path_ent, *filename_ent, *xpath_ent, *behaviors_ent, *filepath_ent, *probe_in; |
| 352 | SEXP_tcxx . . $ SEXP_t# *r0; |
| 353 | |
| 354 | OVAL_FTScxx . . $ OVAL_FTS# *ofts; |
| 355 | OVAL_FTSENTcxx . . $ OVAL_FTSENT# *ofts_ent; |
| 356 | |
| 357 | (void)arg; |
| 358 | |
| 359 | probe_in = probe_ctx_getobjectcxx . . $ probe_ctx_getobject(4299b6b53fa804a5).(ctx); |
| 360 | |
| 361 | path_ent = probe_obj_getentcxx . . $ probe_obj_getent(7907a01f2ff841f3).(probe_in, "path", 1); |
| 362 | filename_ent = probe_obj_getentcxx . . $ probe_obj_getent(7907a01f2ff841f3).(probe_in, "filename", 1); |
| 363 | xpath_ent = probe_obj_getentcxx . . $ probe_obj_getent(7907a01f2ff841f3).(probe_in, "xpath", 1); |
| 364 | filepath_ent = probe_obj_getentcxx . . $ probe_obj_getent(7907a01f2ff841f3).(probe_in, "filepath", 1); |
| 365 | behaviors_ent = probe_obj_getentcxx . . $ probe_obj_getent(7907a01f2ff841f3).(probe_in, "behaviors", 1); |
| 366 | |
| 367 | /* we want (path+filename or filepath) + xpath */ |
| 368 | if ( ((path_ent == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || filename_ent == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && filepath_ent==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ) || |
| 369 | xpath_ent==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 370 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4). (path_ent); |
| 371 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4). (filename_ent); |
| 372 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4). (filepath_ent); |
| 373 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4). (xpath_ent); |
| 374 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4). (behaviors_ent); |
| 375 | |
| 376 | return PROBE_ENOELMcxx . . $ `src/OVAL/probes/public/probe-common.h:9:9`!; |
| 377 | } |
| 378 | |
| 379 | /* behaviours are not important if filepath is used */ |
| 380 | if(filepath_ent != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && behaviors_ent != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 381 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4). (behaviors_ent); |
| 382 | behaviors_ent = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 383 | } |
| 384 | |
| 385 | probe_filebehaviors_canonicalizecxx . . $ probe_filebehaviors_canonicalize(e661f441b24a5de6).(&behaviors_ent); |
| 386 | |
| 387 | struct pfdatacxx . . $ pfdata# pfd; |
| 388 | |
| 389 | pfd.xpathcxx . . $ pfdata#xpath. = SEXP_string_cstrcxx . . $ SEXP_string_cstr(c831a2fa12818dfe).(r0 = probe_ent_getvalcxx . . $ probe_ent_getval(2f7f980afaaae0f0).(xpath_ent)); |
| 390 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4). (r0); |
| 391 | |
| 392 | pfd.filename_entcxx . . $ pfdata#filename_ent. = filename_ent; |
| 393 | pfd.ctxcxx . . $ pfdata#ctx. = ctx; |
| 394 | |
| 395 | const char *prefix = getenvcxx . . $ getenv(a8b8e32347182212).("OSCAP_PROBE_ROOT"); |
| 396 | |
| 397 | if ((ofts = oval_fts_open_prefixedcxx . . $ oval_fts_open_prefixed(d2d91f0fe545c5d7).(prefix, path_ent, filename_ent, filepath_ent, behaviors_ent, probe_ctx_getresultcxx . . $ probe_ctx_getresult(4299b6b53fa804a5).(ctx))) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 398 | while ((ofts_ent = oval_fts_readcxx . . $ oval_fts_read(592d87f37bbdbe51).(ofts)) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 399 | process_filecxx . . $ process_file(a09588dd745e1c63).(prefix, ofts_ent->pathcxx . . $ $anonymous_type_ebdee0feb58b991e_1#path., ofts_ent->filecxx . . $ $anonymous_type_ebdee0feb58b991e_1#file., &pfd, ctx->blocked_pathscxx . . $ probe_ctx#blocked_paths.); |
| 400 | oval_ftsent_freecxx . . $ oval_ftsent_free(7e09326da17d8ab0).(ofts_ent); |
| 401 | } |
| 402 | |
| 403 | oval_fts_closecxx . . $ oval_fts_close(cd898f79c195c42c).(ofts); |
| 404 | } |
| 405 | |
| 406 | freecxx . . $ free(5d22bdacc48458e8).(pfd.xpathcxx . . $ pfdata#xpath.); |
| 407 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4). (path_ent); |
| 408 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4). (filename_ent); |
| 409 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4). (xpath_ent); |
| 410 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4). (behaviors_ent); |
| 411 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4). (filepath_ent); |
| 412 | |
| 413 | return 0; |
| 414 | } |