4 Unix SMB/CIFS implementation.
5 Standardised Authentication types
6 Copyright (C) Andrew Bartlett 2001
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 "../auth/common_auth.h"
24 struct gensec_security;
26 struct extra_auth_info {
27 struct dom_sid user_sid;
28 struct dom_sid pgid_sid;
31 struct auth_serversupplied_info {
35 struct security_unix_token utok;
37 /* NT group information taken from the info3 structure */
39 struct security_token *security_token;
41 /* These are the intermediate session keys, as provided by a
42 * NETLOGON server and used by NTLMSSP to negotiate key
43 * exchange etc (which will provide the session_key in the
44 * auth_session_info). It is usually the same as the keys in
45 * the info3, but is a variable length structure here to allow
46 * it to be omitted if the auth module does not know it.
49 DATA_BLOB session_key;
50 DATA_BLOB lm_session_key;
52 struct netr_SamInfo3 *info3;
54 /* this structure is filled *only* in pathological cases where the user
55 * sid or the primary group sid are not sids of the domain. Normally
56 * this happens only for unix accounts that have unix domain sids.
57 * This is checked only when info3.rid and/or info3.primary_gid are set
58 * to the special invalid value of 0xFFFFFFFF */
59 struct extra_auth_info extra;
62 * This is a token from /etc/passwd and /etc/group
69 typedef NTSTATUS (*prepare_gensec_fn)(TALLOC_CTX *mem_ctx,
70 struct gensec_security **gensec_context);
72 typedef NTSTATUS (*make_auth4_context_fn)(TALLOC_CTX *mem_ctx,
73 struct auth4_context **auth4_context);
78 /* Who set this up in the first place? */
79 const char *challenge_set_by;
81 bool challenge_may_be_modified;
83 struct auth_methods *challenge_set_method;
84 /* What order are the various methods in? Try to stop it changing under us */
85 struct auth_methods *auth_method_list;
87 NTSTATUS (*get_ntlm_challenge)(struct auth_context *auth_context,
89 NTSTATUS (*check_ntlm_password)(const struct auth_context *auth_context,
90 const struct auth_usersupplied_info *user_info,
91 struct auth_serversupplied_info **server_info);
93 prepare_gensec_fn prepare_gensec;
94 make_auth4_context_fn make_auth4_context;
97 typedef struct auth_methods
99 struct auth_methods *prev, *next;
100 const char *name; /* What name got this module */
102 NTSTATUS (*auth)(const struct auth_context *auth_context,
103 void *my_private_data,
105 const struct auth_usersupplied_info *user_info,
106 struct auth_serversupplied_info **server_info);
108 /* If you are using this interface, then you are probably
109 * getting something wrong. This interface is only for
110 * security=server, and makes a number of compromises to allow
111 * that. It is not compatible with being a PDC. */
112 DATA_BLOB (*get_chal)(const struct auth_context *auth_context,
113 void **my_private_data,
114 TALLOC_CTX *mem_ctx);
116 /* Optional methods allowing this module to provide a way to get a gensec context and an auth4_context */
117 prepare_gensec_fn prepare_gensec;
118 make_auth4_context_fn make_auth4_context;
119 /* Used to keep tabs on things like the cli for SMB server authentication */
124 typedef NTSTATUS (*auth_init_function)(struct auth_context *, const char *, struct auth_methods **);
126 struct auth_init_function_entry {
128 /* Function to create a member of the authmethods list */
130 auth_init_function init;
132 struct auth_init_function_entry *prev, *next;
135 extern const struct gensec_security_ops gensec_ntlmssp3_server_ops;
137 /* Changed from 1 -> 2 to add the logon_parameters field. */
138 /* Changed from 2 -> 3 when we reworked many auth structures to use IDL or be in common with Samba4 */
139 #define AUTH_INTERFACE_VERSION 3
141 #include "auth/proto.h"
143 #endif /* _SMBAUTH_H_ */