winbindd: add find_default_route_domain()
[metze/samba/wip.git] / source3 / winbindd / winbindd_proto.h
1 /*
2  * Unix SMB/CIFS implementation.
3  * collected prototypes header
4  *
5  * frozen from "make proto" in May 2008
6  *
7  * Copyright (C) Michael Adam 2008
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, see <http://www.gnu.org/licenses/>.
21  */
22
23 #ifndef _WINBINDD_PROTO_H_
24 #define _WINBINDD_PROTO_H_
25
26 /* The following definitions come from winbindd/winbindd.c  */
27 struct imessaging_context *winbind_imessaging_context(void);
28 void request_error(struct winbindd_cli_state *state);
29 void request_ok(struct winbindd_cli_state *state);
30 bool winbindd_setup_sig_term_handler(bool parent);
31 bool winbindd_setup_stdin_handler(bool parent, bool foreground);
32 bool winbindd_setup_sig_hup_handler(const char *lfile);
33 bool winbindd_use_idmap_cache(void);
34 bool winbindd_use_cache(void);
35 char *get_winbind_priv_pipe_dir(void);
36
37 /* The following definitions come from winbindd/winbindd_ads.c  */
38
39 /* The following definitions come from winbindd/winbindd_rpc.c  */
40
41 NTSTATUS winbindd_lookup_sids(TALLOC_CTX *mem_ctx,
42                               struct winbindd_domain *domain,
43                               uint32_t num_sids,
44                               const struct dom_sid *sids,
45                               char ***domains,
46                               char ***names,
47                               enum lsa_SidType **types);
48 NTSTATUS rpc_lookup_sids(TALLOC_CTX *mem_ctx,
49                          struct winbindd_domain *domain,
50                          struct lsa_SidArray *sids,
51                          struct lsa_RefDomainList **pdomains,
52                          struct lsa_TransNameArray **pnames);
53
54 /* The following definitions come from winbindd/winbindd_cache.c  */
55
56 NTSTATUS wb_cache_query_user_list(struct winbindd_domain *domain,
57                                   TALLOC_CTX *mem_ctx,
58                                   uint32_t **prids);
59 NTSTATUS wb_cache_enum_dom_groups(struct winbindd_domain *domain,
60                                   TALLOC_CTX *mem_ctx,
61                                   uint32_t *num_entries,
62                                   struct wb_acct_info **info);
63 NTSTATUS wb_cache_enum_local_groups(struct winbindd_domain *domain,
64                                     TALLOC_CTX *mem_ctx,
65                                     uint32_t *num_entries,
66                                     struct wb_acct_info **info);
67 NTSTATUS wb_cache_name_to_sid(struct winbindd_domain *domain,
68                               TALLOC_CTX *mem_ctx,
69                               const char *domain_name,
70                               const char *name,
71                               uint32_t flags,
72                               struct dom_sid *sid,
73                               enum lsa_SidType *type);
74 NTSTATUS wb_cache_sid_to_name(struct winbindd_domain *domain,
75                               TALLOC_CTX *mem_ctx,
76                               const struct dom_sid *sid,
77                               char **domain_name,
78                               char **name,
79                               enum lsa_SidType *type);
80 NTSTATUS wb_cache_rids_to_names(struct winbindd_domain *domain,
81                                 TALLOC_CTX *mem_ctx,
82                                 const struct dom_sid *domain_sid,
83                                 uint32_t *rids,
84                                 size_t num_rids,
85                                 char **domain_name,
86                                 char ***names,
87                                 enum lsa_SidType **types);
88 NTSTATUS wb_cache_lookup_usergroups(struct winbindd_domain *domain,
89                                     TALLOC_CTX *mem_ctx,
90                                     const struct dom_sid *user_sid,
91                                     uint32_t *pnum_sids,
92                                     struct dom_sid **psids);
93 NTSTATUS wb_cache_lookup_useraliases(struct winbindd_domain *domain,
94                                      TALLOC_CTX *mem_ctx,
95                                      uint32_t num_sids,
96                                      const struct dom_sid *sids,
97                                      uint32_t *num_aliases,
98                                      uint32_t **alias_rids);
99 NTSTATUS wb_cache_lookup_groupmem(struct winbindd_domain *domain,
100                                   TALLOC_CTX *mem_ctx,
101                                   const struct dom_sid *group_sid,
102                                   enum lsa_SidType type,
103                                   uint32_t *num_names,
104                                   struct dom_sid **sid_mem,
105                                   char ***names,
106                                   uint32_t **name_types);
107 NTSTATUS wb_cache_sequence_number(struct winbindd_domain *domain,
108                                   uint32_t *seq);
109 NTSTATUS wb_cache_lockout_policy(struct winbindd_domain *domain,
110                                  TALLOC_CTX *mem_ctx,
111                                  struct samr_DomInfo12 *policy);
112 NTSTATUS wb_cache_password_policy(struct winbindd_domain *domain,
113                                   TALLOC_CTX *mem_ctx,
114                                   struct samr_DomInfo1 *policy);
115 NTSTATUS wb_cache_trusted_domains(struct winbindd_domain *domain,
116                                   TALLOC_CTX *mem_ctx,
117                                   struct netr_DomainTrustList *trusts);
118
119 NTSTATUS wcache_cached_creds_exist(struct winbindd_domain *domain, const struct dom_sid *sid);
120 NTSTATUS wcache_get_creds(struct winbindd_domain *domain, 
121                           TALLOC_CTX *mem_ctx, 
122                           const struct dom_sid *sid,
123                           const uint8_t **cached_nt_pass,
124                           const uint8_t **cached_salt);
125 NTSTATUS wcache_save_creds(struct winbindd_domain *domain, 
126                            const struct dom_sid *sid,
127                            const uint8_t nt_pass[NT_HASH_LEN]);
128 void wcache_invalidate_samlogon(struct winbindd_domain *domain, 
129                                 const struct dom_sid *user_sid);
130 bool wcache_invalidate_cache(void);
131 bool wcache_invalidate_cache_noinit(void);
132 bool initialize_winbindd_cache(void);
133 void close_winbindd_cache(void);
134 bool lookup_cached_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
135                        char **domain_name, char **name,
136                        enum lsa_SidType *type);
137 bool lookup_cached_name(const char *domain_name,
138                         const char *name,
139                         struct dom_sid *sid,
140                         enum lsa_SidType *type);
141 void cache_name2sid_trusted(struct winbindd_domain *domain,
142                         const char *domain_name,
143                         const char *name,
144                         enum lsa_SidType type,
145                         const struct dom_sid *sid);
146 void cache_name2sid(struct winbindd_domain *domain, 
147                     const char *domain_name, const char *name,
148                     enum lsa_SidType type, const struct dom_sid *sid);
149 NTSTATUS wcache_query_user_fullname(struct winbindd_domain *domain,
150                                     TALLOC_CTX *mem_ctx,
151                                     const struct dom_sid *user_sid,
152                                     const char **full_name);
153
154 NTSTATUS wcache_count_cached_creds(struct winbindd_domain *domain, int *count);
155 NTSTATUS wcache_remove_oldest_cached_creds(struct winbindd_domain *domain, const struct dom_sid *sid) ;
156 bool set_global_winbindd_state_offline(void);
157 void set_global_winbindd_state_online(void);
158 bool get_global_winbindd_state_offline(void);
159 int winbindd_validate_cache(void);
160 int winbindd_validate_cache_nobackup(void);
161 bool winbindd_cache_validate_and_initialize(void);
162 bool wcache_tdc_fetch_list( struct winbindd_tdc_domain **domains, size_t *num_domains );
163 bool wcache_tdc_add_domain( struct winbindd_domain *domain );
164 struct winbindd_tdc_domain * wcache_tdc_fetch_domain( TALLOC_CTX *ctx, const char *name );
165 void wcache_tdc_clear( void );
166 bool wcache_store_seqnum(const char *domain_name, uint32_t seqnum,
167                          time_t last_seq_check);
168 bool wcache_fetch_ndr(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain,
169                       uint32_t opnum, const DATA_BLOB *req, DATA_BLOB *resp);
170 void wcache_store_ndr(struct winbindd_domain *domain, uint32_t opnum,
171                       const DATA_BLOB *req, const DATA_BLOB *resp);
172
173 /* The following definitions come from winbindd/winbindd_ccache_access.c  */
174
175 void winbindd_ccache_ntlm_auth(struct winbindd_cli_state *state);
176 enum winbindd_result winbindd_dual_ccache_ntlm_auth(struct winbindd_domain *domain,
177                                                 struct winbindd_cli_state *state);
178 void winbindd_ccache_save(struct winbindd_cli_state *state);
179
180 /* The following definitions come from winbindd/winbindd_cm.c  */
181 void winbind_msg_domain_offline(struct messaging_context *msg_ctx,
182                                 void *private_data,
183                                 uint32_t msg_type,
184                                 struct server_id server_id,
185                                 DATA_BLOB *data);
186 void winbind_msg_domain_online(struct messaging_context *msg_ctx,
187                                 void *private_data,
188                                 uint32_t msg_type,
189                                 struct server_id server_id,
190                                 DATA_BLOB *data);
191
192 void set_domain_offline(struct winbindd_domain *domain);
193 void set_domain_online_request(struct winbindd_domain *domain);
194
195 struct ndr_interface_table;
196 NTSTATUS wb_open_internal_pipe(TALLOC_CTX *mem_ctx,
197                                const struct ndr_interface_table *table,
198                                struct rpc_pipe_client **ret_pipe);
199 void invalidate_cm_connection(struct winbindd_domain *domain);
200 void close_conns_after_fork(void);
201 NTSTATUS init_dc_connection(struct winbindd_domain *domain, bool need_rw_dc);
202 NTSTATUS cm_connect_sam(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
203                         bool need_rw_dc,
204                         struct rpc_pipe_client **cli, struct policy_handle *sam_handle);
205 NTSTATUS cm_connect_lsa(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
206                         struct rpc_pipe_client **cli, struct policy_handle *lsa_policy);
207 NTSTATUS cm_connect_lsat(struct winbindd_domain *domain,
208                          TALLOC_CTX *mem_ctx,
209                          struct rpc_pipe_client **cli,
210                          struct policy_handle *lsa_policy);
211 NTSTATUS cm_connect_netlogon(struct winbindd_domain *domain,
212                              struct rpc_pipe_client **cli);
213 bool fetch_current_dc_from_gencache(TALLOC_CTX *mem_ctx,
214                                     const char *domain_name,
215                                     char **p_dc_name, char **p_dc_ip);
216
217 /* The following definitions come from winbindd/winbindd_cred_cache.c  */
218
219 bool ccache_entry_exists(const char *username);
220 bool ccache_entry_identical(const char *username,
221                             uid_t uid,
222                             const char *ccname);
223 void ccache_remove_all_after_fork(void);
224 void ccache_regain_all_now(void);
225 NTSTATUS add_ccache_to_list(const char *princ_name,
226                             const char *ccname,
227                             const char *service,
228                             const char *username,
229                             const char *password,
230                             const char *realm,
231                             uid_t uid,
232                             time_t create_time,
233                             time_t ticket_end,
234                             time_t renew_until,
235                             bool postponed_request);
236 NTSTATUS remove_ccache(const char *username);
237 struct WINBINDD_MEMORY_CREDS *find_memory_creds_by_name(const char *username);
238 NTSTATUS winbindd_add_memory_creds(const char *username,
239                                    uid_t uid,
240                                    const char *pass);
241 NTSTATUS winbindd_delete_memory_creds(const char *username);
242 NTSTATUS winbindd_replace_memory_creds(const char *username,
243                                        const char *pass);
244
245 /* The following definitions come from winbindd/winbindd_creds.c  */
246
247 NTSTATUS winbindd_get_creds(struct winbindd_domain *domain,
248                             TALLOC_CTX *mem_ctx,
249                             const struct dom_sid *sid,
250                             struct netr_SamInfo3 **info3,
251                             const uint8_t *cached_nt_pass[NT_HASH_LEN],
252                             const uint8_t *cred_salt[NT_HASH_LEN]);
253 NTSTATUS winbindd_store_creds(struct winbindd_domain *domain,
254                               const char *user, 
255                               const char *pass, 
256                               struct netr_SamInfo3 *info3);
257 NTSTATUS winbindd_update_creds_by_info3(struct winbindd_domain *domain,
258                                         const char *user,
259                                         const char *pass,
260                                         struct netr_SamInfo3 *info3);
261 NTSTATUS winbindd_update_creds_by_name(struct winbindd_domain *domain,
262                                        const char *user,
263                                        const char *pass);
264
265 /* The following definitions come from winbindd/winbindd_domain.c  */
266
267 void setup_domain_child(struct winbindd_domain *domain);
268
269 /* The following definitions come from winbindd/winbindd_dual.c  */
270
271 struct dcerpc_binding_handle *dom_child_handle(struct winbindd_domain *domain);
272 struct winbindd_child *choose_domain_child(struct winbindd_domain *domain);
273
274 struct tevent_req *wb_child_request_send(TALLOC_CTX *mem_ctx,
275                                          struct tevent_context *ev,
276                                          struct winbindd_child *child,
277                                          struct winbindd_request *request);
278 int wb_child_request_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
279                           struct winbindd_response **presponse, int *err);
280 struct tevent_req *wb_domain_request_send(TALLOC_CTX *mem_ctx,
281                                           struct tevent_context *ev,
282                                           struct winbindd_domain *domain,
283                                           struct winbindd_request *request);
284 int wb_domain_request_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
285                            struct winbindd_response **presponse, int *err);
286
287 void setup_child(struct winbindd_domain *domain, struct winbindd_child *child,
288                  const struct winbindd_child_dispatch_table *table,
289                  const char *logprefix,
290                  const char *logname);
291 void winbind_child_died(pid_t pid);
292 void winbindd_flush_negative_conn_cache(struct winbindd_domain *domain);
293 void winbind_msg_debug(struct messaging_context *msg_ctx,
294                          void *private_data,
295                          uint32_t msg_type,
296                          struct server_id server_id,
297                          DATA_BLOB *data);
298 void winbind_msg_offline(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_online(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_onlinestatus(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_dump_event_list(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_domain_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_ip_dropped(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 void winbind_msg_ip_dropped_parent(struct messaging_context *msg_ctx,
329                                    void *private_data,
330                                    uint32_t msg_type,
331                                    struct server_id server_id,
332                                    DATA_BLOB *data);
333 NTSTATUS winbindd_reinit_after_fork(const struct winbindd_child *myself,
334                                     const char *logfilename);
335 struct winbindd_domain *wb_child_domain(void);
336
337 /* The following definitions come from winbindd/winbindd_group.c  */
338 bool fill_grent(TALLOC_CTX *mem_ctx, struct winbindd_gr *gr,
339                 const char *dom_name, const char *gr_name, gid_t unix_gid);
340
341 struct db_context;
342 NTSTATUS winbindd_print_groupmembers(struct db_context *members,
343                                      TALLOC_CTX *mem_ctx,
344                                      int *num_members, char **result);
345
346
347 /* The following definitions come from winbindd/winbindd_idmap.c  */
348
349 void init_idmap_child(void);
350 struct winbindd_child *idmap_child(void);
351 struct idmap_domain *idmap_find_domain_with_sid(const char *domname,
352                                                 const struct dom_sid *sid);
353 const char *idmap_config_const_string(const char *domname, const char *option,
354                                       const char *def);
355 bool idmap_config_bool(const char *domname, const char *option, bool def);
356 int idmap_config_int(const char *domname, const char *option, int def);
357 bool domain_has_idmap_config(const char *domname);
358 bool lp_scan_idmap_domains(bool (*fn)(const char *domname,
359                                       void *private_data),
360                            void *private_data);
361
362 /* The following definitions come from winbindd/winbindd_locator.c  */
363
364 void init_locator_child(void);
365 struct winbindd_child *locator_child(void);
366
367 /* The following definitions come from winbindd/winbindd_misc.c  */
368
369 void winbindd_list_trusted_domains(struct winbindd_cli_state *state);
370 enum winbindd_result winbindd_dual_list_trusted_domains(struct winbindd_domain *domain,
371                                                         struct winbindd_cli_state *state);
372 void winbindd_show_sequence(struct winbindd_cli_state *state);
373 void winbindd_domain_info(struct winbindd_cli_state *state);
374 void winbindd_dc_info(struct winbindd_cli_state *state);
375 void winbindd_ping(struct winbindd_cli_state *state);
376 void winbindd_info(struct winbindd_cli_state *state);
377 void winbindd_interface_version(struct winbindd_cli_state *state);
378 void winbindd_domain_name(struct winbindd_cli_state *state);
379 void winbindd_netbios_name(struct winbindd_cli_state *state);
380 void winbindd_priv_pipe_dir(struct winbindd_cli_state *state);
381
382 /* The following definitions come from winbindd/winbindd_ndr.c  */
383 struct ndr_print;
384 void ndr_print_winbindd_child(struct ndr_print *ndr,
385                               const char *name,
386                               const struct winbindd_child *r);
387 void ndr_print_winbindd_cm_conn(struct ndr_print *ndr,
388                                 const char *name,
389                                 const struct winbindd_cm_conn *r);
390 void ndr_print_winbindd_methods(struct ndr_print *ndr,
391                                 const char *name,
392                                 const struct winbindd_methods *r);
393 void ndr_print_winbindd_domain(struct ndr_print *ndr,
394                                const char *name,
395                                const struct winbindd_domain *r);
396
397 /* The following definitions come from winbindd/winbindd_pam.c  */
398
399 bool check_request_flags(uint32_t flags);
400 NTSTATUS append_auth_data(TALLOC_CTX *mem_ctx,
401                           struct winbindd_response *resp,
402                           uint32_t request_flags,
403                           uint16_t validation_level,
404                           union netr_Validation *validation,
405                           const char *name_domain,
406                           const char *name_user);
407 uid_t get_uid_from_request(struct winbindd_request *request);
408 struct winbindd_domain *find_auth_domain(uint8_t flags,
409                                          const char *domain_name);
410 enum winbindd_result winbindd_dual_pam_auth(struct winbindd_domain *domain,
411                                             struct winbindd_cli_state *state) ;
412 enum winbindd_result winbindd_dual_pam_auth_crap(struct winbindd_domain *domain,
413                                                  struct winbindd_cli_state *state) ;
414 enum winbindd_result winbindd_dual_pam_chauthtok(struct winbindd_domain *contact_domain,
415                                                  struct winbindd_cli_state *state);
416 enum winbindd_result winbindd_dual_pam_logoff(struct winbindd_domain *domain,
417                                               struct winbindd_cli_state *state) ;
418 enum winbindd_result winbindd_dual_pam_chng_pswd_auth_crap(struct winbindd_domain *domainSt, struct winbindd_cli_state *state);
419 NTSTATUS winbindd_pam_auth_pac_send(struct winbindd_cli_state *state,
420                                     struct netr_SamInfo3 **info3);
421
422 NTSTATUS winbind_dual_SamLogon(struct winbindd_domain *domain,
423                                TALLOC_CTX *mem_ctx,
424                                uint32_t logon_parameters,
425                                const char *name_user,
426                                const char *name_domain,
427                                const char *workstation,
428                                const uint8_t chal[8],
429                                DATA_BLOB lm_response,
430                                DATA_BLOB nt_response,
431                                uint8_t *authoritative,
432                                bool skip_sam,
433                                uint32_t *flags,
434                                uint16_t *_validation_level,
435                                union netr_Validation **_validation);
436
437 /* The following definitions come from winbindd/winbindd_util.c  */
438
439 struct winbindd_domain *domain_list(void);
440 struct winbindd_domain *wb_next_domain(struct winbindd_domain *domain);
441 bool domain_is_forest_root(const struct winbindd_domain *domain);
442 void rescan_trusted_domains(struct tevent_context *ev, struct tevent_timer *te,
443                             struct timeval now, void *private_data);
444 enum winbindd_result winbindd_dual_init_connection(struct winbindd_domain *domain,
445                                                    struct winbindd_cli_state *state);
446 bool init_domain_list(void);
447 struct winbindd_domain *find_domain_from_name_noinit(const char *domain_name);
448 struct winbindd_domain *find_trust_from_name_noinit(const char *domain_name);
449 struct winbindd_domain *find_domain_from_name(const char *domain_name);
450 struct winbindd_domain *find_domain_from_sid_noinit(const struct dom_sid *sid);
451 struct winbindd_domain *find_trust_from_sid_noinit(const struct dom_sid *sid);
452 struct winbindd_domain *find_domain_from_sid(const struct dom_sid *sid);
453 struct winbindd_domain *find_our_domain(void);
454 struct winbindd_domain *find_default_route_domain(void);
455 struct winbindd_domain *find_lookup_domain_from_sid(const struct dom_sid *sid);
456 struct winbindd_domain *find_lookup_domain_from_name(const char *domain_name);
457 bool parse_domain_user(const char *domuser, fstring domain, fstring user);
458 bool parse_domain_user_talloc(TALLOC_CTX *mem_ctx, const char *domuser,
459                               char **domain, char **user);
460 bool canonicalize_username(fstring username_inout, fstring domain, fstring user);
461 void fill_domain_username(fstring name, const char *domain, const char *user, bool can_assume);
462 char *fill_domain_username_talloc(TALLOC_CTX *ctx,
463                                   const char *domain,
464                                   const char *user,
465                                   bool can_assume);
466 struct winbindd_cli_state *winbindd_client_list(void);
467 struct winbindd_cli_state *winbindd_client_list_tail(void);
468 struct winbindd_cli_state *
469 winbindd_client_list_prev(struct winbindd_cli_state *cli);
470 void winbindd_add_client(struct winbindd_cli_state *cli);
471 void winbindd_remove_client(struct winbindd_cli_state *cli);
472 void winbindd_promote_client(struct winbindd_cli_state *cli);
473 int winbindd_num_clients(void);
474 NTSTATUS lookup_usergroups_cached(TALLOC_CTX *mem_ctx,
475                                   const struct dom_sid *user_sid,
476                                   uint32_t *p_num_groups, struct dom_sid **user_sids);
477
478 NTSTATUS normalize_name_map(TALLOC_CTX *mem_ctx,
479                              const char *domain_name,
480                              const char *name,
481                              char **normalized);
482 NTSTATUS normalize_name_unmap(TALLOC_CTX *mem_ctx,
483                               char *name,
484                               char **normalized);
485
486 NTSTATUS resolve_username_to_alias(TALLOC_CTX *mem_ctx,
487                                    struct winbindd_domain *domain,
488                                    const char *name, char **alias);
489 NTSTATUS resolve_alias_to_username(TALLOC_CTX *mem_ctx,
490                                    struct winbindd_domain *domain,
491                                    const char *alias, char **name);
492
493 bool winbindd_can_contact_domain(struct winbindd_domain *domain);
494 bool winbindd_internal_child(struct winbindd_child *child);
495 void winbindd_set_locator_kdc_envs(const struct winbindd_domain *domain);
496 void winbindd_unset_locator_kdc_env(const struct winbindd_domain *domain);
497 void winbindd_set_locator_kdc_envs(const struct winbindd_domain *domain);
498 void winbindd_unset_locator_kdc_env(const struct winbindd_domain *domain);
499 void set_auth_errors(struct winbindd_response *resp, NTSTATUS result);
500 bool is_domain_offline(const struct winbindd_domain *domain);
501 bool is_domain_online(const struct winbindd_domain *domain);
502 bool parse_sidlist(TALLOC_CTX *mem_ctx, const char *sidstr,
503                    struct dom_sid **sids, uint32_t *num_sids);
504 bool parse_xidlist(TALLOC_CTX *mem_ctx, const char *xidstr,
505                    struct unixid **pxids, uint32_t *pnum_xids);
506
507 /* The following definitions come from winbindd/winbindd_wins.c  */
508
509 void winbindd_wins_byname(struct winbindd_cli_state *state);
510
511 struct tevent_req *wb_ping_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
512                                 struct winbindd_cli_state *cli,
513                                 struct winbindd_request *request);
514 NTSTATUS wb_ping_recv(struct tevent_req *req,
515                       struct winbindd_response *resp);
516
517 enum winbindd_result winbindd_dual_ping(struct winbindd_domain *domain,
518                                         struct winbindd_cli_state *state);
519
520 struct dcerpc_binding_handle *wbint_binding_handle(TALLOC_CTX *mem_ctx,
521                                                 struct winbindd_domain *domain,
522                                                 struct winbindd_child *child);
523 enum winbindd_result winbindd_dual_ndrcmd(struct winbindd_domain *domain,
524                                           struct winbindd_cli_state *state);
525
526 struct tevent_req *wb_lookupsid_send(TALLOC_CTX *mem_ctx,
527                                      struct tevent_context *ev,
528                                      const struct dom_sid *sid);
529 NTSTATUS wb_lookupsid_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
530                            enum lsa_SidType *type, const char **domain,
531                            const char **name);
532
533 struct tevent_req *winbindd_lookupsid_send(TALLOC_CTX *mem_ctx,
534                                            struct tevent_context *ev,
535                                            struct winbindd_cli_state *cli,
536                                            struct winbindd_request *request);
537 NTSTATUS winbindd_lookupsid_recv(struct tevent_req *req,
538                                  struct winbindd_response *response);
539
540 struct tevent_req *winbindd_lookupsids_send(TALLOC_CTX *mem_ctx,
541                                             struct tevent_context *ev,
542                                             struct winbindd_cli_state *cli,
543                                             struct winbindd_request *request);
544 NTSTATUS winbindd_lookupsids_recv(struct tevent_req *req,
545                                   struct winbindd_response *response);
546
547 struct tevent_req *wb_lookupname_send(TALLOC_CTX *mem_ctx,
548                                       struct tevent_context *ev,
549                                       const char *dom_name, const char *name,
550                                       uint32_t flags);
551 NTSTATUS wb_lookupname_recv(struct tevent_req *req, struct dom_sid *sid,
552                             enum lsa_SidType *type);
553
554 struct tevent_req *winbindd_lookupname_send(TALLOC_CTX *mem_ctx,
555                                             struct tevent_context *ev,
556                                             struct winbindd_cli_state *cli,
557                                             struct winbindd_request *request);
558 NTSTATUS winbindd_lookupname_recv(struct tevent_req *req,
559                                   struct winbindd_response *response);
560
561 struct tevent_req *winbindd_allocate_uid_send(TALLOC_CTX *mem_ctx,
562                                               struct tevent_context *ev,
563                                               struct winbindd_cli_state *cli,
564                                               struct winbindd_request *request);
565 NTSTATUS winbindd_allocate_uid_recv(struct tevent_req *req,
566                                     struct winbindd_response *response);
567
568 struct tevent_req *winbindd_allocate_gid_send(TALLOC_CTX *mem_ctx,
569                                               struct tevent_context *ev,
570                                               struct winbindd_cli_state *cli,
571                                               struct winbindd_request *request);
572 NTSTATUS winbindd_allocate_gid_recv(struct tevent_req *req,
573                                     struct winbindd_response *response);
574
575 struct tevent_req *wb_queryuser_send(TALLOC_CTX *mem_ctx,
576                                      struct tevent_context *ev,
577                                      const struct dom_sid *user_sid);
578 NTSTATUS wb_queryuser_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
579                            struct wbint_userinfo **pinfo);
580
581 struct tevent_req *wb_getpwsid_send(TALLOC_CTX *mem_ctx,
582                                     struct tevent_context *ev,
583                                     const struct dom_sid *user_sid,
584                                     struct winbindd_pw *pw);
585 NTSTATUS wb_getpwsid_recv(struct tevent_req *req);
586
587 struct tevent_req *winbindd_getpwsid_send(TALLOC_CTX *mem_ctx,
588                                           struct tevent_context *ev,
589                                           struct winbindd_cli_state *cli,
590                                           struct winbindd_request *request);
591 NTSTATUS winbindd_getpwsid_recv(struct tevent_req *req,
592                                 struct winbindd_response *response);
593
594 struct tevent_req *winbindd_getpwnam_send(TALLOC_CTX *mem_ctx,
595                                           struct tevent_context *ev,
596                                           struct winbindd_cli_state *cli,
597                                           struct winbindd_request *request);
598 NTSTATUS winbindd_getpwnam_recv(struct tevent_req *req,
599                                 struct winbindd_response *response);
600
601 struct tevent_req *winbindd_getpwuid_send(TALLOC_CTX *mem_ctx,
602                                           struct tevent_context *ev,
603                                           struct winbindd_cli_state *cli,
604                                           struct winbindd_request *request);
605 NTSTATUS winbindd_getpwuid_recv(struct tevent_req *req,
606                                 struct winbindd_response *response);
607 struct tevent_req *wb_lookupuseraliases_send(TALLOC_CTX *mem_ctx,
608                                              struct tevent_context *ev,
609                                              struct winbindd_domain *domain,
610                                              int num_sids,
611                                              const struct dom_sid *sids);
612 NTSTATUS wb_lookupuseraliases_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
613                                    uint32_t *num_aliases, uint32_t **aliases);
614 struct tevent_req *winbindd_getsidaliases_send(TALLOC_CTX *mem_ctx,
615                                                struct tevent_context *ev,
616                                                struct winbindd_cli_state *cli,
617                                                struct winbindd_request *request);
618 NTSTATUS winbindd_getsidaliases_recv(struct tevent_req *req,
619                                      struct winbindd_response *response);
620 struct tevent_req *wb_lookupusergroups_send(TALLOC_CTX *mem_ctx,
621                                             struct tevent_context *ev,
622                                             const struct dom_sid *sid);
623 NTSTATUS wb_lookupusergroups_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
624                                   int *num_sids, struct dom_sid **sids);
625
626 struct tevent_req *winbindd_getuserdomgroups_send(TALLOC_CTX *mem_ctx,
627                                                   struct tevent_context *ev,
628                                                   struct winbindd_cli_state *cli,
629                                                   struct winbindd_request *request);
630 NTSTATUS winbindd_getuserdomgroups_recv(struct tevent_req *req,
631                                         struct winbindd_response *response);
632 struct tevent_req *wb_gettoken_send(TALLOC_CTX *mem_ctx,
633                                     struct tevent_context *ev,
634                                     const struct dom_sid *sid,
635                                     bool expand_local_aliases);
636 NTSTATUS wb_gettoken_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
637                           int *num_sids, struct dom_sid **sids);
638 struct tevent_req *winbindd_getgroups_send(TALLOC_CTX *mem_ctx,
639                                            struct tevent_context *ev,
640                                            struct winbindd_cli_state *cli,
641                                            struct winbindd_request *request);
642 NTSTATUS winbindd_getgroups_recv(struct tevent_req *req,
643                                  struct winbindd_response *response);
644
645 struct tevent_req *wb_seqnum_send(TALLOC_CTX *mem_ctx,
646                                   struct tevent_context *ev,
647                                   struct winbindd_domain *domain);
648 NTSTATUS wb_seqnum_recv(struct tevent_req *req, uint32_t *seqnum);
649
650 struct tevent_req *wb_seqnums_send(TALLOC_CTX *mem_ctx,
651                                    struct tevent_context *ev);
652 NTSTATUS wb_seqnums_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
653                          int *num_domains, struct winbindd_domain ***domains,
654                          NTSTATUS **stati, uint32_t **seqnums);
655
656 struct tevent_req *winbindd_show_sequence_send(TALLOC_CTX *mem_ctx,
657                                                struct tevent_context *ev,
658                                                struct winbindd_cli_state *cli,
659                                                struct winbindd_request *request);
660 NTSTATUS winbindd_show_sequence_recv(struct tevent_req *req,
661                                      struct winbindd_response *response);
662
663 struct tevent_req *wb_group_members_send(TALLOC_CTX *mem_ctx,
664                                          struct tevent_context *ev,
665                                          const struct dom_sid *sid,
666                                          enum lsa_SidType type,
667                                          int max_depth);
668 NTSTATUS wb_group_members_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
669                                struct db_context **members);
670 NTSTATUS add_member_to_db(struct db_context *db, struct dom_sid *sid,
671                           const char *name);
672
673 struct tevent_req *wb_getgrsid_send(TALLOC_CTX *mem_ctx,
674                                     struct tevent_context *ev,
675                                     const struct dom_sid *group_sid,
676                                     int max_nesting);
677 NTSTATUS wb_getgrsid_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
678                           const char **domname, const char **name, gid_t *gid,
679                           struct db_context **members);
680
681 struct tevent_req *winbindd_getgrgid_send(TALLOC_CTX *mem_ctx,
682                                           struct tevent_context *ev,
683                                           struct winbindd_cli_state *cli,
684                                           struct winbindd_request *request);
685 NTSTATUS winbindd_getgrgid_recv(struct tevent_req *req,
686                                 struct winbindd_response *response);
687
688 struct tevent_req *winbindd_getgrnam_send(TALLOC_CTX *mem_ctx,
689                                           struct tevent_context *ev,
690                                           struct winbindd_cli_state *cli,
691                                           struct winbindd_request *request);
692 NTSTATUS winbindd_getgrnam_recv(struct tevent_req *req,
693                                 struct winbindd_response *response);
694
695 struct tevent_req *winbindd_getusersids_send(TALLOC_CTX *mem_ctx,
696                                              struct tevent_context *ev,
697                                              struct winbindd_cli_state *cli,
698                                              struct winbindd_request *request);
699 NTSTATUS winbindd_getusersids_recv(struct tevent_req *req,
700                                    struct winbindd_response *response);
701
702 struct tevent_req *winbindd_lookuprids_send(TALLOC_CTX *mem_ctx,
703                                             struct tevent_context *ev,
704                                             struct winbindd_cli_state *cli,
705                                             struct winbindd_request *request);
706 NTSTATUS winbindd_lookuprids_recv(struct tevent_req *req,
707                                   struct winbindd_response *response);
708
709 struct tevent_req *wb_query_user_list_send(TALLOC_CTX *mem_ctx,
710                                            struct tevent_context *ev,
711                                            struct winbindd_domain *domain);
712 NTSTATUS wb_query_user_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
713                                  char **users);
714
715 struct tevent_req *wb_query_group_list_send(TALLOC_CTX *mem_ctx,
716                                             struct tevent_context *ev,
717                                             struct winbindd_domain *domain);
718 NTSTATUS wb_query_group_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
719                                   int *num_users,
720                                   struct wbint_Principal **groups);
721
722 struct tevent_req *wb_next_pwent_send(TALLOC_CTX *mem_ctx,
723                                       struct tevent_context *ev,
724                                       struct getpwent_state *gstate,
725                                       struct winbindd_pw *pw);
726 NTSTATUS wb_next_pwent_recv(struct tevent_req *req);
727
728 struct tevent_req *winbindd_setpwent_send(TALLOC_CTX *mem_ctx,
729                                           struct tevent_context *ev,
730                                           struct winbindd_cli_state *cli,
731                                           struct winbindd_request *request);
732 NTSTATUS winbindd_setpwent_recv(struct tevent_req *req,
733                                 struct winbindd_response *presp);
734
735 struct tevent_req *winbindd_getpwent_send(TALLOC_CTX *mem_ctx,
736                                           struct tevent_context *ev,
737                                           struct winbindd_cli_state *cli,
738                                           struct winbindd_request *request);
739 NTSTATUS winbindd_getpwent_recv(struct tevent_req *req,
740                                 struct winbindd_response *response);
741
742 struct tevent_req *winbindd_endpwent_send(TALLOC_CTX *mem_ctx,
743                                           struct tevent_context *ev,
744                                           struct winbindd_cli_state *cli,
745                                           struct winbindd_request *request);
746 NTSTATUS winbindd_endpwent_recv(struct tevent_req *req,
747                                 struct winbindd_response *response);
748
749 struct tevent_req *winbindd_dsgetdcname_send(TALLOC_CTX *mem_ctx,
750                                              struct tevent_context *ev,
751                                              struct winbindd_cli_state *cli,
752                                              struct winbindd_request *request);
753 NTSTATUS winbindd_dsgetdcname_recv(struct tevent_req *req,
754                                    struct winbindd_response *response);
755
756 struct tevent_req *wb_dsgetdcname_send(TALLOC_CTX *mem_ctx,
757                                        struct tevent_context *ev,
758                                        const char *domain_name,
759                                        const struct GUID *domain_guid,
760                                        const char *site_name,
761                                        uint32_t flags);
762 NTSTATUS wb_dsgetdcname_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
763                              struct netr_DsRGetDCNameInfo **pdcinfo);
764 NTSTATUS wb_dsgetdcname_gencache_set(const char *domname,
765                                      struct netr_DsRGetDCNameInfo *dcinfo);
766 NTSTATUS wb_dsgetdcname_gencache_get(TALLOC_CTX *mem_ctx,
767                                      const char *domname,
768                                      struct netr_DsRGetDCNameInfo **dcinfo);
769
770 struct tevent_req *winbindd_getdcname_send(TALLOC_CTX *mem_ctx,
771                                            struct tevent_context *ev,
772                                            struct winbindd_cli_state *cli,
773                                            struct winbindd_request *request);
774 NTSTATUS winbindd_getdcname_recv(struct tevent_req *req,
775                                  struct winbindd_response *response);
776
777 struct tevent_req *wb_next_grent_send(TALLOC_CTX *mem_ctx,
778                                       struct tevent_context *ev,
779                                       int max_nesting,
780                                       struct getgrent_state *gstate,
781                                       struct winbindd_gr *gr);
782 NTSTATUS wb_next_grent_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
783                             struct db_context **members);
784
785 struct tevent_req *winbindd_setgrent_send(TALLOC_CTX *mem_ctx,
786                                           struct tevent_context *ev,
787                                           struct winbindd_cli_state *cli,
788                                           struct winbindd_request *request);
789 NTSTATUS winbindd_setgrent_recv(struct tevent_req *req,
790                                 struct winbindd_response *response);
791 struct tevent_req *winbindd_getgrent_send(TALLOC_CTX *mem_ctx,
792                                           struct tevent_context *ev,
793                                           struct winbindd_cli_state *cli,
794                                           struct winbindd_request *request);
795 NTSTATUS winbindd_getgrent_recv(struct tevent_req *req,
796                                 struct winbindd_response *response);
797 struct tevent_req *winbindd_endgrent_send(TALLOC_CTX *mem_ctx,
798                                           struct tevent_context *ev,
799                                           struct winbindd_cli_state *cli,
800                                           struct winbindd_request *request);
801 NTSTATUS winbindd_endgrent_recv(struct tevent_req *req,
802                                 struct winbindd_response *response);
803
804 struct tevent_req *winbindd_list_users_send(TALLOC_CTX *mem_ctx,
805                                             struct tevent_context *ev,
806                                             struct winbindd_cli_state *cli,
807                                             struct winbindd_request *request);
808 NTSTATUS winbindd_list_users_recv(struct tevent_req *req,
809                                   struct winbindd_response *response);
810
811 struct tevent_req *winbindd_list_groups_send(TALLOC_CTX *mem_ctx,
812                                              struct tevent_context *ev,
813                                              struct winbindd_cli_state *cli,
814                                              struct winbindd_request *request);
815 NTSTATUS winbindd_list_groups_recv(struct tevent_req *req,
816                                    struct winbindd_response *response);
817
818 struct tevent_req *winbindd_check_machine_acct_send(TALLOC_CTX *mem_ctx,
819                                                     struct tevent_context *ev,
820                                                     struct winbindd_cli_state *cli,
821                                                     struct winbindd_request *request);
822 NTSTATUS winbindd_check_machine_acct_recv(struct tevent_req *req,
823                                           struct winbindd_response *presp);
824
825 struct tevent_req *winbindd_ping_dc_send(TALLOC_CTX *mem_ctx,
826                                          struct tevent_context *ev,
827                                          struct winbindd_cli_state *cli,
828                                          struct winbindd_request *request);
829 NTSTATUS winbindd_ping_dc_recv(struct tevent_req *req,
830                                struct winbindd_response *presp);
831
832 struct tevent_req *winbindd_change_machine_acct_send(TALLOC_CTX *mem_ctx,
833                                                      struct tevent_context *ev,
834                                                      struct winbindd_cli_state *cli,
835                                                      struct winbindd_request *request);
836 NTSTATUS winbindd_change_machine_acct_recv(struct tevent_req *req,
837                                            struct winbindd_response *presp);
838
839 struct tevent_req *winbindd_pam_auth_send(TALLOC_CTX *mem_ctx,
840                                           struct tevent_context *ev,
841                                           struct winbindd_cli_state *cli,
842                                           struct winbindd_request *request);
843 NTSTATUS winbindd_pam_auth_recv(struct tevent_req *req,
844                                 struct winbindd_response *response);
845
846 struct tevent_req *winbindd_pam_auth_crap_send(
847         TALLOC_CTX *mem_ctx,
848         struct tevent_context *ev,
849         struct winbindd_cli_state *cli,
850         struct winbindd_request *request);
851 NTSTATUS winbindd_pam_auth_crap_recv(struct tevent_req *req,
852                                      struct winbindd_response *response);
853
854 struct tevent_req *winbindd_pam_chauthtok_send(
855         TALLOC_CTX *mem_ctx,
856         struct tevent_context *ev,
857         struct winbindd_cli_state *cli,
858         struct winbindd_request *request);
859 NTSTATUS winbindd_pam_chauthtok_recv(struct tevent_req *req,
860                                      struct winbindd_response *response);
861
862 struct tevent_req *winbindd_pam_logoff_send(TALLOC_CTX *mem_ctx,
863                                             struct tevent_context *ev,
864                                             struct winbindd_cli_state *cli,
865                                             struct winbindd_request *request);
866 NTSTATUS winbindd_pam_logoff_recv(struct tevent_req *req,
867                                   struct winbindd_response *response);
868
869 struct tevent_req *winbindd_pam_chng_pswd_auth_crap_send(
870         TALLOC_CTX *mem_ctx,
871         struct tevent_context *ev,
872         struct winbindd_cli_state *cli,
873         struct winbindd_request *request);
874 NTSTATUS winbindd_pam_chng_pswd_auth_crap_recv(
875         struct tevent_req *req,
876         struct winbindd_response *response);
877
878 struct tevent_req *wb_lookupsids_send(TALLOC_CTX *mem_ctx,
879                                       struct tevent_context *ev,
880                                       struct dom_sid *sids,
881                                       uint32_t num_sids);
882 NTSTATUS wb_lookupsids_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
883                             struct lsa_RefDomainList **domains,
884                             struct lsa_TransNameArray **names);
885
886 struct tevent_req *wb_sids2xids_send(TALLOC_CTX *mem_ctx,
887                                      struct tevent_context *ev,
888                                      const struct dom_sid *sids,
889                                      const uint32_t num_sids);
890 NTSTATUS wb_sids2xids_recv(struct tevent_req *req,
891                            struct unixid xids[], uint32_t num_xids);
892 struct tevent_req *winbindd_sids_to_xids_send(TALLOC_CTX *mem_ctx,
893                                               struct tevent_context *ev,
894                                               struct winbindd_cli_state *cli,
895                                               struct winbindd_request *request);
896 NTSTATUS winbindd_sids_to_xids_recv(struct tevent_req *req,
897                                     struct winbindd_response *response);
898 struct tevent_req *wb_xids2sids_send(TALLOC_CTX *mem_ctx,
899                                      struct tevent_context *ev,
900                                      struct unixid *xids,
901                                      uint32_t num_xids);
902 NTSTATUS wb_xids2sids_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
903                            struct dom_sid **sids);
904 struct tevent_req *winbindd_xids_to_sids_send(TALLOC_CTX *mem_ctx,
905                                               struct tevent_context *ev,
906                                               struct winbindd_cli_state *cli,
907                                               struct winbindd_request *request);
908 NTSTATUS winbindd_xids_to_sids_recv(struct tevent_req *req,
909                                     struct winbindd_response *response);
910 struct tevent_req *winbindd_wins_byip_send(TALLOC_CTX *mem_ctx,
911                                            struct tevent_context *ev,
912                                            struct winbindd_cli_state *cli,
913                                            struct winbindd_request *request);
914 NTSTATUS winbindd_wins_byip_recv(struct tevent_req *req,
915                                  struct winbindd_response *presp);
916 struct tevent_req *winbindd_wins_byname_send(TALLOC_CTX *mem_ctx,
917                                              struct tevent_context *ev,
918                                              struct winbindd_cli_state *cli,
919                                              struct winbindd_request *request);
920 NTSTATUS winbindd_wins_byname_recv(struct tevent_req *req,
921                                    struct winbindd_response *presp);
922
923
924 /* The following definitions come from winbindd/winbindd_samr.c  */
925
926 NTSTATUS open_internal_samr_conn(TALLOC_CTX *mem_ctx,
927                                  struct winbindd_domain *domain,
928                                  struct rpc_pipe_client **samr_pipe,
929                                  struct policy_handle *samr_domain_hnd);
930 NTSTATUS open_internal_lsa_conn(TALLOC_CTX *mem_ctx,
931                                 struct rpc_pipe_client **lsa_pipe,
932                                 struct policy_handle *lsa_hnd);
933
934 /* The following definitions come from winbindd/winbindd_irpc.c  */
935 NTSTATUS wb_irpc_register(void);
936
937 /* The following definitions come from winbindd/winbindd_reconnect.c  */
938 bool reconnect_need_retry(NTSTATUS status, struct winbindd_domain *domain);
939
940 #endif /*  _WINBINDD_PROTO_H_  */