2 Unix SMB/CIFS implementation.
4 Implement a hook into the Samba4 auth subsystem
6 Copyright (C) Andrew Bartlett <abartlet@samba.org> 2004-2010
7 Copyright (C) Stefan Metzmacher <metze@samba.org> 2005
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 3 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, see <http://www.gnu.org/licenses/>.
24 #include "auth/auth.h"
25 #include "auth/auth_sam_reply.h"
26 #include "s3_smbd_proto.h"
27 #include "s3compat_authenticate.h"
28 #include "smbd/service.h"
30 NTSTATUS s3compat_authenticate(TALLOC_CTX *mem_ctx, uint8_t chall[8], const struct auth_usersupplied_info *user_info, struct netr_SamInfo3 **info3)
32 struct stream_connection *samba3_conn;
33 struct auth_context *auth_context;
34 struct auth_serversupplied_info *server_info;
36 samba3_conn = s3compat_get_conn();
38 nt_status = auth_context_create(mem_ctx,
39 samba3_conn->event.ctx, samba3_conn->msg_ctx, samba3_conn->lp_ctx,
41 NT_STATUS_NOT_OK_RETURN(nt_status);
43 nt_status = auth_context_set_challenge(auth_context, chall, "s3compat");
44 NT_STATUS_NOT_OK_RETURN_AND_FREE(nt_status, auth_context);
46 nt_status = auth_check_password(auth_context, auth_context, user_info, &server_info);
47 NT_STATUS_NOT_OK_RETURN_AND_FREE(nt_status, auth_context);
49 nt_status = auth_convert_server_info_saminfo3(mem_ctx,
52 talloc_free(auth_context);