s3: Add winbindd_lookupsids
[Samba.git] / source3 / auth / proto.h
blob88cc7074ed147c9e582dee203f0247c472b76104
2 /* The following definitions come from auth/auth.c */
4 NTSTATUS smb_register_auth(int version, const char *name, auth_init_function init);
5 bool load_auth_module(struct auth_context *auth_context,
6 const char *module, auth_methods **ret) ;
7 NTSTATUS make_auth_context_subsystem(TALLOC_CTX *mem_ctx,
8 struct auth_context **auth_context);
9 NTSTATUS make_auth_context_fixed(TALLOC_CTX *mem_ctx,
10 struct auth_context **auth_context,
11 uchar chal[8]) ;
13 /* The following definitions come from auth/auth_builtin.c */
15 NTSTATUS auth_builtin_init(void);
17 /* The following definitions come from auth/auth_compat.c */
19 NTSTATUS check_plaintext_password(const char *smb_name,
20 DATA_BLOB plaintext_password,
21 struct auth_serversupplied_info **server_info);
22 bool password_ok(struct auth_context *actx, bool global_encrypted,
23 const char *session_workgroup,
24 const char *smb_name, DATA_BLOB password_blob);
26 /* The following definitions come from auth/auth_domain.c */
28 void attempt_machine_password_change(void);
29 NTSTATUS auth_domain_init(void);
31 NTSTATUS auth_netlogond_init(void);
33 /* The following definitions come from auth/auth_ntlmssp.c */
35 NTSTATUS auth_ntlmssp_steal_session_info(TALLOC_CTX *mem_ctx,
36 struct auth_ntlmssp_state *auth_ntlmssp_state,
37 struct auth_serversupplied_info **session_info);
38 NTSTATUS auth_ntlmssp_start(struct auth_ntlmssp_state **auth_ntlmssp_state);
41 /* The following definitions come from auth/auth_sam.c */
43 NTSTATUS check_sam_security(const DATA_BLOB *challenge,
44 TALLOC_CTX *mem_ctx,
45 const struct auth_usersupplied_info *user_info,
46 struct auth_serversupplied_info **server_info);
47 NTSTATUS check_sam_security_info3(const DATA_BLOB *challenge,
48 TALLOC_CTX *mem_ctx,
49 const struct auth_usersupplied_info *user_info,
50 struct netr_SamInfo3 **pinfo3);
51 NTSTATUS auth_sam_init(void);
53 /* The following definitions come from auth/auth_server.c */
55 NTSTATUS auth_server_init(void);
57 /* The following definitions come from auth/auth_unix.c */
59 NTSTATUS auth_unix_init(void);
61 /* The following definitions come from auth/auth_util.c */
63 NTSTATUS make_user_info_map(struct auth_usersupplied_info **user_info,
64 const char *smb_name,
65 const char *client_domain,
66 const char *workstation_name,
67 DATA_BLOB *lm_pwd,
68 DATA_BLOB *nt_pwd,
69 const struct samr_Password *lm_interactive_pwd,
70 const struct samr_Password *nt_interactive_pwd,
71 const char *plaintext,
72 enum auth_password_state password_state);
73 bool make_user_info_netlogon_network(struct auth_usersupplied_info **user_info,
74 const char *smb_name,
75 const char *client_domain,
76 const char *workstation_name,
77 uint32 logon_parameters,
78 const uchar *lm_network_pwd,
79 int lm_pwd_len,
80 const uchar *nt_network_pwd,
81 int nt_pwd_len);
82 bool make_user_info_netlogon_interactive(struct auth_usersupplied_info **user_info,
83 const char *smb_name,
84 const char *client_domain,
85 const char *workstation_name,
86 uint32 logon_parameters,
87 const uchar chal[8],
88 const uchar lm_interactive_pwd[16],
89 const uchar nt_interactive_pwd[16],
90 const uchar *dc_sess_key);
91 bool make_user_info_for_reply(struct auth_usersupplied_info **user_info,
92 const char *smb_name,
93 const char *client_domain,
94 const uint8 chal[8],
95 DATA_BLOB plaintext_password);
96 NTSTATUS make_user_info_for_reply_enc(struct auth_usersupplied_info **user_info,
97 const char *smb_name,
98 const char *client_domain,
99 DATA_BLOB lm_resp, DATA_BLOB nt_resp);
100 bool make_user_info_guest(struct auth_usersupplied_info **user_info) ;
101 struct samu;
102 NTSTATUS make_server_info_sam(struct auth_serversupplied_info **server_info,
103 struct samu *sampass);
104 NTSTATUS create_local_token(struct auth_serversupplied_info *server_info);
105 NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
106 bool is_guest,
107 uid_t *uid, gid_t *gid,
108 char **found_username,
109 struct security_token **token);
110 bool user_in_group_sid(const char *username, const struct dom_sid *group_sid);
111 bool user_in_group(const char *username, const char *groupname);
112 struct passwd;
113 NTSTATUS make_server_info_pw(struct auth_serversupplied_info **server_info,
114 char *unix_username,
115 struct passwd *pwd);
116 NTSTATUS make_serverinfo_from_username(TALLOC_CTX *mem_ctx,
117 const char *username,
118 bool is_guest,
119 struct auth_serversupplied_info **presult);
120 struct auth_serversupplied_info *copy_serverinfo(TALLOC_CTX *mem_ctx,
121 const struct auth_serversupplied_info *src);
122 bool init_guest_info(void);
123 NTSTATUS init_system_info(void);
124 bool session_info_set_session_key(struct auth_serversupplied_info *info,
125 DATA_BLOB session_key);
126 NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx,
127 struct auth_serversupplied_info **server_info);
128 NTSTATUS make_session_info_system(TALLOC_CTX *mem_ctx,
129 struct auth_serversupplied_info **session_info);
130 const struct auth_serversupplied_info *get_session_info_system(void);
131 bool copy_current_user(struct current_user *dst, struct current_user *src);
132 struct passwd *smb_getpwnam( TALLOC_CTX *mem_ctx, const char *domuser,
133 char **p_save_username, bool create );
134 NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
135 const char *sent_nt_username,
136 const char *domain,
137 struct auth_serversupplied_info **server_info,
138 struct netr_SamInfo3 *info3);
139 struct wbcAuthUserInfo;
140 NTSTATUS make_server_info_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
141 const char *sent_nt_username,
142 const char *domain,
143 const struct wbcAuthUserInfo *info,
144 struct auth_serversupplied_info **server_info);
145 void free_user_info(struct auth_usersupplied_info **user_info);
146 bool make_auth_methods(struct auth_context *auth_context, auth_methods **auth_method) ;
147 bool is_trusted_domain(const char* dom_name);
149 /* The following definitions come from auth/user_info.c */
151 NTSTATUS make_user_info(struct auth_usersupplied_info **ret_user_info,
152 const char *smb_name,
153 const char *internal_username,
154 const char *client_domain,
155 const char *domain,
156 const char *workstation_name,
157 const DATA_BLOB *lm_pwd,
158 const DATA_BLOB *nt_pwd,
159 const struct samr_Password *lm_interactive_pwd,
160 const struct samr_Password *nt_interactive_pwd,
161 const char *plaintext_password,
162 enum auth_password_state password_state);
163 void free_user_info(struct auth_usersupplied_info **user_info);
165 /* The following definitions come from auth/auth_winbind.c */
167 NTSTATUS auth_winbind_init(void);
169 /* The following definitions come from auth/server_info.c */
171 struct netr_SamInfo2;
172 struct netr_SamInfo3;
173 struct netr_SamInfo6;
175 struct auth_serversupplied_info *make_server_info(TALLOC_CTX *mem_ctx);
176 NTSTATUS serverinfo_to_SamInfo2(struct auth_serversupplied_info *server_info,
177 uint8_t *pipe_session_key,
178 size_t pipe_session_key_len,
179 struct netr_SamInfo2 *sam2);
180 NTSTATUS serverinfo_to_SamInfo3(const struct auth_serversupplied_info *server_info,
181 uint8_t *pipe_session_key,
182 size_t pipe_session_key_len,
183 struct netr_SamInfo3 *sam3);
184 NTSTATUS serverinfo_to_SamInfo6(struct auth_serversupplied_info *server_info,
185 uint8_t *pipe_session_key,
186 size_t pipe_session_key_len,
187 struct netr_SamInfo6 *sam6);
188 NTSTATUS samu_to_SamInfo3(TALLOC_CTX *mem_ctx,
189 struct samu *samu,
190 const char *login_server,
191 struct netr_SamInfo3 **_info3,
192 struct extra_auth_info *extra);
193 struct netr_SamInfo3 *copy_netr_SamInfo3(TALLOC_CTX *mem_ctx,
194 struct netr_SamInfo3 *orig);
195 struct netr_SamInfo3 *wbcAuthUserInfo_to_netr_SamInfo3(TALLOC_CTX *mem_ctx,
196 const struct wbcAuthUserInfo *info);
198 /* The following definitions come from auth/auth_wbc.c */
200 NTSTATUS auth_wbc_init(void);
202 /* The following definitions come from auth/pampass.c */
204 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
205 bool smb_pam_close_session(char *user, char *tty, char *rhost);
206 NTSTATUS smb_pam_accountcheck(const char *user, const char *rhost);
207 NTSTATUS smb_pam_passcheck(const char * user, const char * rhost,
208 const char * password);
209 bool smb_pam_passchange(const char *user, const char *rhost,
210 const char *oldpassword, const char *newpassword);
211 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
212 bool smb_pam_close_session(char *in_user, char *tty, char *rhost);
214 /* The following definitions come from auth/pass_check.c */
216 void dfs_unlogin(void);
217 NTSTATUS pass_check(const struct passwd *pass,
218 const char *user,
219 const char *rhost,
220 const char *password,
221 bool run_cracker);
223 /* The following definitions come from auth/token_util.c */
225 bool nt_token_check_sid ( const struct dom_sid *sid, const struct security_token *token );
226 bool nt_token_check_domain_rid( struct security_token *token, uint32 rid );
227 struct security_token *get_root_nt_token( void );
228 NTSTATUS add_aliases(const struct dom_sid *domain_sid,
229 struct security_token *token);
230 struct security_token *create_local_nt_token(TALLOC_CTX *mem_ctx,
231 const struct dom_sid *user_sid,
232 bool is_guest,
233 int num_groupsids,
234 const struct dom_sid *groupsids);
235 NTSTATUS create_local_nt_token_from_info3(TALLOC_CTX *mem_ctx,
236 bool is_guest,
237 struct netr_SamInfo3 *info3,
238 struct extra_auth_info *extra,
239 struct security_token **ntok);
240 void debug_unix_user_token(int dbg_class, int dbg_lev, uid_t uid, gid_t gid,
241 int n_groups, gid_t *groups);
243 /* The following definitions come from auth/user_util.c */
245 bool map_username(TALLOC_CTX *ctx, const char *user_in, char **p_user_out);
246 bool user_in_netgroup(TALLOC_CTX *ctx, const char *user, const char *ngname);
247 bool user_in_list(TALLOC_CTX *ctx, const char *user,const char **list);
249 /* The following definitions come from auth/user_krb5.c */
250 struct PAC_LOGON_INFO;
251 NTSTATUS get_user_from_kerberos_info(TALLOC_CTX *mem_ctx,
252 const char *cli_name,
253 const char *princ_name,
254 struct PAC_LOGON_INFO *logon_info,
255 bool *is_mapped,
256 bool *mapped_to_guest,
257 char **ntuser,
258 char **ntdomain,
259 char **username,
260 struct passwd **_pw);
261 NTSTATUS make_server_info_krb5(TALLOC_CTX *mem_ctx,
262 char *ntuser,
263 char *ntdomain,
264 char *username,
265 struct passwd *pw,
266 struct PAC_LOGON_INFO *logon_info,
267 bool mapped_to_guest,
268 struct auth_serversupplied_info **server_info);