Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
read_keytab_file.h
1/* read_keytab_file.h
2 * Routines for reading Kerberos keytab files
3 * Copyright 2007, Anders Broman <[email protected]>
4 *
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <[email protected]>
7 * Copyright 1998 Gerald Combs
8 *
9 * SPDX-License-Identifier: GPL-2.0-or-later
10 */
11
12#ifndef __READ_KEYTAB_FILE_H
13#define __READ_KEYTAB_FILE_H
14
15#include "ws_symbol_export.h"
16
17#ifdef __cplusplus
18extern "C" {
19#endif /* __cplusplus */
20
21WS_DLL_PUBLIC
22void keytab_file_read(const char *);
23
24#ifdef HAVE_KERBEROS
25#define KRB_MAX_KEY_LENGTH 32
26
27#if defined(HAVE_HEIMDAL_KERBEROS) || defined(HAVE_MIT_KERBEROS)
28
29typedef struct _enc_key_t {
30 struct _enc_key_t* next;
31 int keytype;
32 int keylength;
33 uint8_t keyvalue[KRB_MAX_KEY_LENGTH];
34 char* key_origin;
35 int fd_num; /* remember where we learned a key */
36 unsigned id; /* a unique id of the key, relative to fd_num */
37 char* id_str;
38 /* EncTicketPart_key */
39 bool is_ticket_key;
40 /* EncAPRepPart_subkey */
41 bool is_ap_rep_key;
42 /*
43 * for now taken from dissect_krb5_PAC_UPN_DNS_INFO,
44 * we could also use dissect_krb5_PAC_LOGON_INFO if needed
45 *
46 * we get device_sid from dissect_krb5_PAC_DEVICE_INFO if available.
47 *
48 * We remember these from the PAC and
49 * attach it to EncTicketPart_key so it
50 * might be valid if is_ticket_key is true.
51 *
52 * When learning a EncAPRepPart_subkey
53 * we copy the details from the EncTicketPart_key,
54 * so when is_ap_rep_key is true we may also have it.
55 *
56 * So application protocols like SMB2 could use the
57 * is_ap_rep_key=true key details in order to identify
58 * the authenticated user.
59 */
60 struct {
61 const char* account_name;
62 const char* account_domain;
63 const char* account_sid;
64 const char* device_sid;
65 } pac_names;
66 struct _enc_key_t* same_list;
67 unsigned num_same;
68 struct _enc_key_t* src1;
69 struct _enc_key_t* src2;
70} enc_key_t;
71
72extern const enc_key_t* keytab_get_enc_key_list(void);
73extern void keytab_set_enc_key_list(enc_key_t* list);
74extern const wmem_map_t* keytab_get_file_longterm_keys(void);
75extern wmem_map_t* keytab_get_file_all_keys(void);
76extern wmem_map_t* keytab_get_file_session_keys(void);
77
78extern void keytab_file_key_map_insert(wmem_map_t* key_map, enc_key_t* new_key);
79
80#endif /* defined(HAVE_HEIMDAL_KERBEROS) || defined(HAVE_MIT_KERBEROS) */
81
82#endif /* HAVE_KERBEROS */
83
84WS_DLL_LOCAL
85void keytab_file_data_init(void);
86
87#ifdef __cplusplus
88}
89#endif /* __cplusplus */
90
91#endif /* __READ_KEYTAB_FILE_H */
Definition wmem_map.c:60