libcli/named_pipe_auth Change from 'info3' to auth_session_info_transport
[nivanova/samba-autobuild/.git] / source4 / auth / session.h
1 /* 
2    Unix SMB/CIFS implementation.
3    Process and provide the logged on user's authorization token
4    Copyright (C) Andrew Bartlett   2001
5    Copyright (C) Stefan Metzmacher 2005
6    
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11    
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16    
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef _SAMBA_AUTH_SESSION_H
22 #define _SAMBA_AUTH_SESSION_H
23
24 struct auth_session_info {
25         struct security_token *security_token;
26         struct auth_user_info *info;
27         struct auth_user_info_torture *torture;
28         DATA_BLOB session_key;
29         struct cli_credentials *credentials;
30 };
31
32 #include "librpc/gen_ndr/netlogon.h"
33 #include "librpc/gen_ndr/auth.h"
34
35 struct tevent_context;
36 struct ldb_context;
37 struct ldb_dn;
38 /* Create a security token for a session SYSTEM (the most
39  * trusted/prvilaged account), including the local machine account as
40  * the off-host credentials */
41 struct auth_session_info *system_session(struct loadparm_context *lp_ctx) ;
42
43 NTSTATUS auth_anonymous_user_info_dc(TALLOC_CTX *mem_ctx,
44                                              const char *netbios_name,
45                                              struct auth_user_info_dc **interim_info);
46 NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx,
47                                     struct loadparm_context *lp_ctx, /* Optional, if you don't want privilages */
48                                     struct ldb_context *sam_ctx, /* Optional, if you don't want local groups */
49                                     struct auth_user_info_dc *interim_info,
50                                     uint32_t session_info_flags,
51                                     struct auth_session_info **session_info);
52 NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx, 
53                                      struct loadparm_context *lp_ctx,
54                                      struct auth_session_info **session_info);
55 struct auth_session_info *auth_session_info_from_transport(TALLOC_CTX *mem_ctx,
56                                                            struct auth_session_info_transport *session_info_transport,
57                                                            struct loadparm_context *lp_ctx,
58                                                            const char **reason);
59 NTSTATUS auth_session_info_transport_from_session(TALLOC_CTX *mem_ctx,
60                                                   struct auth_session_info *session_info,
61                                                   struct tevent_context *event_ctx,
62                                                   struct loadparm_context *lp_ctx,
63                                                   struct auth_session_info_transport **transport_out);
64
65 /* Produce a session_info for an arbitary DN or principal in the local
66  * DB, assuming the local DB holds all the groups
67  *
68  * Supply either a principal or a DN
69  */
70 NTSTATUS authsam_get_session_info_principal(TALLOC_CTX *mem_ctx,
71                                             struct loadparm_context *lp_ctx,
72                                             struct ldb_context *sam_ctx,
73                                             const char *principal,
74                                             struct ldb_dn *user_dn,
75                                             uint32_t session_info_flags,
76                                             struct auth_session_info **session_info);
77
78 struct auth_session_info *anonymous_session(TALLOC_CTX *mem_ctx, 
79                                             struct loadparm_context *lp_ctx);
80
81 struct auth_session_info *admin_session(TALLOC_CTX *mem_ctx,
82                                         struct loadparm_context *lp_ctx,
83                                         struct dom_sid *domain_sid);
84
85
86 #endif /* _SAMBA_AUTH_SESSION_H */