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 bool was_mapped
; /* Did the username map actually match? */
32 char *client_domain
; /* domain name string */
33 char *domain
; /* domain name after mapping */
34 char *internal_username
; /* username after mapping */
35 char *smb_name
; /* username before mapping */
36 char *wksta_name
; /* workstation name (netbios calling
37 * name) unicode string */
39 uint32 logon_parameters
;
43 struct auth_serversupplied_info
{
46 struct dom_sid
*sids
; /* These SIDs are preliminary between
47 check_ntlm_password and the token creation. */
50 struct unix_user_token utok
;
52 /* NT group information taken from the info3 structure */
56 /* This is the final session key, as used by SMB signing, and
57 * (truncated to 16 bytes) encryption on the SAMR and LSA pipes
59 * It is calculated by NTLMSSP from the session key in the info3,
60 * and is set from the Kerberos session key using
61 * krb5_auth_con_getremotesubkey().
63 * Bootom line, it is not the same as the session keys in info3.
66 DATA_BLOB user_session_key
;
67 DATA_BLOB lm_session_key
;
69 struct netr_SamInfo3
*info3
;
74 * This is a token from /etc/passwd and /etc/group
81 * For performance reasons we keep an alpha_strcpy-sanitized version
82 * of the username around as long as the global variable current_user
83 * still exists. If we did not do keep this, we'd have to call
84 * alpha_strcpy whenever we do a become_user(), potentially on every
85 * smb request. See set_current_user_info.
87 char *sanitized_username
;
93 /* Who set this up in the first place? */
94 const char *challenge_set_by
;
96 bool challenge_may_be_modified
;
98 struct auth_methods
*challenge_set_method
;
99 /* What order are the various methods in? Try to stop it changing under us */
100 struct auth_methods
*auth_method_list
;
102 NTSTATUS (*get_ntlm_challenge
)(struct auth_context
*auth_context
,
104 NTSTATUS (*check_ntlm_password
)(const struct auth_context
*auth_context
,
105 const struct auth_usersupplied_info
*user_info
,
106 struct auth_serversupplied_info
**server_info
);
107 NTSTATUS (*nt_status_squash
)(NTSTATUS nt_status
);
108 void (*free
)(struct auth_context
**auth_context
);
111 typedef struct auth_methods
113 struct auth_methods
*prev
, *next
;
114 const char *name
; /* What name got this module */
116 NTSTATUS (*auth
)(const struct auth_context
*auth_context
,
117 void *my_private_data
,
119 const struct auth_usersupplied_info
*user_info
,
120 struct auth_serversupplied_info
**server_info
);
122 /* If you are using this interface, then you are probably
123 * getting something wrong. This interface is only for
124 * security=server, and makes a number of compromises to allow
125 * that. It is not compatible with being a PDC. */
126 DATA_BLOB (*get_chal
)(const struct auth_context
*auth_context
,
127 void **my_private_data
,
128 TALLOC_CTX
*mem_ctx
);
130 /* Used to keep tabs on things like the cli for SMB server authentication */
135 typedef NTSTATUS (*auth_init_function
)(struct auth_context
*, const char *, struct auth_methods
**);
137 struct auth_init_function_entry
{
139 /* Function to create a member of the authmethods list */
141 auth_init_function init
;
143 struct auth_init_function_entry
*prev
, *next
;
146 typedef struct auth_ntlmssp_state
{
148 struct auth_context
*auth_context
;
149 struct auth_serversupplied_info
*server_info
;
150 struct ntlmssp_state
*ntlmssp_state
;
151 } AUTH_NTLMSSP_STATE
;
153 /* Changed from 1 -> 2 to add the logon_parameters field. */
154 #define AUTH_INTERFACE_VERSION 2
156 #endif /* _SMBAUTH_H_ */