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