2 Unix SMB/CIFS implementation.
3 Authentication utility functions
4 Copyright (C) Andrew Tridgell 1992-1998
5 Copyright (C) Andrew Bartlett 2001-2010
6 Copyright (C) Jeremy Allison 2000-2001
7 Copyright (C) Rafal Szczesniak 2002
8 Copyright (C) Stefan Metzmacher 2005
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #include "auth/auth.h"
26 #include "libcli/security/security.h"
27 #include "libcli/auth/libcli_auth.h"
28 #include "dsdb/samdb/samdb.h"
29 #include "auth/credentials/credentials.h"
30 #include "param/param.h"
31 #include "auth/session_proto.h"
33 _PUBLIC_ struct auth_session_info *anonymous_session(TALLOC_CTX *mem_ctx,
34 struct loadparm_context *lp_ctx)
37 struct auth_session_info *session_info = NULL;
38 nt_status = auth_anonymous_session_info(mem_ctx, lp_ctx, &session_info);
39 if (!NT_STATUS_IS_OK(nt_status)) {
45 _PUBLIC_ NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx,
46 struct tevent_context *event_ctx,
47 struct loadparm_context *lp_ctx,
48 struct auth_serversupplied_info *server_info,
49 struct auth_session_info **_session_info)
51 struct auth_session_info *session_info;
54 session_info = talloc(mem_ctx, struct auth_session_info);
55 NT_STATUS_HAVE_NO_MEMORY(session_info);
57 session_info->server_info = talloc_reference(session_info, server_info);
59 /* unless set otherwise, the session key is the user session
60 * key from the auth subsystem */
61 session_info->session_key = server_info->user_session_key;
63 nt_status = security_token_create(session_info,
66 server_info->account_sid,
67 server_info->primary_group_sid,
68 server_info->n_domain_groups,
69 server_info->domain_groups,
70 server_info->authenticated,
71 &session_info->security_token);
72 NT_STATUS_NOT_OK_RETURN(nt_status);
74 session_info->credentials = NULL;
76 *_session_info = session_info;
81 * prints a struct auth_session_info security token to debug output.
83 void auth_session_info_debug(int dbg_lev,
84 const struct auth_session_info *session_info)
87 DEBUG(dbg_lev, ("Session Info: (NULL)\n"));
91 security_token_debug(dbg_lev, session_info->security_token);