| 1 | /* |
| 2 | * Copyright 2018 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 | * "Jan Černý" <[email protected]> |
| 21 | */ |
| 22 | |
| 23 | #ifdef HAVE_CONFIG_H |
| 24 | #include <config.h> |
| 25 | #endif |
| 26 | |
| 27 | #include "probe-table.h" |
| 28 | #include "oval_types.h" |
| 29 | |
| 30 | #ifdef OPENSCAP_PROBE_INDEPENDENT_ENVIRONMENTVARIABLE |
| 31 | #include "independent/environmentvariable_probe.h" |
| 32 | #endif |
| 33 | |
| 34 | #ifdef OPENSCAP_PROBE_INDEPENDENT_ENVIRONMENTVARIABLE58 |
| 35 | #include "independent/environmentvariable58_probe.h" |
| 36 | #endif |
| 37 | |
| 38 | #ifdef OPENSCAP_PROBE_INDEPENDENT_FAMILY |
| 39 | #include "independent/family_probe.h" |
| 40 | #endif |
| 41 | |
| 42 | #ifdef OPENSCAP_PROBE_INDEPENDENT_FILEHASH |
| 43 | #include "independent/filehash_probe.h" |
| 44 | #endif |
| 45 | |
| 46 | #ifdef OPENSCAP_PROBE_INDEPENDENT_FILEHASH58 |
| 47 | #include "independent/filehash58_probe.h" |
| 48 | #endif |
| 49 | |
| 50 | #ifdef OPENSCAP_PROBE_INDEPENDENT_SQL |
| 51 | #include "independent/sql_probe.h" |
| 52 | #endif |
| 53 | |
| 54 | #ifdef OPENSCAP_PROBE_INDEPENDENT_SQL57 |
| 55 | #include "independent/sql57_probe.h" |
| 56 | #endif |
| 57 | |
| 58 | #ifdef OPENSCAP_PROBE_INDEPENDENT_SYSTEM_INFO |
| 59 | #include "independent/system_info_probe.h" |
| 60 | #endif |
| 61 | |
| 62 | #ifdef OPENSCAP_PROBE_INDEPENDENT_TEXTFILECONTENT |
| 63 | #include "independent/textfilecontent_probe.h" |
| 64 | #endif |
| 65 | |
| 66 | #ifdef OPENSCAP_PROBE_INDEPENDENT_TEXTFILECONTENT54 |
| 67 | #include "independent/textfilecontent54_probe.h" |
| 68 | #endif |
| 69 | |
| 70 | #ifdef OPENSCAP_PROBE_INDEPENDENT_VARIABLE |
| 71 | #include "independent/variable_probe.h" |
| 72 | #endif |
| 73 | |
| 74 | #ifdef OPENSCAP_PROBE_INDEPENDENT_XMLFILECONTENT |
| 75 | #include "independent/xmlfilecontent_probe.h" |
| 76 | #endif |
| 77 | |
| 78 | #ifdef OPENSCAP_PROBE_INDEPENDENT_YAMLFILECONTENT |
| 79 | #include "independent/yamlfilecontent_probe.h" |
| 80 | #endif |
| 81 | |
| 82 | #ifdef OPENSCAP_PROBE_LINUX_DPKGINFO |
| 83 | #include "unix/linux/dpkginfo_probe.h" |
| 84 | #endif |
| 85 | |
| 86 | #ifdef OPENSCAP_PROBE_LINUX_IFLISTENERS |
| 87 | #include "unix/linux/iflisteners_probe.h" |
| 88 | #endif |
| 89 | |
| 90 | #ifdef OPENSCAP_PROBE_LINUX_INETLISTENINGSERVERS |
| 91 | #include "unix/linux/inetlisteningservers_probe.h" |
| 92 | #endif |
| 93 | |
| 94 | #ifdef OPENSCAP_PROBE_LINUX_PARTITION |
| 95 | #include "unix/linux/partition_probe.h" |
| 96 | #endif |
| 97 | |
| 98 | #ifdef OPENSCAP_PROBE_LINUX_RPMINFO |
| 99 | #include "unix/linux/rpminfo_probe.h" |
| 100 | #endif |
| 101 | |
| 102 | #ifdef OPENSCAP_PROBE_LINUX_RPMVERIFY |
| 103 | #include "unix/linux/rpmverify_probe.h" |
| 104 | #endif |
| 105 | |
| 106 | #ifdef OPENSCAP_PROBE_LINUX_RPMVERIFYFILE |
| 107 | #include "unix/linux/rpmverifyfile_probe.h" |
| 108 | #endif |
| 109 | |
| 110 | #ifdef OPENSCAP_PROBE_LINUX_RPMVERIFYPACKAGE |
| 111 | #include "unix/linux/rpmverifypackage_probe.h" |
| 112 | #endif |
| 113 | |
| 114 | #ifdef OPENSCAP_PROBE_LINUX_SELINUXBOOLEAN |
| 115 | #include "unix/linux/selinuxboolean_probe.h" |
| 116 | #endif |
| 117 | |
| 118 | #ifdef OPENSCAP_PROBE_LINUX_SELINUXSECURITYCONTEXT |
| 119 | #include "unix/linux/selinuxsecuritycontext_probe.h" |
| 120 | #endif |
| 121 | |
| 122 | #ifdef OPENSCAP_PROBE_LINUX_SYSTEMDUNITDEPENDENCY |
| 123 | #include "unix/linux/systemdunitdependency_probe.h" |
| 124 | #endif |
| 125 | |
| 126 | #ifdef OPENSCAP_PROBE_LINUX_SYSTEMDUNITPROPERTY |
| 127 | #include "unix/linux/systemdunitproperty_probe.h" |
| 128 | #endif |
| 129 | |
| 130 | #ifdef OPENSCAP_PROBE_LINUX_FWUPDSECURITYATTR |
| 131 | #include "unix/linux/fwupdsecattr_probe.h" |
| 132 | #endif |
| 133 | |
| 134 | #ifdef OPENSCAP_PROBE_SOLARIS_ISAINFO |
| 135 | #include "unix/solaris/isainfo_probe.h" |
| 136 | #endif |
| 137 | |
| 138 | #ifdef OPENSCAP_PROBE_UNIX_DNSCACHE |
| 139 | #include "unix/dnscache_probe.h" |
| 140 | #endif |
| 141 | |
| 142 | #ifdef OPENSCAP_PROBE_UNIX_FILE |
| 143 | #include "unix/file_probe.h" |
| 144 | #endif |
| 145 | |
| 146 | #ifdef OPENSCAP_PROBE_UNIX_FILEEXTENDEDATTRIBUTE |
| 147 | #include "unix/fileextendedattribute_probe.h" |
| 148 | #endif |
| 149 | |
| 150 | #ifdef OPENSCAP_PROBE_UNIX_GCONF |
| 151 | #include "unix/gconf_probe.h" |
| 152 | #endif |
| 153 | |
| 154 | #ifdef OPENSCAP_PROBE_UNIX_INTERFACE |
| 155 | #include "unix/interface_probe.h" |
| 156 | #endif |
| 157 | |
| 158 | #ifdef OPENSCAP_PROBE_UNIX_PASSWORD |
| 159 | #include "unix/password_probe.h" |
| 160 | #endif |
| 161 | |
| 162 | #ifdef OPENSCAP_PROBE_UNIX_PROCESS |
| 163 | #include "unix/process_probe.h" |
| 164 | #endif |
| 165 | |
| 166 | #ifdef OPENSCAP_PROBE_UNIX_PROCESS58 |
| 167 | #include "unix/process58_probe.h" |
| 168 | #endif |
| 169 | |
| 170 | #ifdef OPENSCAP_PROBE_UNIX_ROUTINGTABLE |
| 171 | #include "unix/routingtable_probe.h" |
| 172 | #endif |
| 173 | |
| 174 | #ifdef OPENSCAP_PROBE_UNIX_RUNLEVEL |
| 175 | #include "unix/runlevel_probe.h" |
| 176 | #endif |
| 177 | |
| 178 | #ifdef OPENSCAP_PROBE_UNIX_SHADOW |
| 179 | #include "unix/shadow_probe.h" |
| 180 | #endif |
| 181 | |
| 182 | #ifdef OPENSCAP_PROBE_UNIX_SYMLINK |
| 183 | #include "unix/symlink_probe.h" |
| 184 | #endif |
| 185 | |
| 186 | #ifdef OPENSCAP_PROBE_UNIX_SYSCTL |
| 187 | #include "unix/sysctl_probe.h" |
| 188 | #endif |
| 189 | |
| 190 | #ifdef OPENSCAP_PROBE_UNIX_UNAME |
| 191 | #include "unix/uname_probe.h" |
| 192 | #endif |
| 193 | |
| 194 | #ifdef OPENSCAP_PROBE_UNIX_XINETD |
| 195 | #include "unix/xinetd_probe.h" |
| 196 | #endif |
| 197 | |
| 198 | #ifdef OPENSCAP_PROBE_WINDOWS_ACCESSTOKEN |
| 199 | #include "windows/accesstoken_probe.h" |
| 200 | #endif |
| 201 | |
| 202 | #ifdef OPENSCAP_PROBE_WINDOWS_REGISTRY |
| 203 | #include "windows/registry_probe.h" |
| 204 | #endif |
| 205 | |
| 206 | #ifdef OPENSCAP_PROBE_WINDOWS_WMI57 |
| 207 | #include "windows/wmi57_probe.h" |
| 208 | #endif |
| 209 | |
| 210 | typedef struct probe_table_entry { |
| 211 | oval_subtype_t type; |
| 212 | probe_init_function_t probe_init_function; |
| 213 | probe_main_function_t probe_main_function; |
| 214 | probe_fini_function_t probe_fini_function; |
| 215 | probe_offline_mode_function_t probe_offline_mode_function; |
| 216 | } probe_table_entry_t; |
| 217 | |
| 218 | static const probe_table_entry_t probe_table[] = { |
| 219 | /* {type, init, main, fini, offline} */ |
| 220 | #ifdef OPENSCAP_PROBE_INDEPENDENT_ENVIRONMENTVARIABLE |
| 221 | {OVAL_INDEPENDENT_ENVIRONMENT_VARIABLE, NULL, environmentvariable_probe_main, NULL, NULL}, |
| 222 | #endif |
| 223 | #ifdef OPENSCAP_PROBE_INDEPENDENT_ENVIRONMENTVARIABLE58 |
| 224 | {OVAL_INDEPENDENT_ENVIRONMENT_VARIABLE58, NULL, environmentvariable58_probe_main, NULL, environmentvariable58_probe_offline_mode_supported}, |
| 225 | #endif |
| 226 | #ifdef OPENSCAP_PROBE_INDEPENDENT_FAMILY |
| 227 | {OVAL_INDEPENDENT_FAMILY, NULL, family_probe_main, NULL, family_probe_offline_mode_supported}, |
| 228 | #endif |
| 229 | #ifdef OPENSCAP_PROBE_INDEPENDENT_FILEHASH |
| 230 | {OVAL_INDEPENDENT_FILE_HASH, filehash_probe_init, filehash_probe_main, filehash_probe_fini, filehash_probe_offline_mode_supported}, |
| 231 | #endif |
| 232 | #ifdef OPENSCAP_PROBE_INDEPENDENT_FILEHASH58 |
| 233 | {OVAL_INDEPENDENT_FILE_HASH58, filehash58_probe_init, filehash58_probe_main, filehash58_probe_fini, filehash58_probe_offline_mode_supported}, |
| 234 | #endif |
| 235 | #ifdef OPENSCAP_PROBE_INDEPENDENT_SQL |
| 236 | {OVAL_INDEPENDENT_SQL, NULL, sql_probe_main, NULL, NULL}, |
| 237 | #endif |
| 238 | #ifdef OPENSCAP_PROBE_INDEPENDENT_SQL57 |
| 239 | {OVAL_INDEPENDENT_SQL57, NULL, sql57_probe_main, NULL, NULL}, |
| 240 | #endif |
| 241 | #ifdef OPENSCAP_PROBE_INDEPENDENT_SYSTEM_INFO |
| 242 | {OVAL_INDEPENDENT_SYSCHAR_SUBTYPE, NULL, system_info_probe_main, NULL, system_info_probe_offline_mode_supported}, |
| 243 | #endif |
| 244 | #ifdef OPENSCAP_PROBE_INDEPENDENT_TEXTFILECONTENT |
| 245 | {OVAL_INDEPENDENT_TEXT_FILE_CONTENT, NULL, textfilecontent_probe_main, NULL, textfilecontent_probe_offline_mode_supported}, |
| 246 | #endif |
| 247 | #ifdef OPENSCAP_PROBE_INDEPENDENT_TEXTFILECONTENT54 |
| 248 | {OVAL_INDEPENDENT_TEXT_FILE_CONTENT_54, NULL, textfilecontent54_probe_main, NULL, textfilecontent54_probe_offline_mode_supported}, |
| 249 | #endif |
| 250 | #ifdef OPENSCAP_PROBE_INDEPENDENT_VARIABLE |
| 251 | {OVAL_INDEPENDENT_VARIABLE, NULL, variable_probe_main, NULL, variable_probe_offline_mode_supported}, |
| 252 | #endif |
| 253 | #ifdef OPENSCAP_PROBE_INDEPENDENT_XMLFILECONTENT |
| 254 | {OVAL_INDEPENDENT_XML_FILE_CONTENT, xmlfilecontent_probe_init, xmlfilecontent_probe_main, xmlfilecontent_probe_fini, xmlfilecontent_probe_offline_mode_supported}, |
| 255 | #endif |
| 256 | #ifdef OPENSCAP_PROBE_INDEPENDENT_YAMLFILECONTENT |
| 257 | {OVAL_INDEPENDENT_YAML_FILE_CONTENT, NULL, yamlfilecontent_probe_main, NULL, yamlfilecontent_probe_offline_mode_supported}, |
| 258 | #endif |
| 259 | #ifdef OPENSCAP_PROBE_LINUX_DPKGINFO |
| 260 | {OVAL_LINUX_DPKG_INFO, NULL, dpkginfo_probe_main, NULL, dpkginfo_probe_offline_mode_supported}, |
| 261 | #endif |
| 262 | #ifdef OPENSCAP_PROBE_LINUX_IFLISTENERS |
| 263 | {OVAL_LINUX_IFLISTENERS, NULL, iflisteners_probe_main, NULL, NULL}, |
| 264 | #endif |
| 265 | #ifdef OPENSCAP_PROBE_LINUX_INETLISTENINGSERVERS |
| 266 | {OVAL_LINUX_INET_LISTENING_SERVERS, NULL, inetlisteningservers_probe_main, NULL, NULL}, |
| 267 | #endif |
| 268 | #ifdef OPENSCAP_PROBE_LINUX_PARTITION |
| 269 | {OVAL_LINUX_PARTITION, NULL, partition_probe_main, NULL, patition_probe_offline_mode_supported}, |
| 270 | #endif |
| 271 | #ifdef OPENSCAP_PROBE_LINUX_RPMINFO |
| 272 | {OVAL_LINUX_RPM_INFO, rpminfo_probe_init, rpminfo_probe_main, rpminfo_probe_fini, rpminfo_probe_offline_mode_supported}, |
| 273 | #endif |
| 274 | #ifdef OPENSCAP_PROBE_LINUX_RPMVERIFY |
| 275 | {OVAL_LINUX_RPMVERIFY, rpmverify_probe_init, rpmverify_probe_main, rpmverify_probe_fini, rpmverify_probe_offline_mode_supported}, |
| 276 | #endif |
| 277 | #ifdef OPENSCAP_PROBE_LINUX_RPMVERIFYFILE |
| 278 | {OVAL_LINUX_RPMVERIFYFILE, rpmverifyfile_probe_init, rpmverifyfile_probe_main, rpmverifyfile_probe_fini, rpmverifyfile_probe_offline_mode_supported}, |
| 279 | #endif |
| 280 | #ifdef OPENSCAP_PROBE_LINUX_RPMVERIFYPACKAGE |
| 281 | {OVAL_LINUX_RPMVERIFYPACKAGE, rpmverifypackage_probe_init, rpmverifypackage_probe_main, rpmverifypackage_probe_fini, rpmverifypackage_probe_offline_mode_supported}, |
| 282 | #endif |
| 283 | #ifdef OPENSCAP_PROBE_LINUX_SELINUXBOOLEAN |
| 284 | {OVAL_LINUX_SELINUXBOOLEAN, NULL, selinuxboolean_probe_main, NULL, selinuxboolean_probe_offline_mode_supported}, |
| 285 | #endif |
| 286 | #ifdef OPENSCAP_PROBE_LINUX_SELINUXSECURITYCONTEXT |
| 287 | {OVAL_LINUX_SELINUXSECURITYCONTEXT, NULL, selinuxsecuritycontext_probe_main, NULL, selinuxsecuritycontext_probe_offline_mode_supported}, |
| 288 | #endif |
| 289 | #ifdef OPENSCAP_PROBE_LINUX_SYSTEMDUNITDEPENDENCY |
| 290 | {OVAL_LINUX_SYSTEMDUNITDEPENDENCY, NULL, systemdunitdependency_probe_main, NULL, systemdunitdependency_probe_offline_mode_supported}, |
| 291 | #endif |
| 292 | #ifdef OPENSCAP_PROBE_LINUX_SYSTEMDUNITPROPERTY |
| 293 | {OVAL_LINUX_SYSTEMDUNITPROPERTY, NULL, systemdunitproperty_probe_main, NULL, systemdunitproperty_probe_offline_mode_supported}, |
| 294 | #endif |
| 295 | #ifdef OPENSCAP_PROBE_LINUX_FWUPDSECURITYATTR |
| 296 | {OVAL_LINUX_FWUPDSECATTR, NULL, fwupdsecattr_probe_main, NULL, NULL}, |
| 297 | #endif |
| 298 | #ifdef OPENSCAP_PROBE_SOLARIS_ISAINFO |
| 299 | {OVAL_SOLARIS_ISAINFO, NULL, isainfo_probe_main, NULL, NULL}, |
| 300 | #endif |
| 301 | #ifdef OPENSCAP_PROBE_UNIX_DNSCACHE |
| 302 | {OVAL_UNIX_DNSCACHE, NULL, dnscache_probe_main, NULL, NULL}, |
| 303 | #endif |
| 304 | #ifdef OPENSCAP_PROBE_UNIX_FILE |
| 305 | {OVAL_UNIX_FILE, file_probe_init, file_probe_main, file_probe_fini, file_probe_offline_mode_supported}, |
| 306 | #endif |
| 307 | #ifdef OPENSCAP_PROBE_UNIX_FILEEXTENDEDATTRIBUTE |
| 308 | {OVAL_UNIX_FILEEXTENDEDATTRIBUTE, fileextendedattribute_probe_init, fileextendedattribute_probe_main, fileextendedattribute_probe_fini, fileextendedattribute_probe_offline_mode_supported}, |
| 309 | #endif |
| 310 | #ifdef OPENSCAP_PROBE_UNIX_GCONF |
| 311 | {OVAL_UNIX_GCONF, NULL, gconf_probe_main, NULL, NULL}, |
| 312 | #endif |
| 313 | #ifdef OPENSCAP_PROBE_UNIX_INTERFACE |
| 314 | {OVAL_UNIX_INTERFACE, NULL, interface_probe_main, NULL, NULL}, |
| 315 | #endif |
| 316 | #ifdef OPENSCAP_PROBE_UNIX_PASSWORD |
| 317 | {OVAL_UNIX_PASSWORD, NULL, password_probe_main, NULL, password_probe_offline_mode_supported}, |
| 318 | #endif |
| 319 | #ifdef OPENSCAP_PROBE_UNIX_PROCESS |
| 320 | {OVAL_UNIX_PROCESS, NULL, process_probe_main, NULL, NULL}, |
| 321 | #endif |
| 322 | #ifdef OPENSCAP_PROBE_UNIX_PROCESS58 |
| 323 | {OVAL_UNIX_PROCESS58, NULL, process58_probe_main, NULL, process58_probe_offline_mode_supported}, |
| 324 | #endif |
| 325 | #ifdef OPENSCAP_PROBE_UNIX_ROUTINGTABLE |
| 326 | {OVAL_UNIX_ROUTINGTABLE, NULL, routingtable_probe_main, NULL, NULL}, |
| 327 | #endif |
| 328 | #ifdef OPENSCAP_PROBE_UNIX_RUNLEVEL |
| 329 | {OVAL_UNIX_RUNLEVEL, NULL, runlevel_probe_main, NULL, runlevel_probe_offline_mode_supported}, |
| 330 | #endif |
| 331 | #ifdef OPENSCAP_PROBE_UNIX_SHADOW |
| 332 | {OVAL_UNIX_SHADOW, NULL, shadow_probe_main, NULL, shadow_probe_offline_mode_supported}, |
| 333 | #endif |
| 334 | #ifdef OPENSCAP_PROBE_UNIX_SYMLINK |
| 335 | {OVAL_UNIX_SYMLINK, NULL, symlink_probe_main, NULL, symlink_probe_offline_mode_supported}, |
| 336 | #endif |
| 337 | #ifdef OPENSCAP_PROBE_UNIX_SYSCTL |
| 338 | {OVAL_UNIX_SYSCTL, NULL, sysctl_probe_main, NULL, sysctl_probe_offline_mode_supported}, |
| 339 | #endif |
| 340 | #ifdef OPENSCAP_PROBE_UNIX_UNAME |
| 341 | {OVAL_UNIX_UNAME, NULL, uname_probe_main, NULL, NULL}, |
| 342 | #endif |
| 343 | #ifdef OPENSCAP_PROBE_UNIX_XINETD |
| 344 | {OVAL_UNIX_XINETD, xinetd_probe_init, xinetd_probe_main, xinetd_probe_fini, xinetd_probe_offline_mode_supported}, |
| 345 | #endif |
| 346 | #ifdef OPENSCAP_PROBE_WINDOWS_ACCESSTOKEN |
| 347 | {OVAL_WINDOWS_ACCESS_TOKEN, NULL, accesstoken_probe_main, NULL, NULL}, |
| 348 | #endif |
| 349 | #ifdef OPENSCAP_PROBE_WINDOWS_REGISTRY |
| 350 | {OVAL_WINDOWS_REGISTRY, NULL, registry_probe_main, NULL, NULL}, |
| 351 | #endif |
| 352 | #ifdef OPENSCAP_PROBE_WINDOWS_WMI57 |
| 353 | {OVAL_WINDOWS_WMI_57, NULL, wmi57_probe_main, NULL, NULL}, |
| 354 | #endif |
| 355 | {OVAL_SUBTYPE_UNKNOWN, NULL, NULL, NULL, NULL} |
| 356 | }; |
| 357 | |
| 358 | static const probe_table_entry_t *probe_table_get(oval_subtype_t type) |
| 359 | { |
| 360 | const probe_table_entry_t *entry = probe_table; |
| 361 | while (entry->probe_main_function != NULL && entry->type != type) |
| 362 | { |
| 363 | entry++; |
| 364 | } |
| 365 | return entry; |
| 366 | } |
| 367 | |
| 368 | probe_init_function_t probe_table_get_init_function(oval_subtype_t type) |
| 369 | { |
| 370 | const probe_table_entry_t *entry = probe_table_get(type); |
| 371 | return entry->probe_init_function; |
| 372 | } |
| 373 | |
| 374 | probe_main_function_t probe_table_get_main_function(oval_subtype_t type) |
| 375 | { |
| 376 | const probe_table_entry_t *entry = probe_table_get(type); |
| 377 | return entry->probe_main_function; |
| 378 | } |
| 379 | |
| 380 | probe_fini_function_t probe_table_get_fini_function(oval_subtype_t type) |
| 381 | { |
| 382 | const probe_table_entry_t *entry = probe_table_get(type); |
| 383 | return entry->probe_fini_function; |
| 384 | } |
| 385 | |
| 386 | probe_offline_mode_function_t probe_table_get_offline_mode_function(oval_subtype_t type) |
| 387 | { |
| 388 | const probe_table_entry_t *entry = probe_table_get(type); |
| 389 | return entry->probe_offline_mode_function; |
| 390 | } |
| 391 | |
| 392 | void probe_table_list(FILE *output) |
| 393 | { |
| 394 | const probe_table_entry_t *entry = probe_table; |
| 395 | while (entry->type != OVAL_SUBTYPE_UNKNOWN) |
| 396 | { |
| 397 | oval_subtype_t type = entry->type; |
| 398 | fprintf(output, "%-14s", oval_family_get_text(oval_subtype_get_family(type))); |
| 399 | fprintf(output, "%-29s", oval_subtype_get_text(type)); |
| 400 | fprintf(output, "probe_%s", oval_subtype_get_text(type)); |
| 401 | #if (defined(OPENSCAP_ENABLE_MD5) && defined(OPENSCAP_ENABLE_SHA1)) |
| 402 | if (type == OVAL_INDEPENDENT_FILE_HASH) { |
| 403 | fprintf(output, " (MD5, SHA-1)"); |
| 404 | } |
| 405 | #endif |
| 406 | if (type == OVAL_INDEPENDENT_FILE_HASH58) { |
| 407 | fprintf(output, " ("); |
| 408 | #ifdef OPENSCAP_ENABLE_MD5 |
| 409 | fprintf(output, "MD5, "); |
| 410 | #endif |
| 411 | #ifdef OPENSCAP_ENABLE_SHA1 |
| 412 | fprintf(output, "SHA-1, "); |
| 413 | #endif |
| 414 | fprintf(output, "SHA-224, SHA-256, SHA-384, SHA-512)"); |
| 415 | } |
| 416 | fprintf(output, "\n"); |
| 417 | entry++; |
| 418 | } |
| 419 | } |
| 420 | |
| 421 | int probe_table_size() |
| 422 | { |
| 423 | int size = 0; |
| 424 | const probe_table_entry_t *entry = probe_table; |
| 425 | while (entry->type != OVAL_SUBTYPE_UNKNOWN) { |
| 426 | entry++; |
| 427 | size++; |
| 428 | } |
| 429 | return size; |
| 430 | } |
| 431 | |
| 432 | bool probe_table_exists(oval_subtype_t type) |
| 433 | { |
| 434 | const probe_table_entry_t *entry = probe_table_get(type); |
| 435 | return (entry->type != OVAL_SUBTYPE_UNKNOWN); |
| 436 | } |
| 437 | |
| 438 | oval_subtype_t probe_table_at_index(int idx) |
| 439 | { |
| 440 | if (idx < 0 || idx >= probe_table_size()) { |
| 441 | return OVAL_SUBTYPE_UNKNOWN; |
| 442 | } |
| 443 | const probe_table_entry_t entry = probe_table[idx]; |
| 444 | return entry.type; |
| 445 | } |