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 struct auth_usersupplied_info {
25 DATA_BLOB lm_interactive_pwd;
26 DATA_BLOB nt_interactive_pwd;
27 DATA_BLOB plaintext_password;
31 char *account_name; /* username before mapping */
34 bool was_mapped; /* Did the username map actually match? */
35 char *client_domain; /* domain name string */
36 char *domain; /* domain name after mapping */
37 char *internal_username; /* username after mapping */
38 const char *workstation_name; /* workstation name (netbios calling
39 * name) unicode string */
41 uint32 logon_parameters;
45 struct extra_auth_info {
46 struct dom_sid user_sid;
47 struct dom_sid pgid_sid;
50 struct auth_serversupplied_info {
54 struct unix_user_token utok;
56 /* NT group information taken from the info3 structure */
60 /* This is the final session key, as used by SMB signing, and
61 * (truncated to 16 bytes) encryption on the SAMR and LSA pipes
63 * It is calculated by NTLMSSP from the session key in the info3,
64 * and is set from the Kerberos session key using
65 * krb5_auth_con_getremotesubkey().
67 * Bootom line, it is not the same as the session keys in info3.
70 DATA_BLOB user_session_key;
71 DATA_BLOB lm_session_key;
73 struct netr_SamInfo3 *info3;
75 /* this structure is filled *only* in pathological cases where the user
76 * sid or the primary group sid are not sids of the domain. Normally
77 * this happens only for unix accounts that have unix domain sids.
78 * This is checked only when info3.rid and/or info3.primary_gid are set
79 * to the special invalid value of 0xFFFFFFFF */
80 struct extra_auth_info extra;
85 * This is a token from /etc/passwd and /etc/group
92 * For performance reasons we keep an alpha_strcpy-sanitized version
93 * of the username around as long as the global variable current_user
94 * still exists. If we did not do keep this, we'd have to call
95 * alpha_strcpy whenever we do a become_user(), potentially on every
96 * smb request. See set_current_user_info.
98 char *sanitized_username;
101 struct auth_context {
104 /* Who set this up in the first place? */
105 const char *challenge_set_by;
107 bool challenge_may_be_modified;
109 struct auth_methods *challenge_set_method;
110 /* What order are the various methods in? Try to stop it changing under us */
111 struct auth_methods *auth_method_list;
113 NTSTATUS (*get_ntlm_challenge)(struct auth_context *auth_context,
115 NTSTATUS (*check_ntlm_password)(const struct auth_context *auth_context,
116 const struct auth_usersupplied_info *user_info,
117 struct auth_serversupplied_info **server_info);
118 NTSTATUS (*nt_status_squash)(NTSTATUS nt_status);
119 void (*free)(struct auth_context **auth_context);
122 typedef struct auth_methods
124 struct auth_methods *prev, *next;
125 const char *name; /* What name got this module */
127 NTSTATUS (*auth)(const struct auth_context *auth_context,
128 void *my_private_data,
130 const struct auth_usersupplied_info *user_info,
131 struct auth_serversupplied_info **server_info);
133 /* If you are using this interface, then you are probably
134 * getting something wrong. This interface is only for
135 * security=server, and makes a number of compromises to allow
136 * that. It is not compatible with being a PDC. */
137 DATA_BLOB (*get_chal)(const struct auth_context *auth_context,
138 void **my_private_data,
139 TALLOC_CTX *mem_ctx);
141 /* Used to keep tabs on things like the cli for SMB server authentication */
146 typedef NTSTATUS (*auth_init_function)(struct auth_context *, const char *, struct auth_methods **);
148 struct auth_init_function_entry {
150 /* Function to create a member of the authmethods list */
152 auth_init_function init;
154 struct auth_init_function_entry *prev, *next;
157 struct auth_ntlmssp_state;
159 /* Changed from 1 -> 2 to add the logon_parameters field. */
160 #define AUTH_INTERFACE_VERSION 2
162 #endif /* _SMBAUTH_H_ */