23
23
#ifndef _WINBINDD_PROTO_H_
24
24
#define _WINBINDD_PROTO_H_
27
/* The following definitions come from auth/token_util.c */
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,
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);
43
/* The following definitions come from smbd/connection.c */
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,
50
bool register_message_flags(bool doreg, uint32 msg_flags);
52
26
/* The following definitions come from winbindd/winbindd.c */
54
struct event_context *winbind_event_context(void);
55
27
struct messaging_context *winbind_messaging_context(void);
56
28
void request_error(struct winbindd_cli_state *state);
57
29
void request_ok(struct winbindd_cli_state *state);
79
54
const char ***domains,
80
55
struct dom_sid **sids,
81
56
enum lsa_SidType **types);
83
/* The following definitions come from winbindd/winbindd_async.c */
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);
57
NTSTATUS rpc_lookup_sids(TALLOC_CTX *mem_ctx,
58
struct winbindd_domain *domain,
59
struct lsa_SidArray *sids,
60
struct lsa_RefDomainList **pdomains,
61
struct lsa_TransNameArray **pnames);
90
63
/* The following definitions come from winbindd/winbindd_cache.c */
92
void winbindd_check_cache_size(time_t t);
93
65
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);
66
NTSTATUS wcache_cached_creds_exist(struct winbindd_domain *domain, const struct dom_sid *sid);
95
67
NTSTATUS wcache_get_creds(struct winbindd_domain *domain,
96
68
TALLOC_CTX *mem_ctx,
69
const struct dom_sid *sid,
98
70
const uint8 **cached_nt_pass,
99
71
const uint8 **cached_salt);
100
72
NTSTATUS wcache_save_creds(struct winbindd_domain *domain,
73
const struct dom_sid *sid,
103
74
const uint8 nt_pass[NT_HASH_LEN]);
104
75
void wcache_invalidate_samlogon(struct winbindd_domain *domain,
105
struct netr_SamInfo3 *info3);
76
const struct dom_sid *user_sid);
106
77
bool wcache_invalidate_cache(void);
78
bool wcache_invalidate_cache_noinit(void);
107
79
bool init_wcache(void);
108
80
bool initialize_winbindd_cache(void);
109
81
void close_winbindd_cache(void);
119
91
uint32_t *num_names,
120
92
struct dom_sid **sid_mem, char ***names,
121
93
uint32_t **name_types);
122
bool lookup_cached_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
94
bool lookup_cached_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
123
95
char **domain_name, char **name,
124
96
enum lsa_SidType *type);
125
bool lookup_cached_name(TALLOC_CTX *mem_ctx,
126
const char *domain_name,
97
bool lookup_cached_name(const char *domain_name,
129
100
enum lsa_SidType *type);
130
101
void cache_name2sid(struct winbindd_domain *domain,
131
102
const char *domain_name, const char *name,
132
enum lsa_SidType type, const DOM_SID *sid);
103
enum lsa_SidType type, const struct dom_sid *sid);
133
104
NTSTATUS wcache_name_to_sid(struct winbindd_domain *domain,
134
105
const char *domain_name,
135
106
const char *name,
161
132
bool wcache_tdc_fetch_list( struct winbindd_tdc_domain **domains, size_t *num_domains );
162
133
bool wcache_tdc_add_domain( struct winbindd_domain *domain );
163
134
struct winbindd_tdc_domain * wcache_tdc_fetch_domain( TALLOC_CTX *ctx, const char *name );
135
struct winbindd_tdc_domain* wcache_tdc_fetch_domainbysid(TALLOC_CTX *ctx, const struct dom_sid *sid);
164
136
void wcache_tdc_clear( void );
165
139
NTSTATUS nss_get_info_cached( struct winbindd_domain *domain,
166
const DOM_SID *user_sid,
140
const struct dom_sid *user_sid,
168
ADS_STRUCT *ads, LDAPMessage *msg,
169
142
const char **homedir, const char **shell,
170
143
const char **gecos, gid_t *p_gid);
171
145
bool wcache_store_seqnum(const char *domain_name, uint32_t seqnum,
172
146
time_t last_seq_check);
173
147
bool wcache_fetch_ndr(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain,
181
155
enum winbindd_result winbindd_dual_ccache_ntlm_auth(struct winbindd_domain *domain,
182
156
struct winbindd_cli_state *state);
183
157
void winbindd_ccache_save(struct winbindd_cli_state *state);
184
enum winbindd_result winbindd_dual_ccache_save(
185
struct winbindd_domain *domain, struct winbindd_cli_state *state);
187
159
/* The following definitions come from winbindd/winbindd_cm.c */
189
161
void set_domain_offline(struct winbindd_domain *domain);
190
162
void set_domain_online_request(struct winbindd_domain *domain);
191
void winbind_add_failed_connection_entry(const struct winbindd_domain *domain,
194
163
void invalidate_cm_connection(struct winbindd_cm_conn *conn);
195
164
void close_conns_after_fork(void);
196
165
NTSTATUS init_dc_connection(struct winbindd_domain *domain);
236
208
NTSTATUS winbindd_get_creds(struct winbindd_domain *domain,
237
209
TALLOC_CTX *mem_ctx,
210
const struct dom_sid *sid,
239
211
struct netr_SamInfo3 **info3,
240
212
const uint8 *cached_nt_pass[NT_HASH_LEN],
241
213
const uint8 *cred_salt[NT_HASH_LEN]);
242
214
NTSTATUS winbindd_store_creds(struct winbindd_domain *domain,
244
215
const char *user,
245
216
const char *pass,
246
struct netr_SamInfo3 *info3,
247
const DOM_SID *user_sid);
217
struct netr_SamInfo3 *info3);
248
218
NTSTATUS winbindd_update_creds_by_info3(struct winbindd_domain *domain,
250
219
const char *user,
251
220
const char *pass,
252
221
struct netr_SamInfo3 *info3);
253
NTSTATUS winbindd_update_creds_by_sid(struct winbindd_domain *domain,
257
222
NTSTATUS winbindd_update_creds_by_name(struct winbindd_domain *domain,
259
223
const char *user,
260
224
const char *pass);
262
226
/* The following definitions come from winbindd/winbindd_domain.c */
264
void setup_domain_child(struct winbindd_domain *domain,
265
struct winbindd_child *child);
228
void setup_domain_child(struct winbindd_domain *domain);
267
230
/* The following definitions come from winbindd/winbindd_dual.c */
232
struct dcerpc_binding_handle *dom_child_handle(struct winbindd_domain *domain);
233
struct winbindd_child *choose_domain_child(struct winbindd_domain *domain);
269
235
struct tevent_req *wb_child_request_send(TALLOC_CTX *mem_ctx,
270
236
struct tevent_context *ev,
271
237
struct winbindd_child *child,
279
245
int wb_domain_request_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
280
246
struct winbindd_response **presponse, int *err);
282
void async_domain_request(TALLOC_CTX *mem_ctx,
283
struct winbindd_domain *domain,
284
struct winbindd_request *request,
285
struct winbindd_response *response,
286
void (*continuation)(void *private_data_data, bool success),
287
void *private_data_data);
288
void sendto_domain(struct winbindd_cli_state *state,
289
struct winbindd_domain *domain);
290
248
void setup_child(struct winbindd_domain *domain, struct winbindd_child *child,
291
249
const struct winbindd_child_dispatch_table *table,
292
250
const char *logprefix,
389
358
/* The following definitions come from winbindd/winbindd_pam.c */
391
360
bool check_request_flags(uint32_t flags);
361
uid_t get_uid_from_request(struct winbindd_request *request);
392
362
struct winbindd_domain *find_auth_domain(uint8_t flags,
393
363
const char *domain_name);
394
NTSTATUS check_info3_in_group(struct netr_SamInfo3 *info3,
395
const char *group_sid);
396
NTSTATUS append_auth_data(struct winbindd_cli_state *state,
397
struct netr_SamInfo3 *info3,
398
const char *name_domain,
399
const char *name_user);
400
void winbindd_pam_auth(struct winbindd_cli_state *state);
401
364
enum winbindd_result winbindd_dual_pam_auth(struct winbindd_domain *domain,
402
365
struct winbindd_cli_state *state) ;
403
void winbindd_pam_auth_crap(struct winbindd_cli_state *state);
404
366
enum winbindd_result winbindd_dual_pam_auth_crap(struct winbindd_domain *domain,
405
367
struct winbindd_cli_state *state) ;
406
void winbindd_pam_chauthtok(struct winbindd_cli_state *state);
407
368
enum winbindd_result winbindd_dual_pam_chauthtok(struct winbindd_domain *contact_domain,
408
369
struct winbindd_cli_state *state);
409
void winbindd_pam_logoff(struct winbindd_cli_state *state);
410
370
enum winbindd_result winbindd_dual_pam_logoff(struct winbindd_domain *domain,
411
371
struct winbindd_cli_state *state) ;
412
void winbindd_pam_chng_pswd_auth_crap(struct winbindd_cli_state *state);
413
372
enum winbindd_result winbindd_dual_pam_chng_pswd_auth_crap(struct winbindd_domain *domainSt, struct winbindd_cli_state *state);
415
374
/* The following definitions come from winbindd/winbindd_util.c */
417
376
struct winbindd_domain *domain_list(void);
418
void free_domain_list(void);
377
bool domain_is_forest_root(const struct winbindd_domain *domain);
419
378
void rescan_trusted_domains(struct tevent_context *ev, struct tevent_timer *te,
420
379
struct timeval now, void *private_data);
421
380
enum winbindd_result winbindd_dual_init_connection(struct winbindd_domain *domain,
422
381
struct winbindd_cli_state *state);
423
382
bool init_domain_list(void);
424
void check_domain_trusted( const char *name, const DOM_SID *user_sid );
425
383
struct winbindd_domain *find_domain_from_name_noinit(const char *domain_name);
426
384
struct winbindd_domain *find_domain_from_name(const char *domain_name);
427
struct winbindd_domain *find_domain_from_sid_noinit(const DOM_SID *sid);
428
struct winbindd_domain *find_domain_from_sid(const DOM_SID *sid);
385
struct winbindd_domain *find_domain_from_sid_noinit(const struct dom_sid *sid);
386
struct winbindd_domain *find_domain_from_sid(const struct dom_sid *sid);
429
387
struct winbindd_domain *find_our_domain(void);
430
388
struct winbindd_domain *find_root_domain(void);
431
389
struct winbindd_domain *find_builtin_domain(void);
432
struct winbindd_domain *find_lookup_domain_from_sid(const DOM_SID *sid);
390
struct winbindd_domain *find_lookup_domain_from_sid(const struct dom_sid *sid);
433
391
struct winbindd_domain *find_lookup_domain_from_name(const char *domain_name);
434
392
bool parse_domain_user(const char *domuser, fstring domain, fstring user);
435
393
bool parse_domain_user_talloc(TALLOC_CTX *mem_ctx, const char *domuser,
436
394
char **domain, char **user);
437
void parse_add_domuser(void *buf, char *domuser, int *len);
438
395
bool canonicalize_username(fstring username_inout, fstring domain, fstring user);
439
396
void fill_domain_username(fstring name, const char *domain, const char *user, bool can_assume);
440
397
char *fill_domain_username_talloc(TALLOC_CTX *ctx,
441
398
const char *domain,
442
399
const char *user,
443
400
bool can_assume);
444
const char *get_winbind_pipe_dir(void) ;
445
char *get_winbind_priv_pipe_dir(void) ;
446
int open_winbindd_socket(void);
447
int open_winbindd_priv_socket(void);
448
401
struct winbindd_cli_state *winbindd_client_list(void);
449
402
void winbindd_add_client(struct winbindd_cli_state *cli);
450
403
void winbindd_remove_client(struct winbindd_cli_state *cli);
451
void winbindd_kill_all_clients(void);
452
404
int winbindd_num_clients(void);
453
405
NTSTATUS lookup_usergroups_cached(struct winbindd_domain *domain,
454
406
TALLOC_CTX *mem_ctx,
455
const DOM_SID *user_sid,
456
uint32 *p_num_groups, DOM_SID **user_sids);
407
const struct dom_sid *user_sid,
408
uint32 *p_num_groups, struct dom_sid **user_sids);
458
410
NTSTATUS normalize_name_map(TALLOC_CTX *mem_ctx,
459
411
struct winbindd_domain *domain,
513
468
NTSTATUS winbindd_lookupsid_recv(struct tevent_req *req,
514
469
struct winbindd_response *response);
471
struct tevent_req *winbindd_lookupsids_send(TALLOC_CTX *mem_ctx,
472
struct tevent_context *ev,
473
struct winbindd_cli_state *cli,
474
struct winbindd_request *request);
475
NTSTATUS winbindd_lookupsids_recv(struct tevent_req *req,
476
struct winbindd_response *response);
516
478
struct tevent_req *wb_lookupname_send(TALLOC_CTX *mem_ctx,
517
479
struct tevent_context *ev,
518
480
const char *dom_name, const char *name,
846
808
NTSTATUS winbindd_change_machine_acct_recv(struct tevent_req *req,
847
809
struct winbindd_response *presp);
849
struct tevent_req *winbindd_set_mapping_send(TALLOC_CTX *mem_ctx,
850
struct tevent_context *ev,
851
struct winbindd_cli_state *cli,
852
struct winbindd_request *request);
853
NTSTATUS winbindd_set_mapping_recv(struct tevent_req *req,
854
struct winbindd_response *response);
856
struct tevent_req *winbindd_remove_mapping_send(TALLOC_CTX *mem_ctx,
857
struct tevent_context *ev,
858
struct winbindd_cli_state *cli,
859
struct winbindd_request *request);
860
NTSTATUS winbindd_remove_mapping_recv(struct tevent_req *req,
861
struct winbindd_response *response);
863
struct tevent_req *winbindd_set_hwm_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_hwm_recv(struct tevent_req *req,
868
struct winbindd_response *response);
811
struct tevent_req *winbindd_pam_auth_send(TALLOC_CTX *mem_ctx,
812
struct tevent_context *ev,
813
struct winbindd_cli_state *cli,
814
struct winbindd_request *request);
815
NTSTATUS winbindd_pam_auth_recv(struct tevent_req *req,
816
struct winbindd_response *response);
818
struct tevent_req *winbindd_pam_auth_crap_send(
820
struct tevent_context *ev,
821
struct winbindd_cli_state *cli,
822
struct winbindd_request *request);
823
NTSTATUS winbindd_pam_auth_crap_recv(struct tevent_req *req,
824
struct winbindd_response *response);
826
struct tevent_req *winbindd_pam_chauthtok_send(
828
struct tevent_context *ev,
829
struct winbindd_cli_state *cli,
830
struct winbindd_request *request);
831
NTSTATUS winbindd_pam_chauthtok_recv(struct tevent_req *req,
832
struct winbindd_response *response);
834
struct tevent_req *winbindd_pam_logoff_send(TALLOC_CTX *mem_ctx,
835
struct tevent_context *ev,
836
struct winbindd_cli_state *cli,
837
struct winbindd_request *request);
838
NTSTATUS winbindd_pam_logoff_recv(struct tevent_req *req,
839
struct winbindd_response *response);
841
struct tevent_req *winbindd_pam_chng_pswd_auth_crap_send(
843
struct tevent_context *ev,
844
struct winbindd_cli_state *cli,
845
struct winbindd_request *request);
846
NTSTATUS winbindd_pam_chng_pswd_auth_crap_recv(
847
struct tevent_req *req,
848
struct winbindd_response *response);
850
struct tevent_req *wb_lookupsids_send(TALLOC_CTX *mem_ctx,
851
struct tevent_context *ev,
852
struct dom_sid *sids,
854
NTSTATUS wb_lookupsids_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
855
struct lsa_RefDomainList **domains,
856
struct lsa_TransNameArray **names);
858
struct tevent_req *winbindd_sids_to_xids_send(TALLOC_CTX *mem_ctx,
859
struct tevent_context *ev,
860
struct winbindd_cli_state *cli,
861
struct winbindd_request *request);
862
NTSTATUS winbindd_sids_to_xids_recv(struct tevent_req *req,
863
struct winbindd_response *response);
866
/* The following definitions come from winbindd/winbindd_samr.c */
868
NTSTATUS open_internal_samr_conn(TALLOC_CTX *mem_ctx,
869
struct winbindd_domain *domain,
870
struct rpc_pipe_client **samr_pipe,
871
struct policy_handle *samr_domain_hnd);
870
873
#endif /* _WINBINDD_PROTO_H_ */