libads: Make ads_cldap_netlogon() static
[samba4-gss.git] / source4 / kdc / pac-blobs.h
blob0c5f034df6e566355e90fb026a83513688abcb91
1 /*
2 Unix SMB/CIFS implementation.
4 PAC Glue between Samba and the KDC
6 Copyright (C) Catalyst.Net Ltd 2023
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "lib/replace/replace.h"
24 #include <stddef.h>
25 #include <stdint.h>
27 #include "system/kerberos.h"
28 #include "auth/kerberos/kerberos.h"
29 #include <krb5/krb5.h>
31 #include "lib/util/data_blob.h"
32 #include "librpc/gen_ndr/ndr_krb5pac.h"
34 struct type_data {
35 uint32_t type;
36 const DATA_BLOB *data;
39 struct pac_blobs {
40 size_t type_index[PAC_TYPE_COUNT];
41 struct type_data *type_blobs;
42 size_t num_types;
45 krb5_error_code pac_blobs_from_krb5_pac(TALLOC_CTX *mem_ctx,
46 krb5_context context,
47 const krb5_const_pac pac,
48 struct pac_blobs **pac_blobs);
50 #define pac_blobs_ensure_exists(pac_blobs, type) \
51 _pac_blobs_ensure_exists(pac_blobs, \
52 type, \
53 #type, \
54 __location__, \
55 __func__)
57 krb5_error_code _pac_blobs_ensure_exists(struct pac_blobs *pac_blobs,
58 const uint32_t type,
59 const char *name,
60 const char *location,
61 const char *function);
63 #define pac_blobs_replace_existing(pac_blobs, type, blob) \
64 _pac_blobs_replace_existing(pac_blobs, \
65 type, \
66 #type, \
67 blob, \
68 __location__, \
69 __func__)
71 krb5_error_code _pac_blobs_replace_existing(struct pac_blobs *pac_blobs,
72 const uint32_t type,
73 const char *name,
74 const DATA_BLOB *blob,
75 const char *location,
76 const char *function);
78 krb5_error_code pac_blobs_add_blob(struct pac_blobs *pac_blobs,
79 const uint32_t type,
80 const DATA_BLOB *blob);
82 void pac_blobs_remove_blob(struct pac_blobs *pac_blobs,
83 const uint32_t type);