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