• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

OISF / suricata / 22550934724

01 Mar 2026 07:34PM UTC coverage: 75.853% (+2.2%) from 73.687%
22550934724

Pull #14923

github

web-flow
github-actions: bump github/codeql-action from 4.32.3 to 4.32.4

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.32.3 to 4.32.4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v4.32.3...v4.32.4)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.32.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #14923: github-actions: bump github/codeql-action from 4.32.3 to 4.32.4

240804 of 317461 relevant lines covered (75.85%)

2441195.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/util-lua-dns.c
1
/* Copyright (C) 2014-2025 Open Information Security Foundation
2
 *
3
 * You can copy, redistribute or modify this Program under the terms of
4
 * the GNU General Public License version 2 as published by the Free
5
 * Software Foundation.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 * GNU General Public License for more details.
11
 *
12
 * You should have received a copy of the GNU General Public License
13
 * version 2 along with this program; if not, write to the Free Software
14
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15
 * 02110-1301, USA.
16
 */
17

18
/**
19
 * \file
20
 *
21
 * \author Eric Leblond <eric@regit.org>
22
 *
23
 */
24

25
#include "suricata-common.h"
26
#include "util-lua-dns.h"
27
#include "util-lua.h"
28
#include "util-lua-common.h"
29
#include "rust.h"
30

31
// #define DNS_MT "suricata:dns:tx"
32
static const char dns_tx[] = "suricata:dns:tx";
33

34
struct LuaTx {
35
    DNSTransaction *tx;
36
};
37

38
static int LuaDnsGetTx(lua_State *L)
39
{
×
40
    if (!(LuaStateNeedProto(L, ALPROTO_DNS))) {
×
41
        return LuaCallbackError(L, "error: protocol not dns");
×
42
    }
×
43
    DNSTransaction *tx = LuaStateGetTX(L);
×
44
    if (tx == NULL) {
×
45
        return LuaCallbackError(L, "error: no tx available");
×
46
    }
×
47
    struct LuaTx *ltx = (struct LuaTx *)lua_newuserdata(L, sizeof(*ltx));
×
48
    if (ltx == NULL) {
×
49
        return LuaCallbackError(L, "error: fail to allocate user data");
×
50
    }
×
51
    ltx->tx = tx;
×
52

53
    luaL_getmetatable(L, dns_tx);
×
54
    lua_setmetatable(L, -2);
×
55

56
    return 1;
×
57
}
×
58

59
static int LuaDnsTxGetRrname(lua_State *L)
60
{
×
61
    struct LuaTx *tx = luaL_testudata(L, 1, dns_tx);
×
62
    if (tx == NULL) {
×
63
        lua_pushnil(L);
×
64
        return 1;
×
65
    }
×
66
    return SCDnsLuaGetRrname(L, tx->tx);
×
67
}
×
68

69
static int LuaDnsTxGetTxid(lua_State *L)
70
{
×
71
    struct LuaTx *tx = luaL_testudata(L, 1, dns_tx);
×
72
    if (tx == NULL) {
×
73
        lua_pushnil(L);
×
74
        return 1;
×
75
    }
×
76
    return SCDnsLuaGetTxId(L, tx->tx);
×
77
}
×
78

79
static int LuaDnsTxGetRcode(lua_State *L)
80
{
×
81
    struct LuaTx *tx = luaL_testudata(L, 1, dns_tx);
×
82
    if (tx == NULL) {
×
83
        lua_pushnil(L);
×
84
        return 1;
×
85
    }
×
86
    return SCDnsLuaGetRcode(L, tx->tx);
×
87
}
×
88

89
static int LuaDnsTxGetRcodeString(lua_State *L)
90
{
×
91
    struct LuaTx *tx = luaL_testudata(L, 1, dns_tx);
×
92
    if (tx == NULL) {
×
93
        lua_pushnil(L);
×
94
        return 1;
×
95
    }
×
96
    return SCDnsLuaGetRcodeString(L, tx->tx);
×
97
}
×
98

99
static int LuaDnsTxGetRecursionDesired(lua_State *L)
100
{
×
101
    struct LuaTx *tx = luaL_testudata(L, 1, dns_tx);
×
102
    if (tx == NULL) {
×
103
        lua_pushnil(L);
×
104
        return 1;
×
105
    }
×
106
    uint16_t flags = SCDnsTxGetResponseFlags(tx->tx);
×
107
    int recursion_desired = flags & 0x0080 ? 1 : 0;
×
108
    lua_pushboolean(L, recursion_desired);
×
109
    return 1;
×
110
}
×
111

112
static int LuaDnsTxGetQueries(lua_State *L)
113
{
×
114
    struct LuaTx *tx = luaL_testudata(L, 1, dns_tx);
×
115
    if (tx == NULL) {
×
116
        lua_pushnil(L);
×
117
        return 1;
×
118
    }
×
119
    return SCDnsLuaGetQueryTable(L, tx->tx);
×
120
}
×
121

122
static int LuaDnsTxGetAnswers(lua_State *L)
123
{
×
124
    struct LuaTx *tx = luaL_testudata(L, 1, dns_tx);
×
125
    if (tx == NULL) {
×
126
        lua_pushnil(L);
×
127
        return 1;
×
128
    }
×
129
    return SCDnsLuaGetAnswerTable(L, tx->tx);
×
130
}
×
131

132
static int LuaDnsTxGetAuthorities(lua_State *L)
133
{
×
134
    struct LuaTx *tx = luaL_testudata(L, 1, dns_tx);
×
135
    if (tx == NULL) {
×
136
        lua_pushnil(L);
×
137
        return 1;
×
138
    }
×
139
    return SCDnsLuaGetAuthorityTable(L, tx->tx);
×
140
}
×
141

142
static const struct luaL_Reg txlib[] = {
143
    // clang-format off
144
    { "answers", LuaDnsTxGetAnswers },
145
    { "authorities", LuaDnsTxGetAuthorities },
146
    { "queries", LuaDnsTxGetQueries },
147
    { "rcode", LuaDnsTxGetRcode },
148
    { "rcode_string", LuaDnsTxGetRcodeString },
149
    { "recursion_desired", LuaDnsTxGetRecursionDesired },
150
    { "rrname", LuaDnsTxGetRrname },
151
    { "txid", LuaDnsTxGetTxid },
152
    { NULL, NULL, }
153
    // clang-format on
154
};
155

156
static const struct luaL_Reg dnslib[] = {
157
    // clang-format off
158
    { "get_tx", LuaDnsGetTx },
159
    { NULL, NULL,},
160
    // clang-format on
161
};
162

163
int SCLuaLoadDnsLib(lua_State *L)
164
{
×
165
    luaL_newmetatable(L, dns_tx);
×
166
    lua_pushvalue(L, -1);
×
167
    lua_setfield(L, -2, "__index");
×
168
    luaL_setfuncs(L, txlib, 0);
×
169

170
    luaL_newlib(L, dnslib);
×
171
    return 1;
×
172
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc