vfs_ceph: fix strict_allocate_ftruncate()
[Samba.git] / source3 / include / auth.h
blob0facb8668cd37f5167689acd55230292985ac73d
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;
34 struct security_unix_token utok;
37 * A complete auth_session_info
39 * This is not normally filled in, during the typical
40 * authentication process. If filled in, it has already been
41 * finalised by a nasty hack to support a cached guest/system
42 * session_info
44 const struct auth_session_info *cached_session_info;
46 /* These are the intermediate session keys, as provided by a
47 * NETLOGON server and used by NTLMSSP to negotiate key
48 * exchange etc (which will provide the session_key in the
49 * auth_session_info). It is usually the same as the keys in
50 * the info3, but is a variable length structure here to allow
51 * it to be omitted if the auth module does not know it.
54 DATA_BLOB session_key;
55 DATA_BLOB lm_session_key;
57 struct netr_SamInfo3 *info3;
59 /* this structure is filled *only* in pathological cases where the user
60 * sid or the primary group sid are not sids of the domain. Normally
61 * this happens only for unix accounts that have unix domain sids.
62 * This is checked only when info3.rid and/or info3.primary_gid are set
63 * to the special invalid value of 0xFFFFFFFF */
64 struct extra_auth_info extra;
67 * This is a token from /etc/passwd and /etc/group
69 bool nss_token;
71 char *unix_name;
74 struct auth_context;
76 typedef NTSTATUS (*prepare_gensec_fn)(const struct auth_context *auth_context,
77 TALLOC_CTX *mem_ctx,
78 struct gensec_security **gensec_context);
80 typedef NTSTATUS (*make_auth4_context_fn)(const struct auth_context *auth_context,
81 TALLOC_CTX *mem_ctx,
82 struct auth4_context **auth4_context);
84 struct auth_context {
85 DATA_BLOB challenge;
87 /* What time did this start */
88 struct timeval start_time;
90 /* Who set this up in the first place? */
91 const char *challenge_set_by;
93 /* What order are the various methods in? Try to stop it changing under us */
94 struct auth_methods *auth_method_list;
96 prepare_gensec_fn prepare_gensec;
97 make_auth4_context_fn make_auth4_context;
98 const char *forced_samba4_methods;
101 typedef struct auth_methods
103 struct auth_methods *prev, *next;
104 const char *name; /* What name got this module */
106 NTSTATUS (*auth)(const struct auth_context *auth_context,
107 void *my_private_data,
108 TALLOC_CTX *mem_ctx,
109 const struct auth_usersupplied_info *user_info,
110 struct auth_serversupplied_info **server_info);
112 /* Optional methods allowing this module to provide a way to get a gensec context and an auth4_context */
113 prepare_gensec_fn prepare_gensec;
114 make_auth4_context_fn make_auth4_context;
115 /* Used to keep tabs on things like the cli for SMB server authentication */
116 void *private_data;
118 uint32_t flags;
120 } auth_methods;
122 typedef NTSTATUS (*auth_init_function)(struct auth_context *, const char *, struct auth_methods **);
124 struct auth_init_function_entry {
125 const char *name;
126 /* Function to create a member of the authmethods list */
128 auth_init_function init;
130 struct auth_init_function_entry *prev, *next;
133 extern const struct gensec_security_ops gensec_ntlmssp3_server_ops;
135 /* Intent of use for session key. LSA and SAMR pipes use 16 bytes of session key when doing create/modify calls */
136 enum session_key_use_intent {
137 KEY_USE_FULL = 0,
138 KEY_USE_16BYTES
141 /* Changed from 1 -> 2 to add the logon_parameters field. */
142 /* Changed from 2 -> 3 when we reworked many auth structures to use IDL or be in common with Samba4 */
143 /* Changed from 3 -> 4 when we reworked added the flags */
144 /* Changed from 4 -> 5 as module init functions now take a TALLOC_CTX * */
145 #define AUTH_INTERFACE_VERSION 5
147 #include "auth/proto.h"
149 #endif /* _SMBAUTH_H_ */