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

OISF / suricata / 22550902417

01 Mar 2026 07:32PM UTC coverage: 68.401% (-5.3%) from 73.687%
22550902417

Pull #14922

github

web-flow
github-actions: bump actions/upload-artifact from 6.0.0 to 7.0.0

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 6.0.0 to 7.0.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #14922: github-actions: bump actions/upload-artifact from 6.0.0 to 7.0.0

218243 of 319063 relevant lines covered (68.4%)

3284926.58 hits per line

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

0.0
/rust/src/dns/lua.rs
1
/* Copyright (C) 2017 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
use std::os::raw::c_int;
19

20
use crate::dns::dns::*;
21
use crate::dns::log::*;
22
use crate::lua::*;
23

24
#[no_mangle]
25
pub extern "C" fn SCDnsLuaGetTxId(clua: &mut CLuaState, tx: &mut DNSTransaction) -> c_int {
×
26
    let lua = LuaState { lua: clua };
×
27

×
28
    lua.pushinteger(tx.tx_id() as i64);
×
29
    return 1;
×
30
}
×
31

32
#[no_mangle]
33
pub extern "C" fn SCDnsLuaGetRrname(clua: &mut CLuaState, tx: &mut DNSTransaction) -> c_int {
×
34
    let lua = LuaState { lua: clua };
×
35

36
    if let Some(request) = &tx.request {
×
37
        if let Some(query) = request.queries.first() {
×
38
            lua.pushstring(&String::from_utf8_lossy(&query.name.value));
×
39
            return 1;
×
40
        }
×
41
    } else if let Some(response) = &tx.response {
×
42
        if let Some(query) = response.queries.first() {
×
43
            lua.pushstring(&String::from_utf8_lossy(&query.name.value));
×
44
            return 1;
×
45
        }
×
46
    }
×
47

48
    return 0;
×
49
}
×
50

51
#[no_mangle]
52
pub extern "C" fn SCDnsLuaGetRcode(clua: &mut CLuaState, tx: &mut DNSTransaction) -> c_int {
×
53
    let lua = LuaState { lua: clua };
×
54
    lua.pushinteger(tx.rcode() as i64);
×
55
    return 1;
×
56
}
×
57

58
#[no_mangle]
59
pub extern "C" fn SCDnsLuaGetRcodeString(clua: &mut CLuaState, tx: &mut DNSTransaction) -> c_int {
×
60
    let lua = LuaState { lua: clua };
×
61
    lua.pushstring(&dns_rcode_string(tx.rcode()));
×
62
    return 1;
×
63
}
×
64

65
#[no_mangle]
66
pub extern "C" fn SCDnsLuaGetQueryTable(clua: &mut CLuaState, tx: &mut DNSTransaction) -> c_int {
×
67
    let lua = LuaState { lua: clua };
×
68

×
69
    let mut i: i64 = 0;
×
70

×
71
    // Create table now to be consistent with C that always returns
×
72
    // table even in the absence of any authorities.
×
73
    lua.newtable();
×
74

75
    // We first look in the request for queries. However, if there is
76
    // no request, check the response for queries.
77
    if let Some(request) = &tx.request {
×
78
        for query in &request.queries {
×
79
            lua.pushinteger(i);
×
80
            i += 1;
×
81

×
82
            lua.newtable();
×
83

×
84
            lua.pushstring("type");
×
85
            lua.pushstring(&dns_rrtype_string(query.rrtype));
×
86
            lua.settable(-3);
×
87

×
88
            lua.pushstring("rrname");
×
89
            lua.pushstring(&String::from_utf8_lossy(&query.name.value));
×
90
            lua.settable(-3);
×
91

×
92
            lua.settable(-3);
×
93
        }
×
94
    } else if let Some(response) = &tx.response {
×
95
        for query in &response.queries {
×
96
            lua.pushinteger(i);
×
97
            i += 1;
×
98

×
99
            lua.newtable();
×
100

×
101
            lua.pushstring("type");
×
102
            lua.pushstring(&dns_rrtype_string(query.rrtype));
×
103
            lua.settable(-3);
×
104

×
105
            lua.pushstring("rrname");
×
106
            lua.pushstring(&String::from_utf8_lossy(&query.name.value));
×
107
            lua.settable(-3);
×
108

×
109
            lua.settable(-3);
×
110
        }
×
111
    }
×
112

113
    // Again, always return 1 to be consistent with C, even if the
114
    // table is empty.
115
    return 1;
×
116
}
×
117

118
#[no_mangle]
119
pub extern "C" fn SCDnsLuaGetAnswerTable(clua: &mut CLuaState, tx: &mut DNSTransaction) -> c_int {
×
120
    let lua = LuaState { lua: clua };
×
121

×
122
    let mut i: i64 = 0;
×
123

×
124
    // Create table now to be consistent with C that always returns
×
125
    // table even in the absence of any authorities.
×
126
    lua.newtable();
×
127

128
    if let Some(response) = &tx.response {
×
129
        for answer in &response.answers {
×
130
            lua.pushinteger(i);
×
131
            i += 1;
×
132

×
133
            lua.newtable();
×
134
            lua.pushstring("type");
×
135
            lua.pushstring(&dns_rrtype_string(answer.rrtype));
×
136
            lua.settable(-3);
×
137

×
138
            lua.pushstring("ttl");
×
139
            lua.pushinteger(answer.ttl as i64);
×
140
            lua.settable(-3);
×
141

×
142
            lua.pushstring("rrname");
×
143
            lua.pushstring(&String::from_utf8_lossy(&answer.name.value));
×
144
            lua.settable(-3);
×
145

×
146
            // All rdata types are pushed to "addr" for backwards compatibility
×
147
            match &answer.data {
×
148
                DNSRData::A(ref bytes) | DNSRData::AAAA(ref bytes) => {
×
149
                    if !bytes.is_empty() {
×
150
                        lua.pushstring("addr");
×
151
                        lua.pushstring(&dns_print_addr(bytes));
×
152
                        lua.settable(-3);
×
153
                    }
×
154
                }
155
                DNSRData::CNAME(name)
×
156
                | DNSRData::MX(name)
×
157
                | DNSRData::NS(name)
×
158
                | DNSRData::PTR(name) => {
×
159
                    if !name.value.is_empty() {
×
160
                        lua.pushstring("addr");
×
161
                        lua.pushstring(&String::from_utf8_lossy(&name.value));
×
162
                        lua.settable(-3);
×
163
                    }
×
164
                }
165
                DNSRData::TXT(ref txt) => {
×
166
                    if !txt.is_empty() {
×
167
                        lua.pushstring("addr");
×
168
                        let combined = txt
×
169
                            .iter()
×
170
                            .map(|s| String::from_utf8_lossy(s))
×
171
                            .collect::<Vec<_>>()
×
172
                            .join(" ");
×
173
                        lua.pushstring(&combined);
×
174
                        lua.settable(-3);
×
175
                    }
×
176
                }
177
                DNSRData::NULL(ref bytes)
×
178
                | DNSRData::Unknown(ref bytes) => {
×
179
                    if !bytes.is_empty() {
×
180
                        lua.pushstring("addr");
×
181
                        lua.pushstring(&String::from_utf8_lossy(bytes));
×
182
                        lua.settable(-3);
×
183
                    }
×
184
                }
185
                DNSRData::SOA(ref soa) => {
×
186
                    if !soa.mname.value.is_empty() {
×
187
                        lua.pushstring("addr");
×
188
                        lua.pushstring(&String::from_utf8_lossy(&soa.mname.value));
×
189
                        lua.settable(-3);
×
190
                    }
×
191
                }
192
                DNSRData::SSHFP(ref sshfp) => {
×
193
                    lua.pushstring("addr");
×
194
                    lua.pushstring(&String::from_utf8_lossy(&sshfp.fingerprint));
×
195
                    lua.settable(-3);
×
196
                }
×
197
                DNSRData::SRV(ref srv) => {
×
198
                    lua.pushstring("addr");
×
199
                    lua.pushstring(&String::from_utf8_lossy(&srv.target.value));
×
200
                    lua.settable(-3);
×
201
                }
×
202
                DNSRData::OPT(ref opt) => {
×
203
                    if !opt.is_empty() {
×
204
                        lua.pushstring("addr");
×
205
                        for option in opt.iter() {
×
206
                            lua.pushstring(&String::from_utf8_lossy(&option.code.to_be_bytes()));
×
207
                            lua.pushstring(&String::from_utf8_lossy(&option.data));
×
208
                        }
×
209
                        lua.settable(-3);
×
210
                    }
×
211
                }
212
            }
213
            lua.settable(-3);
×
214
        }
215
    }
×
216

217
    // Again, always return 1 to be consistent with C, even if the
218
    // table is empty.
219
    return 1;
×
220
}
×
221

222
#[no_mangle]
223
pub extern "C" fn SCDnsLuaGetAuthorityTable(
×
224
    clua: &mut CLuaState, tx: &mut DNSTransaction,
×
225
) -> c_int {
×
226
    let lua = LuaState { lua: clua };
×
227

×
228
    let mut i: i64 = 0;
×
229

×
230
    // Create table now to be consistent with C that always returns
×
231
    // table even in the absence of any authorities.
×
232
    lua.newtable();
×
233

234
    if let Some(response) = &tx.response {
×
235
        for answer in &response.authorities {
×
236
            lua.pushinteger(i);
×
237
            i += 1;
×
238

×
239
            lua.newtable();
×
240
            lua.pushstring("type");
×
241
            lua.pushstring(&dns_rrtype_string(answer.rrtype));
×
242
            lua.settable(-3);
×
243

×
244
            lua.pushstring("ttl");
×
245
            lua.pushinteger(answer.ttl as i64);
×
246
            lua.settable(-3);
×
247

×
248
            lua.pushstring("rrname");
×
249
            lua.pushstring(&String::from_utf8_lossy(&answer.name.value));
×
250
            lua.settable(-3);
×
251

×
252
            lua.settable(-3);
×
253
        }
×
254
    }
×
255

256
    // Again, always return 1 to be consistent with C, even if the
257
    // table is empty.
258
    return 1;
×
259
}
×
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