s3: Remove unused sendto_child()
[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
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_domain(struct winbindd_cli_state *state,
291                    struct winbindd_domain *domain);
292 void setup_child(struct winbindd_domain *domain, struct winbindd_child *child,
293                  const struct winbindd_child_dispatch_table *table,
294                  const char *logprefix,
295                  const char *logname);
296 void winbind_child_died(pid_t pid);
297 void winbindd_flush_negative_conn_cache(struct winbindd_domain *domain);
298 void winbind_msg_debug(struct messaging_context *msg_ctx,
299                          void *private_data,
300                          uint32_t msg_type,
301                          struct server_id server_id,
302                          DATA_BLOB *data);
303 void winbind_msg_offline(struct messaging_context *msg_ctx,
304                          void *private_data,
305                          uint32_t msg_type,
306                          struct server_id server_id,
307                          DATA_BLOB *data);
308 void winbind_msg_online(struct messaging_context *msg_ctx,
309                         void *private_data,
310                         uint32_t msg_type,
311                         struct server_id server_id,
312                         DATA_BLOB *data);
313 void winbind_msg_onlinestatus(struct messaging_context *msg_ctx,
314                               void *private_data,
315                               uint32_t msg_type,
316                               struct server_id server_id,
317                               DATA_BLOB *data);
318 void winbind_msg_dump_event_list(struct messaging_context *msg_ctx,
319                                  void *private_data,
320                                  uint32_t msg_type,
321                                  struct server_id server_id,
322                                  DATA_BLOB *data);
323 void winbind_msg_dump_domain_list(struct messaging_context *msg_ctx,
324                                   void *private_data,
325                                   uint32_t msg_type,
326                                   struct server_id server_id,
327                                   DATA_BLOB *data);
328 bool winbindd_reinit_after_fork(const char *logfilename);
329 struct winbindd_domain *wb_child_domain(void);
330
331 /* The following definitions come from winbindd/winbindd_group.c  */
332
333 void winbindd_getgrnam(struct winbindd_cli_state *state);
334 void winbindd_getgrgid(struct winbindd_cli_state *state);
335 void winbindd_setgrent(struct winbindd_cli_state *state);
336 void winbindd_endgrent(struct winbindd_cli_state *state);
337 void winbindd_getgrent(struct winbindd_cli_state *state);
338 void winbindd_list_groups(struct winbindd_cli_state *state);
339 void winbindd_getgroups(struct winbindd_cli_state *state);
340 void winbindd_getusersids(struct winbindd_cli_state *state);
341 void winbindd_getuserdomgroups(struct winbindd_cli_state *state);
342 void winbindd_getsidaliases(struct winbindd_cli_state *state);
343 bool fill_grent(TALLOC_CTX *mem_ctx, struct winbindd_gr *gr,
344                 const char *dom_name, const char *gr_name, gid_t unix_gid);
345 NTSTATUS winbindd_print_groupmembers(struct talloc_dict *members,
346                                      TALLOC_CTX *mem_ctx,
347                                      int *num_members, char **result);
348
349
350 /* The following definitions come from winbindd/winbindd_idmap.c  */
351
352 void init_idmap_child(void);
353 struct winbindd_child *idmap_child(void);
354
355 /* The following definitions come from winbindd/winbindd_locator.c  */
356
357 void init_locator_child(void);
358 struct winbindd_child *locator_child(void);
359
360 /* The following definitions come from winbindd/winbindd_misc.c  */
361
362 void winbindd_list_trusted_domains(struct winbindd_cli_state *state);
363 enum winbindd_result winbindd_dual_list_trusted_domains(struct winbindd_domain *domain,
364                                                         struct winbindd_cli_state *state);
365 void winbindd_show_sequence(struct winbindd_cli_state *state);
366 enum winbindd_result winbindd_dual_show_sequence(struct winbindd_domain *domain,
367                                                  struct winbindd_cli_state *state);
368 void winbindd_domain_info(struct winbindd_cli_state *state);
369 void winbindd_ping(struct winbindd_cli_state *state);
370 void winbindd_info(struct winbindd_cli_state *state);
371 void winbindd_interface_version(struct winbindd_cli_state *state);
372 void winbindd_domain_name(struct winbindd_cli_state *state);
373 void winbindd_netbios_name(struct winbindd_cli_state *state);
374 void winbindd_priv_pipe_dir(struct winbindd_cli_state *state);
375
376 /* The following definitions come from winbindd/winbindd_ndr.c  */
377
378 void ndr_print_winbindd_child(struct ndr_print *ndr,
379                               const char *name,
380                               const struct winbindd_child *r);
381 void ndr_print_winbindd_cm_conn(struct ndr_print *ndr,
382                                 const char *name,
383                                 const struct winbindd_cm_conn *r);
384 void ndr_print_winbindd_methods(struct ndr_print *ndr,
385                                 const char *name,
386                                 const struct winbindd_methods *r);
387 void ndr_print_winbindd_domain(struct ndr_print *ndr,
388                                const char *name,
389                                const struct winbindd_domain *r);
390
391 /* The following definitions come from winbindd/winbindd_pam.c  */
392
393 bool check_request_flags(uint32_t flags);
394 struct winbindd_domain *find_auth_domain(uint8_t flags,
395                                          const char *domain_name);
396 NTSTATUS check_info3_in_group(struct netr_SamInfo3 *info3,
397                               const char *group_sid);
398 NTSTATUS append_auth_data(struct winbindd_cli_state *state,
399                           struct netr_SamInfo3 *info3,
400                           const char *name_domain,
401                           const char *name_user);
402 void winbindd_pam_auth(struct winbindd_cli_state *state);
403 enum winbindd_result winbindd_dual_pam_auth(struct winbindd_domain *domain,
404                                             struct winbindd_cli_state *state) ;
405 void winbindd_pam_auth_crap(struct winbindd_cli_state *state);
406 enum winbindd_result winbindd_dual_pam_auth_crap(struct winbindd_domain *domain,
407                                                  struct winbindd_cli_state *state) ;
408 void winbindd_pam_chauthtok(struct winbindd_cli_state *state);
409 enum winbindd_result winbindd_dual_pam_chauthtok(struct winbindd_domain *contact_domain,
410                                                  struct winbindd_cli_state *state);
411 void winbindd_pam_logoff(struct winbindd_cli_state *state);
412 enum winbindd_result winbindd_dual_pam_logoff(struct winbindd_domain *domain,
413                                               struct winbindd_cli_state *state) ;
414 void winbindd_pam_chng_pswd_auth_crap(struct winbindd_cli_state *state);
415 enum winbindd_result winbindd_dual_pam_chng_pswd_auth_crap(struct winbindd_domain *domainSt, struct winbindd_cli_state *state);
416
417 /* The following definitions come from winbindd/winbindd_util.c  */
418
419 struct winbindd_domain *domain_list(void);
420 void free_domain_list(void);
421 void rescan_trusted_domains(struct tevent_context *ev, struct tevent_timer *te,
422                             struct timeval now, void *private_data);
423 enum winbindd_result winbindd_dual_init_connection(struct winbindd_domain *domain,
424                                                    struct winbindd_cli_state *state);
425 bool init_domain_list(void);
426 void check_domain_trusted( const char *name, const DOM_SID *user_sid );
427 struct winbindd_domain *find_domain_from_name_noinit(const char *domain_name);
428 struct winbindd_domain *find_domain_from_name(const char *domain_name);
429 struct winbindd_domain *find_domain_from_sid_noinit(const DOM_SID *sid);
430 struct winbindd_domain *find_domain_from_sid(const DOM_SID *sid);
431 struct winbindd_domain *find_our_domain(void);
432 struct winbindd_domain *find_root_domain(void);
433 struct winbindd_domain *find_builtin_domain(void);
434 struct winbindd_domain *find_lookup_domain_from_sid(const DOM_SID *sid);
435 struct winbindd_domain *find_lookup_domain_from_name(const char *domain_name);
436 bool winbindd_lookup_sid_by_name(TALLOC_CTX *mem_ctx,
437                                  enum winbindd_cmd orig_cmd,
438                                  struct winbindd_domain *domain, 
439                                  const char *domain_name,
440                                  const char *name, DOM_SID *sid, 
441                                  enum lsa_SidType *type);
442 bool winbindd_lookup_name_by_sid(TALLOC_CTX *mem_ctx,
443                                  struct winbindd_domain *domain,
444                                  DOM_SID *sid,
445                                  char **dom_name,
446                                  char **name,
447                                  enum lsa_SidType *type);
448 void free_getent_state(struct getent_state *state);
449 bool parse_domain_user(const char *domuser, fstring domain, fstring user);
450 bool parse_domain_user_talloc(TALLOC_CTX *mem_ctx, const char *domuser,
451                               char **domain, char **user);
452 void parse_add_domuser(void *buf, char *domuser, int *len);
453 bool canonicalize_username(fstring username_inout, fstring domain, fstring user);
454 void fill_domain_username(fstring name, const char *domain, const char *user, bool can_assume);
455 char *fill_domain_username_talloc(TALLOC_CTX *ctx,
456                                   const char *domain,
457                                   const char *user,
458                                   bool can_assume);
459 const char *get_winbind_pipe_dir(void) ;
460 char *get_winbind_priv_pipe_dir(void) ;
461 int open_winbindd_socket(void);
462 int open_winbindd_priv_socket(void);
463 struct winbindd_cli_state *winbindd_client_list(void);
464 void winbindd_add_client(struct winbindd_cli_state *cli);
465 void winbindd_remove_client(struct winbindd_cli_state *cli);
466 void winbindd_kill_all_clients(void);
467 int winbindd_num_clients(void);
468 NTSTATUS lookup_usergroups_cached(struct winbindd_domain *domain,
469                                   TALLOC_CTX *mem_ctx,
470                                   const DOM_SID *user_sid,
471                                   uint32 *p_num_groups, DOM_SID **user_sids);
472
473 NTSTATUS normalize_name_map(TALLOC_CTX *mem_ctx,
474                              struct winbindd_domain *domain,
475                              const char *name,
476                              char **normalized);
477 NTSTATUS normalize_name_unmap(TALLOC_CTX *mem_ctx,
478                               char *name,
479                               char **normalized);
480
481 NTSTATUS resolve_username_to_alias(TALLOC_CTX *mem_ctx,
482                                    struct winbindd_domain *domain,
483                                    const char *name, char **alias);
484 NTSTATUS resolve_alias_to_username(TALLOC_CTX *mem_ctx,
485                                    struct winbindd_domain *domain,
486                                    const char *alias, char **name);
487
488 bool winbindd_can_contact_domain(struct winbindd_domain *domain);
489 bool winbindd_internal_child(struct winbindd_child *child);
490 void winbindd_set_locator_kdc_envs(const struct winbindd_domain *domain);
491 void winbindd_unset_locator_kdc_env(const struct winbindd_domain *domain);
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 set_auth_errors(struct winbindd_response *resp, NTSTATUS result);
495
496 /* The following definitions come from winbindd/winbindd_wins.c  */
497
498 void winbindd_wins_byip(struct winbindd_cli_state *state);
499 void winbindd_wins_byname(struct winbindd_cli_state *state);
500
501 struct tevent_req *wb_ping_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
502                                 struct winbindd_cli_state *cli,
503                                 struct winbindd_request *request);
504 NTSTATUS wb_ping_recv(struct tevent_req *req,
505                       struct winbindd_response *resp);
506
507 enum winbindd_result winbindd_dual_ping(struct winbindd_domain *domain,
508                                         struct winbindd_cli_state *state);
509
510 struct rpc_pipe_client *wbint_rpccli_create(TALLOC_CTX *mem_ctx,
511                                             struct winbindd_domain *domain,
512                                             struct winbindd_child *child);
513 enum winbindd_result winbindd_dual_ndrcmd(struct winbindd_domain *domain,
514                                           struct winbindd_cli_state *state);
515
516 struct tevent_req *wb_lookupsid_send(TALLOC_CTX *mem_ctx,
517                                      struct tevent_context *ev,
518                                      const struct dom_sid *sid);
519 NTSTATUS wb_lookupsid_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
520                            enum lsa_SidType *type, const char **domain,
521                            const char **name);
522
523 struct tevent_req *winbindd_lookupsid_send(TALLOC_CTX *mem_ctx,
524                                            struct tevent_context *ev,
525                                            struct winbindd_cli_state *cli,
526                                            struct winbindd_request *request);
527 NTSTATUS winbindd_lookupsid_recv(struct tevent_req *req,
528                                  struct winbindd_response *response);
529
530 struct tevent_req *wb_lookupname_send(TALLOC_CTX *mem_ctx,
531                                       struct tevent_context *ev,
532                                       const char *dom_name, const char *name,
533                                       uint32_t flags);
534 NTSTATUS wb_lookupname_recv(struct tevent_req *req, struct dom_sid *sid,
535                             enum lsa_SidType *type);
536
537 struct tevent_req *winbindd_lookupname_send(TALLOC_CTX *mem_ctx,
538                                             struct tevent_context *ev,
539                                             struct winbindd_cli_state *cli,
540                                             struct winbindd_request *request);
541 NTSTATUS winbindd_lookupname_recv(struct tevent_req *req,
542                                   struct winbindd_response *response);
543
544 struct tevent_req *wb_sid2uid_send(TALLOC_CTX *mem_ctx,
545                                    struct tevent_context *ev,
546                                    const struct dom_sid *sid);
547 NTSTATUS wb_sid2uid_recv(struct tevent_req *req, uid_t *uid);
548
549 struct tevent_req *winbindd_sid_to_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_sid_to_uid_recv(struct tevent_req *req,
554                                   struct winbindd_response *response);
555
556 struct tevent_req *wb_sid2gid_send(TALLOC_CTX *mem_ctx,
557                                    struct tevent_context *ev,
558                                    const struct dom_sid *sid);
559 NTSTATUS wb_sid2gid_recv(struct tevent_req *req, gid_t *gid);
560
561 struct tevent_req *winbindd_sid_to_gid_send(TALLOC_CTX *mem_ctx,
562                                             struct tevent_context *ev,
563                                             struct winbindd_cli_state *cli,
564                                             struct winbindd_request *request);
565 NTSTATUS winbindd_sid_to_gid_recv(struct tevent_req *req,
566                                   struct winbindd_response *response);
567
568 struct tevent_req *wb_uid2sid_send(TALLOC_CTX *mem_ctx,
569                                    struct tevent_context *ev,
570                                    uid_t uid);
571 NTSTATUS wb_uid2sid_recv(struct tevent_req *req, struct dom_sid *sid);
572
573 struct tevent_req *winbindd_uid_to_sid_send(TALLOC_CTX *mem_ctx,
574                                             struct tevent_context *ev,
575                                             struct winbindd_cli_state *cli,
576                                             struct winbindd_request *request);
577 NTSTATUS winbindd_uid_to_sid_recv(struct tevent_req *req,
578                                   struct winbindd_response *response);
579
580 struct tevent_req *wb_gid2sid_send(TALLOC_CTX *mem_ctx,
581                                    struct tevent_context *ev,
582                                    gid_t gid);
583 NTSTATUS wb_gid2sid_recv(struct tevent_req *req, struct dom_sid *sid);
584
585 struct tevent_req *winbindd_gid_to_sid_send(TALLOC_CTX *mem_ctx,
586                                             struct tevent_context *ev,
587                                             struct winbindd_cli_state *cli,
588                                             struct winbindd_request *request);
589 NTSTATUS winbindd_gid_to_sid_recv(struct tevent_req *req,
590                                   struct winbindd_response *response);
591
592 struct tevent_req *winbindd_allocate_uid_send(TALLOC_CTX *mem_ctx,
593                                               struct tevent_context *ev,
594                                               struct winbindd_cli_state *cli,
595                                               struct winbindd_request *request);
596 NTSTATUS winbindd_allocate_uid_recv(struct tevent_req *req,
597                                     struct winbindd_response *response);
598
599 struct tevent_req *winbindd_allocate_gid_send(TALLOC_CTX *mem_ctx,
600                                               struct tevent_context *ev,
601                                               struct winbindd_cli_state *cli,
602                                               struct winbindd_request *request);
603 NTSTATUS winbindd_allocate_gid_recv(struct tevent_req *req,
604                                     struct winbindd_response *response);
605
606 struct tevent_req *wb_queryuser_send(TALLOC_CTX *mem_ctx,
607                                      struct tevent_context *ev,
608                                      const struct dom_sid *user_sid);
609 NTSTATUS wb_queryuser_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
610                            struct wbint_userinfo **pinfo);
611
612 struct tevent_req *wb_getpwsid_send(TALLOC_CTX *mem_ctx,
613                                     struct tevent_context *ev,
614                                     const struct dom_sid *user_sid,
615                                     struct winbindd_pw *pw);
616 NTSTATUS wb_getpwsid_recv(struct tevent_req *req);
617
618 struct tevent_req *winbindd_getpwsid_send(TALLOC_CTX *mem_ctx,
619                                           struct tevent_context *ev,
620                                           struct winbindd_cli_state *cli,
621                                           struct winbindd_request *request);
622 NTSTATUS winbindd_getpwsid_recv(struct tevent_req *req,
623                                 struct winbindd_response *response);
624
625 struct tevent_req *winbindd_getpwnam_send(TALLOC_CTX *mem_ctx,
626                                           struct tevent_context *ev,
627                                           struct winbindd_cli_state *cli,
628                                           struct winbindd_request *request);
629 NTSTATUS winbindd_getpwnam_recv(struct tevent_req *req,
630                                 struct winbindd_response *response);
631
632 struct tevent_req *winbindd_getpwuid_send(TALLOC_CTX *mem_ctx,
633                                           struct tevent_context *ev,
634                                           struct winbindd_cli_state *cli,
635                                           struct winbindd_request *request);
636 NTSTATUS winbindd_getpwuid_recv(struct tevent_req *req,
637                                 struct winbindd_response *response);
638 struct tevent_req *wb_lookupuseraliases_send(TALLOC_CTX *mem_ctx,
639                                              struct tevent_context *ev,
640                                              struct winbindd_domain *domain,
641                                              int num_sids,
642                                              const struct dom_sid *sids);
643 NTSTATUS wb_lookupuseraliases_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
644                                    uint32_t *num_aliases, uint32_t **aliases);
645 struct tevent_req *winbindd_getsidaliases_send(TALLOC_CTX *mem_ctx,
646                                                struct tevent_context *ev,
647                                                struct winbindd_cli_state *cli,
648                                                struct winbindd_request *request);
649 NTSTATUS winbindd_getsidaliases_recv(struct tevent_req *req,
650                                      struct winbindd_response *response);
651 struct tevent_req *wb_lookupusergroups_send(TALLOC_CTX *mem_ctx,
652                                             struct tevent_context *ev,
653                                             struct winbindd_domain *domain,
654                                             const struct dom_sid *sid);
655 NTSTATUS wb_lookupusergroups_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
656                                   int *num_sids, struct dom_sid **sids);
657
658 struct tevent_req *winbindd_getuserdomgroups_send(TALLOC_CTX *mem_ctx,
659                                                   struct tevent_context *ev,
660                                                   struct winbindd_cli_state *cli,
661                                                   struct winbindd_request *request);
662 NTSTATUS winbindd_getuserdomgroups_recv(struct tevent_req *req,
663                                         struct winbindd_response *response);
664 struct tevent_req *wb_gettoken_send(TALLOC_CTX *mem_ctx,
665                                     struct tevent_context *ev,
666                                     const struct dom_sid *sid);
667 NTSTATUS wb_gettoken_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
668                           int *num_sids, struct dom_sid **sids);
669 struct tevent_req *winbindd_getgroups_send(TALLOC_CTX *mem_ctx,
670                                            struct tevent_context *ev,
671                                            struct winbindd_cli_state *cli,
672                                            struct winbindd_request *request);
673 NTSTATUS winbindd_getgroups_recv(struct tevent_req *req,
674                                  struct winbindd_response *response);
675
676 struct tevent_req *wb_seqnum_send(TALLOC_CTX *mem_ctx,
677                                   struct tevent_context *ev,
678                                   struct winbindd_domain *domain);
679 NTSTATUS wb_seqnum_recv(struct tevent_req *req, uint32_t *seqnum);
680
681 struct tevent_req *wb_seqnums_send(TALLOC_CTX *mem_ctx,
682                                    struct tevent_context *ev);
683 NTSTATUS wb_seqnums_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
684                          int *num_domains, struct winbindd_domain ***domains,
685                          NTSTATUS **stati, uint32_t **seqnums);
686
687 struct tevent_req *winbindd_show_sequence_send(TALLOC_CTX *mem_ctx,
688                                                struct tevent_context *ev,
689                                                struct winbindd_cli_state *cli,
690                                                struct winbindd_request *request);
691 NTSTATUS winbindd_show_sequence_recv(struct tevent_req *req,
692                                      struct winbindd_response *response);
693
694 struct tevent_req *wb_group_members_send(TALLOC_CTX *mem_ctx,
695                                          struct tevent_context *ev,
696                                          const struct dom_sid *sid,
697                                          enum lsa_SidType type,
698                                          int max_depth);
699 NTSTATUS wb_group_members_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
700                                struct talloc_dict **members);
701
702 struct tevent_req *wb_getgrsid_send(TALLOC_CTX *mem_ctx,
703                                     struct tevent_context *ev,
704                                     const struct dom_sid *group_sid,
705                                     int max_nesting);
706 NTSTATUS wb_getgrsid_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
707                           const char **domname, const char **name, gid_t *gid,
708                           struct talloc_dict **members);
709
710 struct tevent_req *winbindd_getgrgid_send(TALLOC_CTX *mem_ctx,
711                                           struct tevent_context *ev,
712                                           struct winbindd_cli_state *cli,
713                                           struct winbindd_request *request);
714 NTSTATUS winbindd_getgrgid_recv(struct tevent_req *req,
715                                 struct winbindd_response *response);
716
717 struct tevent_req *winbindd_getgrnam_send(TALLOC_CTX *mem_ctx,
718                                           struct tevent_context *ev,
719                                           struct winbindd_cli_state *cli,
720                                           struct winbindd_request *request);
721 NTSTATUS winbindd_getgrnam_recv(struct tevent_req *req,
722                                 struct winbindd_response *response);
723
724 struct tevent_req *winbindd_getusersids_send(TALLOC_CTX *mem_ctx,
725                                              struct tevent_context *ev,
726                                              struct winbindd_cli_state *cli,
727                                              struct winbindd_request *request);
728 NTSTATUS winbindd_getusersids_recv(struct tevent_req *req,
729                                    struct winbindd_response *response);
730
731 struct tevent_req *winbindd_lookuprids_send(TALLOC_CTX *mem_ctx,
732                                             struct tevent_context *ev,
733                                             struct winbindd_cli_state *cli,
734                                             struct winbindd_request *request);
735 NTSTATUS winbindd_lookuprids_recv(struct tevent_req *req,
736                                   struct winbindd_response *response);
737
738 struct tevent_req *wb_query_user_list_send(TALLOC_CTX *mem_ctx,
739                                            struct tevent_context *ev,
740                                            struct winbindd_domain *domain);
741 NTSTATUS wb_query_user_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
742                                  int *num_users,
743                                  struct wbint_userinfo **users);
744
745 struct tevent_req *wb_fill_pwent_send(TALLOC_CTX *mem_ctx,
746                                       struct tevent_context *ev,
747                                       struct wbint_userinfo *info,
748                                       struct winbindd_pw *pw);
749 NTSTATUS wb_fill_pwent_recv(struct tevent_req *req);
750
751 struct tevent_req *wb_next_pwent_send(TALLOC_CTX *mem_ctx,
752                                       struct tevent_context *ev,
753                                       struct getpwent_state *gstate,
754                                       struct winbindd_pw *pw);
755 NTSTATUS wb_next_pwent_recv(struct tevent_req *req);
756
757 struct tevent_req *winbindd_setpwent_send(TALLOC_CTX *mem_ctx,
758                                           struct tevent_context *ev,
759                                           struct winbindd_cli_state *cli,
760                                           struct winbindd_request *request);
761 NTSTATUS winbindd_setpwent_recv(struct tevent_req *req,
762                                 struct winbindd_response *presp);
763
764 struct tevent_req *winbindd_getpwent_send(TALLOC_CTX *mem_ctx,
765                                           struct tevent_context *ev,
766                                           struct winbindd_cli_state *cli,
767                                           struct winbindd_request *request);
768 NTSTATUS winbindd_getpwent_recv(struct tevent_req *req,
769                                 struct winbindd_response *response);
770
771 struct tevent_req *winbindd_endpwent_send(TALLOC_CTX *mem_ctx,
772                                           struct tevent_context *ev,
773                                           struct winbindd_cli_state *cli,
774                                           struct winbindd_request *request);
775 NTSTATUS winbindd_endpwent_recv(struct tevent_req *req,
776                                 struct winbindd_response *response);
777
778 struct tevent_req *winbindd_dsgetdcname_send(TALLOC_CTX *mem_ctx,
779                                              struct tevent_context *ev,
780                                              struct winbindd_cli_state *cli,
781                                              struct winbindd_request *request);
782 NTSTATUS winbindd_dsgetdcname_recv(struct tevent_req *req,
783                                    struct winbindd_response *response);
784
785 struct tevent_req *wb_dsgetdcname_send(TALLOC_CTX *mem_ctx,
786                                        struct tevent_context *ev,
787                                        const char *domain_name,
788                                        const struct GUID *domain_guid,
789                                        const char *site_name,
790                                        uint32_t flags);
791 NTSTATUS wb_dsgetdcname_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
792                              struct netr_DsRGetDCNameInfo **pdcinfo);
793
794 struct tevent_req *winbindd_getdcname_send(TALLOC_CTX *mem_ctx,
795                                            struct tevent_context *ev,
796                                            struct winbindd_cli_state *cli,
797                                            struct winbindd_request *request);
798 NTSTATUS winbindd_getdcname_recv(struct tevent_req *req,
799                                  struct winbindd_response *response);
800
801 struct tevent_req *wb_next_grent_send(TALLOC_CTX *mem_ctx,
802                                       struct tevent_context *ev,
803                                       int max_nesting,
804                                       struct getgrent_state *gstate,
805                                       struct winbindd_gr *gr);
806 NTSTATUS wb_next_grent_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
807                             struct talloc_dict **members);
808
809 struct tevent_req *winbindd_setgrent_send(TALLOC_CTX *mem_ctx,
810                                           struct tevent_context *ev,
811                                           struct winbindd_cli_state *cli,
812                                           struct winbindd_request *request);
813 NTSTATUS winbindd_setgrent_recv(struct tevent_req *req,
814                                 struct winbindd_response *response);
815 struct tevent_req *winbindd_getgrent_send(TALLOC_CTX *mem_ctx,
816                                           struct tevent_context *ev,
817                                           struct winbindd_cli_state *cli,
818                                           struct winbindd_request *request);
819 NTSTATUS winbindd_getgrent_recv(struct tevent_req *req,
820                                 struct winbindd_response *response);
821 struct tevent_req *winbindd_endgrent_send(TALLOC_CTX *mem_ctx,
822                                           struct tevent_context *ev,
823                                           struct winbindd_cli_state *cli,
824                                           struct winbindd_request *request);
825 NTSTATUS winbindd_endgrent_recv(struct tevent_req *req,
826                                 struct winbindd_response *response);
827
828 struct tevent_req *winbindd_list_users_send(TALLOC_CTX *mem_ctx,
829                                             struct tevent_context *ev,
830                                             struct winbindd_cli_state *cli,
831                                             struct winbindd_request *request);
832 NTSTATUS winbindd_list_users_recv(struct tevent_req *req,
833                                   struct winbindd_response *response);
834
835 struct tevent_req *winbindd_list_groups_send(TALLOC_CTX *mem_ctx,
836                                              struct tevent_context *ev,
837                                              struct winbindd_cli_state *cli,
838                                              struct winbindd_request *request);
839 NTSTATUS winbindd_list_groups_recv(struct tevent_req *req,
840                                    struct winbindd_response *response);
841
842 struct tevent_req *winbindd_check_machine_acct_send(TALLOC_CTX *mem_ctx,
843                                                     struct tevent_context *ev,
844                                                     struct winbindd_cli_state *cli,
845                                                     struct winbindd_request *request);
846 NTSTATUS winbindd_check_machine_acct_recv(struct tevent_req *req,
847                                           struct winbindd_response *presp);
848
849 struct tevent_req *winbindd_ping_dc_send(TALLOC_CTX *mem_ctx,
850                                          struct tevent_context *ev,
851                                          struct winbindd_cli_state *cli,
852                                          struct winbindd_request *request);
853 NTSTATUS winbindd_ping_dc_recv(struct tevent_req *req,
854                                struct winbindd_response *presp);
855
856 struct tevent_req *winbindd_change_machine_acct_send(TALLOC_CTX *mem_ctx,
857                                                      struct tevent_context *ev,
858                                                      struct winbindd_cli_state *cli,
859                                                      struct winbindd_request *request);
860 NTSTATUS winbindd_change_machine_acct_recv(struct tevent_req *req,
861                                            struct winbindd_response *presp);
862
863 struct tevent_req *winbindd_set_mapping_send(TALLOC_CTX *mem_ctx,
864                                              struct tevent_context *ev,
865                                              struct winbindd_cli_state *cli,
866                                              struct winbindd_request *request);
867 NTSTATUS winbindd_set_mapping_recv(struct tevent_req *req,
868                                    struct winbindd_response *response);
869
870 struct tevent_req *winbindd_remove_mapping_send(TALLOC_CTX *mem_ctx,
871                                                 struct tevent_context *ev,
872                                                 struct winbindd_cli_state *cli,
873                                                 struct winbindd_request *request);
874 NTSTATUS winbindd_remove_mapping_recv(struct tevent_req *req,
875                                       struct winbindd_response *response);
876
877 struct tevent_req *winbindd_set_hwm_send(TALLOC_CTX *mem_ctx,
878                                          struct tevent_context *ev,
879                                          struct winbindd_cli_state *cli,
880                                          struct winbindd_request *request);
881 NTSTATUS winbindd_set_hwm_recv(struct tevent_req *req,
882                                struct winbindd_response *response);
883
884 #endif /*  _WINBINDD_PROTO_H_  */