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 2 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, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #include "libcli/auth/credentials.h"
26 #include "auth/gensec/gensec.h"
27 #include "auth/gensec/spnego.h"
29 /* modules can use the following to determine if the interface has changed
30 * please increment the version number after each interface change
31 * with a comment and maybe update struct auth_critical_sizes.
33 /* version 1 - version from samba 3.0 - metze */
34 /* version 2 - initial samba4 version - metze */
35 /* version 3 - subsequent samba4 version - abartlet */
36 /* version 4 - subsequent samba4 version - metze */
37 #define AUTH_INTERFACE_VERSION 4
39 #define USER_INFO_CASE_INSENSITIVE_USERNAME 0x01 /* username may be in any case */
40 #define USER_INFO_CASE_INSENSITIVE_PASSWORD 0x02 /* password may be in any case */
41 #define USER_INFO_DONT_CHECK_UNIX_ACCOUNT 0x04 /* dont check unix account status */
43 struct auth_usersupplied_info
45 const char *account_name;
46 const char *domain_name;
47 const char *workstation_name;
48 const char *remote_host;
50 /* the values the client gives us */
52 const char *account_name;
53 const char *domain_name;
60 DATA_BLOB lm_interactive_password;
61 DATA_BLOB nt_interactive_password;
62 DATA_BLOB plaintext_password;
67 struct auth_serversupplied_info
69 struct dom_sid *account_sid;
70 struct dom_sid *primary_group_sid;
72 size_t n_domain_groups;
73 struct dom_sid **domain_groups;
75 DATA_BLOB user_session_key;
76 DATA_BLOB lm_session_key;
78 const char *account_name;
79 const char *domain_name;
81 const char *full_name;
82 const char *logon_script;
83 const char *profile_path;
84 const char *home_directory;
85 const char *home_drive;
90 NTTIME last_password_change;
91 NTTIME allow_password_change;
92 NTTIME force_password_change;
95 uint16_t bad_password_count;
102 struct auth_session_info {
103 struct security_token *security_token;
104 struct auth_serversupplied_info *server_info;
105 DATA_BLOB session_key;
108 struct auth_method_context;
110 struct auth_operations {
113 /* If you are using this interface, then you are probably
114 * getting something wrong. This interface is only for
115 * security=server, and makes a number of compromises to allow
116 * that. It is not compatible with being a PDC. */
118 NTSTATUS (*get_challenge)(struct auth_method_context *ctx, TALLOC_CTX *mem_ctx, DATA_BLOB *challenge);
120 /* Given the user supplied info, check a password */
122 NTSTATUS (*check_password)(struct auth_method_context *ctx, TALLOC_CTX *mem_ctx,
123 const struct auth_usersupplied_info *user_info,
124 struct auth_serversupplied_info **server_info);
127 struct auth_method_context {
128 struct auth_method_context *prev, *next;
129 struct auth_context *auth_ctx;
130 const struct auth_operations *ops;
135 struct auth_context {
137 /* Who set this up in the first place? */
140 BOOL may_be_modified;
145 /* methods, in the order they should be called */
146 struct auth_method_context *methods;
149 /* this structure is used by backends to determine the size of some critical types */
150 struct auth_critical_sizes {
151 int interface_version;
152 int sizeof_auth_operations;
153 int sizeof_auth_methods;
154 int sizeof_auth_context;
155 int sizeof_auth_usersupplied_info;
156 int sizeof_auth_serversupplied_info;
160 #endif /* _SMBAUTH_H_ */