tests/dns_forwarder: remove statically defined IPs
[Samba.git] / auth / gensec / gensec_internal.h
blob55352417e99a5e7b29f6603e0916b09a1914ff66
1 /*
2 Unix SMB/CIFS implementation.
4 Generic Authentication Interface
6 Copyright (C) Andrew Tridgell 2003
7 Copyright (C) Andrew Bartlett <abartlet@samba.org> 2004-2005
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #ifndef __GENSEC_INTERNAL_H__
24 #define __GENSEC_INTERNAL_H__
26 struct gensec_security;
28 struct gensec_security_ops {
29 const char *name;
30 const char *sasl_name;
31 uint8_t auth_type; /* 0 if not offered on DCE-RPC */
32 const char **oid; /* NULL if not offered by SPNEGO */
33 NTSTATUS (*client_start)(struct gensec_security *gensec_security);
34 NTSTATUS (*server_start)(struct gensec_security *gensec_security);
35 /**
36 Determine if a packet has the right 'magic' for this mechanism
38 NTSTATUS (*magic)(struct gensec_security *gensec_security,
39 const DATA_BLOB *first_packet);
40 NTSTATUS (*update)(struct gensec_security *gensec_security, TALLOC_CTX *out_mem_ctx,
41 struct tevent_context *ev,
42 const DATA_BLOB in, DATA_BLOB *out);
43 struct tevent_req *(*update_send)(TALLOC_CTX *mem_ctx,
44 struct tevent_context *ev,
45 struct gensec_security *gensec_security,
46 const DATA_BLOB in);
47 NTSTATUS (*update_recv)(struct tevent_req *req,
48 TALLOC_CTX *out_mem_ctx,
49 DATA_BLOB *out);
50 NTSTATUS (*may_reset_crypto)(struct gensec_security *gensec_security,
51 bool full_reset);
52 NTSTATUS (*seal_packet)(struct gensec_security *gensec_security, TALLOC_CTX *sig_mem_ctx,
53 uint8_t *data, size_t length,
54 const uint8_t *whole_pdu, size_t pdu_length,
55 DATA_BLOB *sig);
56 NTSTATUS (*sign_packet)(struct gensec_security *gensec_security, TALLOC_CTX *sig_mem_ctx,
57 const uint8_t *data, size_t length,
58 const uint8_t *whole_pdu, size_t pdu_length,
59 DATA_BLOB *sig);
60 size_t (*sig_size)(struct gensec_security *gensec_security, size_t data_size);
61 size_t (*max_input_size)(struct gensec_security *gensec_security);
62 size_t (*max_wrapped_size)(struct gensec_security *gensec_security);
63 NTSTATUS (*check_packet)(struct gensec_security *gensec_security,
64 const uint8_t *data, size_t length,
65 const uint8_t *whole_pdu, size_t pdu_length,
66 const DATA_BLOB *sig);
67 NTSTATUS (*unseal_packet)(struct gensec_security *gensec_security,
68 uint8_t *data, size_t length,
69 const uint8_t *whole_pdu, size_t pdu_length,
70 const DATA_BLOB *sig);
71 NTSTATUS (*wrap)(struct gensec_security *gensec_security,
72 TALLOC_CTX *mem_ctx,
73 const DATA_BLOB *in,
74 DATA_BLOB *out);
75 NTSTATUS (*unwrap)(struct gensec_security *gensec_security,
76 TALLOC_CTX *mem_ctx,
77 const DATA_BLOB *in,
78 DATA_BLOB *out);
79 NTSTATUS (*session_key)(struct gensec_security *gensec_security, TALLOC_CTX *mem_ctx,
80 DATA_BLOB *session_key);
81 NTSTATUS (*session_info)(struct gensec_security *gensec_security, TALLOC_CTX *mem_ctx,
82 struct auth_session_info **session_info);
83 void (*want_feature)(struct gensec_security *gensec_security,
84 uint32_t feature);
85 bool (*have_feature)(struct gensec_security *gensec_security,
86 uint32_t feature);
87 NTTIME (*expire_time)(struct gensec_security *gensec_security);
88 bool enabled;
89 bool kerberos;
90 enum gensec_priority priority;
93 struct gensec_security_ops_wrapper {
94 const struct gensec_security_ops *op;
95 const char *oid;
98 struct gensec_security {
99 const struct gensec_security_ops *ops;
100 void *private_data;
101 struct cli_credentials *credentials;
102 struct gensec_target target;
103 enum gensec_role gensec_role;
104 bool subcontext;
105 uint32_t want_features;
106 uint32_t max_update_size;
107 uint8_t dcerpc_auth_level;
108 struct tsocket_address *local_addr, *remote_addr;
109 struct gensec_settings *settings;
111 /* When we are a server, this may be filled in to provide an
112 * NTLM authentication backend, and user lookup (such as if no
113 * PAC is found) */
114 struct auth4_context *auth_context;
116 struct gensec_security *child_security;
119 /* this structure is used by backends to determine the size of some critical types */
120 struct gensec_critical_sizes {
121 int interface_version;
122 int sizeof_gensec_security_ops;
123 int sizeof_gensec_security;
126 NTSTATUS gensec_may_reset_crypto(struct gensec_security *gensec_security,
127 bool full_reset);
129 #endif /* __GENSEC_H__ */