2
Unix SMB/CIFS implementation.
3
Main winbindd server routines
5
Copyright (C) Stefan Metzmacher 2005
6
Copyright (C) Andrew Tridgell 2005
8
This program is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 3 of the License, or
11
(at your option) any later version.
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
18
You should have received a copy of the GNU General Public License
19
along with this program. If not, see <http://www.gnu.org/licenses/>.
22
#include "nsswitch/winbind_nss_config.h"
23
#include "nsswitch/winbind_struct_protocol.h"
24
#include "winbind/idmap.h"
25
#include "libnet/libnet.h"
27
#define WINBINDD_SAMBA3_SOCKET "pipe"
28
/* the privileged socket is in smbd_tmp_dir() */
29
#define WINBINDD_SAMBA3_PRIVILEGED_SOCKET "winbind_pipe"
31
/* this struct stores global data for the winbind task */
32
struct wbsrv_service {
33
struct task_server *task;
35
const struct dom_sid *primary_sid;
36
struct wbsrv_domain *domains;
37
struct idmap_context *idmap_ctx;
39
const char *priv_socket_path;
42
struct wbsrv_samconn {
43
struct wbsrv_domain *domain;
46
struct composite_context (*seqnum_send)(struct wbsrv_samconn *);
47
NTSTATUS (*seqnum_recv)(struct composite_context *, uint64_t *);
53
const struct dom_sid *sid;
56
struct nbt_dc_name *dcs;
60
struct wbsrv_domain *next, *prev;
62
struct wb_dom_info *info;
64
/* Details for the server we are currently talking to */
65
const char *dc_address;
68
struct libnet_context *libnet_ctx;
70
struct dcerpc_binding *lsa_binding;
72
struct dcerpc_binding *samr_binding;
74
struct dcerpc_pipe *netlogon_pipe;
75
struct dcerpc_binding *netlogon_binding;
79
state of a listen socket and it's protocol information
81
struct wbsrv_listen_socket {
82
const char *socket_path;
83
struct wbsrv_service *service;
88
state of an open winbind connection
90
struct wbsrv_connection {
91
/* stream connection we belong to */
92
struct stream_connection *conn;
94
/* the listening socket we belong to, it holds protocol hooks */
95
struct wbsrv_listen_socket *listen_socket;
97
/* storage for protocol specific data */
98
void *protocol_private_data;
100
/* how many calls are pending */
101
uint32_t pending_calls;
103
struct packet_context *packet;
105
struct loadparm_context *lp_ctx;
108
#define WBSRV_SAMBA3_SET_STRING(dest, src) do { \
109
safe_strcpy(dest, src, sizeof(dest)-1);\
113
state of a pwent query
116
/* Current UserList structure, contains 1+ user structs */
117
struct libnet_UserList *user_list;
119
/* Index of the next user struct in the current UserList struct */
122
/* The libnet_ctx to use for the libnet_UserList call */
123
struct libnet_context *libnet_ctx;
129
NOTE about async replies:
130
if the backend wants to reply later:
132
- it should set the WBSRV_CALL_FLAGS_REPLY_ASYNC flag, and may set a
133
talloc_destructor on the this structure or on the private_data (if it's a
134
talloc child of this structure), so that wbsrv_terminate_connection
135
called by another call clean up the whole connection correct.
136
- When the backend is ready to reply it should call wbsrv_send_reply(call),
137
wbsrv_send_reply implies talloc_free(call), so the backend should use
138
talloc_reference(call), if it needs it later.
139
- If wbsrv_send_reply doesn't return NT_STATUS_OK, the backend function
140
should call, wbsrv_terminate_connection(call->wbconn, nt_errstr(status));
144
struct wbsrv_samba3_call {
145
#define WBSRV_CALL_FLAGS_REPLY_ASYNC 0x00000001
148
/* the connection the call belongs to */
149
struct wbsrv_connection *wbconn;
151
/* the backend should use this event context */
152
struct tevent_context *event_ctx;
154
/* here the backend can store stuff like composite_context's ... */
157
/* the request structure of the samba3 protocol */
158
struct winbindd_request request;
160
/* the response structure of the samba3 protocol*/
161
struct winbindd_response response;
164
struct netr_LMSessionKey;
165
struct netr_UserSessionKey;
166
struct winbind_SamLogon;
168
#include "winbind/wb_async_helpers.h"
169
#include "winbind/wb_proto.h"