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 struct auth_usersupplied_info
38 const char *workstation_name;
39 const struct tsocket_address *remote_host;
41 uint32_t logon_parameters;
45 /* the values the client gives us */
47 const char *account_name;
48 const char *domain_name;
51 enum auth_password_state password_state;
59 struct samr_Password *lanman;
60 struct samr_Password *nt;
68 struct auth_method_context;
69 struct tevent_context;
70 struct imessaging_context;
71 struct loadparm_context;
73 struct smb_krb5_context;
75 struct auth4_context {
77 /* Who set this up in the first place? */
85 /* methods, in the order they should be called */
86 struct auth_method_context *methods;
88 /* the event context to use for calls that can block */
89 struct tevent_context *event_ctx;
91 /* the messaging context which can be used by backends */
92 struct imessaging_context *msg_ctx;
94 /* loadparm context */
95 struct loadparm_context *lp_ctx;
97 /* SAM database for this local machine - to fill in local groups, or to authenticate local NTLM users */
98 struct ldb_context *sam_ctx;
100 NTSTATUS (*check_password)(struct auth4_context *auth_ctx,
102 const struct auth_usersupplied_info *user_info,
103 struct auth_user_info_dc **user_info_dc);
105 NTSTATUS (*get_challenge)(struct auth4_context *auth_ctx, uint8_t chal[8]);
107 bool (*challenge_may_be_modified)(struct auth4_context *auth_ctx);
109 NTSTATUS (*set_challenge)(struct auth4_context *auth_ctx, const uint8_t chal[8], const char *set_by);
111 NTSTATUS (*generate_session_info)(TALLOC_CTX *mem_ctx,
112 struct auth4_context *auth_context,
113 struct auth_user_info_dc *user_info_dc,
114 uint32_t session_info_flags,
115 struct auth_session_info **session_info);
117 NTSTATUS (*generate_session_info_pac)(struct auth4_context *auth_ctx,
119 struct smb_krb5_context *smb_krb5_context,
121 const char *principal_name,
122 const struct tsocket_address *remote_address,
123 uint32_t session_info_flags,
124 struct auth_session_info **session_info);