2 Unix SMB/CIFS implementation.
3 Standardised Authentication types
4 Copyright (C) Andrew Bartlett 2001
5 Copyright (C) Stefan Metzmacher 2005
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
24 extern const char *user_attrs[];
26 union netr_Validation;
27 struct netr_SamBaseInfo;
30 /* modules can use the following to determine if the interface has changed
31 * please increment the version number after each interface change
32 * with a comment and maybe update struct auth_critical_sizes.
34 /* version 1 - version from samba 3.0 - metze */
35 /* version 2 - initial samba4 version - metze */
36 /* version 3 - subsequent samba4 version - abartlet */
37 /* version 4 - subsequent samba4 version - metze */
38 /* version 0 - till samba4 is stable - metze */
39 #define AUTH_INTERFACE_VERSION 0
41 #define USER_INFO_CASE_INSENSITIVE_USERNAME 0x01 /* username may be in any case */
42 #define USER_INFO_CASE_INSENSITIVE_PASSWORD 0x02 /* password may be in any case */
43 #define USER_INFO_DONT_CHECK_UNIX_ACCOUNT 0x04 /* dont check unix account status */
44 #define USER_INFO_INTERACTIVE_LOGON 0x08 /* dont check unix account status */
46 enum auth_password_state {
47 AUTH_PASSWORD_RESPONSE,
52 struct auth_usersupplied_info
54 const char *workstation_name;
55 struct socket_address *remote_host;
57 uint32_t logon_parameters;
60 /* the values the client gives us */
62 const char *account_name;
63 const char *domain_name;
66 enum auth_password_state password_state;
74 struct samr_Password *lanman;
75 struct samr_Password *nt;
83 struct auth_serversupplied_info
85 struct dom_sid *account_sid;
86 struct dom_sid *primary_group_sid;
88 size_t n_domain_groups;
89 struct dom_sid **domain_groups;
91 DATA_BLOB user_session_key;
92 DATA_BLOB lm_session_key;
94 const char *account_name;
95 const char *domain_name;
97 const char *full_name;
98 const char *logon_script;
99 const char *profile_path;
100 const char *home_directory;
101 const char *home_drive;
102 const char *logon_server;
107 NTTIME last_password_change;
108 NTTIME allow_password_change;
109 NTTIME force_password_change;
111 uint16_t logon_count;
112 uint16_t bad_password_count;
119 struct auth_session_info {
120 struct security_token *security_token;
121 struct auth_serversupplied_info *server_info;
122 DATA_BLOB session_key;
123 struct cli_credentials *credentials;
126 struct auth_method_context;
127 struct auth_check_password_request;
129 struct auth_operations {
132 /* If you are using this interface, then you are probably
133 * getting something wrong. This interface is only for
134 * security=server, and makes a number of compromises to allow
135 * that. It is not compatible with being a PDC. */
137 NTSTATUS (*get_challenge)(struct auth_method_context *ctx, TALLOC_CTX *mem_ctx, DATA_BLOB *challenge);
139 /* Given the user supplied info, check if this backend want to handle the password checking */
141 NTSTATUS (*want_check)(struct auth_method_context *ctx, TALLOC_CTX *mem_ctx,
142 const struct auth_usersupplied_info *user_info);
144 /* Given the user supplied info, check a password */
146 NTSTATUS (*check_password)(struct auth_method_context *ctx, TALLOC_CTX *mem_ctx,
147 const struct auth_usersupplied_info *user_info,
148 struct auth_serversupplied_info **server_info);
151 struct auth_method_context {
152 struct auth_method_context *prev, *next;
153 struct auth_context *auth_ctx;
154 const struct auth_operations *ops;
159 struct auth_context {
161 /* Who set this up in the first place? */
164 bool may_be_modified;
169 /* methods, in the order they should be called */
170 struct auth_method_context *methods;
172 /* the event context to use for calls that can block */
173 struct event_context *event_ctx;
175 /* the messaging context which can be used by backends */
176 struct messaging_context *msg_ctx;
179 /* this structure is used by backends to determine the size of some critical types */
180 struct auth_critical_sizes {
181 int interface_version;
182 int sizeof_auth_operations;
183 int sizeof_auth_methods;
184 int sizeof_auth_context;
185 int sizeof_auth_usersupplied_info;
186 int sizeof_auth_serversupplied_info;
189 NTSTATUS encrypt_user_info(TALLOC_CTX *mem_ctx, struct auth_context *auth_context,
190 enum auth_password_state to_state,
191 const struct auth_usersupplied_info *user_info_in,
192 const struct auth_usersupplied_info **user_info_encrypted);
194 #include "auth/auth_proto.h"
196 #endif /* _SMBAUTH_H_ */