| 1 | /* |
| 2 | * Copyright 2009--2014 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 | * |
| 20 | */ |
| 21 | |
| 22 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`! |
| 23 | #include <config.h>cxx . . $ `<file>/build/config.h`/ |
| 24 | #endif |
| 25 | |
| 26 | #include <libxml/xmlreader.h> |
| 27 | #include <string.h> |
| 28 | |
| 29 | #include "common/debug_priv.h"cxx . . $ `<file>/src/common/debug_priv.h`/ |
| 30 | #include "common/_error.h"cxx . . $ `<file>/src/common/_error.h`/ |
| 31 | #include "common/public/oscap.h"cxx . . $ `<file>/src/common/public/oscap.h`/ |
| 32 | #include "doc_type_priv.h"cxx . . $ `<file>/src/source/doc_type_priv.h`/ |
| 33 | |
| 34 | int oscap_determine_document_type_readercxx . . $ oscap_determine_document_type_reader(2443a3037591db81).(xmlTextReadercxx . . $ xmlTextReader# *reader, oscap_document_type_tcxx . . $ oscap_document_type_t# *doc_type) |
| 35 | { |
| 36 | const char* elm_name = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 37 | *doc_type = 0; |
| 38 | |
| 39 | /* find root element */ |
| 40 | while (xmlTextReaderReadcxx . . $ xmlTextReaderRead(82a242a19623f75).(reader) == 1 |
| 41 | && xmlTextReaderNodeTypecxx . . $ xmlTextReaderNodeType(82a242a19623f75).(reader) != XML_READER_TYPE_ELEMENTcxx . . $ XML_READER_TYPE_ELEMENT.); |
| 42 | |
| 43 | /* identify document type */ |
| 44 | elm_name = (const char *) xmlTextReaderConstLocalNamecxx . . $ xmlTextReaderConstLocalName(60a5affeeceb06fd).(reader); |
| 45 | if (!elm_name) { |
| 46 | oscap_setxmlerrcxx . . $ `src/common/_error.h:36:9`!(xmlGetLastError()); |
| 47 | return -1; |
| 48 | } |
| 49 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).("oval_definitions", elm_name)) { |
| 50 | *doc_type = OSCAP_DOCUMENT_OVAL_DEFINITIONScxx . . $ OSCAP_DOCUMENT_OVAL_DEFINITIONS.; |
| 51 | } |
| 52 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).("oval_directives", elm_name)) { |
| 53 | *doc_type = OSCAP_DOCUMENT_OVAL_DIRECTIVEScxx . . $ OSCAP_DOCUMENT_OVAL_DIRECTIVES.; |
| 54 | } |
| 55 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).("oval_results", elm_name)) { |
| 56 | *doc_type = OSCAP_DOCUMENT_OVAL_RESULTScxx . . $ OSCAP_DOCUMENT_OVAL_RESULTS.; |
| 57 | } |
| 58 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).("oval_system_characteristics", elm_name)) { |
| 59 | *doc_type = OSCAP_DOCUMENT_OVAL_SYSCHARcxx . . $ OSCAP_DOCUMENT_OVAL_SYSCHAR.; |
| 60 | } |
| 61 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).("oval_variables", elm_name)) { |
| 62 | *doc_type = OSCAP_DOCUMENT_OVAL_VARIABLEScxx . . $ OSCAP_DOCUMENT_OVAL_VARIABLES.; |
| 63 | } |
| 64 | else if (oscap_streqcxx . . $ oscap_streq(b7a7aa4a824b7595).("Benchmark", elm_name) || oscap_streqcxx . . $ oscap_streq(b7a7aa4a824b7595).("TestResult", elm_name)) { |
| 65 | *doc_type = OSCAP_DOCUMENT_XCCDFcxx . . $ OSCAP_DOCUMENT_XCCDF.; |
| 66 | } |
| 67 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).("Tailoring", elm_name)) { |
| 68 | *doc_type = OSCAP_DOCUMENT_XCCDF_TAILORINGcxx . . $ OSCAP_DOCUMENT_XCCDF_TAILORING.; |
| 69 | } |
| 70 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).("cpe-list", elm_name)) { |
| 71 | *doc_type = OSCAP_DOCUMENT_CPE_DICTIONARYcxx . . $ OSCAP_DOCUMENT_CPE_DICTIONARY.; |
| 72 | } |
| 73 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).("platform-specification", elm_name)) { |
| 74 | *doc_type = OSCAP_DOCUMENT_CPE_LANGUAGEcxx . . $ OSCAP_DOCUMENT_CPE_LANGUAGE.; |
| 75 | } |
| 76 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).("data-stream-collection", elm_name)) { |
| 77 | *doc_type = OSCAP_DOCUMENT_SDScxx . . $ OSCAP_DOCUMENT_SDS.; |
| 78 | } |
| 79 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).("asset-report-collection", elm_name)) { |
| 80 | *doc_type = OSCAP_DOCUMENT_ARFcxx . . $ OSCAP_DOCUMENT_ARF.; |
| 81 | } |
| 82 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).("sce_results", elm_name)) { |
| 83 | *doc_type = OSCAP_DOCUMENT_SCE_RESULTcxx . . $ OSCAP_DOCUMENT_SCE_RESULT.; |
| 84 | } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).("ocil", elm_name)) { |
| 85 | *doc_type = OSCAP_DOCUMENT_OCILcxx . . $ OSCAP_DOCUMENT_OCIL.; |
| 86 | } else { |
| 87 | return -1; |
| 88 | } |
| 89 | |
| 90 | dIcxx . . $ `src/common/debug_priv.h:61:9`!("Identified document type: %s", elm_name); |
| 91 | |
| 92 | return 0; |
| 93 | } |