winbindd: Add retry also for ADS method calls
[obnox/samba/samba-obnox.git] / source3 / winbindd / winbindd_proto.h
1 /*
2  * Unix SMB/CIFS implementation.
3  * collected prototypes header
4  *
5  * frozen from "make proto" in May 2008
6  *
7  * Copyright (C) Michael Adam 2008
8  *
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.
13  *
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.
18  *
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/>.
21  */
22
23 #ifndef _WINBINDD_PROTO_H_
24 #define _WINBINDD_PROTO_H_
25
26 #include "ads.h"
27
28 /* The following definitions come from winbindd/winbindd.c  */
29 struct messaging_context *winbind_messaging_context(void);
30 struct imessaging_context *winbind_imessaging_context(void);
31 void request_error(struct winbindd_cli_state *state);
32 void request_ok(struct winbindd_cli_state *state);
33 bool winbindd_setup_sig_term_handler(bool parent);
34 bool winbindd_setup_stdin_handler(bool parent, bool foreground);
35 bool winbindd_setup_sig_hup_handler(const char *lfile);
36 bool winbindd_use_idmap_cache(void);
37 bool winbindd_use_cache(void);
38 char *get_winbind_priv_pipe_dir(void);
39 struct tevent_context *winbind_event_context(void);
40
41 /* The following definitions come from winbindd/winbindd_ads.c  */
42
43 /* The following definitions come from winbindd/winbindd_rpc.c  */
44
45 NTSTATUS winbindd_lookup_sids(TALLOC_CTX *mem_ctx,
46                               struct winbindd_domain *domain,
47                               uint32_t num_sids,
48                               const struct dom_sid *sids,
49                               char ***domains,
50                               char ***names,
51                               enum lsa_SidType **types);
52 NTSTATUS rpc_lookup_sids(TALLOC_CTX *mem_ctx,
53                          struct winbindd_domain *domain,
54                          struct lsa_SidArray *sids,
55                          struct lsa_RefDomainList **pdomains,
56                          struct lsa_TransNameArray **pnames);
57
58 /* The following definitions come from winbindd/winbindd_cache.c  */
59
60 NTSTATUS wcache_cached_creds_exist(struct winbindd_domain *domain, const struct dom_sid *sid);
61 NTSTATUS wcache_get_creds(struct winbindd_domain *domain, 
62                           TALLOC_CTX *mem_ctx, 
63                           const struct dom_sid *sid,
64                           const uint8_t **cached_nt_pass,
65                           const uint8_t **cached_salt);
66 NTSTATUS wcache_save_creds(struct winbindd_domain *domain, 
67                            const struct dom_sid *sid,
68                            const uint8_t nt_pass[NT_HASH_LEN]);
69 void wcache_invalidate_samlogon(struct winbindd_domain *domain, 
70                                 const struct dom_sid *user_sid);
71 bool wcache_invalidate_cache(void);
72 bool wcache_invalidate_cache_noinit(void);
73 bool init_wcache(void);
74 bool initialize_winbindd_cache(void);
75 void close_winbindd_cache(void);
76 NTSTATUS wcache_lookup_groupmem(struct winbindd_domain *domain,
77                                 TALLOC_CTX *mem_ctx,
78                                 const struct dom_sid *group_sid,
79                                 uint32_t *num_names,
80                                 struct dom_sid **sid_mem, char ***names,
81                                 uint32_t **name_types);
82 bool lookup_cached_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
83                        char **domain_name, char **name,
84                        enum lsa_SidType *type);
85 bool lookup_cached_name(const char *domain_name,
86                         const char *name,
87                         struct dom_sid *sid,
88                         enum lsa_SidType *type);
89 void cache_name2sid(struct winbindd_domain *domain, 
90                     const char *domain_name, const char *name,
91                     enum lsa_SidType type, const struct dom_sid *sid);
92 NTSTATUS wcache_name_to_sid(struct winbindd_domain *domain,
93                             const char *domain_name,
94                             const char *name,
95                             struct dom_sid *sid,
96                             enum lsa_SidType *type);
97 NTSTATUS wcache_query_user(struct winbindd_domain *domain,
98                            TALLOC_CTX *mem_ctx,
99                            const struct dom_sid *user_sid,
100                            struct wbint_userinfo *info);
101 NTSTATUS wcache_query_user_fullname(struct winbindd_domain *domain,
102                                     TALLOC_CTX *mem_ctx,
103                                     const struct dom_sid *user_sid,
104                                     const char **full_name);
105 NTSTATUS wcache_lookup_useraliases(struct winbindd_domain *domain,
106                                    TALLOC_CTX *mem_ctx,
107                                    uint32_t num_sids, const struct dom_sid *sids,
108                                    uint32_t *pnum_aliases, uint32_t **paliases);
109 NTSTATUS wcache_lookup_usergroups(struct winbindd_domain *domain,
110                                   TALLOC_CTX *mem_ctx,
111                                   const struct dom_sid *user_sid,
112                                   uint32_t *pnum_sids,
113                                   struct dom_sid **psids);
114
115 void wcache_flush_cache(void);
116 NTSTATUS wcache_count_cached_creds(struct winbindd_domain *domain, int *count);
117 NTSTATUS wcache_remove_oldest_cached_creds(struct winbindd_domain *domain, const struct dom_sid *sid) ;
118 bool set_global_winbindd_state_offline(void);
119 void set_global_winbindd_state_online(void);
120 bool get_global_winbindd_state_offline(void);
121 int winbindd_validate_cache(void);
122 int winbindd_validate_cache_nobackup(void);
123 bool winbindd_cache_validate_and_initialize(void);
124 bool wcache_tdc_fetch_list( struct winbindd_tdc_domain **domains, size_t *num_domains );
125 bool wcache_tdc_add_domain( struct winbindd_domain *domain );
126 struct winbindd_tdc_domain * wcache_tdc_fetch_domain( TALLOC_CTX *ctx, const char *name );
127 struct winbindd_tdc_domain* wcache_tdc_fetch_domainbysid(TALLOC_CTX *ctx, const struct dom_sid *sid);
128 void wcache_tdc_clear( void );
129 #ifdef HAVE_ADS
130 struct ads_struct;
131 NTSTATUS nss_get_info_cached( struct winbindd_domain *domain, 
132                               const struct dom_sid *user_sid,
133                               TALLOC_CTX *ctx,
134                               const char **homedir, const char **shell,
135                               const char **gecos, gid_t *p_gid);
136 #endif
137 bool wcache_store_seqnum(const char *domain_name, uint32_t seqnum,
138                          time_t last_seq_check);
139 bool wcache_fetch_ndr(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain,
140                       uint32_t opnum, const DATA_BLOB *req, DATA_BLOB *resp);
141 void wcache_store_ndr(struct winbindd_domain *domain, uint32_t opnum,
142                       const DATA_BLOB *req, const DATA_BLOB *resp);
143
144 /* The following definitions come from winbindd/winbindd_ccache_access.c  */
145
146 void winbindd_ccache_ntlm_auth(struct winbindd_cli_state *state);
147 enum winbindd_result winbindd_dual_ccache_ntlm_auth(struct winbindd_domain *domain,
148                                                 struct winbindd_cli_state *state);
149 void winbindd_ccache_save(struct winbindd_cli_state *state);
150
151 /* The following definitions come from winbindd/winbindd_cm.c  */
152 void winbind_msg_domain_offline(struct messaging_context *msg_ctx,
153                                 void *private_data,
154                                 uint32_t msg_type,
155                                 struct server_id server_id,
156                                 DATA_BLOB *data);
157 void winbind_msg_domain_online(struct messaging_context *msg_ctx,
158                                 void *private_data,
159                                 uint32_t msg_type,
160                                 struct server_id server_id,
161                                 DATA_BLOB *data);
162
163 void set_domain_offline(struct winbindd_domain *domain);
164 void set_domain_online_request(struct winbindd_domain *domain);
165
166 struct ndr_interface_table;
167 NTSTATUS wb_open_internal_pipe(TALLOC_CTX *mem_ctx,
168                                const struct ndr_interface_table *table,
169                                struct rpc_pipe_client **ret_pipe);
170 void invalidate_cm_connection(struct winbindd_domain *domain);
171 void close_conns_after_fork(void);
172 NTSTATUS init_dc_connection(struct winbindd_domain *domain, bool need_rw_dc);
173 NTSTATUS cm_connect_sam(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
174                         bool need_rw_dc,
175                         struct rpc_pipe_client **cli, struct policy_handle *sam_handle);
176 NTSTATUS cm_connect_lsa(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
177                         struct rpc_pipe_client **cli, struct policy_handle *lsa_policy);
178 NTSTATUS cm_connect_lsat(struct winbindd_domain *domain,
179                          TALLOC_CTX *mem_ctx,
180                          struct rpc_pipe_client **cli,
181                          struct policy_handle *lsa_policy);
182 NTSTATUS cm_connect_netlogon(struct winbindd_domain *domain,
183                              struct rpc_pipe_client **cli);
184 bool fetch_current_dc_from_gencache(TALLOC_CTX *mem_ctx,
185                                     const char *domain_name,
186                                     char **p_dc_name, char **p_dc_ip);
187
188 /* The following definitions come from winbindd/winbindd_cred_cache.c  */
189
190 bool ccache_entry_exists(const char *username);
191 bool ccache_entry_identical(const char *username,
192                             uid_t uid,
193                             const char *ccname);
194 void ccache_remove_all_after_fork(void);
195 void ccache_regain_all_now(void);
196 NTSTATUS add_ccache_to_list(const char *princ_name,
197                             const char *ccname,
198                             const char *service,
199                             const char *username,
200                             const char *password,
201                             const char *realm,
202                             uid_t uid,
203                             time_t create_time,
204                             time_t ticket_end,
205                             time_t renew_until,
206                             bool postponed_request);
207 NTSTATUS remove_ccache(const char *username);
208 struct WINBINDD_MEMORY_CREDS *find_memory_creds_by_name(const char *username);
209 NTSTATUS winbindd_add_memory_creds(const char *username,
210                                    uid_t uid,
211                                    const char *pass);
212 NTSTATUS winbindd_delete_memory_creds(const char *username);
213 NTSTATUS winbindd_replace_memory_creds(const char *username,
214                                        const char *pass);
215
216 /* The following definitions come from winbindd/winbindd_creds.c  */
217
218 NTSTATUS winbindd_get_creds(struct winbindd_domain *domain,
219                             TALLOC_CTX *mem_ctx,
220                             const struct dom_sid *sid,
221                             struct netr_SamInfo3 **info3,
222                             const uint8_t *cached_nt_pass[NT_HASH_LEN],
223                             const uint8_t *cred_salt[NT_HASH_LEN]);
224 NTSTATUS winbindd_store_creds(struct winbindd_domain *domain,
225                               const char *user, 
226                               const char *pass, 
227                               struct netr_SamInfo3 *info3);
228 NTSTATUS winbindd_update_creds_by_info3(struct winbindd_domain *domain,
229                                         const char *user,
230                                         const char *pass,
231                                         struct netr_SamInfo3 *info3);
232 NTSTATUS winbindd_update_creds_by_name(struct winbindd_domain *domain,
233                                        const char *user,
234                                        const char *pass);
235
236 /* The following definitions come from winbindd/winbindd_domain.c  */
237
238 void setup_domain_child(struct winbindd_domain *domain);
239
240 /* The following definitions come from winbindd/winbindd_dual.c  */
241
242 struct dcerpc_binding_handle *dom_child_handle(struct winbindd_domain *domain);
243 struct winbindd_child *choose_domain_child(struct winbindd_domain *domain);
244
245 struct tevent_req *wb_child_request_send(TALLOC_CTX *mem_ctx,
246                                          struct tevent_context *ev,
247                                          struct winbindd_child *child,
248                                          struct winbindd_request *request);
249 int wb_child_request_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
250                           struct winbindd_response **presponse, int *err);
251 struct tevent_req *wb_domain_request_send(TALLOC_CTX *mem_ctx,
252                                           struct tevent_context *ev,
253                                           struct winbindd_domain *domain,
254                                           struct winbindd_request *request);
255 int wb_domain_request_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
256                            struct winbindd_response **presponse, int *err);
257
258 void setup_child(struct winbindd_domain *domain, struct winbindd_child *child,
259                  const struct winbindd_child_dispatch_table *table,
260                  const char *logprefix,
261                  const char *logname);
262 void winbind_child_died(pid_t pid);
263 void winbindd_flush_negative_conn_cache(struct winbindd_domain *domain);
264 void winbind_msg_debug(struct messaging_context *msg_ctx,
265                          void *private_data,
266                          uint32_t msg_type,
267                          struct server_id server_id,
268                          DATA_BLOB *data);
269 void winbind_msg_offline(struct messaging_context *msg_ctx,
270                          void *private_data,
271                          uint32_t msg_type,
272                          struct server_id server_id,
273                          DATA_BLOB *data);
274 void winbind_msg_online(struct messaging_context *msg_ctx,
275                         void *private_data,
276                         uint32_t msg_type,
277                         struct server_id server_id,
278                         DATA_BLOB *data);
279 void winbind_msg_onlinestatus(struct messaging_context *msg_ctx,
280                               void *private_data,
281                               uint32_t msg_type,
282                               struct server_id server_id,
283                               DATA_BLOB *data);
284 void winbind_msg_dump_event_list(struct messaging_context *msg_ctx,
285                                  void *private_data,
286                                  uint32_t msg_type,
287                                  struct server_id server_id,
288                                  DATA_BLOB *data);
289 void winbind_msg_dump_domain_list(struct messaging_context *msg_ctx,
290                                   void *private_data,
291                                   uint32_t msg_type,
292                                   struct server_id server_id,
293                                   DATA_BLOB *data);
294 void winbind_msg_ip_dropped(struct messaging_context *msg_ctx,
295                             void *private_data,
296                             uint32_t msg_type,
297                             struct server_id server_id,
298                             DATA_BLOB *data);
299 void winbind_msg_ip_dropped_parent(struct messaging_context *msg_ctx,
300                                    void *private_data,
301                                    uint32_t msg_type,
302                                    struct server_id server_id,
303                                    DATA_BLOB *data);
304 NTSTATUS winbindd_reinit_after_fork(const struct winbindd_child *myself,
305                                     const char *logfilename);
306 struct winbindd_domain *wb_child_domain(void);
307
308 /* The following definitions come from winbindd/winbindd_group.c  */
309
310 void winbindd_getgrnam(struct winbindd_cli_state *state);
311 void winbindd_getgrgid(struct winbindd_cli_state *state);
312 void winbindd_setgrent(struct winbindd_cli_state *state);
313 void winbindd_endgrent(struct winbindd_cli_state *state);
314 void winbindd_getgrent(struct winbindd_cli_state *state);
315 void winbindd_list_groups(struct winbindd_cli_state *state);
316 void winbindd_getgroups(struct winbindd_cli_state *state);
317 void winbindd_getusersids(struct winbindd_cli_state *state);
318 void winbindd_getuserdomgroups(struct winbindd_cli_state *state);
319 void winbindd_getsidaliases(struct winbindd_cli_state *state);
320 bool fill_grent(TALLOC_CTX *mem_ctx, struct winbindd_gr *gr,
321                 const char *dom_name, const char *gr_name, gid_t unix_gid);
322 NTSTATUS winbindd_print_groupmembers(struct talloc_dict *members,
323                                      TALLOC_CTX *mem_ctx,
324                                      int *num_members, char **result);
325
326
327 /* The following definitions come from winbindd/winbindd_idmap.c  */
328
329 void init_idmap_child(void);
330 struct winbindd_child *idmap_child(void);
331 struct idmap_domain *idmap_find_domain_with_sid(const char *domname,
332                                                 const struct dom_sid *sid);
333
334 /* The following definitions come from winbindd/winbindd_locator.c  */
335
336 void init_locator_child(void);
337 struct winbindd_child *locator_child(void);
338
339 /* The following definitions come from winbindd/winbindd_misc.c  */
340
341 void winbindd_list_trusted_domains(struct winbindd_cli_state *state);
342 enum winbindd_result winbindd_dual_list_trusted_domains(struct winbindd_domain *domain,
343                                                         struct winbindd_cli_state *state);
344 void winbindd_show_sequence(struct winbindd_cli_state *state);
345 void winbindd_domain_info(struct winbindd_cli_state *state);
346 void winbindd_dc_info(struct winbindd_cli_state *state);
347 void winbindd_ping(struct winbindd_cli_state *state);
348 void winbindd_info(struct winbindd_cli_state *state);
349 void winbindd_interface_version(struct winbindd_cli_state *state);
350 void winbindd_domain_name(struct winbindd_cli_state *state);
351 void winbindd_netbios_name(struct winbindd_cli_state *state);
352 void winbindd_priv_pipe_dir(struct winbindd_cli_state *state);
353
354 /* The following definitions come from winbindd/winbindd_ndr.c  */
355 struct ndr_print;
356 void ndr_print_winbindd_child(struct ndr_print *ndr,
357                               const char *name,
358                               const struct winbindd_child *r);
359 void ndr_print_winbindd_cm_conn(struct ndr_print *ndr,
360                                 const char *name,
361                                 const struct winbindd_cm_conn *r);
362 void ndr_print_winbindd_methods(struct ndr_print *ndr,
363                                 const char *name,
364                                 const struct winbindd_methods *r);
365 void ndr_print_winbindd_domain(struct ndr_print *ndr,
366                                const char *name,
367                                const struct winbindd_domain *r);
368
369 /* The following definitions come from winbindd/winbindd_pam.c  */
370
371 bool check_request_flags(uint32_t flags);
372 NTSTATUS append_auth_data(TALLOC_CTX *mem_ctx,
373                           struct winbindd_response *resp,
374                           uint32_t request_flags,
375                           struct netr_SamInfo3 *info3,
376                           const char *name_domain,
377                           const char *name_user);
378 uid_t get_uid_from_request(struct winbindd_request *request);
379 struct winbindd_domain *find_auth_domain(uint8_t flags,
380                                          const char *domain_name);
381 enum winbindd_result winbindd_dual_pam_auth(struct winbindd_domain *domain,
382                                             struct winbindd_cli_state *state) ;
383 enum winbindd_result winbindd_dual_pam_auth_crap(struct winbindd_domain *domain,
384                                                  struct winbindd_cli_state *state) ;
385 enum winbindd_result winbindd_dual_pam_chauthtok(struct winbindd_domain *contact_domain,
386                                                  struct winbindd_cli_state *state);
387 enum winbindd_result winbindd_dual_pam_logoff(struct winbindd_domain *domain,
388                                               struct winbindd_cli_state *state) ;
389 enum winbindd_result winbindd_dual_pam_chng_pswd_auth_crap(struct winbindd_domain *domainSt, struct winbindd_cli_state *state);
390 NTSTATUS winbindd_pam_auth_pac_send(struct winbindd_cli_state *state,
391                                     struct netr_SamInfo3 **info3);
392
393 NTSTATUS winbind_dual_SamLogon(struct winbindd_domain *domain,
394                                TALLOC_CTX *mem_ctx,
395                                uint32_t logon_parameters,
396                                const char *name_user,
397                                const char *name_domain,
398                                const char *workstation,
399                                const uint8_t chal[8],
400                                DATA_BLOB lm_response,
401                                DATA_BLOB nt_response,
402                                struct netr_SamInfo3 **info3);
403
404 /* The following definitions come from winbindd/winbindd_util.c  */
405
406 struct winbindd_domain *domain_list(void);
407 struct winbindd_domain *wb_next_domain(struct winbindd_domain *domain);
408 bool domain_is_forest_root(const struct winbindd_domain *domain);
409 void rescan_trusted_domains(struct tevent_context *ev, struct tevent_timer *te,
410                             struct timeval now, void *private_data);
411 enum winbindd_result winbindd_dual_init_connection(struct winbindd_domain *domain,
412                                                    struct winbindd_cli_state *state);
413 bool init_domain_list(void);
414 struct winbindd_domain *find_domain_from_name_noinit(const char *domain_name);
415 struct winbindd_domain *find_domain_from_name(const char *domain_name);
416 struct winbindd_domain *find_domain_from_sid_noinit(const struct dom_sid *sid);
417 struct winbindd_domain *find_domain_from_sid(const struct dom_sid *sid);
418 struct winbindd_domain *find_our_domain(void);
419 struct winbindd_domain *find_root_domain(void);
420 struct winbindd_domain *find_builtin_domain(void);
421 struct winbindd_domain *find_lookup_domain_from_sid(const struct dom_sid *sid);
422 struct winbindd_domain *find_lookup_domain_from_name(const char *domain_name);
423 bool parse_domain_user(const char *domuser, fstring domain, fstring user);
424 bool parse_domain_user_talloc(TALLOC_CTX *mem_ctx, const char *domuser,
425                               char **domain, char **user);
426 bool canonicalize_username(fstring username_inout, fstring domain, fstring user);
427 void fill_domain_username(fstring name, const char *domain, const char *user, bool can_assume);
428 char *fill_domain_username_talloc(TALLOC_CTX *ctx,
429                                   const char *domain,
430                                   const char *user,
431                                   bool can_assume);
432 struct winbindd_cli_state *winbindd_client_list(void);
433 struct winbindd_cli_state *winbindd_client_list_tail(void);
434 struct winbindd_cli_state *
435 winbindd_client_list_prev(struct winbindd_cli_state *cli);
436 void winbindd_add_client(struct winbindd_cli_state *cli);
437 void winbindd_remove_client(struct winbindd_cli_state *cli);
438 void winbindd_promote_client(struct winbindd_cli_state *cli);
439 int winbindd_num_clients(void);
440 NTSTATUS lookup_usergroups_cached(struct winbindd_domain *domain,
441                                   TALLOC_CTX *mem_ctx,
442                                   const struct dom_sid *user_sid,
443                                   uint32_t *p_num_groups, struct dom_sid **user_sids);
444
445 NTSTATUS normalize_name_map(TALLOC_CTX *mem_ctx,
446                              struct winbindd_domain *domain,
447                              const char *name,
448                              char **normalized);
449 NTSTATUS normalize_name_unmap(TALLOC_CTX *mem_ctx,
450                               char *name,
451                               char **normalized);
452
453 NTSTATUS resolve_username_to_alias(TALLOC_CTX *mem_ctx,
454                                    struct winbindd_domain *domain,
455                                    const char *name, char **alias);
456 NTSTATUS resolve_alias_to_username(TALLOC_CTX *mem_ctx,
457                                    struct winbindd_domain *domain,
458                                    const char *alias, char **name);
459
460 bool winbindd_can_contact_domain(struct winbindd_domain *domain);
461 bool winbindd_internal_child(struct winbindd_child *child);
462 void winbindd_set_locator_kdc_envs(const struct winbindd_domain *domain);
463 void winbindd_unset_locator_kdc_env(const struct winbindd_domain *domain);
464 void winbindd_set_locator_kdc_envs(const struct winbindd_domain *domain);
465 void winbindd_unset_locator_kdc_env(const struct winbindd_domain *domain);
466 void set_auth_errors(struct winbindd_response *resp, NTSTATUS result);
467 bool is_domain_offline(const struct winbindd_domain *domain);
468 bool is_domain_online(const struct winbindd_domain *domain);
469 bool parse_sidlist(TALLOC_CTX *mem_ctx, const char *sidstr,
470                    struct dom_sid **sids, uint32_t *num_sids);
471
472 /* The following definitions come from winbindd/winbindd_wins.c  */
473
474 void winbindd_wins_byname(struct winbindd_cli_state *state);
475
476 struct tevent_req *wb_ping_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
477                                 struct winbindd_cli_state *cli,
478                                 struct winbindd_request *request);
479 NTSTATUS wb_ping_recv(struct tevent_req *req,
480                       struct winbindd_response *resp);
481
482 enum winbindd_result winbindd_dual_ping(struct winbindd_domain *domain,
483                                         struct winbindd_cli_state *state);
484
485 struct dcerpc_binding_handle *wbint_binding_handle(TALLOC_CTX *mem_ctx,
486                                                 struct winbindd_domain *domain,
487                                                 struct winbindd_child *child);
488 enum winbindd_result winbindd_dual_ndrcmd(struct winbindd_domain *domain,
489                                           struct winbindd_cli_state *state);
490
491 struct tevent_req *wb_lookupsid_send(TALLOC_CTX *mem_ctx,
492                                      struct tevent_context *ev,
493                                      const struct dom_sid *sid);
494 NTSTATUS wb_lookupsid_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
495                            enum lsa_SidType *type, const char **domain,
496                            const char **name);
497
498 struct tevent_req *winbindd_lookupsid_send(TALLOC_CTX *mem_ctx,
499                                            struct tevent_context *ev,
500                                            struct winbindd_cli_state *cli,
501                                            struct winbindd_request *request);
502 NTSTATUS winbindd_lookupsid_recv(struct tevent_req *req,
503                                  struct winbindd_response *response);
504
505 struct tevent_req *winbindd_lookupsids_send(TALLOC_CTX *mem_ctx,
506                                             struct tevent_context *ev,
507                                             struct winbindd_cli_state *cli,
508                                             struct winbindd_request *request);
509 NTSTATUS winbindd_lookupsids_recv(struct tevent_req *req,
510                                   struct winbindd_response *response);
511
512 struct tevent_req *wb_lookupname_send(TALLOC_CTX *mem_ctx,
513                                       struct tevent_context *ev,
514                                       const char *dom_name, const char *name,
515                                       uint32_t flags);
516 NTSTATUS wb_lookupname_recv(struct tevent_req *req, struct dom_sid *sid,
517                             enum lsa_SidType *type);
518
519 struct tevent_req *winbindd_lookupname_send(TALLOC_CTX *mem_ctx,
520                                             struct tevent_context *ev,
521                                             struct winbindd_cli_state *cli,
522                                             struct winbindd_request *request);
523 NTSTATUS winbindd_lookupname_recv(struct tevent_req *req,
524                                   struct winbindd_response *response);
525
526 struct tevent_req *winbindd_sid_to_uid_send(TALLOC_CTX *mem_ctx,
527                                             struct tevent_context *ev,
528                                             struct winbindd_cli_state *cli,
529                                             struct winbindd_request *request);
530 NTSTATUS winbindd_sid_to_uid_recv(struct tevent_req *req,
531                                   struct winbindd_response *response);
532
533 struct tevent_req *winbindd_sid_to_gid_send(TALLOC_CTX *mem_ctx,
534                                             struct tevent_context *ev,
535                                             struct winbindd_cli_state *cli,
536                                             struct winbindd_request *request);
537 NTSTATUS winbindd_sid_to_gid_recv(struct tevent_req *req,
538                                   struct winbindd_response *response);
539
540 struct tevent_req *wb_uid2sid_send(TALLOC_CTX *mem_ctx,
541                                    struct tevent_context *ev,
542                                    uid_t uid);
543 NTSTATUS wb_uid2sid_recv(struct tevent_req *req, struct dom_sid *sid);
544
545 struct tevent_req *winbindd_uid_to_sid_send(TALLOC_CTX *mem_ctx,
546                                             struct tevent_context *ev,
547                                             struct winbindd_cli_state *cli,
548                                             struct winbindd_request *request);
549 NTSTATUS winbindd_uid_to_sid_recv(struct tevent_req *req,
550                                   struct winbindd_response *response);
551
552 struct tevent_req *wb_gid2sid_send(TALLOC_CTX *mem_ctx,
553                                    struct tevent_context *ev,
554                                    gid_t gid);
555 NTSTATUS wb_gid2sid_recv(struct tevent_req *req, struct dom_sid *sid);
556
557 struct tevent_req *winbindd_gid_to_sid_send(TALLOC_CTX *mem_ctx,
558                                             struct tevent_context *ev,
559                                             struct winbindd_cli_state *cli,
560                                             struct winbindd_request *request);
561 NTSTATUS winbindd_gid_to_sid_recv(struct tevent_req *req,
562                                   struct winbindd_response *response);
563
564 struct tevent_req *winbindd_allocate_uid_send(TALLOC_CTX *mem_ctx,
565                                               struct tevent_context *ev,
566                                               struct winbindd_cli_state *cli,
567                                               struct winbindd_request *request);
568 NTSTATUS winbindd_allocate_uid_recv(struct tevent_req *req,
569                                     struct winbindd_response *response);
570
571 struct tevent_req *winbindd_allocate_gid_send(TALLOC_CTX *mem_ctx,
572                                               struct tevent_context *ev,
573                                               struct winbindd_cli_state *cli,
574                                               struct winbindd_request *request);
575 NTSTATUS winbindd_allocate_gid_recv(struct tevent_req *req,
576                                     struct winbindd_response *response);
577
578 struct tevent_req *wb_queryuser_send(TALLOC_CTX *mem_ctx,
579                                      struct tevent_context *ev,
580                                      const struct dom_sid *user_sid);
581 NTSTATUS wb_queryuser_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
582                            struct wbint_userinfo **pinfo);
583
584 struct tevent_req *wb_getpwsid_send(TALLOC_CTX *mem_ctx,
585                                     struct tevent_context *ev,
586                                     const struct dom_sid *user_sid,
587                                     struct winbindd_pw *pw);
588 NTSTATUS wb_getpwsid_recv(struct tevent_req *req);
589
590 struct tevent_req *winbindd_getpwsid_send(TALLOC_CTX *mem_ctx,
591                                           struct tevent_context *ev,
592                                           struct winbindd_cli_state *cli,
593                                           struct winbindd_request *request);
594 NTSTATUS winbindd_getpwsid_recv(struct tevent_req *req,
595                                 struct winbindd_response *response);
596
597 struct tevent_req *winbindd_getpwnam_send(TALLOC_CTX *mem_ctx,
598                                           struct tevent_context *ev,
599                                           struct winbindd_cli_state *cli,
600                                           struct winbindd_request *request);
601 NTSTATUS winbindd_getpwnam_recv(struct tevent_req *req,
602                                 struct winbindd_response *response);
603
604 struct tevent_req *winbindd_getpwuid_send(TALLOC_CTX *mem_ctx,
605                                           struct tevent_context *ev,
606                                           struct winbindd_cli_state *cli,
607                                           struct winbindd_request *request);
608 NTSTATUS winbindd_getpwuid_recv(struct tevent_req *req,
609                                 struct winbindd_response *response);
610 struct tevent_req *wb_lookupuseraliases_send(TALLOC_CTX *mem_ctx,
611                                              struct tevent_context *ev,
612                                              struct winbindd_domain *domain,
613                                              int num_sids,
614                                              const struct dom_sid *sids);
615 NTSTATUS wb_lookupuseraliases_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
616                                    uint32_t *num_aliases, uint32_t **aliases);
617 struct tevent_req *winbindd_getsidaliases_send(TALLOC_CTX *mem_ctx,
618                                                struct tevent_context *ev,
619                                                struct winbindd_cli_state *cli,
620                                                struct winbindd_request *request);
621 NTSTATUS winbindd_getsidaliases_recv(struct tevent_req *req,
622                                      struct winbindd_response *response);
623 struct tevent_req *wb_lookupusergroups_send(TALLOC_CTX *mem_ctx,
624                                             struct tevent_context *ev,
625                                             struct winbindd_domain *domain,
626                                             const struct dom_sid *sid);
627 NTSTATUS wb_lookupusergroups_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
628                                   int *num_sids, struct dom_sid **sids);
629
630 struct tevent_req *winbindd_getuserdomgroups_send(TALLOC_CTX *mem_ctx,
631                                                   struct tevent_context *ev,
632                                                   struct winbindd_cli_state *cli,
633                                                   struct winbindd_request *request);
634 NTSTATUS winbindd_getuserdomgroups_recv(struct tevent_req *req,
635                                         struct winbindd_response *response);
636 struct tevent_req *wb_gettoken_send(TALLOC_CTX *mem_ctx,
637                                     struct tevent_context *ev,
638                                     const struct dom_sid *sid);
639 NTSTATUS wb_gettoken_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
640                           int *num_sids, struct dom_sid **sids);
641 struct tevent_req *winbindd_getgroups_send(TALLOC_CTX *mem_ctx,
642                                            struct tevent_context *ev,
643                                            struct winbindd_cli_state *cli,
644                                            struct winbindd_request *request);
645 NTSTATUS winbindd_getgroups_recv(struct tevent_req *req,
646                                  struct winbindd_response *response);
647
648 struct tevent_req *wb_seqnum_send(TALLOC_CTX *mem_ctx,
649                                   struct tevent_context *ev,
650                                   struct winbindd_domain *domain);
651 NTSTATUS wb_seqnum_recv(struct tevent_req *req, uint32_t *seqnum);
652
653 struct tevent_req *wb_seqnums_send(TALLOC_CTX *mem_ctx,
654                                    struct tevent_context *ev);
655 NTSTATUS wb_seqnums_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
656                          int *num_domains, struct winbindd_domain ***domains,
657                          NTSTATUS **stati, uint32_t **seqnums);
658
659 struct tevent_req *winbindd_show_sequence_send(TALLOC_CTX *mem_ctx,
660                                                struct tevent_context *ev,
661                                                struct winbindd_cli_state *cli,
662                                                struct winbindd_request *request);
663 NTSTATUS winbindd_show_sequence_recv(struct tevent_req *req,
664                                      struct winbindd_response *response);
665
666 struct tevent_req *wb_group_members_send(TALLOC_CTX *mem_ctx,
667                                          struct tevent_context *ev,
668                                          const struct dom_sid *sid,
669                                          enum lsa_SidType type,
670                                          int max_depth);
671 NTSTATUS wb_group_members_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
672                                struct talloc_dict **members);
673 NTSTATUS add_wbint_Principal_to_dict(TALLOC_CTX *mem_ctx,
674                                      struct dom_sid *sid,
675                                      const char **name,
676                                      enum lsa_SidType type,
677                                      struct talloc_dict *dict);
678
679 struct tevent_req *wb_getgrsid_send(TALLOC_CTX *mem_ctx,
680                                     struct tevent_context *ev,
681                                     const struct dom_sid *group_sid,
682                                     int max_nesting);
683 NTSTATUS wb_getgrsid_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
684                           const char **domname, const char **name, gid_t *gid,
685                           struct talloc_dict **members);
686
687 struct tevent_req *winbindd_getgrgid_send(TALLOC_CTX *mem_ctx,
688                                           struct tevent_context *ev,
689                                           struct winbindd_cli_state *cli,
690                                           struct winbindd_request *request);
691 NTSTATUS winbindd_getgrgid_recv(struct tevent_req *req,
692                                 struct winbindd_response *response);
693
694 struct tevent_req *winbindd_getgrnam_send(TALLOC_CTX *mem_ctx,
695                                           struct tevent_context *ev,
696                                           struct winbindd_cli_state *cli,
697                                           struct winbindd_request *request);
698 NTSTATUS winbindd_getgrnam_recv(struct tevent_req *req,
699                                 struct winbindd_response *response);
700
701 struct tevent_req *winbindd_getusersids_send(TALLOC_CTX *mem_ctx,
702                                              struct tevent_context *ev,
703                                              struct winbindd_cli_state *cli,
704                                              struct winbindd_request *request);
705 NTSTATUS winbindd_getusersids_recv(struct tevent_req *req,
706                                    struct winbindd_response *response);
707
708 struct tevent_req *winbindd_lookuprids_send(TALLOC_CTX *mem_ctx,
709                                             struct tevent_context *ev,
710                                             struct winbindd_cli_state *cli,
711                                             struct winbindd_request *request);
712 NTSTATUS winbindd_lookuprids_recv(struct tevent_req *req,
713                                   struct winbindd_response *response);
714
715 struct tevent_req *wb_query_user_list_send(TALLOC_CTX *mem_ctx,
716                                            struct tevent_context *ev,
717                                            struct winbindd_domain *domain);
718 NTSTATUS wb_query_user_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
719                                  int *num_users,
720                                  struct wbint_userinfo **users);
721
722 struct tevent_req *wb_query_group_list_send(TALLOC_CTX *mem_ctx,
723                                             struct tevent_context *ev,
724                                             struct winbindd_domain *domain);
725 NTSTATUS wb_query_group_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
726                                   int *num_users,
727                                   struct wbint_Principal **groups);
728
729
730 struct tevent_req *wb_fill_pwent_send(TALLOC_CTX *mem_ctx,
731                                       struct tevent_context *ev,
732                                       struct wbint_userinfo *info,
733                                       struct winbindd_pw *pw);
734 NTSTATUS wb_fill_pwent_recv(struct tevent_req *req);
735
736 struct tevent_req *wb_next_pwent_send(TALLOC_CTX *mem_ctx,
737                                       struct tevent_context *ev,
738                                       struct getpwent_state *gstate,
739                                       struct winbindd_pw *pw);
740 NTSTATUS wb_next_pwent_recv(struct tevent_req *req);
741
742 struct tevent_req *winbindd_setpwent_send(TALLOC_CTX *mem_ctx,
743                                           struct tevent_context *ev,
744                                           struct winbindd_cli_state *cli,
745                                           struct winbindd_request *request);
746 NTSTATUS winbindd_setpwent_recv(struct tevent_req *req,
747                                 struct winbindd_response *presp);
748
749 struct tevent_req *winbindd_getpwent_send(TALLOC_CTX *mem_ctx,
750                                           struct tevent_context *ev,
751                                           struct winbindd_cli_state *cli,
752                                           struct winbindd_request *request);
753 NTSTATUS winbindd_getpwent_recv(struct tevent_req *req,
754                                 struct winbindd_response *response);
755
756 struct tevent_req *winbindd_endpwent_send(TALLOC_CTX *mem_ctx,
757                                           struct tevent_context *ev,
758                                           struct winbindd_cli_state *cli,
759                                           struct winbindd_request *request);
760 NTSTATUS winbindd_endpwent_recv(struct tevent_req *req,
761                                 struct winbindd_response *response);
762
763 struct tevent_req *winbindd_dsgetdcname_send(TALLOC_CTX *mem_ctx,
764                                              struct tevent_context *ev,
765                                              struct winbindd_cli_state *cli,
766                                              struct winbindd_request *request);
767 NTSTATUS winbindd_dsgetdcname_recv(struct tevent_req *req,
768                                    struct winbindd_response *response);
769
770 struct tevent_req *wb_dsgetdcname_send(TALLOC_CTX *mem_ctx,
771                                        struct tevent_context *ev,
772                                        const char *domain_name,
773                                        const struct GUID *domain_guid,
774                                        const char *site_name,
775                                        uint32_t flags);
776 NTSTATUS wb_dsgetdcname_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
777                              struct netr_DsRGetDCNameInfo **pdcinfo);
778
779 struct tevent_req *winbindd_getdcname_send(TALLOC_CTX *mem_ctx,
780                                            struct tevent_context *ev,
781                                            struct winbindd_cli_state *cli,
782                                            struct winbindd_request *request);
783 NTSTATUS winbindd_getdcname_recv(struct tevent_req *req,
784                                  struct winbindd_response *response);
785
786 struct tevent_req *wb_next_grent_send(TALLOC_CTX *mem_ctx,
787                                       struct tevent_context *ev,
788                                       int max_nesting,
789                                       struct getgrent_state *gstate,
790                                       struct winbindd_gr *gr);
791 NTSTATUS wb_next_grent_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
792                             struct talloc_dict **members);
793
794 struct tevent_req *winbindd_setgrent_send(TALLOC_CTX *mem_ctx,
795                                           struct tevent_context *ev,
796                                           struct winbindd_cli_state *cli,
797                                           struct winbindd_request *request);
798 NTSTATUS winbindd_setgrent_recv(struct tevent_req *req,
799                                 struct winbindd_response *response);
800 struct tevent_req *winbindd_getgrent_send(TALLOC_CTX *mem_ctx,
801                                           struct tevent_context *ev,
802                                           struct winbindd_cli_state *cli,
803                                           struct winbindd_request *request);
804 NTSTATUS winbindd_getgrent_recv(struct tevent_req *req,
805                                 struct winbindd_response *response);
806 struct tevent_req *winbindd_endgrent_send(TALLOC_CTX *mem_ctx,
807                                           struct tevent_context *ev,
808                                           struct winbindd_cli_state *cli,
809                                           struct winbindd_request *request);
810 NTSTATUS winbindd_endgrent_recv(struct tevent_req *req,
811                                 struct winbindd_response *response);
812
813 struct tevent_req *winbindd_list_users_send(TALLOC_CTX *mem_ctx,
814                                             struct tevent_context *ev,
815                                             struct winbindd_cli_state *cli,
816                                             struct winbindd_request *request);
817 NTSTATUS winbindd_list_users_recv(struct tevent_req *req,
818                                   struct winbindd_response *response);
819
820 struct tevent_req *winbindd_list_groups_send(TALLOC_CTX *mem_ctx,
821                                              struct tevent_context *ev,
822                                              struct winbindd_cli_state *cli,
823                                              struct winbindd_request *request);
824 NTSTATUS winbindd_list_groups_recv(struct tevent_req *req,
825                                    struct winbindd_response *response);
826
827 struct tevent_req *winbindd_check_machine_acct_send(TALLOC_CTX *mem_ctx,
828                                                     struct tevent_context *ev,
829                                                     struct winbindd_cli_state *cli,
830                                                     struct winbindd_request *request);
831 NTSTATUS winbindd_check_machine_acct_recv(struct tevent_req *req,
832                                           struct winbindd_response *presp);
833
834 struct tevent_req *winbindd_ping_dc_send(TALLOC_CTX *mem_ctx,
835                                          struct tevent_context *ev,
836                                          struct winbindd_cli_state *cli,
837                                          struct winbindd_request *request);
838 NTSTATUS winbindd_ping_dc_recv(struct tevent_req *req,
839                                struct winbindd_response *presp);
840
841 struct tevent_req *winbindd_change_machine_acct_send(TALLOC_CTX *mem_ctx,
842                                                      struct tevent_context *ev,
843                                                      struct winbindd_cli_state *cli,
844                                                      struct winbindd_request *request);
845 NTSTATUS winbindd_change_machine_acct_recv(struct tevent_req *req,
846                                            struct winbindd_response *presp);
847
848 struct tevent_req *winbindd_pam_auth_send(TALLOC_CTX *mem_ctx,
849                                           struct tevent_context *ev,
850                                           struct winbindd_cli_state *cli,
851                                           struct winbindd_request *request);
852 NTSTATUS winbindd_pam_auth_recv(struct tevent_req *req,
853                                 struct winbindd_response *response);
854
855 struct tevent_req *winbindd_pam_auth_crap_send(
856         TALLOC_CTX *mem_ctx,
857         struct tevent_context *ev,
858         struct winbindd_cli_state *cli,
859         struct winbindd_request *request);
860 NTSTATUS winbindd_pam_auth_crap_recv(struct tevent_req *req,
861                                      struct winbindd_response *response);
862
863 struct tevent_req *winbindd_pam_chauthtok_send(
864         TALLOC_CTX *mem_ctx,
865         struct tevent_context *ev,
866         struct winbindd_cli_state *cli,
867         struct winbindd_request *request);
868 NTSTATUS winbindd_pam_chauthtok_recv(struct tevent_req *req,
869                                      struct winbindd_response *response);
870
871 struct tevent_req *winbindd_pam_logoff_send(TALLOC_CTX *mem_ctx,
872                                             struct tevent_context *ev,
873                                             struct winbindd_cli_state *cli,
874                                             struct winbindd_request *request);
875 NTSTATUS winbindd_pam_logoff_recv(struct tevent_req *req,
876                                   struct winbindd_response *response);
877
878 struct tevent_req *winbindd_pam_chng_pswd_auth_crap_send(
879         TALLOC_CTX *mem_ctx,
880         struct tevent_context *ev,
881         struct winbindd_cli_state *cli,
882         struct winbindd_request *request);
883 NTSTATUS winbindd_pam_chng_pswd_auth_crap_recv(
884         struct tevent_req *req,
885         struct winbindd_response *response);
886
887 struct tevent_req *wb_lookupsids_send(TALLOC_CTX *mem_ctx,
888                                       struct tevent_context *ev,
889                                       struct dom_sid *sids,
890                                       uint32_t num_sids);
891 NTSTATUS wb_lookupsids_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
892                             struct lsa_RefDomainList **domains,
893                             struct lsa_TransNameArray **names);
894
895 struct tevent_req *wb_sids2xids_send(TALLOC_CTX *mem_ctx,
896                                      struct tevent_context *ev,
897                                      const struct dom_sid *sids,
898                                      const uint32_t num_sids);
899 NTSTATUS wb_sids2xids_recv(struct tevent_req *req,
900                            struct unixid xids[], uint32_t num_xids);
901 struct tevent_req *winbindd_sids_to_xids_send(TALLOC_CTX *mem_ctx,
902                                               struct tevent_context *ev,
903                                               struct winbindd_cli_state *cli,
904                                               struct winbindd_request *request);
905 NTSTATUS winbindd_sids_to_xids_recv(struct tevent_req *req,
906                                     struct winbindd_response *response);
907 struct tevent_req *winbindd_wins_byip_send(TALLOC_CTX *mem_ctx,
908                                            struct tevent_context *ev,
909                                            struct winbindd_cli_state *cli,
910                                            struct winbindd_request *request);
911 NTSTATUS winbindd_wins_byip_recv(struct tevent_req *req,
912                                  struct winbindd_response *presp);
913 struct tevent_req *winbindd_wins_byname_send(TALLOC_CTX *mem_ctx,
914                                              struct tevent_context *ev,
915                                              struct winbindd_cli_state *cli,
916                                              struct winbindd_request *request);
917 NTSTATUS winbindd_wins_byname_recv(struct tevent_req *req,
918                                    struct winbindd_response *presp);
919
920
921 /* The following definitions come from winbindd/winbindd_samr.c  */
922
923 NTSTATUS open_internal_samr_conn(TALLOC_CTX *mem_ctx,
924                                  struct winbindd_domain *domain,
925                                  struct rpc_pipe_client **samr_pipe,
926                                  struct policy_handle *samr_domain_hnd);
927 NTSTATUS open_internal_lsa_conn(TALLOC_CTX *mem_ctx,
928                                 struct rpc_pipe_client **lsa_pipe,
929                                 struct policy_handle *lsa_hnd);
930
931 /* The following definitions come from winbindd/winbindd_ads.c  */
932 ADS_STATUS ads_idmap_cached_connection(ADS_STRUCT **adsp, const char *dom_name);
933
934 /* The following definitions come from winbindd/winbindd_irpc.c  */
935 NTSTATUS wb_irpc_register(void);
936
937 /* The following definitions come from winbindd/winbindd_reconnect.c  */
938 bool reconnect_need_retry(NTSTATUS status, struct winbindd_domain *domain);
939
940 #endif /*  _WINBINDD_PROTO_H_  */