s3:winbind: Add a lower-cost alternative to wbinfo -t: wbinfo --ping-dc
[obnox/samba/samba-obnox.git] / source3 / winbindd / winbindd_proto.h
1 /*
2  * Unix SMB/CIFS implementation.
3  * collected prototypes header
4  *
5  * frozen from "make proto" in May 2008
6  *
7  * Copyright (C) Michael Adam 2008
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, see <http://www.gnu.org/licenses/>.
21  */
22
23 #ifndef _WINBINDD_PROTO_H_
24 #define _WINBINDD_PROTO_H_
25
26
27 /* The following definitions come from auth/token_util.c  */
28
29 bool nt_token_check_sid ( const DOM_SID *sid, const NT_USER_TOKEN *token );
30 bool nt_token_check_domain_rid( NT_USER_TOKEN *token, uint32 rid );
31 NT_USER_TOKEN *get_root_nt_token( void );
32 NTSTATUS add_aliases(const DOM_SID *domain_sid,
33                      struct nt_user_token *token);
34 struct nt_user_token *create_local_nt_token(TALLOC_CTX *mem_ctx,
35                                             const DOM_SID *user_sid,
36                                             bool is_guest,
37                                             int num_groupsids,
38                                             const DOM_SID *groupsids);
39 void debug_nt_user_token(int dbg_class, int dbg_lev, NT_USER_TOKEN *token);
40 void debug_unix_user_token(int dbg_class, int dbg_lev, uid_t uid, gid_t gid,
41                            int n_groups, gid_t *groups);
42
43 /* The following definitions come from smbd/connection.c  */
44
45 bool yield_connection(connection_struct *conn, const char *name);
46 int count_current_connections( const char *sharename, bool clear  );
47 int count_all_current_connections(void);
48 bool claim_connection(connection_struct *conn, const char *name,
49                       uint32 msg_flags);
50 bool register_message_flags(bool doreg, uint32 msg_flags);
51
52 /* The following definitions come from winbindd/winbindd.c  */
53
54 struct event_context *winbind_event_context(void);
55 struct messaging_context *winbind_messaging_context(void);
56 void request_error(struct winbindd_cli_state *state);
57 void request_ok(struct winbindd_cli_state *state);
58 bool winbindd_setup_sig_term_handler(bool parent);
59 bool winbindd_setup_sig_hup_handler(const char *lfile);
60 bool winbindd_use_idmap_cache(void);
61 bool winbindd_use_cache(void);
62 int main(int argc, char **argv, char **envp);
63
64 /* The following definitions come from winbindd/winbindd_ads.c  */
65
66 /* The following definitions come from winbindd/winbindd_rpc.c  */
67
68 NTSTATUS winbindd_lookup_sids(TALLOC_CTX *mem_ctx,
69                               struct winbindd_domain *domain,
70                               uint32_t num_sids,
71                               const struct dom_sid *sids,
72                               char ***domains,
73                               char ***names,
74                               enum lsa_SidType **types);
75 NTSTATUS winbindd_lookup_names(TALLOC_CTX *mem_ctx,
76                                struct winbindd_domain *domain,
77                                uint32_t num_names,
78                                const char **names,
79                                const char ***domains,
80                                struct dom_sid **sids,
81                                enum lsa_SidType **types);
82
83 /* The following definitions come from winbindd/winbindd_async.c  */
84
85 bool print_sidlist(TALLOC_CTX *mem_ctx, const DOM_SID *sids,
86                    size_t num_sids, char **result, ssize_t *len);
87 bool parse_sidlist(TALLOC_CTX *mem_ctx, const char *sidstr,
88                    DOM_SID **sids, size_t *num_sids);
89
90 /* The following definitions come from winbindd/winbindd_cache.c  */
91
92 void winbindd_check_cache_size(time_t t);
93 struct cache_entry *centry_start(struct winbindd_domain *domain, NTSTATUS status);
94 NTSTATUS wcache_cached_creds_exist(struct winbindd_domain *domain, const DOM_SID *sid);
95 NTSTATUS wcache_get_creds(struct winbindd_domain *domain, 
96                           TALLOC_CTX *mem_ctx, 
97                           const DOM_SID *sid,
98                           const uint8 **cached_nt_pass,
99                           const uint8 **cached_salt);
100 NTSTATUS wcache_save_creds(struct winbindd_domain *domain, 
101                            TALLOC_CTX *mem_ctx, 
102                            const DOM_SID *sid, 
103                            const uint8 nt_pass[NT_HASH_LEN]);
104 void wcache_invalidate_samlogon(struct winbindd_domain *domain, 
105                                 struct netr_SamInfo3 *info3);
106 bool wcache_invalidate_cache(void);
107 bool init_wcache(void);
108 bool initialize_winbindd_cache(void);
109 void close_winbindd_cache(void);
110 NTSTATUS wcache_sid_to_name(struct winbindd_domain *domain,
111                             const struct dom_sid *sid,
112                             TALLOC_CTX *mem_ctx,
113                             char **domain_name,
114                             char **name,
115                             enum lsa_SidType *type);
116 NTSTATUS wcache_lookup_groupmem(struct winbindd_domain *domain,
117                                 TALLOC_CTX *mem_ctx,
118                                 const struct dom_sid *group_sid,
119                                 uint32_t *num_names,
120                                 struct dom_sid **sid_mem, char ***names,
121                                 uint32_t **name_types);
122 bool lookup_cached_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
123                        char **domain_name, char **name,
124                        enum lsa_SidType *type);
125 bool lookup_cached_name(TALLOC_CTX *mem_ctx,
126                         const char *domain_name,
127                         const char *name,
128                         DOM_SID *sid,
129                         enum lsa_SidType *type);
130 void cache_name2sid(struct winbindd_domain *domain, 
131                     const char *domain_name, const char *name,
132                     enum lsa_SidType type, const DOM_SID *sid);
133 NTSTATUS wcache_name_to_sid(struct winbindd_domain *domain,
134                             const char *domain_name,
135                             const char *name,
136                             struct dom_sid *sid,
137                             enum lsa_SidType *type);
138 NTSTATUS wcache_query_user(struct winbindd_domain *domain,
139                            TALLOC_CTX *mem_ctx,
140                            const struct dom_sid *user_sid,
141                            struct wbint_userinfo *info);
142 NTSTATUS wcache_lookup_useraliases(struct winbindd_domain *domain,
143                                    TALLOC_CTX *mem_ctx,
144                                    uint32 num_sids, const DOM_SID *sids,
145                                    uint32 *pnum_aliases, uint32 **paliases);
146 NTSTATUS wcache_lookup_usergroups(struct winbindd_domain *domain,
147                                   TALLOC_CTX *mem_ctx,
148                                   const struct dom_sid *user_sid,
149                                   uint32_t *pnum_sids,
150                                   struct dom_sid **psids);
151
152 void wcache_flush_cache(void);
153 NTSTATUS wcache_count_cached_creds(struct winbindd_domain *domain, int *count);
154 NTSTATUS wcache_remove_oldest_cached_creds(struct winbindd_domain *domain, const DOM_SID *sid) ;
155 bool set_global_winbindd_state_offline(void);
156 void set_global_winbindd_state_online(void);
157 bool get_global_winbindd_state_offline(void);
158 int winbindd_validate_cache(void);
159 int winbindd_validate_cache_nobackup(void);
160 bool winbindd_cache_validate_and_initialize(void);
161 bool wcache_tdc_fetch_list( struct winbindd_tdc_domain **domains, size_t *num_domains );
162 bool wcache_tdc_add_domain( struct winbindd_domain *domain );
163 struct winbindd_tdc_domain * wcache_tdc_fetch_domain( TALLOC_CTX *ctx, const char *name );
164 void wcache_tdc_clear( void );
165 NTSTATUS nss_get_info_cached( struct winbindd_domain *domain, 
166                               const DOM_SID *user_sid,
167                               TALLOC_CTX *ctx,
168                               ADS_STRUCT *ads, LDAPMessage *msg,
169                               const char **homedir, const char **shell,
170                               const char **gecos, gid_t *p_gid);
171 bool wcache_store_seqnum(const char *domain_name, uint32_t seqnum,
172                          time_t last_seq_check);
173 bool wcache_fetch_ndr(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain,
174                       uint32_t opnum, const DATA_BLOB *req, DATA_BLOB *resp);
175 void wcache_store_ndr(struct winbindd_domain *domain, uint32_t opnum,
176                       const DATA_BLOB *req, const DATA_BLOB *resp);
177
178 /* The following definitions come from winbindd/winbindd_ccache_access.c  */
179
180 void winbindd_ccache_ntlm_auth(struct winbindd_cli_state *state);
181 enum winbindd_result winbindd_dual_ccache_ntlm_auth(struct winbindd_domain *domain,
182                                                 struct winbindd_cli_state *state);
183
184 /* The following definitions come from winbindd/winbindd_cm.c  */
185
186 void set_domain_offline(struct winbindd_domain *domain);
187 void set_domain_online_request(struct winbindd_domain *domain);
188 void winbind_add_failed_connection_entry(const struct winbindd_domain *domain,
189                                         const char *server,
190                                         NTSTATUS result);
191 void invalidate_cm_connection(struct winbindd_cm_conn *conn);
192 void close_conns_after_fork(void);
193 NTSTATUS init_dc_connection(struct winbindd_domain *domain);
194 NTSTATUS cm_connect_sam(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
195                         struct rpc_pipe_client **cli, struct policy_handle *sam_handle);
196 NTSTATUS cm_connect_lsa(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
197                         struct rpc_pipe_client **cli, struct policy_handle *lsa_policy);
198 NTSTATUS cm_connect_lsa_tcp(struct winbindd_domain *domain,
199                             TALLOC_CTX *mem_ctx,
200                             struct rpc_pipe_client **cli);
201 NTSTATUS cm_connect_netlogon(struct winbindd_domain *domain,
202                              struct rpc_pipe_client **cli);
203
204 /* The following definitions come from winbindd/winbindd_cred_cache.c  */
205
206 bool ccache_entry_exists(const char *username);
207 bool ccache_entry_identical(const char *username,
208                             uid_t uid,
209                             const char *ccname);
210 void ccache_remove_all_after_fork(void);
211 void ccache_regain_all_now(void);
212 NTSTATUS add_ccache_to_list(const char *princ_name,
213                             const char *ccname,
214                             const char *service,
215                             const char *username,
216                             const char *realm,
217                             uid_t uid,
218                             time_t create_time,
219                             time_t ticket_end,
220                             time_t renew_until,
221                             bool postponed_request);
222 NTSTATUS remove_ccache(const char *username);
223 struct WINBINDD_MEMORY_CREDS *find_memory_creds_by_name(const char *username);
224 NTSTATUS winbindd_add_memory_creds(const char *username,
225                                    uid_t uid,
226                                    const char *pass);
227 NTSTATUS winbindd_delete_memory_creds(const char *username);
228 NTSTATUS winbindd_replace_memory_creds(const char *username,
229                                        const char *pass);
230
231 /* The following definitions come from winbindd/winbindd_creds.c  */
232
233 NTSTATUS winbindd_get_creds(struct winbindd_domain *domain,
234                             TALLOC_CTX *mem_ctx,
235                             const DOM_SID *sid,
236                             struct netr_SamInfo3 **info3,
237                             const uint8 *cached_nt_pass[NT_HASH_LEN],
238                             const uint8 *cred_salt[NT_HASH_LEN]);
239 NTSTATUS winbindd_store_creds(struct winbindd_domain *domain,
240                               TALLOC_CTX *mem_ctx, 
241                               const char *user, 
242                               const char *pass, 
243                               struct netr_SamInfo3 *info3,
244                               const DOM_SID *user_sid);
245 NTSTATUS winbindd_update_creds_by_info3(struct winbindd_domain *domain,
246                                         TALLOC_CTX *mem_ctx,
247                                         const char *user,
248                                         const char *pass,
249                                         struct netr_SamInfo3 *info3);
250 NTSTATUS winbindd_update_creds_by_sid(struct winbindd_domain *domain,
251                                       TALLOC_CTX *mem_ctx,
252                                       const DOM_SID *sid,
253                                       const char *pass);
254 NTSTATUS winbindd_update_creds_by_name(struct winbindd_domain *domain,
255                                        TALLOC_CTX *mem_ctx,
256                                        const char *user,
257                                        const char *pass);
258
259 /* The following definitions come from winbindd/winbindd_domain.c  */
260
261 void setup_domain_child(struct winbindd_domain *domain,
262                         struct winbindd_child *child);
263
264 /* The following definitions come from winbindd/winbindd_dual.c  */
265
266 struct tevent_req *wb_child_request_send(TALLOC_CTX *mem_ctx,
267                                          struct tevent_context *ev,
268                                          struct winbindd_child *child,
269                                          struct winbindd_request *request);
270 int wb_child_request_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
271                           struct winbindd_response **presponse, int *err);
272 struct tevent_req *wb_domain_request_send(TALLOC_CTX *mem_ctx,
273                                           struct tevent_context *ev,
274                                           struct winbindd_domain *domain,
275                                           struct winbindd_request *request);
276 int wb_domain_request_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
277                            struct winbindd_response **presponse, int *err);
278
279 void async_request(TALLOC_CTX *mem_ctx, struct winbindd_child *child,
280                    struct winbindd_request *request,
281                    struct winbindd_response *response,
282                    void (*continuation)(void *private_data, bool success),
283                    void *private_data);
284 void async_domain_request(TALLOC_CTX *mem_ctx,
285                           struct winbindd_domain *domain,
286                           struct winbindd_request *request,
287                           struct winbindd_response *response,
288                           void (*continuation)(void *private_data_data, bool success),
289                           void *private_data_data);
290 void sendto_child(struct winbindd_cli_state *state,
291                   struct winbindd_child *child);
292 void sendto_domain(struct winbindd_cli_state *state,
293                    struct winbindd_domain *domain);
294 void setup_child(struct winbindd_domain *domain, struct winbindd_child *child,
295                  const struct winbindd_child_dispatch_table *table,
296                  const char *logprefix,
297                  const char *logname);
298 void winbind_child_died(pid_t pid);
299 void winbindd_flush_negative_conn_cache(struct winbindd_domain *domain);
300 void winbind_msg_debug(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 void winbind_msg_offline(struct messaging_context *msg_ctx,
306                          void *private_data,
307                          uint32_t msg_type,
308                          struct server_id server_id,
309                          DATA_BLOB *data);
310 void winbind_msg_online(struct messaging_context *msg_ctx,
311                         void *private_data,
312                         uint32_t msg_type,
313                         struct server_id server_id,
314                         DATA_BLOB *data);
315 void winbind_msg_onlinestatus(struct messaging_context *msg_ctx,
316                               void *private_data,
317                               uint32_t msg_type,
318                               struct server_id server_id,
319                               DATA_BLOB *data);
320 void winbind_msg_dump_event_list(struct messaging_context *msg_ctx,
321                                  void *private_data,
322                                  uint32_t msg_type,
323                                  struct server_id server_id,
324                                  DATA_BLOB *data);
325 void winbind_msg_dump_domain_list(struct messaging_context *msg_ctx,
326                                   void *private_data,
327                                   uint32_t msg_type,
328                                   struct server_id server_id,
329                                   DATA_BLOB *data);
330 bool winbindd_reinit_after_fork(const char *logfilename);
331 struct winbindd_domain *wb_child_domain(void);
332
333 /* The following definitions come from winbindd/winbindd_group.c  */
334
335 void winbindd_getgrnam(struct winbindd_cli_state *state);
336 void winbindd_getgrgid(struct winbindd_cli_state *state);
337 void winbindd_setgrent(struct winbindd_cli_state *state);
338 void winbindd_endgrent(struct winbindd_cli_state *state);
339 void winbindd_getgrent(struct winbindd_cli_state *state);
340 void winbindd_list_groups(struct winbindd_cli_state *state);
341 void winbindd_getgroups(struct winbindd_cli_state *state);
342 void winbindd_getusersids(struct winbindd_cli_state *state);
343 void winbindd_getuserdomgroups(struct winbindd_cli_state *state);
344 void winbindd_getsidaliases(struct winbindd_cli_state *state);
345 bool fill_grent(TALLOC_CTX *mem_ctx, struct winbindd_gr *gr,
346                 const char *dom_name, const char *gr_name, gid_t unix_gid);
347 NTSTATUS winbindd_print_groupmembers(struct talloc_dict *members,
348                                      TALLOC_CTX *mem_ctx,
349                                      int *num_members, char **result);
350
351
352 /* The following definitions come from winbindd/winbindd_idmap.c  */
353
354 void init_idmap_child(void);
355 struct winbindd_child *idmap_child(void);
356
357 /* The following definitions come from winbindd/winbindd_locator.c  */
358
359 void init_locator_child(void);
360 struct winbindd_child *locator_child(void);
361
362 /* The following definitions come from winbindd/winbindd_misc.c  */
363
364 void winbindd_list_trusted_domains(struct winbindd_cli_state *state);
365 enum winbindd_result winbindd_dual_list_trusted_domains(struct winbindd_domain *domain,
366                                                         struct winbindd_cli_state *state);
367 void winbindd_show_sequence(struct winbindd_cli_state *state);
368 enum winbindd_result winbindd_dual_show_sequence(struct winbindd_domain *domain,
369                                                  struct winbindd_cli_state *state);
370 void winbindd_domain_info(struct winbindd_cli_state *state);
371 void winbindd_ping(struct winbindd_cli_state *state);
372 void winbindd_info(struct winbindd_cli_state *state);
373 void winbindd_interface_version(struct winbindd_cli_state *state);
374 void winbindd_domain_name(struct winbindd_cli_state *state);
375 void winbindd_netbios_name(struct winbindd_cli_state *state);
376 void winbindd_priv_pipe_dir(struct winbindd_cli_state *state);
377
378 /* The following definitions come from winbindd/winbindd_ndr.c  */
379
380 void ndr_print_winbindd_child(struct ndr_print *ndr,
381                               const char *name,
382                               const struct winbindd_child *r);
383 void ndr_print_winbindd_cm_conn(struct ndr_print *ndr,
384                                 const char *name,
385                                 const struct winbindd_cm_conn *r);
386 void ndr_print_winbindd_methods(struct ndr_print *ndr,
387                                 const char *name,
388                                 const struct winbindd_methods *r);
389 void ndr_print_winbindd_domain(struct ndr_print *ndr,
390                                const char *name,
391                                const struct winbindd_domain *r);
392
393 /* The following definitions come from winbindd/winbindd_pam.c  */
394
395 bool check_request_flags(uint32_t flags);
396 struct winbindd_domain *find_auth_domain(uint8_t flags,
397                                          const char *domain_name);
398 NTSTATUS check_info3_in_group(struct netr_SamInfo3 *info3,
399                               const char *group_sid);
400 NTSTATUS append_auth_data(struct winbindd_cli_state *state,
401                           struct netr_SamInfo3 *info3,
402                           const char *name_domain,
403                           const char *name_user);
404 void winbindd_pam_auth(struct winbindd_cli_state *state);
405 enum winbindd_result winbindd_dual_pam_auth(struct winbindd_domain *domain,
406                                             struct winbindd_cli_state *state) ;
407 void winbindd_pam_auth_crap(struct winbindd_cli_state *state);
408 enum winbindd_result winbindd_dual_pam_auth_crap(struct winbindd_domain *domain,
409                                                  struct winbindd_cli_state *state) ;
410 void winbindd_pam_chauthtok(struct winbindd_cli_state *state);
411 enum winbindd_result winbindd_dual_pam_chauthtok(struct winbindd_domain *contact_domain,
412                                                  struct winbindd_cli_state *state);
413 void winbindd_pam_logoff(struct winbindd_cli_state *state);
414 enum winbindd_result winbindd_dual_pam_logoff(struct winbindd_domain *domain,
415                                               struct winbindd_cli_state *state) ;
416 void winbindd_pam_chng_pswd_auth_crap(struct winbindd_cli_state *state);
417 enum winbindd_result winbindd_dual_pam_chng_pswd_auth_crap(struct winbindd_domain *domainSt, struct winbindd_cli_state *state);
418
419 /* The following definitions come from winbindd/winbindd_util.c  */
420
421 struct winbindd_domain *domain_list(void);
422 void free_domain_list(void);
423 void rescan_trusted_domains(struct tevent_context *ev, struct tevent_timer *te,
424                             struct timeval now, void *private_data);
425 enum winbindd_result winbindd_dual_init_connection(struct winbindd_domain *domain,
426                                                    struct winbindd_cli_state *state);
427 bool init_domain_list(void);
428 void check_domain_trusted( const char *name, const DOM_SID *user_sid );
429 struct winbindd_domain *find_domain_from_name_noinit(const char *domain_name);
430 struct winbindd_domain *find_domain_from_name(const char *domain_name);
431 struct winbindd_domain *find_domain_from_sid_noinit(const DOM_SID *sid);
432 struct winbindd_domain *find_domain_from_sid(const DOM_SID *sid);
433 struct winbindd_domain *find_our_domain(void);
434 struct winbindd_domain *find_root_domain(void);
435 struct winbindd_domain *find_builtin_domain(void);
436 struct winbindd_domain *find_lookup_domain_from_sid(const DOM_SID *sid);
437 struct winbindd_domain *find_lookup_domain_from_name(const char *domain_name);
438 bool winbindd_lookup_sid_by_name(TALLOC_CTX *mem_ctx,
439                                  enum winbindd_cmd orig_cmd,
440                                  struct winbindd_domain *domain, 
441                                  const char *domain_name,
442                                  const char *name, DOM_SID *sid, 
443                                  enum lsa_SidType *type);
444 bool winbindd_lookup_name_by_sid(TALLOC_CTX *mem_ctx,
445                                  struct winbindd_domain *domain,
446                                  DOM_SID *sid,
447                                  char **dom_name,
448                                  char **name,
449                                  enum lsa_SidType *type);
450 void free_getent_state(struct getent_state *state);
451 bool parse_domain_user(const char *domuser, fstring domain, fstring user);
452 bool parse_domain_user_talloc(TALLOC_CTX *mem_ctx, const char *domuser,
453                               char **domain, char **user);
454 void parse_add_domuser(void *buf, char *domuser, int *len);
455 bool canonicalize_username(fstring username_inout, fstring domain, fstring user);
456 void fill_domain_username(fstring name, const char *domain, const char *user, bool can_assume);
457 char *fill_domain_username_talloc(TALLOC_CTX *ctx,
458                                   const char *domain,
459                                   const char *user,
460                                   bool can_assume);
461 const char *get_winbind_pipe_dir(void) ;
462 char *get_winbind_priv_pipe_dir(void) ;
463 int open_winbindd_socket(void);
464 int open_winbindd_priv_socket(void);
465 struct winbindd_cli_state *winbindd_client_list(void);
466 void winbindd_add_client(struct winbindd_cli_state *cli);
467 void winbindd_remove_client(struct winbindd_cli_state *cli);
468 void winbindd_kill_all_clients(void);
469 int winbindd_num_clients(void);
470 NTSTATUS lookup_usergroups_cached(struct winbindd_domain *domain,
471                                   TALLOC_CTX *mem_ctx,
472                                   const DOM_SID *user_sid,
473                                   uint32 *p_num_groups, DOM_SID **user_sids);
474
475 NTSTATUS normalize_name_map(TALLOC_CTX *mem_ctx,
476                              struct winbindd_domain *domain,
477                              const char *name,
478                              char **normalized);
479 NTSTATUS normalize_name_unmap(TALLOC_CTX *mem_ctx,
480                               char *name,
481                               char **normalized);
482
483 NTSTATUS resolve_username_to_alias(TALLOC_CTX *mem_ctx,
484                                    struct winbindd_domain *domain,
485                                    const char *name, char **alias);
486 NTSTATUS resolve_alias_to_username(TALLOC_CTX *mem_ctx,
487                                    struct winbindd_domain *domain,
488                                    const char *alias, char **name);
489
490 bool winbindd_can_contact_domain(struct winbindd_domain *domain);
491 bool winbindd_internal_child(struct winbindd_child *child);
492 void winbindd_set_locator_kdc_envs(const struct winbindd_domain *domain);
493 void winbindd_unset_locator_kdc_env(const struct winbindd_domain *domain);
494 void winbindd_set_locator_kdc_envs(const struct winbindd_domain *domain);
495 void winbindd_unset_locator_kdc_env(const struct winbindd_domain *domain);
496 void set_auth_errors(struct winbindd_response *resp, NTSTATUS result);
497
498 /* The following definitions come from winbindd/winbindd_wins.c  */
499
500 void winbindd_wins_byip(struct winbindd_cli_state *state);
501 void winbindd_wins_byname(struct winbindd_cli_state *state);
502
503 struct tevent_req *wb_ping_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
504                                 struct winbindd_cli_state *cli,
505                                 struct winbindd_request *request);
506 NTSTATUS wb_ping_recv(struct tevent_req *req,
507                       struct winbindd_response *resp);
508
509 enum winbindd_result winbindd_dual_ping(struct winbindd_domain *domain,
510                                         struct winbindd_cli_state *state);
511
512 struct rpc_pipe_client *wbint_rpccli_create(TALLOC_CTX *mem_ctx,
513                                             struct winbindd_domain *domain,
514                                             struct winbindd_child *child);
515 enum winbindd_result winbindd_dual_ndrcmd(struct winbindd_domain *domain,
516                                           struct winbindd_cli_state *state);
517
518 struct tevent_req *wb_lookupsid_send(TALLOC_CTX *mem_ctx,
519                                      struct tevent_context *ev,
520                                      const struct dom_sid *sid);
521 NTSTATUS wb_lookupsid_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
522                            enum lsa_SidType *type, const char **domain,
523                            const char **name);
524
525 struct tevent_req *winbindd_lookupsid_send(TALLOC_CTX *mem_ctx,
526                                            struct tevent_context *ev,
527                                            struct winbindd_cli_state *cli,
528                                            struct winbindd_request *request);
529 NTSTATUS winbindd_lookupsid_recv(struct tevent_req *req,
530                                  struct winbindd_response *response);
531
532 struct tevent_req *wb_lookupname_send(TALLOC_CTX *mem_ctx,
533                                       struct tevent_context *ev,
534                                       const char *dom_name, const char *name,
535                                       uint32_t flags);
536 NTSTATUS wb_lookupname_recv(struct tevent_req *req, struct dom_sid *sid,
537                             enum lsa_SidType *type);
538
539 struct tevent_req *winbindd_lookupname_send(TALLOC_CTX *mem_ctx,
540                                             struct tevent_context *ev,
541                                             struct winbindd_cli_state *cli,
542                                             struct winbindd_request *request);
543 NTSTATUS winbindd_lookupname_recv(struct tevent_req *req,
544                                   struct winbindd_response *response);
545
546 struct tevent_req *wb_sid2uid_send(TALLOC_CTX *mem_ctx,
547                                    struct tevent_context *ev,
548                                    const struct dom_sid *sid);
549 NTSTATUS wb_sid2uid_recv(struct tevent_req *req, uid_t *uid);
550
551 struct tevent_req *winbindd_sid_to_uid_send(TALLOC_CTX *mem_ctx,
552                                             struct tevent_context *ev,
553                                             struct winbindd_cli_state *cli,
554                                             struct winbindd_request *request);
555 NTSTATUS winbindd_sid_to_uid_recv(struct tevent_req *req,
556                                   struct winbindd_response *response);
557
558 struct tevent_req *wb_sid2gid_send(TALLOC_CTX *mem_ctx,
559                                    struct tevent_context *ev,
560                                    const struct dom_sid *sid);
561 NTSTATUS wb_sid2gid_recv(struct tevent_req *req, gid_t *gid);
562
563 struct tevent_req *winbindd_sid_to_gid_send(TALLOC_CTX *mem_ctx,
564                                             struct tevent_context *ev,
565                                             struct winbindd_cli_state *cli,
566                                             struct winbindd_request *request);
567 NTSTATUS winbindd_sid_to_gid_recv(struct tevent_req *req,
568                                   struct winbindd_response *response);
569
570 struct tevent_req *wb_uid2sid_send(TALLOC_CTX *mem_ctx,
571                                    struct tevent_context *ev,
572                                    uid_t uid);
573 NTSTATUS wb_uid2sid_recv(struct tevent_req *req, struct dom_sid *sid);
574
575 struct tevent_req *winbindd_uid_to_sid_send(TALLOC_CTX *mem_ctx,
576                                             struct tevent_context *ev,
577                                             struct winbindd_cli_state *cli,
578                                             struct winbindd_request *request);
579 NTSTATUS winbindd_uid_to_sid_recv(struct tevent_req *req,
580                                   struct winbindd_response *response);
581
582 struct tevent_req *wb_gid2sid_send(TALLOC_CTX *mem_ctx,
583                                    struct tevent_context *ev,
584                                    gid_t gid);
585 NTSTATUS wb_gid2sid_recv(struct tevent_req *req, struct dom_sid *sid);
586
587 struct tevent_req *winbindd_gid_to_sid_send(TALLOC_CTX *mem_ctx,
588                                             struct tevent_context *ev,
589                                             struct winbindd_cli_state *cli,
590                                             struct winbindd_request *request);
591 NTSTATUS winbindd_gid_to_sid_recv(struct tevent_req *req,
592                                   struct winbindd_response *response);
593
594 struct tevent_req *winbindd_allocate_uid_send(TALLOC_CTX *mem_ctx,
595                                               struct tevent_context *ev,
596                                               struct winbindd_cli_state *cli,
597                                               struct winbindd_request *request);
598 NTSTATUS winbindd_allocate_uid_recv(struct tevent_req *req,
599                                     struct winbindd_response *response);
600
601 struct tevent_req *winbindd_allocate_gid_send(TALLOC_CTX *mem_ctx,
602                                               struct tevent_context *ev,
603                                               struct winbindd_cli_state *cli,
604                                               struct winbindd_request *request);
605 NTSTATUS winbindd_allocate_gid_recv(struct tevent_req *req,
606                                     struct winbindd_response *response);
607
608 struct tevent_req *wb_queryuser_send(TALLOC_CTX *mem_ctx,
609                                      struct tevent_context *ev,
610                                      const struct dom_sid *user_sid);
611 NTSTATUS wb_queryuser_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
612                            struct wbint_userinfo **pinfo);
613
614 struct tevent_req *wb_getpwsid_send(TALLOC_CTX *mem_ctx,
615                                     struct tevent_context *ev,
616                                     const struct dom_sid *user_sid,
617                                     struct winbindd_pw *pw);
618 NTSTATUS wb_getpwsid_recv(struct tevent_req *req);
619
620 struct tevent_req *winbindd_getpwsid_send(TALLOC_CTX *mem_ctx,
621                                           struct tevent_context *ev,
622                                           struct winbindd_cli_state *cli,
623                                           struct winbindd_request *request);
624 NTSTATUS winbindd_getpwsid_recv(struct tevent_req *req,
625                                 struct winbindd_response *response);
626
627 struct tevent_req *winbindd_getpwnam_send(TALLOC_CTX *mem_ctx,
628                                           struct tevent_context *ev,
629                                           struct winbindd_cli_state *cli,
630                                           struct winbindd_request *request);
631 NTSTATUS winbindd_getpwnam_recv(struct tevent_req *req,
632                                 struct winbindd_response *response);
633
634 struct tevent_req *winbindd_getpwuid_send(TALLOC_CTX *mem_ctx,
635                                           struct tevent_context *ev,
636                                           struct winbindd_cli_state *cli,
637                                           struct winbindd_request *request);
638 NTSTATUS winbindd_getpwuid_recv(struct tevent_req *req,
639                                 struct winbindd_response *response);
640 struct tevent_req *wb_lookupuseraliases_send(TALLOC_CTX *mem_ctx,
641                                              struct tevent_context *ev,
642                                              struct winbindd_domain *domain,
643                                              int num_sids,
644                                              const struct dom_sid *sids);
645 NTSTATUS wb_lookupuseraliases_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
646                                    uint32_t *num_aliases, uint32_t **aliases);
647 struct tevent_req *winbindd_getsidaliases_send(TALLOC_CTX *mem_ctx,
648                                                struct tevent_context *ev,
649                                                struct winbindd_cli_state *cli,
650                                                struct winbindd_request *request);
651 NTSTATUS winbindd_getsidaliases_recv(struct tevent_req *req,
652                                      struct winbindd_response *response);
653 struct tevent_req *wb_lookupusergroups_send(TALLOC_CTX *mem_ctx,
654                                             struct tevent_context *ev,
655                                             struct winbindd_domain *domain,
656                                             const struct dom_sid *sid);
657 NTSTATUS wb_lookupusergroups_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
658                                   int *num_sids, struct dom_sid **sids);
659
660 struct tevent_req *winbindd_getuserdomgroups_send(TALLOC_CTX *mem_ctx,
661                                                   struct tevent_context *ev,
662                                                   struct winbindd_cli_state *cli,
663                                                   struct winbindd_request *request);
664 NTSTATUS winbindd_getuserdomgroups_recv(struct tevent_req *req,
665                                         struct winbindd_response *response);
666 struct tevent_req *wb_gettoken_send(TALLOC_CTX *mem_ctx,
667                                     struct tevent_context *ev,
668                                     const struct dom_sid *sid);
669 NTSTATUS wb_gettoken_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
670                           int *num_sids, struct dom_sid **sids);
671 struct tevent_req *winbindd_getgroups_send(TALLOC_CTX *mem_ctx,
672                                            struct tevent_context *ev,
673                                            struct winbindd_cli_state *cli,
674                                            struct winbindd_request *request);
675 NTSTATUS winbindd_getgroups_recv(struct tevent_req *req,
676                                  struct winbindd_response *response);
677
678 struct tevent_req *wb_seqnum_send(TALLOC_CTX *mem_ctx,
679                                   struct tevent_context *ev,
680                                   struct winbindd_domain *domain);
681 NTSTATUS wb_seqnum_recv(struct tevent_req *req, uint32_t *seqnum);
682
683 struct tevent_req *wb_seqnums_send(TALLOC_CTX *mem_ctx,
684                                    struct tevent_context *ev);
685 NTSTATUS wb_seqnums_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
686                          int *num_domains, struct winbindd_domain ***domains,
687                          NTSTATUS **stati, uint32_t **seqnums);
688
689 struct tevent_req *winbindd_show_sequence_send(TALLOC_CTX *mem_ctx,
690                                                struct tevent_context *ev,
691                                                struct winbindd_cli_state *cli,
692                                                struct winbindd_request *request);
693 NTSTATUS winbindd_show_sequence_recv(struct tevent_req *req,
694                                      struct winbindd_response *response);
695
696 struct tevent_req *wb_group_members_send(TALLOC_CTX *mem_ctx,
697                                          struct tevent_context *ev,
698                                          const struct dom_sid *sid,
699                                          enum lsa_SidType type,
700                                          int max_depth);
701 NTSTATUS wb_group_members_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
702                                struct talloc_dict **members);
703
704 struct tevent_req *wb_getgrsid_send(TALLOC_CTX *mem_ctx,
705                                     struct tevent_context *ev,
706                                     const struct dom_sid *group_sid,
707                                     int max_nesting);
708 NTSTATUS wb_getgrsid_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
709                           const char **domname, const char **name, gid_t *gid,
710                           struct talloc_dict **members);
711
712 struct tevent_req *winbindd_getgrgid_send(TALLOC_CTX *mem_ctx,
713                                           struct tevent_context *ev,
714                                           struct winbindd_cli_state *cli,
715                                           struct winbindd_request *request);
716 NTSTATUS winbindd_getgrgid_recv(struct tevent_req *req,
717                                 struct winbindd_response *response);
718
719 struct tevent_req *winbindd_getgrnam_send(TALLOC_CTX *mem_ctx,
720                                           struct tevent_context *ev,
721                                           struct winbindd_cli_state *cli,
722                                           struct winbindd_request *request);
723 NTSTATUS winbindd_getgrnam_recv(struct tevent_req *req,
724                                 struct winbindd_response *response);
725
726 struct tevent_req *winbindd_getusersids_send(TALLOC_CTX *mem_ctx,
727                                              struct tevent_context *ev,
728                                              struct winbindd_cli_state *cli,
729                                              struct winbindd_request *request);
730 NTSTATUS winbindd_getusersids_recv(struct tevent_req *req,
731                                    struct winbindd_response *response);
732
733 struct tevent_req *winbindd_lookuprids_send(TALLOC_CTX *mem_ctx,
734                                             struct tevent_context *ev,
735                                             struct winbindd_cli_state *cli,
736                                             struct winbindd_request *request);
737 NTSTATUS winbindd_lookuprids_recv(struct tevent_req *req,
738                                   struct winbindd_response *response);
739
740 struct tevent_req *wb_query_user_list_send(TALLOC_CTX *mem_ctx,
741                                            struct tevent_context *ev,
742                                            struct winbindd_domain *domain);
743 NTSTATUS wb_query_user_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
744                                  int *num_users,
745                                  struct wbint_userinfo **users);
746
747 struct tevent_req *wb_fill_pwent_send(TALLOC_CTX *mem_ctx,
748                                       struct tevent_context *ev,
749                                       struct wbint_userinfo *info,
750                                       struct winbindd_pw *pw);
751 NTSTATUS wb_fill_pwent_recv(struct tevent_req *req);
752
753 struct tevent_req *wb_next_pwent_send(TALLOC_CTX *mem_ctx,
754                                       struct tevent_context *ev,
755                                       struct getpwent_state *gstate,
756                                       struct winbindd_pw *pw);
757 NTSTATUS wb_next_pwent_recv(struct tevent_req *req);
758
759 struct tevent_req *winbindd_setpwent_send(TALLOC_CTX *mem_ctx,
760                                           struct tevent_context *ev,
761                                           struct winbindd_cli_state *cli,
762                                           struct winbindd_request *request);
763 NTSTATUS winbindd_setpwent_recv(struct tevent_req *req,
764                                 struct winbindd_response *presp);
765
766 struct tevent_req *winbindd_getpwent_send(TALLOC_CTX *mem_ctx,
767                                           struct tevent_context *ev,
768                                           struct winbindd_cli_state *cli,
769                                           struct winbindd_request *request);
770 NTSTATUS winbindd_getpwent_recv(struct tevent_req *req,
771                                 struct winbindd_response *response);
772
773 struct tevent_req *winbindd_endpwent_send(TALLOC_CTX *mem_ctx,
774                                           struct tevent_context *ev,
775                                           struct winbindd_cli_state *cli,
776                                           struct winbindd_request *request);
777 NTSTATUS winbindd_endpwent_recv(struct tevent_req *req,
778                                 struct winbindd_response *response);
779
780 struct tevent_req *winbindd_dsgetdcname_send(TALLOC_CTX *mem_ctx,
781                                              struct tevent_context *ev,
782                                              struct winbindd_cli_state *cli,
783                                              struct winbindd_request *request);
784 NTSTATUS winbindd_dsgetdcname_recv(struct tevent_req *req,
785                                    struct winbindd_response *response);
786
787 struct tevent_req *wb_dsgetdcname_send(TALLOC_CTX *mem_ctx,
788                                        struct tevent_context *ev,
789                                        const char *domain_name,
790                                        const struct GUID *domain_guid,
791                                        const char *site_name,
792                                        uint32_t flags);
793 NTSTATUS wb_dsgetdcname_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
794                              struct netr_DsRGetDCNameInfo **pdcinfo);
795
796 struct tevent_req *winbindd_getdcname_send(TALLOC_CTX *mem_ctx,
797                                            struct tevent_context *ev,
798                                            struct winbindd_cli_state *cli,
799                                            struct winbindd_request *request);
800 NTSTATUS winbindd_getdcname_recv(struct tevent_req *req,
801                                  struct winbindd_response *response);
802
803 struct tevent_req *wb_next_grent_send(TALLOC_CTX *mem_ctx,
804                                       struct tevent_context *ev,
805                                       int max_nesting,
806                                       struct getgrent_state *gstate,
807                                       struct winbindd_gr *gr);
808 NTSTATUS wb_next_grent_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
809                             struct talloc_dict **members);
810
811 struct tevent_req *winbindd_setgrent_send(TALLOC_CTX *mem_ctx,
812                                           struct tevent_context *ev,
813                                           struct winbindd_cli_state *cli,
814                                           struct winbindd_request *request);
815 NTSTATUS winbindd_setgrent_recv(struct tevent_req *req,
816                                 struct winbindd_response *response);
817 struct tevent_req *winbindd_getgrent_send(TALLOC_CTX *mem_ctx,
818                                           struct tevent_context *ev,
819                                           struct winbindd_cli_state *cli,
820                                           struct winbindd_request *request);
821 NTSTATUS winbindd_getgrent_recv(struct tevent_req *req,
822                                 struct winbindd_response *response);
823 struct tevent_req *winbindd_endgrent_send(TALLOC_CTX *mem_ctx,
824                                           struct tevent_context *ev,
825                                           struct winbindd_cli_state *cli,
826                                           struct winbindd_request *request);
827 NTSTATUS winbindd_endgrent_recv(struct tevent_req *req,
828                                 struct winbindd_response *response);
829
830 struct tevent_req *winbindd_list_users_send(TALLOC_CTX *mem_ctx,
831                                             struct tevent_context *ev,
832                                             struct winbindd_cli_state *cli,
833                                             struct winbindd_request *request);
834 NTSTATUS winbindd_list_users_recv(struct tevent_req *req,
835                                   struct winbindd_response *response);
836
837 struct tevent_req *winbindd_list_groups_send(TALLOC_CTX *mem_ctx,
838                                              struct tevent_context *ev,
839                                              struct winbindd_cli_state *cli,
840                                              struct winbindd_request *request);
841 NTSTATUS winbindd_list_groups_recv(struct tevent_req *req,
842                                    struct winbindd_response *response);
843
844 struct tevent_req *winbindd_check_machine_acct_send(TALLOC_CTX *mem_ctx,
845                                                     struct tevent_context *ev,
846                                                     struct winbindd_cli_state *cli,
847                                                     struct winbindd_request *request);
848 NTSTATUS winbindd_check_machine_acct_recv(struct tevent_req *req,
849                                           struct winbindd_response *presp);
850
851 struct tevent_req *winbindd_ping_dc_send(TALLOC_CTX *mem_ctx,
852                                          struct tevent_context *ev,
853                                          struct winbindd_cli_state *cli,
854                                          struct winbindd_request *request);
855 NTSTATUS winbindd_ping_dc_recv(struct tevent_req *req,
856                                struct winbindd_response *presp);
857
858 struct tevent_req *winbindd_change_machine_acct_send(TALLOC_CTX *mem_ctx,
859                                                      struct tevent_context *ev,
860                                                      struct winbindd_cli_state *cli,
861                                                      struct winbindd_request *request);
862 NTSTATUS winbindd_change_machine_acct_recv(struct tevent_req *req,
863                                            struct winbindd_response *presp);
864
865 struct tevent_req *winbindd_set_mapping_send(TALLOC_CTX *mem_ctx,
866                                              struct tevent_context *ev,
867                                              struct winbindd_cli_state *cli,
868                                              struct winbindd_request *request);
869 NTSTATUS winbindd_set_mapping_recv(struct tevent_req *req,
870                                    struct winbindd_response *response);
871
872 struct tevent_req *winbindd_remove_mapping_send(TALLOC_CTX *mem_ctx,
873                                                 struct tevent_context *ev,
874                                                 struct winbindd_cli_state *cli,
875                                                 struct winbindd_request *request);
876 NTSTATUS winbindd_remove_mapping_recv(struct tevent_req *req,
877                                       struct winbindd_response *response);
878
879 struct tevent_req *winbindd_set_hwm_send(TALLOC_CTX *mem_ctx,
880                                          struct tevent_context *ev,
881                                          struct winbindd_cli_state *cli,
882                                          struct winbindd_request *request);
883 NTSTATUS winbindd_set_hwm_recv(struct tevent_req *req,
884                                struct winbindd_response *response);
885
886 #endif /*  _WINBINDD_PROTO_H_  */