s3-auth remove sanitized_username from auth_serversupplied_info
[Samba.git] / source3 / include / auth.h
blobbe23adb4a72e43b33de773498a3d398c6e5f55d4
1 #ifndef _SMBAUTH_H_
2 #define _SMBAUTH_H_
3 /*
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 #include "../auth/common_auth.h"
24 struct gensec_security;
26 struct extra_auth_info {
27 struct dom_sid user_sid;
28 struct dom_sid pgid_sid;
31 struct auth_serversupplied_info {
32 bool guest;
33 bool system;
35 struct security_unix_token utok;
37 /* NT group information taken from the info3 structure */
39 struct security_token *security_token;
41 /* This is the final session key, as used by SMB signing, and
42 * (truncated to 16 bytes) encryption on the SAMR and LSA pipes
43 * when over ncacn_np.
44 * It is calculated by NTLMSSP from the session key in the info3,
45 * and is set from the Kerberos session key using
46 * krb5_auth_con_getremotesubkey().
48 * Bottom line, it is not the same as the session keys in info3.
51 DATA_BLOB session_key;
52 DATA_BLOB lm_session_key;
54 struct netr_SamInfo3 *info3;
56 /* this structure is filled *only* in pathological cases where the user
57 * sid or the primary group sid are not sids of the domain. Normally
58 * this happens only for unix accounts that have unix domain sids.
59 * This is checked only when info3.rid and/or info3.primary_gid are set
60 * to the special invalid value of 0xFFFFFFFF */
61 struct extra_auth_info extra;
64 * This is a token from /etc/passwd and /etc/group
66 bool nss_token;
68 char *unix_name;
71 struct auth_context {
72 DATA_BLOB challenge;
74 /* Who set this up in the first place? */
75 const char *challenge_set_by;
77 bool challenge_may_be_modified;
79 struct auth_methods *challenge_set_method;
80 /* What order are the various methods in? Try to stop it changing under us */
81 struct auth_methods *auth_method_list;
83 NTSTATUS (*get_ntlm_challenge)(struct auth_context *auth_context,
84 uint8_t chal[8]);
85 NTSTATUS (*check_ntlm_password)(const struct auth_context *auth_context,
86 const struct auth_usersupplied_info *user_info,
87 struct auth_serversupplied_info **server_info);
88 NTSTATUS (*nt_status_squash)(NTSTATUS nt_status);
90 NTSTATUS (*prepare_gensec)(TALLOC_CTX *mem_ctx,
91 struct gensec_security **gensec_context);
92 NTSTATUS (*gensec_start_mech_by_oid)(struct gensec_security *gensec_context, const char *oid_string);
95 typedef struct auth_methods
97 struct auth_methods *prev, *next;
98 const char *name; /* What name got this module */
100 NTSTATUS (*auth)(const struct auth_context *auth_context,
101 void *my_private_data,
102 TALLOC_CTX *mem_ctx,
103 const struct auth_usersupplied_info *user_info,
104 struct auth_serversupplied_info **server_info);
106 /* If you are using this interface, then you are probably
107 * getting something wrong. This interface is only for
108 * security=server, and makes a number of compromises to allow
109 * that. It is not compatible with being a PDC. */
110 DATA_BLOB (*get_chal)(const struct auth_context *auth_context,
111 void **my_private_data,
112 TALLOC_CTX *mem_ctx);
114 /* Optional methods allowing this module to provide a way to get a gensec context */
115 NTSTATUS (*prepare_gensec)(TALLOC_CTX *mem_ctx,
116 struct gensec_security **gensec_context);
117 NTSTATUS (*gensec_start_mech_by_oid)(struct gensec_security *gensec_context, const char *oid_string);
118 /* Used to keep tabs on things like the cli for SMB server authentication */
119 void *private_data;
121 } auth_methods;
123 typedef NTSTATUS (*auth_init_function)(struct auth_context *, const char *, struct auth_methods **);
125 struct auth_init_function_entry {
126 const char *name;
127 /* Function to create a member of the authmethods list */
129 auth_init_function init;
131 struct auth_init_function_entry *prev, *next;
134 struct auth_ntlmssp_state;
136 /* Changed from 1 -> 2 to add the logon_parameters field. */
137 /* Changed from 2 -> 3 when we reworked many auth structures to use IDL or be in common with Samba4 */
138 #define AUTH_INTERFACE_VERSION 3
140 #include "auth/proto.h"
142 #endif /* _SMBAUTH_H_ */