| 1 | /* | 
|---|
| 2 | *  Unix SMB/CIFS implementation. | 
|---|
| 3 | *  Password and authentication handling | 
|---|
| 4 | * | 
|---|
| 5 | *  Copyright (C) Andrew Tridgell               1992-2001 | 
|---|
| 6 | *  Copyright (C) Luke Kenneth Casson Leighton  1996-2000 | 
|---|
| 7 | *  Copyright (C) Jeremy Allison                1997-2001 | 
|---|
| 8 | *  Copyright (C) John H Terpsta                1999-2001 | 
|---|
| 9 | *  Copyright (C) Tim Potter                    2000 | 
|---|
| 10 | *  Copyright (C) Andrew Bartlett               2001-2003 | 
|---|
| 11 | *  Copyright (C) Jelmer Vernooij               2002 | 
|---|
| 12 | *  Copyright (C) Rafal Szczesniak              2002 | 
|---|
| 13 | *  Copyright (C) Gerald Carter                 2003 | 
|---|
| 14 | *  Copyright (C) Volker Lendecke               2006,2010 | 
|---|
| 15 | *  Copyright (C) Michael Adam                  2007 | 
|---|
| 16 | *  Copyright (C) Dan Sledz                     2009 | 
|---|
| 17 | *  Copyright (C) Simo Sorce                    2010 | 
|---|
| 18 | * | 
|---|
| 19 | *  This program is free software; you can redistribute it and/or modify | 
|---|
| 20 | *  it under the terms of the GNU General Public License as published by | 
|---|
| 21 | *  the Free Software Foundation; either version 3 of the License, or | 
|---|
| 22 | *  (at your option) any later version. | 
|---|
| 23 | * | 
|---|
| 24 | *  This program is distributed in the hope that it will be useful, | 
|---|
| 25 | *  but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 26 | *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 27 | *  GNU General Public License for more details. | 
|---|
| 28 | * | 
|---|
| 29 | *  You should have received a copy of the GNU General Public License | 
|---|
| 30 | *  along with this program.  If not, see <http://www.gnu.org/licenses/>. | 
|---|
| 31 | */ | 
|---|
| 32 |  | 
|---|
| 33 | #ifndef _AUTH_PROTO_H_ | 
|---|
| 34 | #define _AUTH_PROTO_H_ | 
|---|
| 35 |  | 
|---|
| 36 | /* The following definitions come from auth/auth.c  */ | 
|---|
| 37 |  | 
|---|
| 38 | NTSTATUS smb_register_auth(int version, const char *name, auth_init_function init); | 
|---|
| 39 | bool load_auth_module(struct auth_context *auth_context, | 
|---|
| 40 | const char *module, auth_methods **ret) ; | 
|---|
| 41 | NTSTATUS make_auth_context_subsystem(TALLOC_CTX *mem_ctx, | 
|---|
| 42 | struct auth_context **auth_context); | 
|---|
| 43 | NTSTATUS make_auth_context_fixed(TALLOC_CTX *mem_ctx, | 
|---|
| 44 | struct auth_context **auth_context, | 
|---|
| 45 | uchar chal[8]) ; | 
|---|
| 46 |  | 
|---|
| 47 | /* The following definitions come from auth/auth_builtin.c  */ | 
|---|
| 48 |  | 
|---|
| 49 | NTSTATUS auth_builtin_init(void); | 
|---|
| 50 |  | 
|---|
| 51 | /* The following definitions come from auth/auth_compat.c  */ | 
|---|
| 52 |  | 
|---|
| 53 | NTSTATUS check_plaintext_password(const char *smb_name, | 
|---|
| 54 | DATA_BLOB plaintext_password, | 
|---|
| 55 | struct auth_serversupplied_info **server_info); | 
|---|
| 56 | bool password_ok(struct auth_context *actx, bool global_encrypted, | 
|---|
| 57 | const char *session_workgroup, | 
|---|
| 58 | const char *smb_name, DATA_BLOB password_blob); | 
|---|
| 59 |  | 
|---|
| 60 | /* The following definitions come from auth/auth_domain.c  */ | 
|---|
| 61 |  | 
|---|
| 62 | void attempt_machine_password_change(void); | 
|---|
| 63 | NTSTATUS auth_domain_init(void); | 
|---|
| 64 |  | 
|---|
| 65 | NTSTATUS auth_netlogond_init(void); | 
|---|
| 66 |  | 
|---|
| 67 | /* The following definitions come from auth/auth_ntlmssp.c  */ | 
|---|
| 68 |  | 
|---|
| 69 | NTSTATUS auth_ntlmssp_steal_session_info(TALLOC_CTX *mem_ctx, | 
|---|
| 70 | struct auth_ntlmssp_state *auth_ntlmssp_state, | 
|---|
| 71 | struct auth_serversupplied_info **session_info); | 
|---|
| 72 | NTSTATUS auth_ntlmssp_start(struct auth_ntlmssp_state **auth_ntlmssp_state); | 
|---|
| 73 |  | 
|---|
| 74 |  | 
|---|
| 75 | /* The following definitions come from auth/auth_sam.c  */ | 
|---|
| 76 |  | 
|---|
| 77 | NTSTATUS check_sam_security(const DATA_BLOB *challenge, | 
|---|
| 78 | TALLOC_CTX *mem_ctx, | 
|---|
| 79 | const struct auth_usersupplied_info *user_info, | 
|---|
| 80 | struct auth_serversupplied_info **server_info); | 
|---|
| 81 | NTSTATUS check_sam_security_info3(const DATA_BLOB *challenge, | 
|---|
| 82 | TALLOC_CTX *mem_ctx, | 
|---|
| 83 | const struct auth_usersupplied_info *user_info, | 
|---|
| 84 | struct netr_SamInfo3 **pinfo3); | 
|---|
| 85 | NTSTATUS auth_sam_init(void); | 
|---|
| 86 |  | 
|---|
| 87 | /* The following definitions come from auth/auth_server.c  */ | 
|---|
| 88 |  | 
|---|
| 89 | NTSTATUS auth_server_init(void); | 
|---|
| 90 |  | 
|---|
| 91 | /* The following definitions come from auth/auth_unix.c  */ | 
|---|
| 92 |  | 
|---|
| 93 | NTSTATUS auth_unix_init(void); | 
|---|
| 94 |  | 
|---|
| 95 | /* The following definitions come from auth/auth_util.c  */ | 
|---|
| 96 |  | 
|---|
| 97 | NTSTATUS make_user_info_map(struct auth_usersupplied_info **user_info, | 
|---|
| 98 | const char *smb_name, | 
|---|
| 99 | const char *client_domain, | 
|---|
| 100 | const char *workstation_name, | 
|---|
| 101 | DATA_BLOB *lm_pwd, | 
|---|
| 102 | DATA_BLOB *nt_pwd, | 
|---|
| 103 | const struct samr_Password *lm_interactive_pwd, | 
|---|
| 104 | const struct samr_Password *nt_interactive_pwd, | 
|---|
| 105 | const char *plaintext, | 
|---|
| 106 | enum auth_password_state password_state); | 
|---|
| 107 | bool make_user_info_netlogon_network(struct auth_usersupplied_info **user_info, | 
|---|
| 108 | const char *smb_name, | 
|---|
| 109 | const char *client_domain, | 
|---|
| 110 | const char *workstation_name, | 
|---|
| 111 | uint32 logon_parameters, | 
|---|
| 112 | const uchar *lm_network_pwd, | 
|---|
| 113 | int lm_pwd_len, | 
|---|
| 114 | const uchar *nt_network_pwd, | 
|---|
| 115 | int nt_pwd_len); | 
|---|
| 116 | bool make_user_info_netlogon_interactive(struct auth_usersupplied_info **user_info, | 
|---|
| 117 | const char *smb_name, | 
|---|
| 118 | const char *client_domain, | 
|---|
| 119 | const char *workstation_name, | 
|---|
| 120 | uint32 logon_parameters, | 
|---|
| 121 | const uchar chal[8], | 
|---|
| 122 | const uchar lm_interactive_pwd[16], | 
|---|
| 123 | const uchar nt_interactive_pwd[16], | 
|---|
| 124 | const uchar *dc_sess_key); | 
|---|
| 125 | bool make_user_info_for_reply(struct auth_usersupplied_info **user_info, | 
|---|
| 126 | const char *smb_name, | 
|---|
| 127 | const char *client_domain, | 
|---|
| 128 | const uint8 chal[8], | 
|---|
| 129 | DATA_BLOB plaintext_password); | 
|---|
| 130 | NTSTATUS make_user_info_for_reply_enc(struct auth_usersupplied_info **user_info, | 
|---|
| 131 | const char *smb_name, | 
|---|
| 132 | const char *client_domain, | 
|---|
| 133 | DATA_BLOB lm_resp, DATA_BLOB nt_resp); | 
|---|
| 134 | bool make_user_info_guest(struct auth_usersupplied_info **user_info) ; | 
|---|
| 135 | struct samu; | 
|---|
| 136 | NTSTATUS make_server_info_sam(struct auth_serversupplied_info **server_info, | 
|---|
| 137 | struct samu *sampass); | 
|---|
| 138 | NTSTATUS create_local_token(struct auth_serversupplied_info *server_info); | 
|---|
| 139 | NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username, | 
|---|
| 140 | bool is_guest, | 
|---|
| 141 | uid_t *uid, gid_t *gid, | 
|---|
| 142 | char **found_username, | 
|---|
| 143 | struct security_token **token); | 
|---|
| 144 | bool user_in_group_sid(const char *username, const struct dom_sid *group_sid); | 
|---|
| 145 | bool user_in_group(const char *username, const char *groupname); | 
|---|
| 146 | struct passwd; | 
|---|
| 147 | NTSTATUS make_server_info_pw(struct auth_serversupplied_info **server_info, | 
|---|
| 148 | char *unix_username, | 
|---|
| 149 | struct passwd *pwd); | 
|---|
| 150 | NTSTATUS make_serverinfo_from_username(TALLOC_CTX *mem_ctx, | 
|---|
| 151 | const char *username, | 
|---|
| 152 | bool use_guest_token, | 
|---|
| 153 | bool is_guest, | 
|---|
| 154 | struct auth_serversupplied_info **presult); | 
|---|
| 155 | struct auth_serversupplied_info *copy_serverinfo(TALLOC_CTX *mem_ctx, | 
|---|
| 156 | const struct auth_serversupplied_info *src); | 
|---|
| 157 | bool init_guest_info(void); | 
|---|
| 158 | NTSTATUS init_system_info(void); | 
|---|
| 159 | bool session_info_set_session_key(struct auth_serversupplied_info *info, | 
|---|
| 160 | DATA_BLOB session_key); | 
|---|
| 161 | NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx, | 
|---|
| 162 | struct auth_serversupplied_info **server_info); | 
|---|
| 163 | NTSTATUS make_session_info_system(TALLOC_CTX *mem_ctx, | 
|---|
| 164 | struct auth_serversupplied_info **session_info); | 
|---|
| 165 | const struct auth_serversupplied_info *get_session_info_system(void); | 
|---|
| 166 | bool copy_current_user(struct current_user *dst, struct current_user *src); | 
|---|
| 167 | struct passwd *smb_getpwnam( TALLOC_CTX *mem_ctx, const char *domuser, | 
|---|
| 168 | char **p_save_username, bool create ); | 
|---|
| 169 | NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx, | 
|---|
| 170 | const char *sent_nt_username, | 
|---|
| 171 | const char *domain, | 
|---|
| 172 | struct auth_serversupplied_info **server_info, | 
|---|
| 173 | struct netr_SamInfo3 *info3); | 
|---|
| 174 | struct wbcAuthUserInfo; | 
|---|
| 175 | NTSTATUS make_server_info_wbcAuthUserInfo(TALLOC_CTX *mem_ctx, | 
|---|
| 176 | const char *sent_nt_username, | 
|---|
| 177 | const char *domain, | 
|---|
| 178 | const struct wbcAuthUserInfo *info, | 
|---|
| 179 | struct auth_serversupplied_info **server_info); | 
|---|
| 180 | void free_user_info(struct auth_usersupplied_info **user_info); | 
|---|
| 181 | bool make_auth_methods(struct auth_context *auth_context, auth_methods **auth_method) ; | 
|---|
| 182 | bool is_trusted_domain(const char* dom_name); | 
|---|
| 183 |  | 
|---|
| 184 | /* The following definitions come from auth/user_info.c  */ | 
|---|
| 185 |  | 
|---|
| 186 | NTSTATUS make_user_info(struct auth_usersupplied_info **ret_user_info, | 
|---|
| 187 | const char *smb_name, | 
|---|
| 188 | const char *internal_username, | 
|---|
| 189 | const char *client_domain, | 
|---|
| 190 | const char *domain, | 
|---|
| 191 | const char *workstation_name, | 
|---|
| 192 | const DATA_BLOB *lm_pwd, | 
|---|
| 193 | const DATA_BLOB *nt_pwd, | 
|---|
| 194 | const struct samr_Password *lm_interactive_pwd, | 
|---|
| 195 | const struct samr_Password *nt_interactive_pwd, | 
|---|
| 196 | const char *plaintext_password, | 
|---|
| 197 | enum auth_password_state password_state); | 
|---|
| 198 | void free_user_info(struct auth_usersupplied_info **user_info); | 
|---|
| 199 |  | 
|---|
| 200 | /* The following definitions come from auth/auth_winbind.c  */ | 
|---|
| 201 |  | 
|---|
| 202 | NTSTATUS auth_winbind_init(void); | 
|---|
| 203 |  | 
|---|
| 204 | /* The following definitions come from auth/server_info.c  */ | 
|---|
| 205 |  | 
|---|
| 206 | struct netr_SamInfo2; | 
|---|
| 207 | struct netr_SamInfo3; | 
|---|
| 208 | struct netr_SamInfo6; | 
|---|
| 209 |  | 
|---|
| 210 | struct auth_serversupplied_info *make_server_info(TALLOC_CTX *mem_ctx); | 
|---|
| 211 | NTSTATUS serverinfo_to_SamInfo2(struct auth_serversupplied_info *server_info, | 
|---|
| 212 | uint8_t *pipe_session_key, | 
|---|
| 213 | size_t pipe_session_key_len, | 
|---|
| 214 | struct netr_SamInfo2 *sam2); | 
|---|
| 215 | NTSTATUS serverinfo_to_SamInfo3(const struct auth_serversupplied_info *server_info, | 
|---|
| 216 | uint8_t *pipe_session_key, | 
|---|
| 217 | size_t pipe_session_key_len, | 
|---|
| 218 | struct netr_SamInfo3 *sam3); | 
|---|
| 219 | NTSTATUS serverinfo_to_SamInfo6(struct auth_serversupplied_info *server_info, | 
|---|
| 220 | uint8_t *pipe_session_key, | 
|---|
| 221 | size_t pipe_session_key_len, | 
|---|
| 222 | struct netr_SamInfo6 *sam6); | 
|---|
| 223 | NTSTATUS samu_to_SamInfo3(TALLOC_CTX *mem_ctx, | 
|---|
| 224 | struct samu *samu, | 
|---|
| 225 | const char *login_server, | 
|---|
| 226 | struct netr_SamInfo3 **_info3, | 
|---|
| 227 | struct extra_auth_info *extra); | 
|---|
| 228 | struct netr_SamInfo3 *copy_netr_SamInfo3(TALLOC_CTX *mem_ctx, | 
|---|
| 229 | struct netr_SamInfo3 *orig); | 
|---|
| 230 | struct netr_SamInfo3 *wbcAuthUserInfo_to_netr_SamInfo3(TALLOC_CTX *mem_ctx, | 
|---|
| 231 | const struct wbcAuthUserInfo *info); | 
|---|
| 232 |  | 
|---|
| 233 | /* The following definitions come from auth/auth_wbc.c  */ | 
|---|
| 234 |  | 
|---|
| 235 | NTSTATUS auth_wbc_init(void); | 
|---|
| 236 |  | 
|---|
| 237 | /* The following definitions come from auth/pampass.c  */ | 
|---|
| 238 |  | 
|---|
| 239 | bool smb_pam_claim_session(char *user, char *tty, char *rhost); | 
|---|
| 240 | bool smb_pam_close_session(char *user, char *tty, char *rhost); | 
|---|
| 241 | NTSTATUS smb_pam_accountcheck(const char *user, const char *rhost); | 
|---|
| 242 | NTSTATUS smb_pam_passcheck(const char * user, const char * rhost, | 
|---|
| 243 | const char * password); | 
|---|
| 244 | bool smb_pam_passchange(const char *user, const char *rhost, | 
|---|
| 245 | const char *oldpassword, const char *newpassword); | 
|---|
| 246 | bool smb_pam_claim_session(char *user, char *tty, char *rhost); | 
|---|
| 247 | bool smb_pam_close_session(char *in_user, char *tty, char *rhost); | 
|---|
| 248 |  | 
|---|
| 249 | /* The following definitions come from auth/pass_check.c  */ | 
|---|
| 250 |  | 
|---|
| 251 | void dfs_unlogin(void); | 
|---|
| 252 | NTSTATUS pass_check(const struct passwd *pass, | 
|---|
| 253 | const char *user, | 
|---|
| 254 | const char *rhost, | 
|---|
| 255 | const char *password, | 
|---|
| 256 | bool run_cracker); | 
|---|
| 257 |  | 
|---|
| 258 | /* The following definitions come from auth/token_util.c  */ | 
|---|
| 259 |  | 
|---|
| 260 | bool nt_token_check_sid ( const struct dom_sid *sid, const struct security_token *token ); | 
|---|
| 261 | bool nt_token_check_domain_rid( struct security_token *token, uint32 rid ); | 
|---|
| 262 | struct security_token *get_root_nt_token( void ); | 
|---|
| 263 | NTSTATUS add_aliases(const struct dom_sid *domain_sid, | 
|---|
| 264 | struct security_token *token); | 
|---|
| 265 | struct security_token *create_local_nt_token(TALLOC_CTX *mem_ctx, | 
|---|
| 266 | const struct dom_sid *user_sid, | 
|---|
| 267 | bool is_guest, | 
|---|
| 268 | int num_groupsids, | 
|---|
| 269 | const struct dom_sid *groupsids); | 
|---|
| 270 | NTSTATUS create_local_nt_token_from_info3(TALLOC_CTX *mem_ctx, | 
|---|
| 271 | bool is_guest, | 
|---|
| 272 | struct netr_SamInfo3 *info3, | 
|---|
| 273 | struct extra_auth_info *extra, | 
|---|
| 274 | struct security_token **ntok); | 
|---|
| 275 | void debug_unix_user_token(int dbg_class, int dbg_lev, uid_t uid, gid_t gid, | 
|---|
| 276 | int n_groups, gid_t *groups); | 
|---|
| 277 |  | 
|---|
| 278 | /* The following definitions come from auth/user_util.c  */ | 
|---|
| 279 |  | 
|---|
| 280 | bool map_username(TALLOC_CTX *ctx, const char *user_in, char **p_user_out); | 
|---|
| 281 | bool user_in_netgroup(TALLOC_CTX *ctx, const char *user, const char *ngname); | 
|---|
| 282 | bool user_in_list(TALLOC_CTX *ctx, const char *user,const char **list); | 
|---|
| 283 |  | 
|---|
| 284 | /* The following definitions come from auth/user_krb5.c  */ | 
|---|
| 285 | struct PAC_LOGON_INFO; | 
|---|
| 286 | NTSTATUS get_user_from_kerberos_info(TALLOC_CTX *mem_ctx, | 
|---|
| 287 | const char *cli_name, | 
|---|
| 288 | const char *princ_name, | 
|---|
| 289 | struct PAC_LOGON_INFO *logon_info, | 
|---|
| 290 | bool *is_mapped, | 
|---|
| 291 | bool *mapped_to_guest, | 
|---|
| 292 | char **ntuser, | 
|---|
| 293 | char **ntdomain, | 
|---|
| 294 | char **username, | 
|---|
| 295 | struct passwd **_pw); | 
|---|
| 296 | NTSTATUS make_server_info_krb5(TALLOC_CTX *mem_ctx, | 
|---|
| 297 | char *ntuser, | 
|---|
| 298 | char *ntdomain, | 
|---|
| 299 | char *username, | 
|---|
| 300 | struct passwd *pw, | 
|---|
| 301 | struct PAC_LOGON_INFO *logon_info, | 
|---|
| 302 | bool mapped_to_guest, | 
|---|
| 303 | struct auth_serversupplied_info **server_info); | 
|---|
| 304 |  | 
|---|
| 305 | #endif /* _AUTH_PROTO_H_ */ | 
|---|