s3: Survive an idle child that was killed
[Samba.git] / source3 / include / auth.h
bloba123a3b59b08346aaf4223d958e2719f2a91f581
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 extra_auth_info {
25 struct dom_sid user_sid;
26 struct dom_sid pgid_sid;
29 struct auth_serversupplied_info {
30 bool guest;
31 bool system;
33 struct unix_user_token utok;
35 /* NT group information taken from the info3 structure */
37 struct security_token *ptok;
39 /* This is the final session key, as used by SMB signing, and
40 * (truncated to 16 bytes) encryption on the SAMR and LSA pipes
41 * when over ncacn_np.
42 * It is calculated by NTLMSSP from the session key in the info3,
43 * and is set from the Kerberos session key using
44 * krb5_auth_con_getremotesubkey().
46 * Bottom line, it is not the same as the session keys in info3.
49 DATA_BLOB user_session_key;
50 DATA_BLOB lm_session_key;
52 struct netr_SamInfo3 *info3;
54 /* this structure is filled *only* in pathological cases where the user
55 * sid or the primary group sid are not sids of the domain. Normally
56 * this happens only for unix accounts that have unix domain sids.
57 * This is checked only when info3.rid and/or info3.primary_gid are set
58 * to the special invalid value of 0xFFFFFFFF */
59 struct extra_auth_info extra;
61 void *pam_handle;
64 * This is a token from /etc/passwd and /etc/group
66 bool nss_token;
68 char *unix_name;
71 * For performance reasons we keep an alpha_strcpy-sanitized version
72 * of the username around as long as the global variable current_user
73 * still exists. If we did not do keep this, we'd have to call
74 * alpha_strcpy whenever we do a become_user(), potentially on every
75 * smb request. See set_current_user_info.
77 char *sanitized_username;
80 struct auth_context {
81 DATA_BLOB challenge;
83 /* Who set this up in the first place? */
84 const char *challenge_set_by;
86 bool challenge_may_be_modified;
88 struct auth_methods *challenge_set_method;
89 /* What order are the various methods in? Try to stop it changing under us */
90 struct auth_methods *auth_method_list;
92 NTSTATUS (*get_ntlm_challenge)(struct auth_context *auth_context,
93 uint8_t chal[8]);
94 NTSTATUS (*check_ntlm_password)(const struct auth_context *auth_context,
95 const struct auth_usersupplied_info *user_info,
96 struct auth_serversupplied_info **server_info);
97 NTSTATUS (*nt_status_squash)(NTSTATUS nt_status);
100 typedef struct auth_methods
102 struct auth_methods *prev, *next;
103 const char *name; /* What name got this module */
105 NTSTATUS (*auth)(const struct auth_context *auth_context,
106 void *my_private_data,
107 TALLOC_CTX *mem_ctx,
108 const struct auth_usersupplied_info *user_info,
109 struct auth_serversupplied_info **server_info);
111 /* If you are using this interface, then you are probably
112 * getting something wrong. This interface is only for
113 * security=server, and makes a number of compromises to allow
114 * that. It is not compatible with being a PDC. */
115 DATA_BLOB (*get_chal)(const struct auth_context *auth_context,
116 void **my_private_data,
117 TALLOC_CTX *mem_ctx);
119 /* Used to keep tabs on things like the cli for SMB server authentication */
120 void *private_data;
122 } auth_methods;
124 typedef NTSTATUS (*auth_init_function)(struct auth_context *, const char *, struct auth_methods **);
126 struct auth_init_function_entry {
127 const char *name;
128 /* Function to create a member of the authmethods list */
130 auth_init_function init;
132 struct auth_init_function_entry *prev, *next;
135 struct auth_ntlmssp_state;
137 /* Changed from 1 -> 2 to add the logon_parameters field. */
138 /* Changed from 2 -> 3 when we reworked many auth structures to use IDL or be in common with Samba4 */
139 #define AUTH_INTERFACE_VERSION 3
141 #endif /* _SMBAUTH_H_ */