| 1 | /* |
| 2 | * Copyright 2009 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 | |
| 23 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`! |
| 24 | #include <config.h>cxx . . $ `<file>/build/config.h`/ |
| 25 | #endif |
| 26 | |
| 27 | #include <string.h> |
| 28 | |
| 29 | #include "_sexp-types.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/_sexp-types.h`/ |
| 30 | #include "_seap-types.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/_seap-types.h`/ |
| 31 | #include "_seap-message.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/_seap-message.h`/ |
| 32 | #include "debug_priv.h"cxx . . $ `<file>/src/common/debug_priv.h`/ |
| 33 | |
| 34 | SEAP_msg_tcxx . . $ SEAP_msg_t# *SEAP_msg_newcxx . . $ SEAP_msg_new(b76a66c6f733d68f). (void) |
| 35 | { |
| 36 | SEAP_msg_tcxx . . $ SEAP_msg_t# *new = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(SEAP_msg_tcxx . . $ SEAP_msg_t#)); |
| 37 | new->idcxx . . $ SEAP_msg#id. = 0; |
| 38 | new->attrscxx . . $ SEAP_msg#attrs. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 39 | new->attrs_cntcxx . . $ SEAP_msg#attrs_cnt. = 0; |
| 40 | new->sexpcxx . . $ SEAP_msg#sexp. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 41 | |
| 42 | return (new); |
| 43 | } |
| 44 | |
| 45 | SEAP_msg_tcxx . . $ SEAP_msg_t# *SEAP_msg_clonecxx . . $ SEAP_msg_clone(5f7ab50696302eaa). (SEAP_msg_tcxx . . $ SEAP_msg_t# *msg) |
| 46 | { |
| 47 | uint16_tcxx . . $ uint16_t# i; |
| 48 | |
| 49 | SEAP_msg_tcxx . . $ SEAP_msg_t# *new = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(SEAP_msg_tcxx . . $ SEAP_msg_t#)); |
| 50 | memcpycxx . . $ memcpy(cc817cb175f282d). (new, msg, sizeof (SEAP_msg_tcxx . . $ SEAP_msg_t#)); |
| 51 | |
| 52 | new->attrscxx . . $ SEAP_msg#attrs. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(SEAP_attr_tcxx . . $ SEAP_attr_t#) * new->attrs_cntcxx . . $ SEAP_msg#attrs_cnt.); |
| 53 | |
| 54 | for (i = 0; i < new->attrs_cntcxx . . $ SEAP_msg#attrs_cnt.; ++i) { |
| 55 | new->attrscxx . . $ SEAP_msg#attrs.[i].namecxx . . $ SEAP_attr#name. = strdupcxx . . $ strdup(a8b8e32347182212). (msg->attrscxx . . $ SEAP_msg#attrs.[i].namecxx . . $ SEAP_attr#name.); |
| 56 | new->attrscxx . . $ SEAP_msg#attrs.[i].valuecxx . . $ SEAP_attr#value. = SEXP_refcxx . . $ SEXP_ref(2f7f980afaaae0f0). (msg->attrscxx . . $ SEAP_msg#attrs.[i].valuecxx . . $ SEAP_attr#value.); |
| 57 | } |
| 58 | |
| 59 | new->sexpcxx . . $ SEAP_msg#sexp. = SEXP_refcxx . . $ SEXP_ref(2f7f980afaaae0f0). (msg->sexpcxx . . $ SEAP_msg#sexp.); |
| 60 | |
| 61 | return (new); |
| 62 | } |
| 63 | |
| 64 | void SEAP_msg_freecxx . . $ SEAP_msg_free(4995d55015d41e57). (SEAP_msg_tcxx . . $ SEAP_msg_t# *msg) |
| 65 | { |
| 66 | if (msg == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 67 | return; |
| 68 | |
| 69 | if (msg->attrscxx . . $ SEAP_msg#attrs. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 70 | for (; msg->attrs_cntcxx . . $ SEAP_msg#attrs_cnt. > 0; --msg->attrs_cntcxx . . $ SEAP_msg#attrs_cnt.) { |
| 71 | dDcxx . . $ `src/common/debug_priv.h:64:9`!("name=%s, value=%p", |
| 72 | msg->attrs[msg->attrs_cnt - 1].name, |
| 73 | msg->attrs[msg->attrs_cnt - 1].value); |
| 74 | |
| 75 | freecxx . . $ free(5d22bdacc48458e8).(msg->attrscxx . . $ SEAP_msg#attrs.[msg->attrs_cntcxx . . $ SEAP_msg#attrs_cnt. - 1].namecxx . . $ SEAP_attr#name.); |
| 76 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4). (msg->attrscxx . . $ SEAP_msg#attrs.[msg->attrs_cntcxx . . $ SEAP_msg#attrs_cnt. - 1].valuecxx . . $ SEAP_attr#value.); |
| 77 | } |
| 78 | |
| 79 | freecxx . . $ free(5d22bdacc48458e8).(msg->attrscxx . . $ SEAP_msg#attrs.); |
| 80 | } |
| 81 | |
| 82 | if (msg->sexpcxx . . $ SEAP_msg#sexp. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 83 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4). (msg->sexpcxx . . $ SEAP_msg#sexp.); |
| 84 | |
| 85 | freecxx . . $ free(5d22bdacc48458e8).(msg); |
| 86 | return; |
| 87 | } |
| 88 | |
| 89 | int SEAP_msg_setcxx . . $ SEAP_msg_set(780f103242f3120a). (SEAP_msg_tcxx . . $ SEAP_msg_t# *msg, SEXP_tcxx . . $ SEXP_t# *sexp) |
| 90 | { |
| 91 | msg->sexpcxx . . $ SEAP_msg#sexp. = SEXP_refcxx . . $ SEXP_ref(2f7f980afaaae0f0). (sexp); |
| 92 | return (0); |
| 93 | } |
| 94 | |
| 95 | void SEAP_msg_unsetcxx . . $ SEAP_msg_unset(4995d55015d41e57). (SEAP_msg_tcxx . . $ SEAP_msg_t# *msg) |
| 96 | { |
| 97 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4). (msg->sexpcxx . . $ SEAP_msg#sexp.); |
| 98 | msg->sexpcxx . . $ SEAP_msg#sexp. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 99 | return; |
| 100 | } |
| 101 | |
| 102 | SEXP_tcxx . . $ SEXP_t# *SEAP_msg_getcxx . . $ SEAP_msg_get(265ef69b98da50a9). (SEAP_msg_tcxx . . $ SEAP_msg_t# *msg) |
| 103 | { |
| 104 | return SEXP_refcxx . . $ SEXP_ref(2f7f980afaaae0f0). (msg->sexpcxx . . $ SEAP_msg#sexp.); |
| 105 | } |
| 106 | |
| 107 | SEAP_msgid_tcxx . . $ SEAP_msgid_t# SEAP_msg_idcxx . . $ SEAP_msg_id(18c00517003ebe74). (SEAP_msg_tcxx . . $ SEAP_msg_t# *msg) |
| 108 | { |
| 109 | return (msg->idcxx . . $ SEAP_msg#id.); |
| 110 | } |
| 111 | |
| 112 | int SEAP_msgattr_setcxx . . $ SEAP_msgattr_set(be99563c35b05491). (SEAP_msg_tcxx . . $ SEAP_msg_t# *msg, const char *attr, SEXP_tcxx . . $ SEXP_t# *value) |
| 113 | { |
| 114 | _Acxx . . $ `src/common/debug_priv.h:43:9`!(msg != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 115 | _Acxx . . $ `src/common/debug_priv.h:43:9`!(attr != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 116 | |
| 117 | #ifndef NDEBUGcxx . . $ `<built-in>:425:9`! |
| 118 | if (value != NULL) |
| 119 | SEXP_VALIDATE(value); |
| 120 | #endif |
| 121 | void *new_attrs = realloccxx . . $ realloc(417ab160f6baadc6).(msg->attrscxx . . $ SEAP_msg#attrs., sizeof(SEAP_attr_tcxx . . $ SEAP_attr_t#) * (++msg->attrs_cntcxx . . $ SEAP_msg#attrs_cnt.)); |
| 122 | if (new_attrs == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 123 | return -1; |
| 124 | msg->attrscxx . . $ SEAP_msg#attrs. = new_attrs; |
| 125 | msg->attrscxx . . $ SEAP_msg#attrs.[msg->attrs_cntcxx . . $ SEAP_msg#attrs_cnt. - 1].namecxx . . $ SEAP_attr#name. = strdupcxx . . $ strdup(a8b8e32347182212). (attr); |
| 126 | msg->attrscxx . . $ SEAP_msg#attrs.[msg->attrs_cntcxx . . $ SEAP_msg#attrs_cnt. - 1].valuecxx . . $ SEAP_attr#value. = (value != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ? SEXP_refcxx . . $ SEXP_ref(2f7f980afaaae0f0). (value) : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 127 | |
| 128 | return (0); |
| 129 | } |
| 130 | |
| 131 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! SEAP_msgattr_existscxx . . $ SEAP_msgattr_exists(2dc8898f2a6eccd3). (SEAP_msg_tcxx . . $ SEAP_msg_t# *msg, const char *name) |
| 132 | { |
| 133 | uint16_tcxx . . $ uint16_t# i; |
| 134 | |
| 135 | _Acxx . . $ `src/common/debug_priv.h:43:9`!(msg != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 136 | _Acxx . . $ `src/common/debug_priv.h:43:9`!(name != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 137 | |
| 138 | dDcxx . . $ `src/common/debug_priv.h:64:9`!("cnt = %u", msg->attrs_cnt); |
| 139 | |
| 140 | /* FIXME: this is stupid */ |
| 141 | for (i = 0; i < msg->attrs_cntcxx . . $ SEAP_msg#attrs_cnt.; ++i) { |
| 142 | dDcxx . . $ `src/common/debug_priv.h:64:9`!("%s ?= %s", name, msg->attrs[i].name); |
| 143 | if (strcmpcxx . . $ strcmp(5ae29d726ae57f88). (name, msg->attrscxx . . $ SEAP_msg#attrs.[i].namecxx . . $ SEAP_attr#name.) == 0) |
| 144 | return (truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!); |
| 145 | } |
| 146 | |
| 147 | return (falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!); |
| 148 | } |
| 149 |