Coverage Report

Created: 2026-09-28 07:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/suricata8/src/detect-krb5-cname.c
Line
Count
Source
1
/* Copyright (C) 2018-2022 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 Pierre Chifflier <chifflier@wzdftpd.net>
22
 */
23
24
#include "suricata-common.h"
25
#include "util-unittest.h"
26
27
#include "detect-parse.h"
28
#include "detect-engine.h"
29
#include "detect-engine-buffer.h"
30
#include "detect-engine-mpm.h"
31
#include "detect-engine-state.h"
32
#include "detect-engine-prefilter.h"
33
#include "detect-engine-content-inspection.h"
34
35
#include "detect-krb5-cname.h"
36
37
#include "rust.h"
38
#include "util-profiling.h"
39
40
static int g_krb5_cname_buffer_id = 0;
41
42
static int DetectKrb5CNameSetup(DetectEngineCtx *de_ctx, Signature *s, const char *arg)
43
3
{
44
3
    if (SCDetectBufferSetActiveList(de_ctx, s, g_krb5_cname_buffer_id) < 0)
45
0
        return -1;
46
47
3
    if (SCDetectSignatureSetAppProto(s, ALPROTO_KRB5) != 0)
48
2
        return -1;
49
50
1
    return 0;
51
3
}
52
53
void DetectKrb5CNameRegister(void)
54
39
{
55
39
    sigmatch_table[DETECT_KRB5_CNAME].name = "krb5.cname";
56
39
    sigmatch_table[DETECT_KRB5_CNAME].alias = "krb5_cname";
57
39
    sigmatch_table[DETECT_KRB5_CNAME].url = "/rules/kerberos-keywords.html#krb5-cname";
58
39
    sigmatch_table[DETECT_KRB5_CNAME].Setup = DetectKrb5CNameSetup;
59
39
    sigmatch_table[DETECT_KRB5_CNAME].flags |= SIGMATCH_NOOPT | SIGMATCH_INFO_STICKY_BUFFER;
60
39
    sigmatch_table[DETECT_KRB5_CNAME].desc = "sticky buffer to match on Kerberos 5 client name";
61
62
39
    DetectAppLayerMultiRegister(
63
39
            "krb5_cname", ALPROTO_KRB5, SIG_FLAG_TOCLIENT, 1, SCKrb5TxGetCname, 2);
64
65
39
    DetectBufferTypeSetDescriptionByName("krb5_cname",
66
39
            "Kerberos 5 ticket client name");
67
68
39
    g_krb5_cname_buffer_id = DetectBufferTypeGetByName("krb5_cname");
69
70
39
    DetectBufferTypeSupportsMultiInstance("krb5_cname");
71
39
}