2 Unix SMB/CIFS implementation.
3 Standardised Authentication types
4 Copyright (C) Andrew Bartlett 2001
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 /* modules can use the following to determine if the interface has changed
25 * please increment the version number after each interface change
26 * with a comment and maybe update struct auth_critical_sizes.
28 /* version 1 - version from samba 3.0 - metze */
29 /* version 2 - initial samba4 version - metze */
30 /* version 3 - subsequent samba4 version - abartlet */
31 #define AUTH_INTERFACE_VERSION 3
33 /* AUTH_STR - string */
34 typedef struct auth_str
40 struct auth_usersupplied_info
45 DATA_BLOB lm_interactive_password;
46 DATA_BLOB nt_interactive_password;
47 DATA_BLOB plaintext_password;
51 AUTH_STR client_domain; /* domain name string */
52 AUTH_STR domain; /* domain name after mapping */
53 AUTH_STR internal_username; /* username after mapping */
54 AUTH_STR smb_name; /* username before mapping */
55 AUTH_STR wksta_name; /* workstation name (netbios calling name) unicode string */
59 struct auth_serversupplied_info
63 struct dom_sid *user_sid;
64 struct dom_sid *primary_group_sid;
66 size_t n_domain_groups;
67 struct dom_sid **domain_groups;
69 DATA_BLOB user_session_key;
70 DATA_BLOB lm_session_key;
72 const char *account_name;
75 const char *full_name;
76 const char *logon_script;
77 const char *profile_path;
78 const char *home_directory;
79 const char *home_drive;
84 NTTIME last_password_change;
85 NTTIME allow_password_change;
86 NTTIME force_password_change;
89 uint16 bad_password_count;
94 struct auth_session_info
97 /* NT group information taken from the info3 structure */
99 NT_USER_TOKEN *nt_user_token;
101 struct auth_serversupplied_info *server_info;
103 DATA_BLOB session_key;
105 /* needed to key the schannel credentials */
106 const char *workstation;
109 struct auth_context {
112 /* Who set this up in the first place? */
113 const char *challenge_set_by;
115 BOOL challenge_may_be_modified;
117 struct auth_methods *challenge_set_method;
119 /* methods, in the order they should be called */
120 struct auth_methods *auth_method_list;
123 const uint8_t *(*get_ntlm_challenge)(struct auth_context *auth_context);
124 NTSTATUS (*check_ntlm_password)(struct auth_context *auth_context,
125 const struct auth_usersupplied_info *user_info,
126 struct auth_serversupplied_info **server_info);
127 NTSTATUS (*nt_status_squash)(NTSTATUS nt_status);
132 struct auth_methods *prev, *next;
133 const char *name; /* What name got this module */
135 NTSTATUS (*auth)(const struct auth_context *auth_context,
136 void *my_private_data,
138 const struct auth_usersupplied_info *user_info,
139 struct auth_serversupplied_info **server_info);
141 DATA_BLOB (*get_chal)(const struct auth_context *auth_context,
142 void **my_private_data,
143 TALLOC_CTX *mem_ctx);
145 /* Used to keep tabs on things like the cli for SMB server authentication */
148 /* Function to clean up the above arbitary structure */
149 void (*free_private_data)(void **private_data);
151 /* Function to send a keepalive message on the above structure */
152 void (*send_keepalive)(void **private_data);
156 struct auth_operations {
157 /* the name of the backend */
160 /* Function to create a member of the authmethods list */
161 NTSTATUS (*init)(struct auth_context *, const char *, struct auth_methods **);
164 /* this structure is used by backends to determine the size of some critical types */
165 struct auth_critical_sizes {
166 int interface_version;
167 int sizeof_auth_operations;
168 int sizeof_auth_methods;
169 int sizeof_auth_context;
170 int sizeof_auth_usersupplied_info;
171 int sizeof_auth_serversupplied_info;
175 #endif /* _SMBAUTH_H_ */