| 1 | /** |
| 2 | * @file uname_probe.c |
| 3 | * @brief uname probe |
| 4 | * @author "Steve Grubb" <[email protected]> |
| 5 | * |
| 6 | * 2010/06/13 [email protected] |
| 7 | * This probe is able to process an uname_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 | * Steve Grubb <[email protected]> |
| 31 | */ |
| 32 | |
| 33 | /* |
| 34 | * uname probe: |
| 35 | * |
| 36 | * machine_class |
| 37 | * node_name |
| 38 | * os_name |
| 39 | * os_release |
| 40 | * os_version |
| 41 | * processor_type |
| 42 | */ |
| 43 | |
| 44 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`! |
| 45 | #include <config.h>cxx . . $ `<file>/build/config.h`/ |
| 46 | #endif |
| 47 | |
| 48 | #ifdef HAVE_STDIO_EXT_Hcxx . . $ `build/config.h:71:9`! |
| 49 | # include <stdio_ext.h> |
| 50 | #endif |
| 51 | #include <string.h> |
| 52 | #include <sys/utsname.h> |
| 53 | #if defined HAVE_SYS_SYSTEMINFO_H && defined (OS_SOLARIS) |
| 54 | #include <sys/systeminfo.h> |
| 55 | #endif |
| 56 | |
| 57 | #include "_seap.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/_seap.h`/ |
| 58 | #include "probe-api.h"cxx . . $ `<file>/src/OVAL/probes/public/probe-api.h`/ |
| 59 | #include "uname_probe.h"cxx . . $ `<file>/src/OVAL/probes/unix/uname_probe.h`/ |
| 60 | |
| 61 | int uname_probe_maincxx . . $ uname_probe_main(470536d3ffacaf10).(probe_ctxcxx . . $ probe_ctx# *ctx, void *arg) |
| 62 | { |
| 63 | struct utsnamecxx . . $ utsname# buf; |
| 64 | SEXP_tcxx . . $ SEXP_t# *item; |
| 65 | #if defined (OS_SOLARIS) |
| 66 | char procbuf[SYS_NMLN]; |
| 67 | #endif |
| 68 | |
| 69 | // Collect the info |
| 70 | unamecxx . . $ uname(c69a16225c55e184).(&buf); |
| 71 | |
| 72 | #if defined (OS_SOLARIS) |
| 73 | if (sysinfo(SI_ARCHITECTURE, procbuf, sizeof(procbuf)) == -1) |
| 74 | return(PROBE_EFATAL); |
| 75 | #endif |
| 76 | item = probe_item_createcxx . . $ probe_item_create(36b16a6622050a9c).(OVAL_UNIX_UNAMEcxx . . $ OVAL_UNIX_UNAME., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 77 | "machine_class", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., buf.machinecxx . . $ utsname#machine., |
| 78 | "node_name", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., buf.nodenamecxx . . $ utsname#nodename., |
| 79 | "os_name", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., buf.sysnamecxx . . $ utsname#sysname., |
| 80 | "os_release", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., buf.releasecxx . . $ utsname#release., |
| 81 | "os_version", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., buf.versioncxx . . $ utsname#version., |
| 82 | #if defined (OS_SOLARIS) |
| 83 | "processor_type", OVAL_DATATYPE_STRING, procbuf, |
| 84 | #else |
| 85 | "processor_type", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., buf.machinecxx . . $ utsname#machine., |
| 86 | #endif |
| 87 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 88 | |
| 89 | probe_item_collectcxx . . $ probe_item_collect(11bb80e0c30650d7).(ctx, item); |
| 90 | |
| 91 | return 0; |
| 92 | } |