5cc90f2ab0247156674ee051d0d33417d18a93b9
[samba.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 /* The following definitions come from winbindd/winbindd.c  */
27 struct messaging_context *winbind_messaging_context(void);
28 void request_error(struct winbindd_cli_state *state);
29 void request_ok(struct winbindd_cli_state *state);
30 bool winbindd_setup_sig_term_handler(bool parent);
31 bool winbindd_setup_stdin_handler(bool parent, bool foreground);
32 bool winbindd_setup_sig_hup_handler(const char *lfile);
33 bool winbindd_use_idmap_cache(void);
34 bool winbindd_use_cache(void);
35 void winbindd_register_handlers(bool foreground);
36 const char *get_winbind_pipe_dir(void);
37 char *get_winbind_priv_pipe_dir(void);
38 int main(int argc, char **argv, char **envp);
39
40 /* The following definitions come from winbindd/winbindd_ads.c  */
41
42 /* The following definitions come from winbindd/winbindd_rpc.c  */
43
44 NTSTATUS winbindd_lookup_sids(TALLOC_CTX *mem_ctx,
45                               struct winbindd_domain *domain,
46                               uint32_t num_sids,
47                               const struct dom_sid *sids,
48                               char ***domains,
49                               char ***names,
50                               enum lsa_SidType **types);
51 NTSTATUS rpc_lookup_sids(TALLOC_CTX *mem_ctx,
52                          struct winbindd_domain *domain,
53                          struct lsa_SidArray *sids,
54                          struct lsa_RefDomainList **pdomains,
55                          struct lsa_TransNameArray **pnames);
56
57 /* The following definitions come from winbindd/winbindd_cache.c  */
58
59 struct cache_entry *centry_start(struct winbindd_domain *domain, NTSTATUS status);
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
155 void set_domain_offline(struct winbindd_domain *domain);
156 void set_domain_online_request(struct winbindd_domain *domain);
157 void invalidate_cm_connection(struct winbindd_cm_conn *conn);
158 void close_conns_after_fork(void);
159 NTSTATUS init_dc_connection(struct winbindd_domain *domain);
160 NTSTATUS cm_connect_sam(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
161                         struct rpc_pipe_client **cli, struct policy_handle *sam_handle);
162 NTSTATUS cm_connect_lsa(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
163                         struct rpc_pipe_client **cli, struct policy_handle *lsa_policy);
164 NTSTATUS cm_connect_lsa_tcp(struct winbindd_domain *domain,
165                             TALLOC_CTX *mem_ctx,
166                             struct rpc_pipe_client **cli);
167 NTSTATUS cm_connect_netlogon(struct winbindd_domain *domain,
168                              struct rpc_pipe_client **cli);
169 bool fetch_current_dc_from_gencache(TALLOC_CTX *mem_ctx,
170                                     const char *domain_name,
171                                     char **p_dc_name, char **p_dc_ip);
172
173 /* The following definitions come from winbindd/winbindd_cred_cache.c  */
174
175 bool ccache_entry_exists(const char *username);
176 bool ccache_entry_identical(const char *username,
177                             uid_t uid,
178                             const char *ccname);
179 void ccache_remove_all_after_fork(void);
180 void ccache_regain_all_now(void);
181 NTSTATUS add_ccache_to_list(const char *princ_name,
182                             const char *ccname,
183                             const char *service,
184                             const char *username,
185                             const char *password,
186                             const char *realm,
187                             uid_t uid,
188                             time_t create_time,
189                             time_t ticket_end,
190                             time_t renew_until,
191                             bool postponed_request);
192 NTSTATUS remove_ccache(const char *username);
193 struct WINBINDD_MEMORY_CREDS *find_memory_creds_by_name(const char *username);
194 NTSTATUS winbindd_add_memory_creds(const char *username,
195                                    uid_t uid,
196                                    const char *pass);
197 NTSTATUS winbindd_delete_memory_creds(const char *username);
198 NTSTATUS winbindd_replace_memory_creds(const char *username,
199                                        const char *pass);
200
201 /* The following definitions come from winbindd/winbindd_creds.c  */
202
203 NTSTATUS winbindd_get_creds(struct winbindd_domain *domain,
204                             TALLOC_CTX *mem_ctx,
205                             const struct dom_sid *sid,
206                             struct netr_SamInfo3 **info3,
207                             const uint8 *cached_nt_pass[NT_HASH_LEN],
208                             const uint8 *cred_salt[NT_HASH_LEN]);
209 NTSTATUS winbindd_store_creds(struct winbindd_domain *domain,
210                               const char *user, 
211                               const char *pass, 
212                               struct netr_SamInfo3 *info3);
213 NTSTATUS winbindd_update_creds_by_info3(struct winbindd_domain *domain,
214                                         const char *user,
215                                         const char *pass,
216                                         struct netr_SamInfo3 *info3);
217 NTSTATUS winbindd_update_creds_by_name(struct winbindd_domain *domain,
218                                        const char *user,
219                                        const char *pass);
220
221 /* The following definitions come from winbindd/winbindd_domain.c  */
222
223 void setup_domain_child(struct winbindd_domain *domain);
224
225 /* The following definitions come from winbindd/winbindd_dual.c  */
226
227 struct dcerpc_binding_handle *dom_child_handle(struct winbindd_domain *domain);
228 struct winbindd_child *choose_domain_child(struct winbindd_domain *domain);
229
230 struct tevent_req *wb_child_request_send(TALLOC_CTX *mem_ctx,
231                                          struct tevent_context *ev,
232                                          struct winbindd_child *child,
233                                          struct winbindd_request *request);
234 int wb_child_request_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
235                           struct winbindd_response **presponse, int *err);
236 struct tevent_req *wb_domain_request_send(TALLOC_CTX *mem_ctx,
237                                           struct tevent_context *ev,
238                                           struct winbindd_domain *domain,
239                                           struct winbindd_request *request);
240 int wb_domain_request_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
241                            struct winbindd_response **presponse, int *err);
242
243 void setup_child(struct winbindd_domain *domain, struct winbindd_child *child,
244                  const struct winbindd_child_dispatch_table *table,
245                  const char *logprefix,
246                  const char *logname);
247 void winbind_child_died(pid_t pid);
248 void winbindd_flush_negative_conn_cache(struct winbindd_domain *domain);
249 void winbind_msg_debug(struct messaging_context *msg_ctx,
250                          void *private_data,
251                          uint32_t msg_type,
252                          struct server_id server_id,
253                          DATA_BLOB *data);
254 void winbind_msg_offline(struct messaging_context *msg_ctx,
255                          void *private_data,
256                          uint32_t msg_type,
257                          struct server_id server_id,
258                          DATA_BLOB *data);
259 void winbind_msg_online(struct messaging_context *msg_ctx,
260                         void *private_data,
261                         uint32_t msg_type,
262                         struct server_id server_id,
263                         DATA_BLOB *data);
264 void winbind_msg_onlinestatus(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_dump_event_list(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_dump_domain_list(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_ip_dropped(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_ip_dropped_parent(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 NTSTATUS winbindd_reinit_after_fork(const struct winbindd_child *myself,
290                                     const char *logfilename);
291 struct winbindd_domain *wb_child_domain(void);
292
293 /* The following definitions come from winbindd/winbindd_group.c  */
294
295 void winbindd_getgrnam(struct winbindd_cli_state *state);
296 void winbindd_getgrgid(struct winbindd_cli_state *state);
297 void winbindd_setgrent(struct winbindd_cli_state *state);
298 void winbindd_endgrent(struct winbindd_cli_state *state);
299 void winbindd_getgrent(struct winbindd_cli_state *state);
300 void winbindd_list_groups(struct winbindd_cli_state *state);
301 void winbindd_getgroups(struct winbindd_cli_state *state);
302 void winbindd_getusersids(struct winbindd_cli_state *state);
303 void winbindd_getuserdomgroups(struct winbindd_cli_state *state);
304 void winbindd_getsidaliases(struct winbindd_cli_state *state);
305 bool fill_grent(TALLOC_CTX *mem_ctx, struct winbindd_gr *gr,
306                 const char *dom_name, const char *gr_name, gid_t unix_gid);
307 NTSTATUS winbindd_print_groupmembers(struct talloc_dict *members,
308                                      TALLOC_CTX *mem_ctx,
309                                      int *num_members, char **result);
310
311
312 /* The following definitions come from winbindd/winbindd_idmap.c  */
313
314 void init_idmap_child(void);
315 struct winbindd_child *idmap_child(void);
316 struct idmap_domain *idmap_find_domain(const char *domname);
317
318 /* The following definitions come from winbindd/winbindd_locator.c  */
319
320 void init_locator_child(void);
321 struct winbindd_child *locator_child(void);
322
323 /* The following definitions come from winbindd/winbindd_misc.c  */
324
325 void winbindd_list_trusted_domains(struct winbindd_cli_state *state);
326 enum winbindd_result winbindd_dual_list_trusted_domains(struct winbindd_domain *domain,
327                                                         struct winbindd_cli_state *state);
328 void winbindd_show_sequence(struct winbindd_cli_state *state);
329 void winbindd_domain_info(struct winbindd_cli_state *state);
330 void winbindd_dc_info(struct winbindd_cli_state *state);
331 void winbindd_ping(struct winbindd_cli_state *state);
332 void winbindd_info(struct winbindd_cli_state *state);
333 void winbindd_interface_version(struct winbindd_cli_state *state);
334 void winbindd_domain_name(struct winbindd_cli_state *state);
335 void winbindd_netbios_name(struct winbindd_cli_state *state);
336 void winbindd_priv_pipe_dir(struct winbindd_cli_state *state);
337
338 /* The following definitions come from winbindd/winbindd_ndr.c  */
339 struct ndr_print;
340 void ndr_print_winbindd_child(struct ndr_print *ndr,
341                               const char *name,
342                               const struct winbindd_child *r);
343 void ndr_print_winbindd_cm_conn(struct ndr_print *ndr,
344                                 const char *name,
345                                 const struct winbindd_cm_conn *r);
346 void ndr_print_winbindd_methods(struct ndr_print *ndr,
347                                 const char *name,
348                                 const struct winbindd_methods *r);
349 void ndr_print_winbindd_domain(struct ndr_print *ndr,
350                                const char *name,
351                                const struct winbindd_domain *r);
352
353 /* The following definitions come from winbindd/winbindd_pam.c  */
354
355 bool check_request_flags(uint32_t flags);
356 NTSTATUS append_auth_data(TALLOC_CTX *mem_ctx,
357                           struct winbindd_response *resp,
358                           uint32_t request_flags,
359                           struct netr_SamInfo3 *info3,
360                           const char *name_domain,
361                           const char *name_user);
362 uid_t get_uid_from_request(struct winbindd_request *request);
363 struct winbindd_domain *find_auth_domain(uint8_t flags,
364                                          const char *domain_name);
365 enum winbindd_result winbindd_dual_pam_auth(struct winbindd_domain *domain,
366                                             struct winbindd_cli_state *state) ;
367 enum winbindd_result winbindd_dual_pam_auth_crap(struct winbindd_domain *domain,
368                                                  struct winbindd_cli_state *state) ;
369 enum winbindd_result winbindd_dual_pam_chauthtok(struct winbindd_domain *contact_domain,
370                                                  struct winbindd_cli_state *state);
371 enum winbindd_result winbindd_dual_pam_logoff(struct winbindd_domain *domain,
372                                               struct winbindd_cli_state *state) ;
373 enum winbindd_result winbindd_dual_pam_chng_pswd_auth_crap(struct winbindd_domain *domainSt, struct winbindd_cli_state *state);
374 NTSTATUS winbindd_pam_auth_pac_send(struct winbindd_cli_state *state,
375                                     struct netr_SamInfo3 **info3);
376
377 /* The following definitions come from winbindd/winbindd_util.c  */
378
379 struct winbindd_domain *domain_list(void);
380 bool domain_is_forest_root(const struct winbindd_domain *domain);
381 void rescan_trusted_domains(struct tevent_context *ev, struct tevent_timer *te,
382                             struct timeval now, void *private_data);
383 enum winbindd_result winbindd_dual_init_connection(struct winbindd_domain *domain,
384                                                    struct winbindd_cli_state *state);
385 bool init_domain_list(void);
386 struct winbindd_domain *find_domain_from_name_noinit(const char *domain_name);
387 struct winbindd_domain *find_domain_from_name(const char *domain_name);
388 struct winbindd_domain *find_domain_from_sid_noinit(const struct dom_sid *sid);
389 struct winbindd_domain *find_domain_from_sid(const struct dom_sid *sid);
390 struct winbindd_domain *find_our_domain(void);
391 struct winbindd_domain *find_root_domain(void);
392 struct winbindd_domain *find_builtin_domain(void);
393 struct winbindd_domain *find_lookup_domain_from_sid(const struct dom_sid *sid);
394 struct winbindd_domain *find_lookup_domain_from_name(const char *domain_name);
395 bool parse_domain_user(const char *domuser, fstring domain, fstring user);
396 bool parse_domain_user_talloc(TALLOC_CTX *mem_ctx, const char *domuser,
397                               char **domain, char **user);
398 bool canonicalize_username(fstring username_inout, fstring domain, fstring user);
399 void fill_domain_username(fstring name, const char *domain, const char *user, bool can_assume);
400 char *fill_domain_username_talloc(TALLOC_CTX *ctx,
401                                   const char *domain,
402                                   const char *user,
403                                   bool can_assume);
404 struct winbindd_cli_state *winbindd_client_list(void);
405 void winbindd_add_client(struct winbindd_cli_state *cli);
406 void winbindd_remove_client(struct winbindd_cli_state *cli);
407 int winbindd_num_clients(void);
408 NTSTATUS lookup_usergroups_cached(struct winbindd_domain *domain,
409                                   TALLOC_CTX *mem_ctx,
410                                   const struct dom_sid *user_sid,
411                                   uint32 *p_num_groups, struct dom_sid **user_sids);
412
413 NTSTATUS normalize_name_map(TALLOC_CTX *mem_ctx,
414                              struct winbindd_domain *domain,
415                              const char *name,
416                              char **normalized);
417 NTSTATUS normalize_name_unmap(TALLOC_CTX *mem_ctx,
418                               char *name,
419                               char **normalized);
420
421 NTSTATUS resolve_username_to_alias(TALLOC_CTX *mem_ctx,
422                                    struct winbindd_domain *domain,
423                                    const char *name, char **alias);
424 NTSTATUS resolve_alias_to_username(TALLOC_CTX *mem_ctx,
425                                    struct winbindd_domain *domain,
426                                    const char *alias, char **name);
427
428 bool winbindd_can_contact_domain(struct winbindd_domain *domain);
429 bool winbindd_internal_child(struct winbindd_child *child);
430 void winbindd_set_locator_kdc_envs(const struct winbindd_domain *domain);
431 void winbindd_unset_locator_kdc_env(const struct winbindd_domain *domain);
432 void winbindd_set_locator_kdc_envs(const struct winbindd_domain *domain);
433 void winbindd_unset_locator_kdc_env(const struct winbindd_domain *domain);
434 void set_auth_errors(struct winbindd_response *resp, NTSTATUS result);
435 bool is_domain_offline(const struct winbindd_domain *domain);
436 bool is_domain_online(const struct winbindd_domain *domain);
437 bool parse_sidlist(TALLOC_CTX *mem_ctx, const char *sidstr,
438                    struct dom_sid **sids, uint32_t *num_sids);
439
440 /* The following definitions come from winbindd/winbindd_wins.c  */
441
442 void winbindd_wins_byname(struct winbindd_cli_state *state);
443
444 struct tevent_req *wb_ping_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
445                                 struct winbindd_cli_state *cli,
446                                 struct winbindd_request *request);
447 NTSTATUS wb_ping_recv(struct tevent_req *req,
448                       struct winbindd_response *resp);
449
450 enum winbindd_result winbindd_dual_ping(struct winbindd_domain *domain,
451                                         struct winbindd_cli_state *state);
452
453 struct dcerpc_binding_handle *wbint_binding_handle(TALLOC_CTX *mem_ctx,
454                                                 struct winbindd_domain *domain,
455                                                 struct winbindd_child *child);
456 enum winbindd_result winbindd_dual_ndrcmd(struct winbindd_domain *domain,
457                                           struct winbindd_cli_state *state);
458
459 struct tevent_req *wb_lookupsid_send(TALLOC_CTX *mem_ctx,
460                                      struct tevent_context *ev,
461                                      const struct dom_sid *sid);
462 NTSTATUS wb_lookupsid_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
463                            enum lsa_SidType *type, const char **domain,
464                            const char **name);
465
466 struct tevent_req *winbindd_lookupsid_send(TALLOC_CTX *mem_ctx,
467                                            struct tevent_context *ev,
468                                            struct winbindd_cli_state *cli,
469                                            struct winbindd_request *request);
470 NTSTATUS winbindd_lookupsid_recv(struct tevent_req *req,
471                                  struct winbindd_response *response);
472
473 struct tevent_req *winbindd_lookupsids_send(TALLOC_CTX *mem_ctx,
474                                             struct tevent_context *ev,
475                                             struct winbindd_cli_state *cli,
476                                             struct winbindd_request *request);
477 NTSTATUS winbindd_lookupsids_recv(struct tevent_req *req,
478                                   struct winbindd_response *response);
479
480 struct tevent_req *wb_lookupname_send(TALLOC_CTX *mem_ctx,
481                                       struct tevent_context *ev,
482                                       const char *dom_name, const char *name,
483                                       uint32_t flags);
484 NTSTATUS wb_lookupname_recv(struct tevent_req *req, struct dom_sid *sid,
485                             enum lsa_SidType *type);
486
487 struct tevent_req *winbindd_lookupname_send(TALLOC_CTX *mem_ctx,
488                                             struct tevent_context *ev,
489                                             struct winbindd_cli_state *cli,
490                                             struct winbindd_request *request);
491 NTSTATUS winbindd_lookupname_recv(struct tevent_req *req,
492                                   struct winbindd_response *response);
493
494 struct tevent_req *wb_sid2uid_send(TALLOC_CTX *mem_ctx,
495                                    struct tevent_context *ev,
496                                    const struct dom_sid *sid);
497 NTSTATUS wb_sid2uid_recv(struct tevent_req *req, uid_t *uid);
498
499 struct tevent_req *winbindd_sid_to_uid_send(TALLOC_CTX *mem_ctx,
500                                             struct tevent_context *ev,
501                                             struct winbindd_cli_state *cli,
502                                             struct winbindd_request *request);
503 NTSTATUS winbindd_sid_to_uid_recv(struct tevent_req *req,
504                                   struct winbindd_response *response);
505
506 struct tevent_req *wb_sid2gid_send(TALLOC_CTX *mem_ctx,
507                                    struct tevent_context *ev,
508                                    const struct dom_sid *sid);
509 NTSTATUS wb_sid2gid_recv(struct tevent_req *req, gid_t *gid);
510
511 struct tevent_req *winbindd_sid_to_gid_send(TALLOC_CTX *mem_ctx,
512                                             struct tevent_context *ev,
513                                             struct winbindd_cli_state *cli,
514                                             struct winbindd_request *request);
515 NTSTATUS winbindd_sid_to_gid_recv(struct tevent_req *req,
516                                   struct winbindd_response *response);
517
518 struct tevent_req *wb_uid2sid_send(TALLOC_CTX *mem_ctx,
519                                    struct tevent_context *ev,
520                                    uid_t uid);
521 NTSTATUS wb_uid2sid_recv(struct tevent_req *req, struct dom_sid *sid);
522
523 struct tevent_req *winbindd_uid_to_sid_send(TALLOC_CTX *mem_ctx,
524                                             struct tevent_context *ev,
525                                             struct winbindd_cli_state *cli,
526                                             struct winbindd_request *request);
527 NTSTATUS winbindd_uid_to_sid_recv(struct tevent_req *req,
528                                   struct winbindd_response *response);
529
530 struct tevent_req *wb_gid2sid_send(TALLOC_CTX *mem_ctx,
531                                    struct tevent_context *ev,
532                                    gid_t gid);
533 NTSTATUS wb_gid2sid_recv(struct tevent_req *req, struct dom_sid *sid);
534
535 struct tevent_req *winbindd_gid_to_sid_send(TALLOC_CTX *mem_ctx,
536                                             struct tevent_context *ev,
537                                             struct winbindd_cli_state *cli,
538                                             struct winbindd_request *request);
539 NTSTATUS winbindd_gid_to_sid_recv(struct tevent_req *req,
540                                   struct winbindd_response *response);
541
542 struct tevent_req *winbindd_allocate_uid_send(TALLOC_CTX *mem_ctx,
543                                               struct tevent_context *ev,
544                                               struct winbindd_cli_state *cli,
545                                               struct winbindd_request *request);
546 NTSTATUS winbindd_allocate_uid_recv(struct tevent_req *req,
547                                     struct winbindd_response *response);
548
549 struct tevent_req *winbindd_allocate_gid_send(TALLOC_CTX *mem_ctx,
550                                               struct tevent_context *ev,
551                                               struct winbindd_cli_state *cli,
552                                               struct winbindd_request *request);
553 NTSTATUS winbindd_allocate_gid_recv(struct tevent_req *req,
554                                     struct winbindd_response *response);
555
556 struct tevent_req *wb_queryuser_send(TALLOC_CTX *mem_ctx,
557                                      struct tevent_context *ev,
558                                      const struct dom_sid *user_sid);
559 NTSTATUS wb_queryuser_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
560                            struct wbint_userinfo **pinfo);
561
562 struct tevent_req *wb_getpwsid_send(TALLOC_CTX *mem_ctx,
563                                     struct tevent_context *ev,
564                                     const struct dom_sid *user_sid,
565                                     struct winbindd_pw *pw);
566 NTSTATUS wb_getpwsid_recv(struct tevent_req *req);
567
568 struct tevent_req *winbindd_getpwsid_send(TALLOC_CTX *mem_ctx,
569                                           struct tevent_context *ev,
570                                           struct winbindd_cli_state *cli,
571                                           struct winbindd_request *request);
572 NTSTATUS winbindd_getpwsid_recv(struct tevent_req *req,
573                                 struct winbindd_response *response);
574
575 struct tevent_req *winbindd_getpwnam_send(TALLOC_CTX *mem_ctx,
576                                           struct tevent_context *ev,
577                                           struct winbindd_cli_state *cli,
578                                           struct winbindd_request *request);
579 NTSTATUS winbindd_getpwnam_recv(struct tevent_req *req,
580                                 struct winbindd_response *response);
581
582 struct tevent_req *winbindd_getpwuid_send(TALLOC_CTX *mem_ctx,
583                                           struct tevent_context *ev,
584                                           struct winbindd_cli_state *cli,
585                                           struct winbindd_request *request);
586 NTSTATUS winbindd_getpwuid_recv(struct tevent_req *req,
587                                 struct winbindd_response *response);
588 struct tevent_req *wb_lookupuseraliases_send(TALLOC_CTX *mem_ctx,
589                                              struct tevent_context *ev,
590                                              struct winbindd_domain *domain,
591                                              int num_sids,
592                                              const struct dom_sid *sids);
593 NTSTATUS wb_lookupuseraliases_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
594                                    uint32_t *num_aliases, uint32_t **aliases);
595 struct tevent_req *winbindd_getsidaliases_send(TALLOC_CTX *mem_ctx,
596                                                struct tevent_context *ev,
597                                                struct winbindd_cli_state *cli,
598                                                struct winbindd_request *request);
599 NTSTATUS winbindd_getsidaliases_recv(struct tevent_req *req,
600                                      struct winbindd_response *response);
601 struct tevent_req *wb_lookupusergroups_send(TALLOC_CTX *mem_ctx,
602                                             struct tevent_context *ev,
603                                             struct winbindd_domain *domain,
604                                             const struct dom_sid *sid);
605 NTSTATUS wb_lookupusergroups_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
606                                   int *num_sids, struct dom_sid **sids);
607
608 struct tevent_req *winbindd_getuserdomgroups_send(TALLOC_CTX *mem_ctx,
609                                                   struct tevent_context *ev,
610                                                   struct winbindd_cli_state *cli,
611                                                   struct winbindd_request *request);
612 NTSTATUS winbindd_getuserdomgroups_recv(struct tevent_req *req,
613                                         struct winbindd_response *response);
614 struct tevent_req *wb_gettoken_send(TALLOC_CTX *mem_ctx,
615                                     struct tevent_context *ev,
616                                     const struct dom_sid *sid);
617 NTSTATUS wb_gettoken_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
618                           int *num_sids, struct dom_sid **sids);
619 struct tevent_req *winbindd_getgroups_send(TALLOC_CTX *mem_ctx,
620                                            struct tevent_context *ev,
621                                            struct winbindd_cli_state *cli,
622                                            struct winbindd_request *request);
623 NTSTATUS winbindd_getgroups_recv(struct tevent_req *req,
624                                  struct winbindd_response *response);
625
626 struct tevent_req *wb_seqnum_send(TALLOC_CTX *mem_ctx,
627                                   struct tevent_context *ev,
628                                   struct winbindd_domain *domain);
629 NTSTATUS wb_seqnum_recv(struct tevent_req *req, uint32_t *seqnum);
630
631 struct tevent_req *wb_seqnums_send(TALLOC_CTX *mem_ctx,
632                                    struct tevent_context *ev);
633 NTSTATUS wb_seqnums_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
634                          int *num_domains, struct winbindd_domain ***domains,
635                          NTSTATUS **stati, uint32_t **seqnums);
636
637 struct tevent_req *winbindd_show_sequence_send(TALLOC_CTX *mem_ctx,
638                                                struct tevent_context *ev,
639                                                struct winbindd_cli_state *cli,
640                                                struct winbindd_request *request);
641 NTSTATUS winbindd_show_sequence_recv(struct tevent_req *req,
642                                      struct winbindd_response *response);
643
644 struct tevent_req *wb_group_members_send(TALLOC_CTX *mem_ctx,
645                                          struct tevent_context *ev,
646                                          const struct dom_sid *sid,
647                                          enum lsa_SidType type,
648                                          int max_depth);
649 NTSTATUS wb_group_members_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
650                                struct talloc_dict **members);
651
652 struct tevent_req *wb_getgrsid_send(TALLOC_CTX *mem_ctx,
653                                     struct tevent_context *ev,
654                                     const struct dom_sid *group_sid,
655                                     int max_nesting);
656 NTSTATUS wb_getgrsid_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
657                           const char **domname, const char **name, gid_t *gid,
658                           struct talloc_dict **members);
659
660 struct tevent_req *winbindd_getgrgid_send(TALLOC_CTX *mem_ctx,
661                                           struct tevent_context *ev,
662                                           struct winbindd_cli_state *cli,
663                                           struct winbindd_request *request);
664 NTSTATUS winbindd_getgrgid_recv(struct tevent_req *req,
665                                 struct winbindd_response *response);
666
667 struct tevent_req *winbindd_getgrnam_send(TALLOC_CTX *mem_ctx,
668                                           struct tevent_context *ev,
669                                           struct winbindd_cli_state *cli,
670                                           struct winbindd_request *request);
671 NTSTATUS winbindd_getgrnam_recv(struct tevent_req *req,
672                                 struct winbindd_response *response);
673
674 struct tevent_req *winbindd_getusersids_send(TALLOC_CTX *mem_ctx,
675                                              struct tevent_context *ev,
676                                              struct winbindd_cli_state *cli,
677                                              struct winbindd_request *request);
678 NTSTATUS winbindd_getusersids_recv(struct tevent_req *req,
679                                    struct winbindd_response *response);
680
681 struct tevent_req *winbindd_lookuprids_send(TALLOC_CTX *mem_ctx,
682                                             struct tevent_context *ev,
683                                             struct winbindd_cli_state *cli,
684                                             struct winbindd_request *request);
685 NTSTATUS winbindd_lookuprids_recv(struct tevent_req *req,
686                                   struct winbindd_response *response);
687
688 struct tevent_req *wb_query_user_list_send(TALLOC_CTX *mem_ctx,
689                                            struct tevent_context *ev,
690                                            struct winbindd_domain *domain);
691 NTSTATUS wb_query_user_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
692                                  int *num_users,
693                                  struct wbint_userinfo **users);
694
695 struct tevent_req *wb_fill_pwent_send(TALLOC_CTX *mem_ctx,
696                                       struct tevent_context *ev,
697                                       struct wbint_userinfo *info,
698                                       struct winbindd_pw *pw);
699 NTSTATUS wb_fill_pwent_recv(struct tevent_req *req);
700
701 struct tevent_req *wb_next_pwent_send(TALLOC_CTX *mem_ctx,
702                                       struct tevent_context *ev,
703                                       struct getpwent_state *gstate,
704                                       struct winbindd_pw *pw);
705 NTSTATUS wb_next_pwent_recv(struct tevent_req *req);
706
707 struct tevent_req *winbindd_setpwent_send(TALLOC_CTX *mem_ctx,
708                                           struct tevent_context *ev,
709                                           struct winbindd_cli_state *cli,
710                                           struct winbindd_request *request);
711 NTSTATUS winbindd_setpwent_recv(struct tevent_req *req,
712                                 struct winbindd_response *presp);
713
714 struct tevent_req *winbindd_getpwent_send(TALLOC_CTX *mem_ctx,
715                                           struct tevent_context *ev,
716                                           struct winbindd_cli_state *cli,
717                                           struct winbindd_request *request);
718 NTSTATUS winbindd_getpwent_recv(struct tevent_req *req,
719                                 struct winbindd_response *response);
720
721 struct tevent_req *winbindd_endpwent_send(TALLOC_CTX *mem_ctx,
722                                           struct tevent_context *ev,
723                                           struct winbindd_cli_state *cli,
724                                           struct winbindd_request *request);
725 NTSTATUS winbindd_endpwent_recv(struct tevent_req *req,
726                                 struct winbindd_response *response);
727
728 struct tevent_req *winbindd_dsgetdcname_send(TALLOC_CTX *mem_ctx,
729                                              struct tevent_context *ev,
730                                              struct winbindd_cli_state *cli,
731                                              struct winbindd_request *request);
732 NTSTATUS winbindd_dsgetdcname_recv(struct tevent_req *req,
733                                    struct winbindd_response *response);
734
735 struct tevent_req *wb_dsgetdcname_send(TALLOC_CTX *mem_ctx,
736                                        struct tevent_context *ev,
737                                        const char *domain_name,
738                                        const struct GUID *domain_guid,
739                                        const char *site_name,
740                                        uint32_t flags);
741 NTSTATUS wb_dsgetdcname_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
742                              struct netr_DsRGetDCNameInfo **pdcinfo);
743
744 struct tevent_req *winbindd_getdcname_send(TALLOC_CTX *mem_ctx,
745                                            struct tevent_context *ev,
746                                            struct winbindd_cli_state *cli,
747                                            struct winbindd_request *request);
748 NTSTATUS winbindd_getdcname_recv(struct tevent_req *req,
749                                  struct winbindd_response *response);
750
751 struct tevent_req *wb_next_grent_send(TALLOC_CTX *mem_ctx,
752                                       struct tevent_context *ev,
753                                       int max_nesting,
754                                       struct getgrent_state *gstate,
755                                       struct winbindd_gr *gr);
756 NTSTATUS wb_next_grent_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
757                             struct talloc_dict **members);
758
759 struct tevent_req *winbindd_setgrent_send(TALLOC_CTX *mem_ctx,
760                                           struct tevent_context *ev,
761                                           struct winbindd_cli_state *cli,
762                                           struct winbindd_request *request);
763 NTSTATUS winbindd_setgrent_recv(struct tevent_req *req,
764                                 struct winbindd_response *response);
765 struct tevent_req *winbindd_getgrent_send(TALLOC_CTX *mem_ctx,
766                                           struct tevent_context *ev,
767                                           struct winbindd_cli_state *cli,
768                                           struct winbindd_request *request);
769 NTSTATUS winbindd_getgrent_recv(struct tevent_req *req,
770                                 struct winbindd_response *response);
771 struct tevent_req *winbindd_endgrent_send(TALLOC_CTX *mem_ctx,
772                                           struct tevent_context *ev,
773                                           struct winbindd_cli_state *cli,
774                                           struct winbindd_request *request);
775 NTSTATUS winbindd_endgrent_recv(struct tevent_req *req,
776                                 struct winbindd_response *response);
777
778 struct tevent_req *winbindd_list_users_send(TALLOC_CTX *mem_ctx,
779                                             struct tevent_context *ev,
780                                             struct winbindd_cli_state *cli,
781                                             struct winbindd_request *request);
782 NTSTATUS winbindd_list_users_recv(struct tevent_req *req,
783                                   struct winbindd_response *response);
784
785 struct tevent_req *winbindd_list_groups_send(TALLOC_CTX *mem_ctx,
786                                              struct tevent_context *ev,
787                                              struct winbindd_cli_state *cli,
788                                              struct winbindd_request *request);
789 NTSTATUS winbindd_list_groups_recv(struct tevent_req *req,
790                                    struct winbindd_response *response);
791
792 struct tevent_req *winbindd_check_machine_acct_send(TALLOC_CTX *mem_ctx,
793                                                     struct tevent_context *ev,
794                                                     struct winbindd_cli_state *cli,
795                                                     struct winbindd_request *request);
796 NTSTATUS winbindd_check_machine_acct_recv(struct tevent_req *req,
797                                           struct winbindd_response *presp);
798
799 struct tevent_req *winbindd_ping_dc_send(TALLOC_CTX *mem_ctx,
800                                          struct tevent_context *ev,
801                                          struct winbindd_cli_state *cli,
802                                          struct winbindd_request *request);
803 NTSTATUS winbindd_ping_dc_recv(struct tevent_req *req,
804                                struct winbindd_response *presp);
805
806 struct tevent_req *winbindd_change_machine_acct_send(TALLOC_CTX *mem_ctx,
807                                                      struct tevent_context *ev,
808                                                      struct winbindd_cli_state *cli,
809                                                      struct winbindd_request *request);
810 NTSTATUS winbindd_change_machine_acct_recv(struct tevent_req *req,
811                                            struct winbindd_response *presp);
812
813 struct tevent_req *winbindd_pam_auth_send(TALLOC_CTX *mem_ctx,
814                                           struct tevent_context *ev,
815                                           struct winbindd_cli_state *cli,
816                                           struct winbindd_request *request);
817 NTSTATUS winbindd_pam_auth_recv(struct tevent_req *req,
818                                 struct winbindd_response *response);
819
820 struct tevent_req *winbindd_pam_auth_crap_send(
821         TALLOC_CTX *mem_ctx,
822         struct tevent_context *ev,
823         struct winbindd_cli_state *cli,
824         struct winbindd_request *request);
825 NTSTATUS winbindd_pam_auth_crap_recv(struct tevent_req *req,
826                                      struct winbindd_response *response);
827
828 struct tevent_req *winbindd_pam_chauthtok_send(
829         TALLOC_CTX *mem_ctx,
830         struct tevent_context *ev,
831         struct winbindd_cli_state *cli,
832         struct winbindd_request *request);
833 NTSTATUS winbindd_pam_chauthtok_recv(struct tevent_req *req,
834                                      struct winbindd_response *response);
835
836 struct tevent_req *winbindd_pam_logoff_send(TALLOC_CTX *mem_ctx,
837                                             struct tevent_context *ev,
838                                             struct winbindd_cli_state *cli,
839                                             struct winbindd_request *request);
840 NTSTATUS winbindd_pam_logoff_recv(struct tevent_req *req,
841                                   struct winbindd_response *response);
842
843 struct tevent_req *winbindd_pam_chng_pswd_auth_crap_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_chng_pswd_auth_crap_recv(
849         struct tevent_req *req,
850         struct winbindd_response *response);
851
852 struct tevent_req *wb_lookupsids_send(TALLOC_CTX *mem_ctx,
853                                       struct tevent_context *ev,
854                                       struct dom_sid *sids,
855                                       uint32_t num_sids);
856 NTSTATUS wb_lookupsids_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
857                             struct lsa_RefDomainList **domains,
858                             struct lsa_TransNameArray **names);
859
860 struct tevent_req *winbindd_sids_to_xids_send(TALLOC_CTX *mem_ctx,
861                                               struct tevent_context *ev,
862                                               struct winbindd_cli_state *cli,
863                                               struct winbindd_request *request);
864 NTSTATUS winbindd_sids_to_xids_recv(struct tevent_req *req,
865                                     struct winbindd_response *response);
866 struct tevent_req *winbindd_wins_byip_send(TALLOC_CTX *mem_ctx,
867                                            struct tevent_context *ev,
868                                            struct winbindd_cli_state *cli,
869                                            struct winbindd_request *request);
870 NTSTATUS winbindd_wins_byip_recv(struct tevent_req *req,
871                                  struct winbindd_response *presp);
872 struct tevent_req *winbindd_wins_byname_send(TALLOC_CTX *mem_ctx,
873                                              struct tevent_context *ev,
874                                              struct winbindd_cli_state *cli,
875                                              struct winbindd_request *request);
876 NTSTATUS winbindd_wins_byname_recv(struct tevent_req *req,
877                                    struct winbindd_response *presp);
878
879
880 /* The following definitions come from winbindd/winbindd_samr.c  */
881
882 NTSTATUS open_internal_samr_conn(TALLOC_CTX *mem_ctx,
883                                  struct winbindd_domain *domain,
884                                  struct rpc_pipe_client **samr_pipe,
885                                  struct policy_handle *samr_domain_hnd);
886
887 #endif /*  _WINBINDD_PROTO_H_  */