vfs: Convert fake_acls_sys_acl_delete_def_file to synthetic_smb_fname
[Samba/gebeck_regimport.git] / auth / common_auth.h
bloba40f7c2b3d7010517f5a5e91c789f92846917e03
1 /*
2 Unix SMB/CIFS implementation.
3 Standardised Authentication types
4 Copyright (C) Andrew Bartlett 2001-2010
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 3 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, see <http://www.gnu.org/licenses/>.
20 #ifndef AUTH_COMMON_AUTH_H
21 #define AUTH_COMMON_AUTH_H
23 #include "librpc/gen_ndr/auth.h"
25 #define USER_INFO_CASE_INSENSITIVE_USERNAME 0x01 /* username may be in any case */
26 #define USER_INFO_CASE_INSENSITIVE_PASSWORD 0x02 /* password may be in any case */
27 #define USER_INFO_DONT_CHECK_UNIX_ACCOUNT 0x04 /* don't check unix account status */
28 #define USER_INFO_INTERACTIVE_LOGON 0x08 /* don't check unix account status */
30 enum auth_password_state {
31 AUTH_PASSWORD_PLAIN = 1,
32 AUTH_PASSWORD_HASH = 2,
33 AUTH_PASSWORD_RESPONSE = 3
36 #define AUTH_SESSION_INFO_DEFAULT_GROUPS 0x01 /* Add the user to the default world and network groups */
37 #define AUTH_SESSION_INFO_AUTHENTICATED 0x02 /* Add the user to the 'authenticated users' group */
38 #define AUTH_SESSION_INFO_SIMPLE_PRIVILEGES 0x04 /* Use a trivial map between users and privilages, rather than a DB */
39 #define AUTH_SESSION_INFO_UNIX_TOKEN 0x08 /* The returned token must have the unix_token and unix_info elements provided */
41 struct auth_usersupplied_info
43 const char *workstation_name;
44 const struct tsocket_address *remote_host;
46 uint32_t logon_parameters;
48 bool mapped_state;
49 bool was_mapped;
50 /* the values the client gives us */
51 struct {
52 const char *account_name;
53 const char *domain_name;
54 } client, mapped;
56 enum auth_password_state password_state;
58 struct {
59 struct {
60 DATA_BLOB lanman;
61 DATA_BLOB nt;
62 } response;
63 struct {
64 struct samr_Password *lanman;
65 struct samr_Password *nt;
66 } hash;
68 char *plaintext;
69 } password;
70 uint32_t flags;
73 struct auth_method_context;
74 struct tevent_context;
75 struct imessaging_context;
76 struct loadparm_context;
77 struct ldb_context;
78 struct smb_krb5_context;
80 struct auth4_context {
81 struct {
82 /* Who set this up in the first place? */
83 const char *set_by;
85 DATA_BLOB data;
86 } challenge;
88 /* methods, in the order they should be called */
89 struct auth_method_context *methods;
91 /* the event context to use for calls that can block */
92 struct tevent_context *event_ctx;
94 /* the messaging context which can be used by backends */
95 struct imessaging_context *msg_ctx;
97 /* loadparm context */
98 struct loadparm_context *lp_ctx;
100 /* SAM database for this local machine - to fill in local groups, or to authenticate local NTLM users */
101 struct ldb_context *sam_ctx;
103 /* Private data for the callbacks on this auth context */
104 void *private_data;
106 NTSTATUS (*check_ntlm_password)(struct auth4_context *auth_ctx,
107 TALLOC_CTX *mem_ctx,
108 const struct auth_usersupplied_info *user_info,
109 void **server_returned_info,
110 DATA_BLOB *nt_session_key, DATA_BLOB *lm_session_key);
112 NTSTATUS (*get_ntlm_challenge)(struct auth4_context *auth_ctx, uint8_t chal[8]);
114 NTSTATUS (*set_ntlm_challenge)(struct auth4_context *auth_ctx, const uint8_t chal[8], const char *set_by);
116 NTSTATUS (*generate_session_info)(struct auth4_context *auth_context,
117 TALLOC_CTX *mem_ctx,
118 void *server_returned_info,
119 const char *original_user_name,
120 uint32_t session_info_flags,
121 struct auth_session_info **session_info);
123 NTSTATUS (*generate_session_info_pac)(struct auth4_context *auth_ctx,
124 TALLOC_CTX *mem_ctx,
125 struct smb_krb5_context *smb_krb5_context,
126 DATA_BLOB *pac_blob,
127 const char *principal_name,
128 const struct tsocket_address *remote_address,
129 uint32_t session_info_flags,
130 struct auth_session_info **session_info);
133 #endif