4 Unix SMB/Netbios implementation.
6 Standardised Authentication types
7 Copyright (C) Andrew Bartlett 2001
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 /* AUTH_STR - string */
25 typedef struct normal_string
31 /* AUTH_UNISTR - unicode string or buffer */
32 typedef struct unicode_string
38 typedef struct interactive_password
40 OWF_INFO lm_owf; /* LM OWF Password */
41 OWF_INFO nt_owf; /* NT OWF Password */
42 } auth_interactive_password;
44 typedef struct auth_usersupplied_info
49 auth_interactive_password * interactive_password;
50 DATA_BLOB plaintext_password;
56 AUTH_STR client_domain; /* domain name string */
57 AUTH_STR domain; /* domain name after mapping */
58 AUTH_STR internal_username; /* username after mapping */
59 AUTH_STR smb_name; /* username before mapping */
60 AUTH_STR wksta_name; /* workstation name (netbios calling name) unicode string */
62 } auth_usersupplied_info;
64 #define SAM_FILL_NAME 0x01
65 #define SAM_FILL_INFO3 0x02
66 #define SAM_FILL_SAM 0x04
67 #define SAM_FILL_UNIX 0x08
68 #define SAM_FILL_ALL (SAM_FILL_NAME | SAM_FILL_INFO3 | SAM_FILL_SAM | SAM_FILL_UNIX)
70 typedef struct auth_serversupplied_info
74 /* This groups info is needed for when we become_user() for this uid */
78 /* NT group information taken from the info3 structure */
82 uchar session_key[16];
84 uint8 first_8_lm_hash[8];
86 uint32 sam_fill_level; /* How far is this structure filled? */
88 SAM_ACCOUNT *sam_account;
92 } auth_serversupplied_info;
97 /* Who set this up in the first place? */
98 char *challenge_set_by;
100 struct auth_methods *challenge_set_method;
101 /* What order are the various methods in? Try to stop it changing under us */
102 struct auth_methods *auth_method_list;
105 const uint8 *(*get_ntlm_challenge)(struct auth_context *auth_context);
106 NTSTATUS (*check_ntlm_password)(const struct auth_context *auth_context,
107 const struct auth_usersupplied_info *user_info,
108 struct auth_serversupplied_info **server_info);
109 NTSTATUS (*nt_status_squash)(NTSTATUS nt_status);
110 void (*free)(struct auth_context **auth_context);
113 typedef struct auth_methods
115 struct auth_methods *prev, *next;
116 char *name; /* What name got this module */
118 NTSTATUS (*auth)(const struct auth_context *auth_context,
119 void *my_private_data,
121 const struct auth_usersupplied_info *user_info,
122 auth_serversupplied_info **server_info);
124 DATA_BLOB (*get_chal)(const struct auth_context *auth_context,
125 void **my_private_data,
126 TALLOC_CTX *mem_ctx);
128 /* Used to keep tabs on things like the cli for SMB server authentication */
131 /* Function to clean up the above arbitary structure */
132 void (*free_private_data)(void **private_data);
134 /* Function to send a keepalive message on the above structure */
135 void (*send_keepalive)(void **private_data);
139 struct auth_init_function {
141 /* Function to create a member of the authmethods list */
142 BOOL (*init)(struct auth_context *auth_context, struct auth_methods **auth_method);
146 #endif /* _SMBAUTH_H_ */