2
Unix SMB/CIFS implementation.
4
Wrapper around winbindd_rpc.c to centralize retry logic.
6
Copyright (C) Volker Lendecke 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 2 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, write to the Free Software
20
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27
#define DBGC_CLASS DBGC_WINBIND
29
extern struct winbindd_methods msrpc_methods;
32
static NTSTATUS query_user_list(struct winbindd_domain *domain,
35
WINBIND_USERINFO **info)
39
result = msrpc_methods.query_user_list(domain, mem_ctx,
42
if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
43
result = msrpc_methods.query_user_list(domain, mem_ctx,
48
/* list all domain groups */
49
static NTSTATUS enum_dom_groups(struct winbindd_domain *domain,
52
struct acct_info **info)
56
result = msrpc_methods.enum_dom_groups(domain, mem_ctx,
59
if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
60
result = msrpc_methods.enum_dom_groups(domain, mem_ctx,
65
/* List all domain groups */
67
static NTSTATUS enum_local_groups(struct winbindd_domain *domain,
70
struct acct_info **info)
74
result = msrpc_methods.enum_local_groups(domain, mem_ctx,
77
if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
78
result = msrpc_methods.enum_local_groups(domain, mem_ctx,
84
/* convert a single name to a sid in a domain */
85
static NTSTATUS name_to_sid(struct winbindd_domain *domain,
87
const char *domain_name,
90
enum SID_NAME_USE *type)
94
result = msrpc_methods.name_to_sid(domain, mem_ctx,
98
if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
99
result = msrpc_methods.name_to_sid(domain, mem_ctx,
107
convert a domain SID to a user or group name
109
static NTSTATUS sid_to_name(struct winbindd_domain *domain,
114
enum SID_NAME_USE *type)
118
result = msrpc_methods.sid_to_name(domain, mem_ctx, sid,
119
domain_name, name, type);
121
if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
122
result = msrpc_methods.sid_to_name(domain, mem_ctx, sid,
123
domain_name, name, type);
128
static NTSTATUS rids_to_names(struct winbindd_domain *domain,
135
enum SID_NAME_USE **types)
139
result = msrpc_methods.rids_to_names(domain, mem_ctx, sid,
141
domain_name, names, types);
142
if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL)) {
143
result = msrpc_methods.rids_to_names(domain, mem_ctx, sid,
152
/* Lookup user information from a rid or username. */
153
static NTSTATUS query_user(struct winbindd_domain *domain,
155
const DOM_SID *user_sid,
156
WINBIND_USERINFO *user_info)
160
result = msrpc_methods.query_user(domain, mem_ctx, user_sid,
163
if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
164
result = msrpc_methods.query_user(domain, mem_ctx, user_sid,
170
/* Lookup groups a user is a member of. I wish Unix had a call like this! */
171
static NTSTATUS lookup_usergroups(struct winbindd_domain *domain,
173
const DOM_SID *user_sid,
174
uint32 *num_groups, DOM_SID **user_gids)
178
result = msrpc_methods.lookup_usergroups(domain, mem_ctx,
179
user_sid, num_groups,
182
if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
183
result = msrpc_methods.lookup_usergroups(domain, mem_ctx,
184
user_sid, num_groups,
190
static NTSTATUS lookup_useraliases(struct winbindd_domain *domain,
192
uint32 num_sids, const DOM_SID *sids,
193
uint32 *num_aliases, uint32 **alias_rids)
197
result = msrpc_methods.lookup_useraliases(domain, mem_ctx,
202
if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
203
result = msrpc_methods.lookup_useraliases(domain, mem_ctx,
211
/* Lookup group membership given a rid. */
212
static NTSTATUS lookup_groupmem(struct winbindd_domain *domain,
214
const DOM_SID *group_sid, uint32 *num_names,
215
DOM_SID **sid_mem, char ***names,
220
result = msrpc_methods.lookup_groupmem(domain, mem_ctx,
221
group_sid, num_names,
225
if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
226
result = msrpc_methods.lookup_groupmem(domain, mem_ctx,
227
group_sid, num_names,
234
/* find the sequence number for a domain */
235
static NTSTATUS sequence_number(struct winbindd_domain *domain, uint32 *seq)
239
result = msrpc_methods.sequence_number(domain, seq);
241
if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
242
result = msrpc_methods.sequence_number(domain, seq);
247
/* find the lockout policy of a domain */
248
static NTSTATUS lockout_policy(struct winbindd_domain *domain,
250
SAM_UNK_INFO_12 *policy)
254
result = msrpc_methods.lockout_policy(domain, mem_ctx, policy);
256
if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
257
result = msrpc_methods.lockout_policy(domain, mem_ctx, policy);
262
/* find the password policy of a domain */
263
static NTSTATUS password_policy(struct winbindd_domain *domain,
265
SAM_UNK_INFO_1 *policy)
269
result = msrpc_methods.password_policy(domain, mem_ctx, policy);
271
if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
272
result = msrpc_methods.password_policy(domain, mem_ctx, policy);
277
/* get a list of trusted domains */
278
static NTSTATUS trusted_domains(struct winbindd_domain *domain,
287
result = msrpc_methods.trusted_domains(domain, mem_ctx,
289
alt_names, dom_sids);
291
if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
292
result = msrpc_methods.trusted_domains(domain, mem_ctx,
294
alt_names, dom_sids);
299
/* the rpc backend methods are exposed via this structure */
300
struct winbindd_methods reconnect_methods = {