2 * Unix SMB/CIFS implementation.
3 * collected prototypes header
5 * frozen from "make proto" in May 2008
7 * Copyright (C) Michael Adam 2008
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.
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.
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/>.
27 /* The following definitions come from auth/auth.c */
29 NTSTATUS smb_register_auth(int version, const char *name, auth_init_function init);
30 bool load_auth_module(struct auth_context *auth_context,
31 const char *module, auth_methods **ret) ;
32 NTSTATUS make_auth_context_subsystem(struct auth_context **auth_context) ;
33 NTSTATUS make_auth_context_fixed(struct auth_context **auth_context, uchar chal[8]) ;
35 /* The following definitions come from auth/auth_builtin.c */
37 NTSTATUS auth_builtin_init(void);
39 /* The following definitions come from auth/auth_compat.c */
41 NTSTATUS check_plaintext_password(const char *smb_name, DATA_BLOB plaintext_password, auth_serversupplied_info **server_info);
42 bool password_ok(const char *smb_name, DATA_BLOB password_blob);
44 /* The following definitions come from auth/auth_domain.c */
46 void attempt_machine_password_change(void);
47 NTSTATUS auth_domain_init(void);
49 NTSTATUS auth_netlogond_init(void);
51 /* The following definitions come from auth/auth_ntlmssp.c */
53 NTSTATUS auth_ntlmssp_start(AUTH_NTLMSSP_STATE **auth_ntlmssp_state);
54 void auth_ntlmssp_end(AUTH_NTLMSSP_STATE **auth_ntlmssp_state);
55 NTSTATUS auth_ntlmssp_update(AUTH_NTLMSSP_STATE *auth_ntlmssp_state,
56 const DATA_BLOB request, DATA_BLOB *reply) ;
58 /* The following definitions come from auth/auth_sam.c */
60 NTSTATUS auth_sam_init(void);
62 /* The following definitions come from auth/auth_server.c */
64 NTSTATUS auth_server_init(void);
66 /* The following definitions come from auth/auth_unix.c */
68 NTSTATUS auth_unix_init(void);
70 /* The following definitions come from auth/auth_util.c */
72 NTSTATUS make_user_info_map(auth_usersupplied_info **user_info,
74 const char *client_domain,
75 const char *wksta_name,
76 DATA_BLOB *lm_pwd, DATA_BLOB *nt_pwd,
77 DATA_BLOB *lm_interactive_pwd, DATA_BLOB *nt_interactive_pwd,
80 bool make_user_info_netlogon_network(auth_usersupplied_info **user_info,
82 const char *client_domain,
83 const char *wksta_name,
84 uint32 logon_parameters,
85 const uchar *lm_network_pwd,
87 const uchar *nt_network_pwd,
89 bool make_user_info_netlogon_interactive(auth_usersupplied_info **user_info,
91 const char *client_domain,
92 const char *wksta_name,
93 uint32 logon_parameters,
95 const uchar lm_interactive_pwd[16],
96 const uchar nt_interactive_pwd[16],
97 const uchar *dc_sess_key);
98 bool make_user_info_for_reply(auth_usersupplied_info **user_info,
100 const char *client_domain,
102 DATA_BLOB plaintext_password);
103 NTSTATUS make_user_info_for_reply_enc(auth_usersupplied_info **user_info,
104 const char *smb_name,
105 const char *client_domain,
106 DATA_BLOB lm_resp, DATA_BLOB nt_resp);
107 bool make_user_info_guest(auth_usersupplied_info **user_info) ;
108 NTSTATUS make_server_info_sam(auth_serversupplied_info **server_info,
109 struct samu *sampass);
110 NTSTATUS create_local_token(auth_serversupplied_info *server_info);
111 NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
113 uid_t *uid, gid_t *gid,
114 char **found_username,
115 struct nt_user_token **token);
116 bool user_in_group_sid(const char *username, const DOM_SID *group_sid);
117 bool user_in_group(const char *username, const char *groupname);
118 NTSTATUS make_server_info_pw(auth_serversupplied_info **server_info,
121 NTSTATUS make_serverinfo_from_username(TALLOC_CTX *mem_ctx,
122 const char *username,
124 struct auth_serversupplied_info **presult);
125 struct auth_serversupplied_info *copy_serverinfo(TALLOC_CTX *mem_ctx,
126 const auth_serversupplied_info *src);
127 bool init_guest_info(void);
128 bool server_info_set_session_key(struct auth_serversupplied_info *info,
129 DATA_BLOB session_key);
130 NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx,
131 auth_serversupplied_info **server_info);
132 bool copy_current_user(struct current_user *dst, struct current_user *src);
133 struct passwd *smb_getpwnam( TALLOC_CTX *mem_ctx, char *domuser,
134 fstring save_username, bool create );
135 NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
136 const char *sent_nt_username,
138 auth_serversupplied_info **server_info,
139 struct netr_SamInfo3 *info3);
140 NTSTATUS make_server_info_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
141 const char *sent_nt_username,
143 const struct wbcAuthUserInfo *info,
144 auth_serversupplied_info **server_info);
145 void free_user_info(auth_usersupplied_info **user_info);
146 bool make_auth_methods(struct auth_context *auth_context, auth_methods **auth_method) ;
147 bool is_trusted_domain(const char* dom_name);
149 /* The following definitions come from auth/auth_winbind.c */
151 NTSTATUS auth_winbind_init(void);
153 /* The following definitions come from auth/auth_wbc.c */
155 NTSTATUS auth_wbc_init(void);
157 /* The following definitions come from auth/pampass.c */
159 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
160 bool smb_pam_close_session(char *user, char *tty, char *rhost);
161 NTSTATUS smb_pam_accountcheck(const char * user);
162 NTSTATUS smb_pam_passcheck(const char * user, const char * password);
163 bool smb_pam_passchange(const char * user, const char * oldpassword, const char * newpassword);
164 NTSTATUS smb_pam_accountcheck(const char * user);
165 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
166 bool smb_pam_close_session(char *in_user, char *tty, char *rhost);
168 /* The following definitions come from auth/pass_check.c */
170 void dfs_unlogin(void);
171 NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *password,
172 int pwlen, bool (*fn) (const char *, const char *), bool run_cracker);
174 /* The following definitions come from auth/token_util.c */
176 bool nt_token_check_sid ( const DOM_SID *sid, const NT_USER_TOKEN *token );
177 bool nt_token_check_domain_rid( NT_USER_TOKEN *token, uint32 rid );
178 NT_USER_TOKEN *get_root_nt_token( void );
179 NTSTATUS add_aliases(const DOM_SID *domain_sid,
180 struct nt_user_token *token);
181 NTSTATUS create_builtin_users(const DOM_SID *sid);
182 NTSTATUS create_builtin_administrators(const DOM_SID *sid);
183 struct nt_user_token *create_local_nt_token(TALLOC_CTX *mem_ctx,
184 const DOM_SID *user_sid,
187 const DOM_SID *groupsids);
188 void debug_nt_user_token(int dbg_class, int dbg_lev, NT_USER_TOKEN *token);
189 void debug_unix_user_token(int dbg_class, int dbg_lev, uid_t uid, gid_t gid,
190 int n_groups, gid_t *groups);
192 /* The following definitions come from groupdb/mapping.c */
194 NTSTATUS add_initial_entry(gid_t gid, const char *sid, enum lsa_SidType sid_name_use, const char *nt_name, const char *comment);
195 bool get_domain_group_from_sid(DOM_SID sid, GROUP_MAP *map);
196 int smb_create_group(const char *unix_group, gid_t *new_gid);
197 int smb_delete_group(const char *unix_group);
198 int smb_set_primary_group(const char *unix_group, const char* unix_user);
199 int smb_add_user_group(const char *unix_group, const char *unix_user);
200 int smb_delete_user_group(const char *unix_group, const char *unix_user);
201 NTSTATUS pdb_default_getgrsid(struct pdb_methods *methods, GROUP_MAP *map,
203 NTSTATUS pdb_default_getgrgid(struct pdb_methods *methods, GROUP_MAP *map,
205 NTSTATUS pdb_default_getgrnam(struct pdb_methods *methods, GROUP_MAP *map,
207 NTSTATUS pdb_default_add_group_mapping_entry(struct pdb_methods *methods,
209 NTSTATUS pdb_default_update_group_mapping_entry(struct pdb_methods *methods,
211 NTSTATUS pdb_default_delete_group_mapping_entry(struct pdb_methods *methods,
213 NTSTATUS pdb_default_enum_group_mapping(struct pdb_methods *methods,
214 const DOM_SID *sid, enum lsa_SidType sid_name_use,
215 GROUP_MAP **pp_rmap, size_t *p_num_entries,
217 NTSTATUS pdb_default_create_alias(struct pdb_methods *methods,
218 const char *name, uint32 *rid);
219 NTSTATUS pdb_default_delete_alias(struct pdb_methods *methods,
221 NTSTATUS pdb_default_get_aliasinfo(struct pdb_methods *methods,
223 struct acct_info *info);
224 NTSTATUS pdb_default_set_aliasinfo(struct pdb_methods *methods,
226 struct acct_info *info);
227 NTSTATUS pdb_default_add_aliasmem(struct pdb_methods *methods,
228 const DOM_SID *alias, const DOM_SID *member);
229 NTSTATUS pdb_default_del_aliasmem(struct pdb_methods *methods,
230 const DOM_SID *alias, const DOM_SID *member);
231 NTSTATUS pdb_default_enum_aliasmem(struct pdb_methods *methods,
232 const DOM_SID *alias, DOM_SID **pp_members,
233 size_t *p_num_members);
234 NTSTATUS pdb_default_alias_memberships(struct pdb_methods *methods,
236 const DOM_SID *domain_sid,
237 const DOM_SID *members,
239 uint32 **pp_alias_rids,
240 size_t *p_num_alias_rids);
241 NTSTATUS pdb_nop_getgrsid(struct pdb_methods *methods, GROUP_MAP *map,
243 NTSTATUS pdb_nop_getgrgid(struct pdb_methods *methods, GROUP_MAP *map,
245 NTSTATUS pdb_nop_getgrnam(struct pdb_methods *methods, GROUP_MAP *map,
247 NTSTATUS pdb_nop_add_group_mapping_entry(struct pdb_methods *methods,
249 NTSTATUS pdb_nop_update_group_mapping_entry(struct pdb_methods *methods,
251 NTSTATUS pdb_nop_delete_group_mapping_entry(struct pdb_methods *methods,
253 NTSTATUS pdb_nop_enum_group_mapping(struct pdb_methods *methods,
254 enum lsa_SidType sid_name_use,
255 GROUP_MAP **rmap, size_t *num_entries,
257 bool pdb_get_dom_grp_info(const DOM_SID *sid, struct acct_info *info);
258 bool pdb_set_dom_grp_info(const DOM_SID *sid, const struct acct_info *info);
259 NTSTATUS pdb_create_builtin_alias(uint32 rid);
261 /* The following definitions come from groupdb/mapping_ldb.c */
263 const struct mapping_backend *groupdb_ldb_init(void);
265 /* The following definitions come from groupdb/mapping_tdb.c */
267 const struct mapping_backend *groupdb_tdb_init(void);
269 /* The following definitions come from intl/lang_tdb.c */
271 bool lang_tdb_init(const char *lang);
272 const char *lang_msg(const char *msgid);
273 void lang_msg_free(const char *msgstr);
274 char *lang_tdb_current(void);
276 /* The following definitions come from lib/access.c */
278 bool client_match(const char *tok, const void *item);
279 bool list_match(const char **list,const void *item,
280 bool (*match_fn)(const char *, const void *));
281 bool allow_access(const char **deny_list,
282 const char **allow_list,
285 bool check_access(int sock, const char **allow_list, const char **deny_list);
287 /* The following definitions come from lib/account_pol.c */
289 void account_policy_names_list(const char ***names, int *num_names);
290 const char *decode_account_policy_name(int field);
291 const char *get_account_policy_attr(int field);
292 const char *account_policy_get_desc(int field);
293 int account_policy_name_to_fieldnum(const char *name);
294 bool account_policy_get_default(int account_policy, uint32 *val);
295 bool init_account_policy(void);
296 bool account_policy_get(int field, uint32 *value);
297 bool account_policy_set(int field, uint32 value);
298 bool cache_account_policy_set(int field, uint32 value);
299 bool cache_account_policy_get(int field, uint32 *value);
300 struct db_context *get_account_pol_db( void );
302 /* The following definitions come from lib/adt_tree.c */
305 /* The following definitions come from lib/afs.c */
307 char *afs_createtoken_str(const char *username, const char *cell);
308 bool afs_login(connection_struct *conn);
309 bool afs_login(connection_struct *conn);
310 char *afs_createtoken_str(const char *username, const char *cell);
312 /* The following definitions come from lib/afs_settoken.c */
314 int afs_syscall( int subcall,
319 bool afs_settoken_str(const char *token_string);
320 bool afs_settoken_str(const char *token_string);
322 /* The following definitions come from lib/audit.c */
324 const char *audit_category_str(uint32 category);
325 const char *audit_param_str(uint32 category);
326 const char *audit_description_str(uint32 category);
327 bool get_audit_category_from_param(const char *param, uint32 *audit_category);
328 const char *audit_policy_str(TALLOC_CTX *mem_ctx, uint32 policy);
330 /* The following definitions come from lib/bitmap.c */
332 struct bitmap *bitmap_allocate(int n);
333 void bitmap_free(struct bitmap *bm);
334 struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n);
335 int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src);
336 bool bitmap_set(struct bitmap *bm, unsigned i);
337 bool bitmap_clear(struct bitmap *bm, unsigned i);
338 bool bitmap_query(struct bitmap *bm, unsigned i);
339 int bitmap_find(struct bitmap *bm, unsigned ofs);
341 /* The following definitions come from lib/charcnv.c */
343 NTSTATUS smb_register_charset(struct charset_functions *funcs);
344 char lp_failed_convert_char(void);
345 void lazy_initialize_conv(void);
346 void gfree_charcnv(void);
347 void init_iconv(void);
348 size_t convert_string(charset_t from, charset_t to,
349 void const *src, size_t srclen,
350 void *dest, size_t destlen, bool allow_bad_conv);
351 size_t unix_strupper(const char *src, size_t srclen, char *dest, size_t destlen);
352 char *talloc_strdup_upper(TALLOC_CTX *ctx, const char *s);
353 char *strupper_talloc(TALLOC_CTX *ctx, const char *s);
354 size_t unix_strlower(const char *src, size_t srclen, char *dest, size_t destlen);
355 char *talloc_strdup_lower(TALLOC_CTX *ctx, const char *s);
356 char *strlower_talloc(TALLOC_CTX *ctx, const char *s);
357 size_t ucs2_align(const void *base_ptr, const void *p, int flags);
358 size_t push_ascii(void *dest, const char *src, size_t dest_len, int flags);
359 size_t push_ascii_fstring(void *dest, const char *src);
360 size_t push_ascii_nstring(void *dest, const char *src);
361 size_t pull_ascii(char *dest, const void *src, size_t dest_len, size_t src_len, int flags);
362 size_t pull_ascii_fstring(char *dest, const void *src);
363 size_t pull_ascii_nstring(char *dest, size_t dest_len, const void *src);
364 size_t push_ucs2(const void *base_ptr, void *dest, const char *src, size_t dest_len, int flags);
365 size_t push_utf8_fstring(void *dest, const char *src);
366 bool push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
367 size_t *converted_size);
368 size_t pull_ucs2(const void *base_ptr, char *dest, const void *src, size_t dest_len, size_t src_len, int flags);
369 size_t pull_ucs2_base_talloc(TALLOC_CTX *ctx,
370 const void *base_ptr,
375 size_t pull_ucs2_fstring(char *dest, const void *src);
376 bool push_ucs2_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src,
377 size_t *converted_size);
378 bool pull_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
379 size_t *converted_size);
380 bool pull_ucs2_talloc(TALLOC_CTX *ctx, char **dest, const smb_ucs2_t *src,
381 size_t *converted_size);
382 bool pull_ascii_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
383 size_t *converted_size);
384 size_t push_string_check_fn(const char *function, unsigned int line,
385 void *dest, const char *src,
386 size_t dest_len, int flags);
387 size_t push_string_base(const char *function, unsigned int line,
388 const char *base, uint16 flags2,
389 void *dest, const char *src,
390 size_t dest_len, int flags);
391 size_t pull_string_fn(const char *function,
393 const void *base_ptr,
400 size_t pull_string_talloc_fn(const char *function,
403 const void *base_ptr,
409 size_t align_string(const void *base_ptr, const char *p, int flags);
410 codepoint_t next_codepoint(const char *str, size_t *size);
412 /* The following definitions come from lib/clobber.c */
414 void clobber_region(const char *fn, unsigned int line, char *dest, size_t len);
416 /* The following definitions come from lib/conn_tdb.c */
418 struct db_record *connections_fetch_record(TALLOC_CTX *mem_ctx,
420 struct db_record *connections_fetch_entry(TALLOC_CTX *mem_ctx,
421 connection_struct *conn,
423 int connections_traverse(int (*fn)(struct db_record *rec,
426 int connections_forall(int (*fn)(struct db_record *rec,
427 const struct connections_key *key,
428 const struct connections_data *data,
431 bool connections_init(bool rw);
433 /* The following definitions come from lib/dbwrap_util.c */
435 int32_t dbwrap_fetch_int32(struct db_context *db, const char *keystr);
436 int dbwrap_store_int32(struct db_context *db, const char *keystr, int32_t v);
437 bool dbwrap_fetch_uint32(struct db_context *db, const char *keystr,
439 int dbwrap_store_uint32(struct db_context *db, const char *keystr, uint32_t v);
440 uint32_t dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr,
441 uint32_t *oldval, uint32_t change_val);
442 int32 dbwrap_change_int32_atomic(struct db_context *db, const char *keystr,
443 int32 *oldval, int32 change_val);
444 NTSTATUS dbwrap_trans_store(struct db_context *db, TDB_DATA key, TDB_DATA dbuf,
446 NTSTATUS dbwrap_trans_delete(struct db_context *db, TDB_DATA key);
447 NTSTATUS dbwrap_trans_store_int32(struct db_context *db, const char *keystr,
449 NTSTATUS dbwrap_trans_store_uint32(struct db_context *db, const char *keystr,
451 NTSTATUS dbwrap_trans_store_bystring(struct db_context *db, const char *key,
452 TDB_DATA data, int flags);
453 NTSTATUS dbwrap_trans_delete_bystring(struct db_context *db, const char *key);
455 /* The following definitions come from lib/debug.c */
457 void gfree_debugsyms(void);
458 const char *debug_classname_from_index(int ndx);
459 int debug_add_class(const char *classname);
460 int debug_lookup_classname(const char *classname);
461 bool debug_parse_levels(const char *params_str);
462 void debug_message(struct messaging_context *msg_ctx, void *private_data, uint32_t msg_type, struct server_id src, DATA_BLOB *data);
463 void debug_init(void);
464 void debug_register_msgs(struct messaging_context *msg_ctx);
465 void setup_logging(const char *pname, bool interactive);
466 void debug_set_logfile(const char *name);
467 bool reopen_logs( void );
468 void force_check_log_size( void );
469 bool need_to_check_log_size( void );
470 void check_log_size( void );
471 void dbgflush( void );
472 bool dbghdrclass(int level, int cls, const char *location, const char *func);
473 bool dbghdr(int level, const char *location, const char *func);
474 TALLOC_CTX *debug_ctx(void);
476 /* The following definitions come from lib/display_sec.c */
478 char *get_sec_mask_str(TALLOC_CTX *ctx, uint32 type);
479 void display_sec_access(uint32_t *info);
480 void display_sec_ace_flags(uint8_t flags);
481 void display_sec_ace(SEC_ACE *ace);
482 void display_sec_acl(SEC_ACL *sec_acl);
483 void display_acl_type(uint16 type);
484 void display_sec_desc(SEC_DESC *sec);
486 /* The following definitions come from lib/dmallocmsg.c */
488 void register_dmalloc_msgs(struct messaging_context *msg_ctx);
490 /* The following definitions come from lib/dprintf.c */
492 void display_set_stderr(void);
494 /* The following definitions come from lib/errmap_unix.c */
496 NTSTATUS map_nt_error_from_unix(int unix_error);
497 int map_errno_from_nt_status(NTSTATUS status);
499 /* The following definitions come from lib/fault.c */
500 void fault_setup(void (*fn)(void *));
501 void dump_core_setup(const char *progname);
503 /* The following definitions come from lib/file_id.c */
505 struct file_id vfs_file_id_from_sbuf(connection_struct *conn, const SMB_STRUCT_STAT *sbuf);
506 bool file_id_equal(const struct file_id *id1, const struct file_id *id2);
507 const char *file_id_string_tos(const struct file_id *id);
508 void push_file_id_16(char *buf, const struct file_id *id);
509 void push_file_id_24(char *buf, const struct file_id *id);
510 void pull_file_id_24(char *buf, struct file_id *id);
512 /* The following definitions come from lib/gencache.c */
514 bool gencache_init(void);
515 bool gencache_shutdown(void);
516 bool gencache_set(const char *keystr, const char *value, time_t timeout);
517 bool gencache_del(const char *keystr);
518 bool gencache_get(const char *keystr, char **valstr, time_t *timeout);
519 bool gencache_get_data_blob(const char *keystr, DATA_BLOB *blob, bool *expired);
520 bool gencache_set_data_blob(const char *keystr, const DATA_BLOB *blob, time_t timeout);
521 void gencache_iterate(void (*fn)(const char* key, const char *value, time_t timeout, void* dptr),
522 void* data, const char* keystr_pattern);
523 int gencache_lock_entry( const char *key );
524 void gencache_unlock_entry( const char *key );
526 /* The following definitions come from lib/interface.c */
528 bool ismyaddr(const struct sockaddr *ip);
529 bool ismyip_v4(struct in_addr ip);
530 bool is_local_net(const struct sockaddr *from);
531 void setup_linklocal_scope_id(struct sockaddr *pss);
532 bool is_local_net_v4(struct in_addr from);
533 int iface_count(void);
534 int iface_count_v4_nl(void);
535 const struct in_addr *first_ipv4_iface(void);
536 struct interface *get_interface(int n);
537 const struct sockaddr_storage *iface_n_sockaddr_storage(int n);
538 const struct in_addr *iface_n_ip_v4(int n);
539 const struct in_addr *iface_n_bcast_v4(int n);
540 const struct sockaddr_storage *iface_n_bcast(int n);
541 const struct sockaddr_storage *iface_ip(const struct sockaddr *ip);
542 bool iface_local(const struct sockaddr *ip);
543 void load_interfaces(void);
544 void gfree_interfaces(void);
545 bool interfaces_changed(void);
547 /* The following definitions come from lib/ldap_debug_handler.c */
549 void init_ldap_debugging(void);
551 /* The following definitions come from lib/ldap_escape.c */
553 char *escape_ldap_string_alloc(const char *s);
554 char *escape_rdn_val_string_alloc(const char *s);
556 /* The following definitions come from lib/module.c */
558 NTSTATUS smb_load_module(const char *module_name);
559 int smb_load_modules(const char **modules);
560 NTSTATUS smb_probe_module(const char *subsystem, const char *module);
561 NTSTATUS smb_load_module(const char *module_name);
562 int smb_load_modules(const char **modules);
563 NTSTATUS smb_probe_module(const char *subsystem, const char *module);
564 void init_modules(void);
566 /* The following definitions come from lib/ms_fnmatch.c */
568 int ms_fnmatch(const char *pattern, const char *string, bool translate_pattern,
569 bool is_case_sensitive);
570 int gen_fnmatch(const char *pattern, const char *string);
572 /* The following definitions come from lib/pam_errors.c */
574 NTSTATUS pam_to_nt_status(int pam_error);
575 int nt_status_to_pam(NTSTATUS nt_status);
576 NTSTATUS pam_to_nt_status(int pam_error);
577 int nt_status_to_pam(NTSTATUS nt_status);
579 /* The following definitions come from lib/pidfile.c */
581 pid_t pidfile_pid(const char *name);
582 void pidfile_create(const char *program_name);
584 /* The following definitions come from lib/popt_common.c */
586 void popt_common_set_auth_info(struct user_auth_info *auth_info);
588 /* The following definitions come from lib/privileges.c */
590 bool get_privileges_for_sids(SE_PRIV *privileges, DOM_SID *slist, int scount);
591 NTSTATUS privilege_enumerate_accounts(DOM_SID **sids, int *num_sids);
592 NTSTATUS privilege_enum_sids(const SE_PRIV *mask, TALLOC_CTX *mem_ctx,
593 DOM_SID **sids, int *num_sids);
594 bool grant_privilege(const DOM_SID *sid, const SE_PRIV *priv_mask);
595 bool grant_privilege_by_name(DOM_SID *sid, const char *name);
596 bool revoke_privilege(const DOM_SID *sid, const SE_PRIV *priv_mask);
597 bool revoke_all_privileges( DOM_SID *sid );
598 bool revoke_privilege_by_name(DOM_SID *sid, const char *name);
599 NTSTATUS privilege_create_account(const DOM_SID *sid );
600 NTSTATUS privilege_set_init(PRIVILEGE_SET *priv_set);
601 NTSTATUS privilege_set_init_by_ctx(TALLOC_CTX *mem_ctx, PRIVILEGE_SET *priv_set);
602 void privilege_set_free(PRIVILEGE_SET *priv_set);
603 NTSTATUS dup_luid_attr(TALLOC_CTX *mem_ctx, LUID_ATTR **new_la, LUID_ATTR *old_la, int count);
604 bool is_privileged_sid( const DOM_SID *sid );
605 bool grant_all_privileges( const DOM_SID *sid );
607 /* The following definitions come from lib/privileges_basic.c */
609 bool se_priv_copy( SE_PRIV *dst, const SE_PRIV *src );
610 bool se_priv_put_all_privileges(SE_PRIV *mask);
611 void se_priv_add( SE_PRIV *mask, const SE_PRIV *addpriv );
612 void se_priv_remove( SE_PRIV *mask, const SE_PRIV *removepriv );
613 bool se_priv_equal( const SE_PRIV *mask1, const SE_PRIV *mask2 );
614 bool se_priv_from_name( const char *name, SE_PRIV *mask );
615 void dump_se_priv( int dbg_cl, int dbg_lvl, const SE_PRIV *mask );
616 bool is_privilege_assigned(const SE_PRIV *privileges,
617 const SE_PRIV *check);
618 const char* get_privilege_dispname( const char *name );
619 bool user_has_privileges(const NT_USER_TOKEN *token, const SE_PRIV *privilege);
620 bool user_has_any_privilege(NT_USER_TOKEN *token, const SE_PRIV *privilege);
621 int count_all_privileges( void );
622 LUID_ATTR get_privilege_luid( SE_PRIV *mask );
623 const char *luid_to_privilege_name(const LUID *set);
624 bool se_priv_to_privilege_set( PRIVILEGE_SET *set, SE_PRIV *mask );
625 bool privilege_set_to_se_priv( SE_PRIV *mask, struct lsa_PrivilegeSet *privset );
627 /* The following definitions come from lib/readline.c */
629 void smb_readline_done(void);
630 char *smb_readline(const char *prompt, void (*callback)(void),
631 char **(completion_fn)(const char *text, int start, int end));
632 const char *smb_readline_get_line_buffer(void);
633 void smb_readline_ca_char(char c);
634 int cmd_history(void);
636 /* The following definitions come from lib/recvfile.c */
638 ssize_t sys_recvfile(int fromfd,
642 ssize_t sys_recvfile(int fromfd,
646 ssize_t drain_socket(int sockfd, size_t count);
648 /* The following definitions come from lib/secdesc.c */
650 bool sec_desc_equal(SEC_DESC *s1, SEC_DESC *s2);
651 uint32_t get_sec_info(const SEC_DESC *sd);
652 SEC_DESC_BUF *sec_desc_merge(TALLOC_CTX *ctx, SEC_DESC_BUF *new_sdb, SEC_DESC_BUF *old_sdb);
653 SEC_DESC *make_sec_desc(TALLOC_CTX *ctx,
654 enum security_descriptor_revision revision,
656 const DOM_SID *owner_sid, const DOM_SID *grp_sid,
657 SEC_ACL *sacl, SEC_ACL *dacl, size_t *sd_size);
658 SEC_DESC *dup_sec_desc(TALLOC_CTX *ctx, const SEC_DESC *src);
659 NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx,
660 struct security_descriptor *secdesc,
661 uint8 **data, size_t *len);
662 NTSTATUS marshall_sec_desc_buf(TALLOC_CTX *mem_ctx,
663 struct sec_desc_buf *secdesc_buf,
664 uint8_t **data, size_t *len);
665 NTSTATUS unmarshall_sec_desc(TALLOC_CTX *mem_ctx, uint8 *data, size_t len,
666 struct security_descriptor **psecdesc);
667 NTSTATUS unmarshall_sec_desc_buf(TALLOC_CTX *mem_ctx, uint8_t *data, size_t len,
668 struct sec_desc_buf **psecdesc_buf);
669 SEC_DESC *make_standard_sec_desc(TALLOC_CTX *ctx, const DOM_SID *owner_sid, const DOM_SID *grp_sid,
670 SEC_ACL *dacl, size_t *sd_size);
671 SEC_DESC_BUF *make_sec_desc_buf(TALLOC_CTX *ctx, size_t len, SEC_DESC *sec_desc);
672 SEC_DESC_BUF *dup_sec_desc_buf(TALLOC_CTX *ctx, SEC_DESC_BUF *src);
673 NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, uint32 mask, size_t *sd_size);
674 NTSTATUS sec_desc_mod_sid(SEC_DESC *sd, DOM_SID *sid, uint32 mask);
675 NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, size_t *sd_size);
676 NTSTATUS se_create_child_secdesc(TALLOC_CTX *ctx,
679 const SEC_DESC *parent_ctr,
680 const DOM_SID *owner_sid,
681 const DOM_SID *group_sid,
683 NTSTATUS se_create_child_secdesc_buf(TALLOC_CTX *ctx,
684 SEC_DESC_BUF **ppsdb,
685 const SEC_DESC *parent_ctr,
688 /* The following definitions come from lib/select.c */
690 void sys_select_signal(char c);
691 int sys_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *tval);
692 int sys_select_intr(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *tval);
694 /* The following definitions come from lib/sendfile.c */
696 ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
698 /* The following definitions come from lib/server_mutex.c */
700 struct named_mutex *grab_named_mutex(TALLOC_CTX *mem_ctx, const char *name,
703 /* The following definitions come from lib/sharesec.c */
705 SEC_DESC *get_share_security_default( TALLOC_CTX *ctx, size_t *psize, uint32 def_access);
706 SEC_DESC *get_share_security( TALLOC_CTX *ctx, const char *servicename,
708 bool set_share_security(const char *share_name, SEC_DESC *psd);
709 bool delete_share_security(const char *servicename);
710 bool share_access_check(const NT_USER_TOKEN *token, const char *sharename,
711 uint32 desired_access);
712 bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, SEC_DESC **ppsd);
714 /* The following definitions come from lib/smbldap.c */
716 int smb_ldap_start_tls(LDAP *ldap_struct, int version);
717 int smb_ldap_setup_conn(LDAP **ldap_struct, const char *uri);
718 int smb_ldap_upgrade_conn(LDAP *ldap_struct, int *new_version) ;
719 int smb_ldap_setup_full_conn(LDAP **ldap_struct, const char *uri);
720 int smbldap_search(struct smbldap_state *ldap_state,
721 const char *base, int scope, const char *filter,
722 const char *attrs[], int attrsonly,
724 int smbldap_search_paged(struct smbldap_state *ldap_state,
725 const char *base, int scope, const char *filter,
726 const char **attrs, int attrsonly, int pagesize,
727 LDAPMessage **res, void **cookie);
728 int smbldap_modify(struct smbldap_state *ldap_state, const char *dn, LDAPMod *attrs[]);
729 int smbldap_add(struct smbldap_state *ldap_state, const char *dn, LDAPMod *attrs[]);
730 int smbldap_delete(struct smbldap_state *ldap_state, const char *dn);
731 int smbldap_extended_operation(struct smbldap_state *ldap_state,
732 LDAP_CONST char *reqoid, struct berval *reqdata,
733 LDAPControl **serverctrls, LDAPControl **clientctrls,
734 char **retoidp, struct berval **retdatap);
735 int smbldap_search_suffix (struct smbldap_state *ldap_state,
736 const char *filter, const char **search_attr,
737 LDAPMessage ** result);
738 void smbldap_free_struct(struct smbldap_state **ldap_state) ;
739 NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx, struct event_context *event_ctx,
740 const char *location,
741 struct smbldap_state **smbldap_state);
742 bool smbldap_has_control(LDAP *ld, const char *control);
743 bool smbldap_has_extension(LDAP *ld, const char *extension);
744 bool smbldap_has_naming_context(LDAP *ld, const char *naming_context);
745 bool smbldap_set_creds(struct smbldap_state *ldap_state, bool anon, const char *dn, const char *secret);
747 /* The following definitions come from lib/smbldap_util.c */
749 NTSTATUS smbldap_search_domain_info(struct smbldap_state *ldap_state,
750 LDAPMessage ** result, const char *domain_name,
753 /* The following definitions come from lib/smbrun.c */
755 int smbrun_no_sanitize(const char *cmd, int *outfd);
756 int smbrun(const char *cmd, int *outfd);
757 int smbrunsecret(const char *cmd, const char *secret);
759 /* The following definitions come from lib/sock_exec.c */
761 int sock_exec(const char *prog);
763 /* The following definitions come from lib/substitute.c */
765 void free_local_machine_name(void);
766 bool set_local_machine_name(const char *local_name, bool perm);
767 const char *get_local_machine_name(void);
768 bool set_remote_machine_name(const char *remote_name, bool perm);
769 const char *get_remote_machine_name(void);
770 void sub_set_smb_name(const char *name);
771 void set_current_user_info(const char *smb_name, const char *unix_name,
773 const char *get_current_username(void);
774 void standard_sub_basic(const char *smb_name, const char *domain_name,
775 char *str, size_t len);
776 char *talloc_sub_basic(TALLOC_CTX *mem_ctx, const char *smb_name,
777 const char *domain_name, const char *str);
778 char *alloc_sub_basic(const char *smb_name, const char *domain_name,
780 char *talloc_sub_specified(TALLOC_CTX *mem_ctx,
781 const char *input_string,
782 const char *username,
786 char *talloc_sub_advanced(TALLOC_CTX *mem_ctx,
787 const char *servicename, const char *user,
788 const char *connectpath, gid_t gid,
789 const char *smb_name, const char *domain_name,
791 void standard_sub_advanced(const char *servicename, const char *user,
792 const char *connectpath, gid_t gid,
793 const char *smb_name, const char *domain_name,
794 char *str, size_t len);
795 char *standard_sub_conn(TALLOC_CTX *ctx, connection_struct *conn, const char *str);
797 /* The following definitions come from lib/sysacls.c */
799 int sys_acl_get_entry(SMB_ACL_T acl_d, int entry_id, SMB_ACL_ENTRY_T *entry_p);
800 int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *type_p);
801 int sys_acl_get_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
802 void *sys_acl_get_qualifier(SMB_ACL_ENTRY_T entry_d);
803 int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset_d);
804 int sys_acl_add_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
805 int sys_acl_get_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
806 char *sys_acl_to_text(SMB_ACL_T acl_d, ssize_t *len_p);
807 SMB_ACL_T sys_acl_init(int count);
808 int sys_acl_create_entry(SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p);
809 int sys_acl_set_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type);
810 int sys_acl_set_qualifier(SMB_ACL_ENTRY_T entry_d, void *qual_p);
811 int sys_acl_set_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d);
812 int sys_acl_free_text(char *text);
813 int sys_acl_free_acl(SMB_ACL_T acl_d) ;
814 int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype);
815 int sys_acl_valid(SMB_ACL_T acl_d);
816 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
817 const char *path_p, SMB_ACL_TYPE_T type);
818 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
819 int sys_acl_set_file(vfs_handle_struct *handle,
820 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
821 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
823 int sys_acl_delete_def_file(vfs_handle_struct *handle,
825 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
826 const char *path_p, SMB_ACL_TYPE_T type);
827 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
828 int sys_acl_set_file(vfs_handle_struct *handle,
829 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
830 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
832 int sys_acl_delete_def_file(vfs_handle_struct *handle,
834 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
835 const char *path_p, SMB_ACL_TYPE_T type);
836 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
837 int sys_acl_set_file(vfs_handle_struct *handle,
838 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
839 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
841 int sys_acl_delete_def_file(vfs_handle_struct *handle,
843 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
844 const char *path_p, SMB_ACL_TYPE_T type);
845 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
846 int sys_acl_set_file(vfs_handle_struct *handle,
847 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
848 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
850 int sys_acl_delete_def_file(vfs_handle_struct *handle,
852 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
853 const char *path_p, SMB_ACL_TYPE_T type);
854 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
855 int sys_acl_set_file(vfs_handle_struct *handle,
856 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
857 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
859 int sys_acl_delete_def_file(vfs_handle_struct *handle,
861 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
862 const char *path_p, SMB_ACL_TYPE_T type);
863 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
864 int sys_acl_set_file(vfs_handle_struct *handle,
865 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
866 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
868 int sys_acl_delete_def_file(vfs_handle_struct *handle,
870 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
871 const char *path_p, SMB_ACL_TYPE_T type);
872 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
873 int sys_acl_set_file(vfs_handle_struct *handle,
874 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
875 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
877 int sys_acl_delete_def_file(vfs_handle_struct *handle,
879 int no_acl_syscall_error(int err);
881 /* The following definitions come from lib/sysquotas.c */
883 int sys_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
884 int sys_set_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
886 /* The following definitions come from lib/sysquotas_*.c */
888 int sys_get_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
889 int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
891 int sys_get_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
892 int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
894 /* The following definitions come from lib/system.c */
896 void *sys_memalign( size_t align, size_t size );
897 int sys_usleep(long usecs);
898 ssize_t sys_read(int fd, void *buf, size_t count);
899 ssize_t sys_write(int fd, const void *buf, size_t count);
900 ssize_t sys_writev(int fd, const struct iovec *iov, int iovcnt);
901 ssize_t sys_pread(int fd, void *buf, size_t count, SMB_OFF_T off);
902 ssize_t sys_pwrite(int fd, const void *buf, size_t count, SMB_OFF_T off);
903 ssize_t sys_send(int s, const void *msg, size_t len, int flags);
904 ssize_t sys_sendto(int s, const void *msg, size_t len, int flags, const struct sockaddr *to, socklen_t tolen);
905 ssize_t sys_recv(int fd, void *buf, size_t count, int flags);
906 ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen);
907 int sys_fcntl_ptr(int fd, int cmd, void *arg);
908 int sys_fcntl_long(int fd, int cmd, long arg);
909 int sys_stat(const char *fname,SMB_STRUCT_STAT *sbuf);
910 int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf);
911 int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf);
912 int sys_ftruncate(int fd, SMB_OFF_T offset);
913 SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence);
914 int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence);
915 SMB_OFF_T sys_ftell(FILE *fp);
916 int sys_creat(const char *path, mode_t mode);
917 int sys_open(const char *path, int oflag, mode_t mode);
918 FILE *sys_fopen(const char *path, const char *type);
919 void kernel_flock(int fd, uint32 share_mode);
920 SMB_STRUCT_DIR *sys_opendir(const char *name);
921 SMB_STRUCT_DIRENT *sys_readdir(SMB_STRUCT_DIR *dirp);
922 void sys_seekdir(SMB_STRUCT_DIR *dirp, long offset);
923 long sys_telldir(SMB_STRUCT_DIR *dirp);
924 void sys_rewinddir(SMB_STRUCT_DIR *dirp);
925 int sys_closedir(SMB_STRUCT_DIR *dirp);
926 int sys_mknod(const char *path, mode_t mode, SMB_DEV_T dev);
927 int sys_waitpid(pid_t pid,int *status,int options);
928 char *sys_getwd(char *s);
929 void set_effective_capability(enum smbd_capability capability);
930 void drop_effective_capability(enum smbd_capability capability);
931 long sys_random(void);
932 void sys_srandom(unsigned int seed);
933 int groups_max(void);
934 int sys_getgroups(int setlen, gid_t *gidset);
935 int sys_setgroups(gid_t UNUSED(primary_gid), int setlen, gid_t *gidset);
936 void sys_setpwent(void);
937 struct passwd *sys_getpwent(void);
938 void sys_endpwent(void);
939 struct passwd *sys_getpwnam(const char *name);
940 struct passwd *sys_getpwuid(uid_t uid);
941 struct group *sys_getgrnam(const char *name);
942 struct group *sys_getgrgid(gid_t gid);
943 int sys_popen(const char *command);
944 int sys_pclose(int fd);
945 ssize_t sys_getxattr (const char *path, const char *name, void *value, size_t size);
946 ssize_t sys_lgetxattr (const char *path, const char *name, void *value, size_t size);
947 ssize_t sys_fgetxattr (int filedes, const char *name, void *value, size_t size);
948 ssize_t sys_listxattr (const char *path, char *list, size_t size);
949 ssize_t sys_llistxattr (const char *path, char *list, size_t size);
950 ssize_t sys_flistxattr (int filedes, char *list, size_t size);
951 int sys_removexattr (const char *path, const char *name);
952 int sys_lremovexattr (const char *path, const char *name);
953 int sys_fremovexattr (int filedes, const char *name);
954 int sys_setxattr (const char *path, const char *name, const void *value, size_t size, int flags);
955 int sys_lsetxattr (const char *path, const char *name, const void *value, size_t size, int flags);
956 int sys_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags);
957 uint32 unix_dev_major(SMB_DEV_T dev);
958 uint32 unix_dev_minor(SMB_DEV_T dev);
959 int sys_aio_read(SMB_STRUCT_AIOCB *aiocb);
960 int sys_aio_write(SMB_STRUCT_AIOCB *aiocb);
961 ssize_t sys_aio_return(SMB_STRUCT_AIOCB *aiocb);
962 int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb);
963 int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb);
964 int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb);
965 int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout);
966 int sys_aio_read(SMB_STRUCT_AIOCB *aiocb);
967 int sys_aio_write(SMB_STRUCT_AIOCB *aiocb);
968 ssize_t sys_aio_return(SMB_STRUCT_AIOCB *aiocb);
969 int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb);
970 int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb);
971 int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb);
972 int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout);
973 int sys_getpeereid( int s, uid_t *uid);
974 int sys_getnameinfo(const struct sockaddr *psa,
981 int sys_connect(int fd, const struct sockaddr * addr);
983 /* The following definitions come from lib/system_smbd.c */
985 bool getgroups_unix_user(TALLOC_CTX *mem_ctx, const char *user,
987 gid_t **ret_groups, size_t *p_ngroups);
989 /* The following definitions come from lib/tallocmsg.c */
991 void register_msg_pool_usage(struct messaging_context *msg_ctx);
993 /* The following definitions come from lib/time.c */
995 void push_dos_date(uint8_t *buf, int offset, time_t unixdate, int zone_offset);
996 void push_dos_date2(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
997 void push_dos_date3(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
998 time_t pull_dos_date(const uint8_t *date_ptr, int zone_offset);
999 time_t pull_dos_date2(const uint8_t *date_ptr, int zone_offset);
1000 time_t pull_dos_date3(const uint8_t *date_ptr, int zone_offset);
1001 uint32 convert_time_t_to_uint32(time_t t);
1002 time_t convert_uint32_to_time_t(uint32 u);
1003 bool nt_time_is_zero(const NTTIME *nt);
1004 time_t generalized_to_unix_time(const char *str);
1005 int get_server_zone_offset(void);
1006 int set_server_zone_offset(time_t t);
1007 char *current_timestring(TALLOC_CTX *ctx, bool hires);
1008 void srv_put_dos_date(char *buf,int offset,time_t unixdate);
1009 void srv_put_dos_date2(char *buf,int offset, time_t unixdate);
1010 void srv_put_dos_date3(char *buf,int offset,time_t unixdate);
1011 void put_long_date_timespec(char *p, struct timespec ts);
1012 void put_long_date(char *p, time_t t);
1013 struct timespec get_create_timespec(const SMB_STRUCT_STAT *st,bool fake_dirs);
1014 struct timespec get_atimespec(const SMB_STRUCT_STAT *pst);
1015 void set_atimespec(SMB_STRUCT_STAT *pst, struct timespec ts);
1016 struct timespec get_mtimespec(const SMB_STRUCT_STAT *pst);
1017 void set_mtimespec(SMB_STRUCT_STAT *pst, struct timespec ts);
1018 struct timespec get_ctimespec(const SMB_STRUCT_STAT *pst);
1019 void set_ctimespec(SMB_STRUCT_STAT *pst, struct timespec ts);
1020 void dos_filetime_timespec(struct timespec *tsp);
1021 time_t srv_make_unix_date(const void *date_ptr);
1022 time_t srv_make_unix_date2(const void *date_ptr);
1023 time_t srv_make_unix_date3(const void *date_ptr);
1024 time_t convert_timespec_to_time_t(struct timespec ts);
1025 struct timespec convert_time_t_to_timespec(time_t t);
1026 struct timespec convert_timeval_to_timespec(const struct timeval tv);
1027 struct timeval convert_timespec_to_timeval(const struct timespec ts);
1028 struct timespec timespec_current(void);
1029 struct timespec timespec_min(const struct timespec *ts1,
1030 const struct timespec *ts2);
1031 int timespec_compare(const struct timespec *ts1, const struct timespec *ts2);
1032 struct timespec interpret_long_date(const char *p);
1033 void cli_put_dos_date(struct cli_state *cli, char *buf, int offset, time_t unixdate);
1034 void cli_put_dos_date2(struct cli_state *cli, char *buf, int offset, time_t unixdate);
1035 void cli_put_dos_date3(struct cli_state *cli, char *buf, int offset, time_t unixdate);
1036 time_t cli_make_unix_date(struct cli_state *cli, const void *date_ptr);
1037 time_t cli_make_unix_date2(struct cli_state *cli, const void *date_ptr);
1038 time_t cli_make_unix_date3(struct cli_state *cli, const void *date_ptr);
1039 bool nt_time_equals(const NTTIME *nt1, const NTTIME *nt2);
1040 void TimeInit(void);
1041 void get_process_uptime(struct timeval *ret_time);
1042 time_t nt_time_to_unix_abs(const NTTIME *nt);
1043 time_t uint64s_nt_time_to_unix_abs(const uint64_t *src);
1044 void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts);
1045 void unix_to_nt_time_abs(NTTIME *nt, time_t t);
1046 bool null_mtime(time_t mtime);
1047 const char *time_to_asc(const time_t t);
1048 const char *display_time(NTTIME nttime);
1049 bool nt_time_is_set(const NTTIME *nt);
1051 /* The following definitions come from lib/username.c */
1053 char *get_user_home_dir(TALLOC_CTX *mem_ctx, const char *user);
1054 struct passwd *Get_Pwnam_alloc(TALLOC_CTX *mem_ctx, const char *user);
1056 /* The following definitions come from lib/util.c */
1058 bool all_zero(const uint8_t *ptr, size_t size);
1059 bool set_global_myname(const char *myname);
1060 const char *global_myname(void);
1061 bool set_global_myworkgroup(const char *myworkgroup);
1062 const char *lp_workgroup(void);
1063 bool set_global_scope(const char *scope);
1064 const char *global_scope(void);
1065 void gfree_names(void);
1066 void gfree_all( void );
1067 const char *my_netbios_names(int i);
1068 bool set_netbios_aliases(const char **str_array);
1069 bool init_names(void);
1070 struct user_auth_info *user_auth_info_init(TALLOC_CTX *mem_ctx);
1071 const char *get_cmdline_auth_info_username(const struct user_auth_info *auth_info);
1072 void set_cmdline_auth_info_username(struct user_auth_info *auth_info,
1073 const char *username);
1074 void set_cmdline_auth_info_password(struct user_auth_info *auth_info,
1075 const char *password);
1076 const char *get_cmdline_auth_info_password(const struct user_auth_info *auth_info);
1077 bool set_cmdline_auth_info_signing_state(struct user_auth_info *auth_info,
1079 int get_cmdline_auth_info_signing_state(const struct user_auth_info *auth_info);
1080 void set_cmdline_auth_info_use_kerberos(struct user_auth_info *auth_info,
1082 bool get_cmdline_auth_info_use_kerberos(const struct user_auth_info *auth_info);
1083 void set_cmdline_auth_info_fallback_after_kerberos(struct user_auth_info *auth_info,
1085 bool get_cmdline_auth_info_fallback_after_kerberos(const struct user_auth_info *auth_info);
1086 void set_cmdline_auth_info_use_krb5_ticket(struct user_auth_info *auth_info);
1087 void set_cmdline_auth_info_smb_encrypt(struct user_auth_info *auth_info);
1088 void set_cmdline_auth_info_use_machine_account(struct user_auth_info *auth_info);
1089 bool get_cmdline_auth_info_got_pass(const struct user_auth_info *auth_info);
1090 bool get_cmdline_auth_info_smb_encrypt(const struct user_auth_info *auth_info);
1091 bool get_cmdline_auth_info_use_machine_account(const struct user_auth_info *auth_info);
1092 struct user_auth_info *get_cmdline_auth_info_copy(TALLOC_CTX *mem_ctx,
1093 const struct user_auth_info *info);
1094 bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_info);
1095 void set_cmdline_auth_info_getpass(struct user_auth_info *auth_info);
1096 bool add_gid_to_array_unique(TALLOC_CTX *mem_ctx, gid_t gid,
1097 gid_t **gids, size_t *num_gids);
1098 bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf);
1099 bool socket_exist(const char *fname);
1100 bool directory_exist_stat(char *dname,SMB_STRUCT_STAT *st);
1101 uint64_t get_file_size_stat(const SMB_STRUCT_STAT *sbuf);
1102 SMB_OFF_T get_file_size(char *file_name);
1103 char *attrib_string(uint16 mode);
1104 void show_msg(char *buf);
1105 void smb_set_enclen(char *buf,int len,uint16 enc_ctx_num);
1106 void smb_setlen(char *buf,int len);
1107 int set_message_bcc(char *buf,int num_bytes);
1108 ssize_t message_push_blob(uint8 **outbuf, DATA_BLOB blob);
1109 char *unix_clean_name(TALLOC_CTX *ctx, const char *s);
1110 char *clean_name(TALLOC_CTX *ctx, const char *s);
1111 ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, SMB_OFF_T pos);
1112 int set_blocking(int fd, bool set);
1113 void smb_msleep(unsigned int t);
1114 bool reinit_after_fork(struct messaging_context *msg_ctx,
1115 struct event_context *ev_ctx,
1116 bool parent_longlived);
1117 bool yesno(const char *p);
1118 void *malloc_(size_t size);
1119 void *memalign_array(size_t el_size, size_t align, unsigned int count);
1120 void *calloc_array(size_t size, size_t nmemb);
1121 void *Realloc(void *p, size_t size, bool free_old_on_error);
1122 void add_to_large_array(TALLOC_CTX *mem_ctx, size_t element_size,
1123 void *element, void *_array, uint32 *num_elements,
1124 ssize_t *array_size);
1125 char *get_myname(TALLOC_CTX *ctx);
1126 char *get_mydnsdomname(TALLOC_CTX *ctx);
1127 int interpret_protocol(const char *str,int def);
1128 char *automount_lookup(TALLOC_CTX *ctx, const char *user_name);
1129 char *automount_lookup(TALLOC_CTX *ctx, const char *user_name);
1130 bool process_exists(const struct server_id pid);
1131 const char *uidtoname(uid_t uid);
1132 char *gidtoname(gid_t gid);
1133 uid_t nametouid(const char *name);
1134 gid_t nametogid(const char *name);
1135 void smb_panic(const char *const why);
1136 void log_stack_trace(void);
1137 const char *readdirname(SMB_STRUCT_DIR *p);
1138 bool is_in_path(const char *name, name_compare_entry *namelist, bool case_sensitive);
1139 void set_namearray(name_compare_entry **ppname_array, const char *namelist);
1140 void free_namearray(name_compare_entry *name_array);
1141 bool fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
1142 bool fcntl_getlock(int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid);
1143 bool is_myname(const char *s);
1144 bool is_myworkgroup(const char *s);
1145 void ra_lanman_string( const char *native_lanman );
1146 const char *get_remote_arch_str(void);
1147 void set_remote_arch(enum remote_arch_types type);
1148 enum remote_arch_types get_remote_arch(void);
1149 const char *tab_depth(int level, int depth);
1150 int str_checksum(const char *s);
1151 void zero_free(void *p, size_t size);
1152 int set_maxfiles(int requested_max);
1153 int smb_mkstemp(char *name_template);
1154 void *smb_xmalloc_array(size_t size, unsigned int count);
1155 char *myhostname(void);
1156 char *lock_path(const char *name);
1157 char *pid_path(const char *name);
1158 char *lib_path(const char *name);
1159 char *modules_path(const char *name);
1160 char *data_path(const char *name);
1161 char *state_path(const char *name);
1162 char *cache_path(const char *name);
1163 const char *shlib_ext(void);
1164 bool parent_dirname(TALLOC_CTX *mem_ctx, const char *dir, char **parent,
1166 bool ms_has_wild(const char *s);
1167 bool ms_has_wild_w(const smb_ucs2_t *s);
1168 bool mask_match(const char *string, const char *pattern, bool is_case_sensitive);
1169 bool mask_match_search(const char *string, const char *pattern, bool is_case_sensitive);
1170 bool mask_match_list(const char *string, char **list, int listLen, bool is_case_sensitive);
1171 bool unix_wild_match(const char *pattern, const char *string);
1172 bool name_to_fqdn(fstring fqdn, const char *name);
1173 void *talloc_append_blob(TALLOC_CTX *mem_ctx, void *buf, DATA_BLOB blob);
1174 uint32 map_share_mode_to_deny_mode(uint32 share_access, uint32 private_options);
1175 pid_t procid_to_pid(const struct server_id *proc);
1176 void set_my_vnn(uint32 vnn);
1177 uint32 get_my_vnn(void);
1178 struct server_id pid_to_procid(pid_t pid);
1179 struct server_id procid_self(void);
1180 struct server_id server_id_self(void);
1181 bool procid_equal(const struct server_id *p1, const struct server_id *p2);
1182 bool cluster_id_equal(const struct server_id *id1,
1183 const struct server_id *id2);
1184 bool procid_is_me(const struct server_id *pid);
1185 struct server_id interpret_pid(const char *pid_string);
1186 char *procid_str(TALLOC_CTX *mem_ctx, const struct server_id *pid);
1187 char *procid_str_static(const struct server_id *pid);
1188 bool procid_valid(const struct server_id *pid);
1189 bool procid_is_local(const struct server_id *pid);
1190 int this_is_smp(void);
1191 bool trans_oob(uint32_t bufsize, uint32_t offset, uint32_t length);
1192 bool is_offset_safe(const char *buf_base, size_t buf_len, char *ptr, size_t off);
1193 char *get_safe_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
1194 char *get_safe_str_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
1195 int get_safe_SVAL(const char *buf_base, size_t buf_len, char *ptr, size_t off, int failval);
1196 int get_safe_IVAL(const char *buf_base, size_t buf_len, char *ptr, size_t off, int failval);
1197 void split_domain_user(TALLOC_CTX *mem_ctx,
1198 const char *full_name,
1201 void *_talloc_zero_zeronull(const void *ctx, size_t size, const char *name);
1202 void *_talloc_memdup_zeronull(const void *t, const void *p, size_t size, const char *name);
1203 void *_talloc_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
1204 void *_talloc_zero_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
1205 void *talloc_zeronull(const void *context, size_t size, const char *name);
1206 NTSTATUS split_ntfs_stream_name(TALLOC_CTX *mem_ctx, const char *fname,
1207 char **pbase, char **pstream);
1208 bool is_valid_policy_hnd(const struct policy_handle *hnd);
1209 bool policy_hnd_equal(const struct policy_handle *hnd1,
1210 const struct policy_handle *hnd2);
1211 const char *strip_hostname(const char *s);
1213 /* The following definitions come from lib/util_file.c */
1215 char **file_lines_pload(const char *syscmd, int *numlines);
1216 void file_lines_free(char **lines);
1218 /* The following definitions come from lib/util_nscd.c */
1220 void smb_nscd_flush_user_cache(void);
1221 void smb_nscd_flush_group_cache(void);
1223 /* The following definitions come from lib/util_nttoken.c */
1225 NT_USER_TOKEN *dup_nt_token(TALLOC_CTX *mem_ctx, const NT_USER_TOKEN *ptoken);
1226 NTSTATUS merge_nt_token(TALLOC_CTX *mem_ctx,
1227 const struct nt_user_token *token_1,
1228 const struct nt_user_token *token_2,
1229 struct nt_user_token **token_out);
1230 bool token_sid_in_ace(const NT_USER_TOKEN *token, const SEC_ACE *ace);
1232 /* The following definitions come from lib/util_pw.c */
1234 struct passwd *tcopy_passwd(TALLOC_CTX *mem_ctx, const struct passwd *from) ;
1235 void flush_pwnam_cache(void);
1236 struct passwd *getpwnam_alloc(TALLOC_CTX *mem_ctx, const char *name);
1237 struct passwd *getpwuid_alloc(TALLOC_CTX *mem_ctx, uid_t uid) ;
1239 /* The following definitions come from lib/util_reg.c */
1241 const char *reg_type_lookup(enum winreg_Type type);
1242 WERROR reg_pull_multi_sz(TALLOC_CTX *mem_ctx, const void *buf, size_t len,
1243 uint32 *num_values, char ***values);
1245 /* The following definitions come from lib/util_reg_api.c */
1247 WERROR registry_pull_value(TALLOC_CTX *mem_ctx,
1248 struct registry_value **pvalue,
1249 enum winreg_Type type, uint8 *data,
1250 uint32 size, uint32 length);
1251 WERROR registry_push_value(TALLOC_CTX *mem_ctx,
1252 const struct registry_value *value,
1253 DATA_BLOB *presult);
1255 /* The following definitions come from lib/util_seaccess.c */
1257 void se_map_generic(uint32 *access_mask, const struct generic_mapping *mapping);
1258 void security_acl_map_generic(struct security_acl *sa, const struct generic_mapping *mapping);
1259 void se_map_standard(uint32 *access_mask, struct standard_mapping *mapping);
1260 NTSTATUS se_access_check(const SEC_DESC *sd, const NT_USER_TOKEN *token,
1261 uint32 acc_desired, uint32 *acc_granted);
1262 NTSTATUS samr_make_sam_obj_sd(TALLOC_CTX *ctx, SEC_DESC **psd, size_t *sd_size);
1264 /* The following definitions come from lib/util_sec.c */
1266 void sec_init(void);
1267 uid_t sec_initial_uid(void);
1268 gid_t sec_initial_gid(void);
1269 bool non_root_mode(void);
1270 void gain_root_privilege(void);
1271 void gain_root_group_privilege(void);
1272 void set_effective_uid(uid_t uid);
1273 void set_effective_gid(gid_t gid);
1274 void save_re_uid(void);
1275 void restore_re_uid_fromroot(void);
1276 void restore_re_uid(void);
1277 void save_re_gid(void);
1278 void restore_re_gid(void);
1279 int set_re_uid(void);
1280 void become_user_permanently(uid_t uid, gid_t gid);
1281 bool is_setuid_root(void) ;
1283 /* The following definitions come from lib/util_sid.c */
1285 const char *sid_type_lookup(uint32 sid_type) ;
1286 NT_USER_TOKEN *get_system_token(void) ;
1287 const char *get_global_sam_name(void) ;
1288 char *sid_to_fstring(fstring sidstr_out, const DOM_SID *sid);
1289 char *sid_string_talloc(TALLOC_CTX *mem_ctx, const DOM_SID *sid);
1290 char *sid_string_dbg(const DOM_SID *sid);
1291 char *sid_string_tos(const DOM_SID *sid);
1292 bool string_to_sid(DOM_SID *sidout, const char *sidstr);
1293 DOM_SID *string_sid_talloc(TALLOC_CTX *mem_ctx, const char *sidstr);
1294 bool sid_append_rid(DOM_SID *sid, uint32 rid);
1295 bool sid_compose(DOM_SID *dst, const DOM_SID *domain_sid, uint32 rid);
1296 bool sid_split_rid(DOM_SID *sid, uint32 *rid);
1297 bool sid_peek_rid(const DOM_SID *sid, uint32 *rid);
1298 bool sid_peek_check_rid(const DOM_SID *exp_dom_sid, const DOM_SID *sid, uint32 *rid);
1299 void sid_copy(DOM_SID *dst, const DOM_SID *src);
1300 bool sid_linearize(char *outbuf, size_t len, const DOM_SID *sid);
1301 bool sid_parse(const char *inbuf, size_t len, DOM_SID *sid);
1302 int sid_compare(const DOM_SID *sid1, const DOM_SID *sid2);
1303 int sid_compare_domain(const DOM_SID *sid1, const DOM_SID *sid2);
1304 bool sid_equal(const DOM_SID *sid1, const DOM_SID *sid2);
1305 bool non_mappable_sid(DOM_SID *sid);
1306 char *sid_binstring(const DOM_SID *sid);
1307 char *sid_binstring_hex(const DOM_SID *sid);
1308 DOM_SID *sid_dup_talloc(TALLOC_CTX *ctx, const DOM_SID *src);
1309 NTSTATUS add_sid_to_array(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
1310 DOM_SID **sids, size_t *num);
1311 NTSTATUS add_sid_to_array_unique(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
1312 DOM_SID **sids, size_t *num_sids);
1313 void del_sid_from_array(const DOM_SID *sid, DOM_SID **sids, size_t *num);
1314 bool add_rid_to_array_unique(TALLOC_CTX *mem_ctx,
1315 uint32 rid, uint32 **pp_rids, size_t *p_num);
1316 bool is_null_sid(const DOM_SID *sid);
1317 bool is_sid_in_token(const NT_USER_TOKEN *token, const DOM_SID *sid);
1318 NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx,
1319 const struct netr_SamInfo3 *info3,
1320 DOM_SID **user_sids,
1321 size_t *num_user_sids,
1322 bool include_user_group_rid,
1323 bool skip_ressource_groups);
1325 /* The following definitions come from lib/util_sock.c */
1327 bool interpret_string_addr_internal(struct addrinfo **ppres,
1328 const char *str, int flags);
1329 bool is_broadcast_addr(const struct sockaddr *pss);
1330 bool interpret_string_addr(struct sockaddr_storage *pss,
1333 bool is_loopback_ip_v4(struct in_addr ip);
1334 bool is_loopback_addr(const struct sockaddr *pss);
1335 bool is_zero_addr(const struct sockaddr *pss);
1336 void zero_ip_v4(struct in_addr *ip);
1337 void zero_sockaddr(struct sockaddr_storage *pss);
1338 void in_addr_to_sockaddr_storage(struct sockaddr_storage *ss,
1340 bool same_net(const struct sockaddr *ip1,
1341 const struct sockaddr *ip2,
1342 const struct sockaddr *mask);
1343 bool sockaddr_equal(const struct sockaddr *ip1,
1344 const struct sockaddr *ip2);
1345 bool is_address_any(const struct sockaddr *psa);
1346 uint16_t get_sockaddr_port(const struct sockaddr_storage *pss);
1347 char *print_sockaddr(char *dest,
1349 const struct sockaddr_storage *psa);
1350 char *print_canonical_sockaddr(TALLOC_CTX *ctx,
1351 const struct sockaddr_storage *pss);
1352 void set_sockaddr_port(struct sockaddr *psa, uint16_t port);
1353 const char *client_name(int fd);
1354 int get_socket_port(int fd);
1355 const char *client_addr(int fd, char *addr, size_t addrlen);
1356 const char *client_socket_addr(int fd, char *addr, size_t addr_len);
1357 int client_socket_port(int fd);
1358 void set_smb_read_error(enum smb_read_errors *pre,
1359 enum smb_read_errors newerr);
1360 void cond_set_smb_read_error(enum smb_read_errors *pre,
1361 enum smb_read_errors newerr);
1362 bool is_a_socket(int fd);
1363 void set_socket_options(int fd, const char *options);
1364 ssize_t read_udp_v4_socket(int fd,
1367 struct sockaddr_storage *psa);
1368 NTSTATUS read_socket_with_timeout(int fd, char *buf,
1369 size_t mincnt, size_t maxcnt,
1370 unsigned int time_out,
1372 NTSTATUS read_data(int fd, char *buffer, size_t N);
1373 ssize_t write_data(int fd, const char *buffer, size_t N);
1374 ssize_t write_data_iov(int fd, const struct iovec *orig_iov, int iovcnt);
1375 bool send_keepalive(int client);
1376 NTSTATUS read_smb_length_return_keepalive(int fd, char *inbuf,
1377 unsigned int timeout,
1379 NTSTATUS read_smb_length(int fd, char *inbuf, unsigned int timeout,
1381 NTSTATUS receive_smb_raw(int fd,
1384 unsigned int timeout,
1387 int open_socket_in(int type,
1390 const struct sockaddr_storage *psock,
1392 NTSTATUS open_socket_out(const struct sockaddr_storage *pss, uint16_t port,
1393 int timeout, int *pfd);
1394 struct tevent_req *open_socket_out_send(TALLOC_CTX *mem_ctx,
1395 struct event_context *ev,
1396 const struct sockaddr_storage *pss,
1399 NTSTATUS open_socket_out_recv(struct tevent_req *req, int *pfd);
1400 struct tevent_req *open_socket_out_defer_send(TALLOC_CTX *mem_ctx,
1401 struct event_context *ev,
1402 struct timeval wait_time,
1403 const struct sockaddr_storage *pss,
1406 NTSTATUS open_socket_out_defer_recv(struct tevent_req *req, int *pfd);
1407 bool open_any_socket_out(struct sockaddr_storage *addrs, int num_addrs,
1408 int timeout, int *fd_index, int *fd);
1409 int open_udp_socket(const char *host, int port);
1410 const char *get_peer_name(int fd, bool force_lookup);
1411 const char *get_peer_addr(int fd, char *addr, size_t addr_len);
1412 int create_pipe_sock(const char *socket_dir,
1413 const char *socket_name,
1415 const char *get_mydnsfullname(void);
1416 bool is_myname_or_ipaddr(const char *s);
1417 struct tevent_req *read_smb_send(TALLOC_CTX *mem_ctx,
1418 struct tevent_context *ev,
1420 ssize_t read_smb_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1421 uint8_t **pbuf, int *perrno);
1423 /* The following definitions come from lib/util_str.c */
1425 bool next_token(const char **ptr, char *buff, const char *sep, size_t bufsize);
1426 bool next_token_talloc(TALLOC_CTX *ctx,
1430 bool next_token_no_ltrim_talloc(TALLOC_CTX *ctx,
1434 int StrCaseCmp(const char *s, const char *t);
1435 int StrnCaseCmp(const char *s, const char *t, size_t len);
1436 bool strnequal(const char *s1,const char *s2,size_t n);
1437 bool strcsequal(const char *s1,const char *s2);
1438 void strnorm(char *s, int case_default);
1439 bool strisnormal(const char *s, int case_default);
1440 char *push_skip_string(char *buf);
1441 char *skip_string(const char *base, size_t len, char *buf);
1442 size_t str_charnum(const char *s);
1443 size_t str_ascii_charnum(const char *s);
1444 bool trim_char(char *s,char cfront,char cback);
1445 bool strhasupper(const char *s);
1446 bool strhaslower(const char *s);
1447 char *safe_strcpy_fn(const char *fn,
1452 char *safe_strcat_fn(const char *fn,
1457 char *alpha_strcpy_fn(const char *fn,
1461 const char *other_safe_chars,
1463 char *StrnCpy_fn(const char *fn, int line,char *dest,const char *src,size_t n);
1464 bool in_list(const char *s, const char *list, bool casesensitive);
1465 void string_free(char **s);
1466 bool string_set(char **dest,const char *src);
1467 void string_sub2(char *s,const char *pattern, const char *insert, size_t len,
1468 bool remove_unsafe_characters, bool replace_once,
1469 bool allow_trailing_dollar);
1470 void string_sub_once(char *s, const char *pattern,
1471 const char *insert, size_t len);
1472 void string_sub(char *s,const char *pattern, const char *insert, size_t len);
1473 void fstring_sub(char *s,const char *pattern,const char *insert);
1474 char *realloc_string_sub2(char *string,
1475 const char *pattern,
1477 bool remove_unsafe_characters,
1478 bool allow_trailing_dollar);
1479 char *realloc_string_sub(char *string,
1480 const char *pattern,
1481 const char *insert);
1482 char *talloc_string_sub2(TALLOC_CTX *mem_ctx, const char *src,
1483 const char *pattern,
1485 bool remove_unsafe_characters,
1487 bool allow_trailing_dollar);
1488 char *talloc_string_sub(TALLOC_CTX *mem_ctx,
1490 const char *pattern,
1491 const char *insert);
1492 void all_string_sub(char *s,const char *pattern,const char *insert, size_t len);
1493 char *talloc_all_string_sub(TALLOC_CTX *ctx,
1495 const char *pattern,
1496 const char *insert);
1497 char *octal_string(int i);
1498 char *string_truncate(char *s, unsigned int length);
1499 char *strchr_m(const char *src, char c);
1500 char *strrchr_m(const char *s, char c);
1501 char *strnrchr_m(const char *s, char c, unsigned int n);
1502 char *strstr_m(const char *src, const char *findstr);
1503 void strlower_m(char *s);
1504 void strupper_m(char *s);
1505 size_t strlen_m(const char *s);
1506 size_t strlen_m_term(const char *s);
1507 size_t strlen_m_term_null(const char *s);
1508 char *binary_string_rfc2254(char *buf, int len);
1509 char *binary_string(char *buf, int len);
1510 int fstr_sprintf(fstring s, const char *fmt, ...);
1511 bool str_list_sub_basic( char **list, const char *smb_name,
1512 const char *domain_name );
1513 bool str_list_substitute(char **list, const char *pattern, const char *insert);
1514 bool str_list_check(const char **list, const char *s);
1515 bool str_list_check_ci(const char **list, const char *s);
1517 char *ipstr_list_make(char **ipstr_list,
1518 const struct ip_service *ip_list,
1520 int ipstr_list_parse(const char *ipstr_list, struct ip_service **ip_list);
1521 void ipstr_list_free(char* ipstr_list);
1522 void rfc1738_unescape(char *buf);
1523 DATA_BLOB base64_decode_data_blob(const char *s);
1524 void base64_decode_inplace(char *s);
1525 char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data);
1526 uint64_t STR_TO_SMB_BIG_UINT(const char *nptr, const char **entptr);
1527 SMB_OFF_T conv_str_size(const char * str);
1528 void string_append(char **left, const char *right);
1529 bool add_string_to_array(TALLOC_CTX *mem_ctx,
1530 const char *str, const char ***strings,
1532 void sprintf_append(TALLOC_CTX *mem_ctx, char **string, ssize_t *len,
1533 size_t *bufsize, const char *fmt, ...);
1534 int asprintf_strupper_m(char **strp, const char *fmt, ...);
1535 char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...);
1536 char *talloc_asprintf_strlower_m(TALLOC_CTX *t, const char *fmt, ...);
1537 char *sstring_sub(const char *src, char front, char back);
1538 bool validate_net_name( const char *name,
1539 const char *invalid_chars,
1541 char *escape_shell_string(const char *src);
1542 char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep);
1544 /* The following definitions come from lib/util_unistr.c */
1546 void gfree_case_tables(void);
1547 void load_case_tables(void);
1548 void init_valid_table(void);
1549 size_t dos_PutUniCode(char *dst,const char *src, size_t len, bool null_terminate);
1550 char *skip_unibuf(char *src, size_t len);
1551 int rpcstr_pull(char* dest, void *src, int dest_len, int src_len, int flags);
1552 int rpcstr_pull_talloc(TALLOC_CTX *ctx,
1557 int rpcstr_push(void *dest, const char *src, size_t dest_len, int flags);
1558 int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src);
1559 smb_ucs2_t toupper_w(smb_ucs2_t val);
1560 smb_ucs2_t tolower_w( smb_ucs2_t val );
1561 bool islower_w(smb_ucs2_t c);
1562 bool isupper_w(smb_ucs2_t c);
1563 bool isvalid83_w(smb_ucs2_t c);
1564 size_t strlen_w(const smb_ucs2_t *src);
1565 size_t strnlen_w(const smb_ucs2_t *src, size_t max);
1566 smb_ucs2_t *strchr_w(const smb_ucs2_t *s, smb_ucs2_t c);
1567 smb_ucs2_t *strchr_wa(const smb_ucs2_t *s, char c);
1568 smb_ucs2_t *strrchr_w(const smb_ucs2_t *s, smb_ucs2_t c);
1569 smb_ucs2_t *strnrchr_w(const smb_ucs2_t *s, smb_ucs2_t c, unsigned int n);
1570 smb_ucs2_t *strstr_w(const smb_ucs2_t *s, const smb_ucs2_t *ins);
1571 bool strlower_w(smb_ucs2_t *s);
1572 bool strupper_w(smb_ucs2_t *s);
1573 void strnorm_w(smb_ucs2_t *s, int case_default);
1574 int strcmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b);
1575 int strncmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len);
1576 int strcasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b);
1577 int strncasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len);
1578 bool strequal_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2);
1579 bool strnequal_w(const smb_ucs2_t *s1,const smb_ucs2_t *s2,size_t n);
1580 smb_ucs2_t *strdup_w(const smb_ucs2_t *src);
1581 smb_ucs2_t *strndup_w(const smb_ucs2_t *src, size_t len);
1582 smb_ucs2_t *strncpy_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const size_t max);
1583 smb_ucs2_t *strncat_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const size_t max);
1584 smb_ucs2_t *strcat_w(smb_ucs2_t *dest, const smb_ucs2_t *src);
1585 void string_replace_w(smb_ucs2_t *s, smb_ucs2_t oldc, smb_ucs2_t newc);
1586 bool trim_string_w(smb_ucs2_t *s, const smb_ucs2_t *front,
1587 const smb_ucs2_t *back);
1588 int strcmp_wa(const smb_ucs2_t *a, const char *b);
1589 int strncmp_wa(const smb_ucs2_t *a, const char *b, size_t len);
1590 smb_ucs2_t *strpbrk_wa(const smb_ucs2_t *s, const char *p);
1591 smb_ucs2_t *strstr_wa(const smb_ucs2_t *s, const char *ins);
1592 int toupper_ascii(int c);
1593 int tolower_ascii(int c);
1594 int isupper_ascii(int c);
1595 int islower_ascii(int c);
1597 /* The following definitions come from lib/util_uuid.c */
1599 void smb_uuid_pack(const struct GUID uu, UUID_FLAT *ptr);
1600 void smb_uuid_unpack(const UUID_FLAT in, struct GUID *uu);
1601 char *guid_binstring(const struct GUID *guid);
1603 /* The following definitions come from lib/version.c */
1605 const char *samba_version_string(void);
1607 /* The following definitions come from lib/winbind_util.c */
1609 bool winbind_lookup_name(const char *dom_name, const char *name, DOM_SID *sid,
1610 enum lsa_SidType *name_type);
1611 bool winbind_lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
1612 const char **domain, const char **name,
1613 enum lsa_SidType *name_type);
1614 bool winbind_ping(void);
1615 bool winbind_sid_to_uid(uid_t *puid, const DOM_SID *sid);
1616 bool winbind_uid_to_sid(DOM_SID *sid, uid_t uid);
1617 bool winbind_sid_to_gid(gid_t *pgid, const DOM_SID *sid);
1618 bool winbind_gid_to_sid(DOM_SID *sid, gid_t gid);
1619 struct passwd * winbind_getpwnam(const char * sname);
1620 struct passwd * winbind_getpwsid(const DOM_SID *sid);
1621 wbcErr wb_is_trusted_domain(const char *domain);
1622 bool winbind_lookup_rids(TALLOC_CTX *mem_ctx,
1623 const DOM_SID *domain_sid,
1624 int num_rids, uint32 *rids,
1625 const char **domain_name,
1626 const char ***names, enum lsa_SidType **types);
1627 bool winbind_allocate_uid(uid_t *uid);
1628 bool winbind_allocate_gid(gid_t *gid);
1629 bool winbind_get_groups(TALLOC_CTX *mem_ctx,
1630 const char *account,
1631 uint32_t *num_groups,
1633 bool winbind_get_sid_aliases(TALLOC_CTX *mem_ctx,
1634 const DOM_SID *dom_sid,
1635 const DOM_SID *members,
1637 uint32_t **pp_alias_rids,
1638 size_t *p_num_alias_rids);
1641 /* The following definitions come from lib/wins_srv.c */
1643 bool wins_srv_is_dead(struct in_addr wins_ip, struct in_addr src_ip);
1644 void wins_srv_alive(struct in_addr wins_ip, struct in_addr src_ip);
1645 void wins_srv_died(struct in_addr wins_ip, struct in_addr src_ip);
1646 unsigned wins_srv_count(void);
1647 char **wins_srv_tags(void);
1648 void wins_srv_tags_free(char **list);
1649 struct in_addr wins_srv_ip_tag(const char *tag, struct in_addr src_ip);
1650 unsigned wins_srv_count_tag(const char *tag);
1652 /* The following definitions come from libads/ads_status.c */
1654 ADS_STATUS ads_build_error(enum ads_error_type etype,
1655 int rc, int minor_status);
1656 ADS_STATUS ads_build_nt_error(enum ads_error_type etype,
1657 NTSTATUS nt_status);
1658 NTSTATUS ads_ntstatus(ADS_STATUS status);
1659 const char *ads_errstr(ADS_STATUS status);
1660 NTSTATUS gss_err_to_ntstatus(uint32 maj, uint32 min);
1662 /* The following definitions come from libads/ads_struct.c */
1664 char *ads_build_path(const char *realm, const char *sep, const char *field, int reverse);
1665 char *ads_build_dn(const char *realm);
1666 char *ads_build_domain(const char *dn);
1667 ADS_STRUCT *ads_init(const char *realm,
1668 const char *workgroup,
1669 const char *ldap_server);
1670 void ads_destroy(ADS_STRUCT **ads);
1672 /* The following definitions come from libads/ads_utils.c */
1674 uint32 ads_acb2uf(uint32 acb);
1675 uint32 ads_uf2acb(uint32 uf);
1676 uint32 ads_uf2atype(uint32 uf);
1677 uint32 ads_gtype2atype(uint32 gtype);
1678 enum lsa_SidType ads_atype_map(uint32 atype);
1680 /* The following definitions come from libads/authdata.c */
1682 struct PAC_LOGON_INFO *get_logon_info_from_pac(struct PAC_DATA *pac_data);
1683 NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
1687 time_t *expire_time,
1688 time_t *renew_till_time,
1689 const char *cache_name,
1691 bool add_netbios_addr,
1692 time_t renewable_time,
1693 struct PAC_DATA **pac_ret);
1694 NTSTATUS kerberos_return_info3_from_pac(TALLOC_CTX *mem_ctx,
1698 time_t *expire_time,
1699 time_t *renew_till_time,
1700 const char *cache_name,
1702 bool add_netbios_addr,
1703 time_t renewable_time,
1704 struct netr_SamInfo3 **info3);
1706 /* The following definitions come from libads/cldap.c */
1707 bool ads_cldap_netlogon(TALLOC_CTX *mem_ctx,
1710 uint32_t nt_version,
1711 struct netlogon_samlogon_response **reply);
1712 bool ads_cldap_netlogon_5(TALLOC_CTX *mem_ctx,
1715 struct NETLOGON_SAM_LOGON_RESPONSE_EX *reply5);
1717 /* The following definitions come from libads/disp_sec.c */
1719 void ads_disp_sd(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, SEC_DESC *sd);
1721 /* The following definitions come from libads/dns.c */
1723 NTSTATUS ads_dns_lookup_ns(TALLOC_CTX *ctx,
1724 const char *dnsdomain,
1725 struct dns_rr_ns **nslist,
1727 bool sitename_store(const char *realm, const char *sitename);
1728 char *sitename_fetch(const char *realm);
1729 bool stored_sitename_changed(const char *realm, const char *sitename);
1730 NTSTATUS ads_dns_query_dcs(TALLOC_CTX *ctx,
1732 const char *sitename,
1733 struct dns_rr_srv **dclist,
1735 NTSTATUS ads_dns_query_gcs(TALLOC_CTX *ctx,
1737 const char *sitename,
1738 struct dns_rr_srv **dclist,
1740 NTSTATUS ads_dns_query_kdcs(TALLOC_CTX *ctx,
1741 const char *dns_forest_name,
1742 const char *sitename,
1743 struct dns_rr_srv **dclist,
1745 NTSTATUS ads_dns_query_pdc(TALLOC_CTX *ctx,
1746 const char *dns_domain_name,
1747 struct dns_rr_srv **dclist,
1749 NTSTATUS ads_dns_query_dcs_guid(TALLOC_CTX *ctx,
1750 const char *dns_forest_name,
1751 const struct GUID *domain_guid,
1752 struct dns_rr_srv **dclist,
1755 /* The following definitions come from libads/kerberos.c */
1757 int kerberos_kinit_password_ext(const char *principal,
1758 const char *password,
1760 time_t *expire_time,
1761 time_t *renew_till_time,
1762 const char *cache_name,
1764 bool add_netbios_addr,
1765 time_t renewable_time,
1766 NTSTATUS *ntstatus);
1767 int ads_kinit_password(ADS_STRUCT *ads);
1768 int ads_kdestroy(const char *cc_name);
1769 char* kerberos_standard_des_salt( void );
1770 bool kerberos_secrets_store_des_salt( const char* salt );
1771 char* kerberos_secrets_fetch_des_salt( void );
1772 char *kerberos_get_default_realm_from_ccache( void );
1773 bool kerberos_secrets_store_salting_principal(const char *service,
1775 const char *principal);
1776 int kerberos_kinit_password(const char *principal,
1777 const char *password,
1779 const char *cache_name);
1780 bool create_local_private_krb5_conf_for_domain(const char *realm,
1782 const char *sitename,
1783 struct sockaddr_storage *pss);
1786 /* The following definitions come from libsmb/credentials.c */
1788 char *credstr(const unsigned char *cred);
1789 void creds_server_init(uint32 neg_flags,
1791 struct netr_Credential *clnt_chal,
1792 struct netr_Credential *srv_chal,
1793 const unsigned char mach_pw[16],
1794 struct netr_Credential *init_chal_out);
1795 bool netlogon_creds_server_check(const struct dcinfo *dc,
1796 const struct netr_Credential *rcv_cli_chal_in);
1797 bool netlogon_creds_server_step(struct dcinfo *dc,
1798 const struct netr_Authenticator *received_cred,
1799 struct netr_Authenticator *cred_out);
1800 void cred_hash3(unsigned char *out, const unsigned char *in, const unsigned char *key, int forw);
1802 /* The following definitions come from libads/kerberos_keytab.c */
1804 int ads_keytab_add_entry(ADS_STRUCT *ads, const char *srvPrinc);
1805 int ads_keytab_flush(ADS_STRUCT *ads);
1806 int ads_keytab_create_default(ADS_STRUCT *ads);
1807 int ads_keytab_list(const char *keytab_name);
1809 /* The following definitions come from libads/kerberos_verify.c */
1811 NTSTATUS ads_verify_ticket(TALLOC_CTX *mem_ctx,
1814 const DATA_BLOB *ticket,
1816 struct PAC_DATA **pac_data,
1818 DATA_BLOB *session_key,
1819 bool use_replay_cache);
1821 /* The following definitions come from libads/krb5_errs.c */
1824 /* The following definitions come from libads/krb5_setpw.c */
1826 ADS_STATUS ads_krb5_set_password(const char *kdc_host, const char *princ,
1827 const char *newpw, int time_offset);
1828 ADS_STATUS kerberos_set_password(const char *kpasswd_server,
1829 const char *auth_principal, const char *auth_password,
1830 const char *target_principal, const char *new_password,
1832 ADS_STATUS ads_set_machine_password(ADS_STRUCT *ads,
1833 const char *machine_account,
1834 const char *password);
1836 /* The following definitions come from libads/ldap.c */
1838 bool ads_sitename_match(ADS_STRUCT *ads);
1839 bool ads_closest_dc(ADS_STRUCT *ads);
1840 ADS_STATUS ads_connect(ADS_STRUCT *ads);
1841 ADS_STATUS ads_connect_user_creds(ADS_STRUCT *ads);
1842 ADS_STATUS ads_connect_gc(ADS_STRUCT *ads);
1843 void ads_disconnect(ADS_STRUCT *ads);
1844 ADS_STATUS ads_do_search_all_fn(ADS_STRUCT *ads, const char *bind_path,
1845 int scope, const char *expr, const char **attrs,
1846 bool (*fn)(ADS_STRUCT *, char *, void **, void *),
1848 char *ads_parent_dn(const char *dn);
1849 ADS_MODLIST ads_init_mods(TALLOC_CTX *ctx);
1850 ADS_STATUS ads_mod_str(TALLOC_CTX *ctx, ADS_MODLIST *mods,
1851 const char *name, const char *val);
1852 ADS_STATUS ads_mod_strlist(TALLOC_CTX *ctx, ADS_MODLIST *mods,
1853 const char *name, const char **vals);
1854 ADS_STATUS ads_gen_mod(ADS_STRUCT *ads, const char *mod_dn, ADS_MODLIST mods);
1855 ADS_STATUS ads_gen_add(ADS_STRUCT *ads, const char *new_dn, ADS_MODLIST mods);
1856 ADS_STATUS ads_del_dn(ADS_STRUCT *ads, char *del_dn);
1857 char *ads_ou_string(ADS_STRUCT *ads, const char *org_unit);
1858 char *ads_default_ou_string(ADS_STRUCT *ads, const char *wknguid);
1859 ADS_STATUS ads_add_strlist(TALLOC_CTX *ctx, ADS_MODLIST *mods,
1860 const char *name, const char **vals);
1861 uint32 ads_get_kvno(ADS_STRUCT *ads, const char *account_name);
1862 uint32_t ads_get_machine_kvno(ADS_STRUCT *ads, const char *machine_name);
1863 ADS_STATUS ads_clear_service_principal_names(ADS_STRUCT *ads, const char *machine_name);
1864 ADS_STATUS ads_add_service_principal_name(ADS_STRUCT *ads, const char *machine_name,
1865 const char *my_fqdn, const char *spn);
1866 ADS_STATUS ads_create_machine_acct(ADS_STRUCT *ads, const char *machine_name,
1867 const char *org_unit);
1868 ADS_STATUS ads_move_machine_acct(ADS_STRUCT *ads, const char *machine_name,
1869 const char *org_unit, bool *moved);
1870 int ads_count_replies(ADS_STRUCT *ads, void *res);
1871 ADS_STATUS ads_USN(ADS_STRUCT *ads, uint32 *usn);
1872 ADS_STATUS ads_current_time(ADS_STRUCT *ads);
1873 ADS_STATUS ads_domain_func_level(ADS_STRUCT *ads, uint32 *val);
1874 ADS_STATUS ads_domain_sid(ADS_STRUCT *ads, DOM_SID *sid);
1875 ADS_STATUS ads_site_dn(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const char **site_name);
1876 ADS_STATUS ads_site_dn_for_machine(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const char *computer_name, const char **site_dn);
1877 ADS_STATUS ads_upn_suffixes(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char ***suffixes, size_t *num_suffixes);
1878 ADS_STATUS ads_get_joinable_ous(ADS_STRUCT *ads,
1879 TALLOC_CTX *mem_ctx,
1882 ADS_STATUS ads_get_sid_from_extended_dn(TALLOC_CTX *mem_ctx,
1883 const char *extended_dn,
1884 enum ads_extended_dn_flags flags,
1886 char* ads_get_dnshostname( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name );
1887 char* ads_get_upn( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name );
1888 char* ads_get_samaccountname( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name );
1889 ADS_STATUS ads_join_realm(ADS_STRUCT *ads, const char *machine_name,
1890 uint32 account_type, const char *org_unit);
1891 ADS_STATUS ads_leave_realm(ADS_STRUCT *ads, const char *hostname);
1892 ADS_STATUS ads_find_samaccount(ADS_STRUCT *ads,
1893 TALLOC_CTX *mem_ctx,
1894 const char *samaccountname,
1896 const char **dn_ret);
1897 ADS_STATUS ads_config_path(ADS_STRUCT *ads,
1898 TALLOC_CTX *mem_ctx,
1899 char **config_path);
1900 const char *ads_get_extended_right_name_by_guid(ADS_STRUCT *ads,
1901 const char *config_path,
1902 TALLOC_CTX *mem_ctx,
1903 const struct GUID *rights_guid);
1904 ADS_STATUS ads_check_ou_dn(TALLOC_CTX *mem_ctx,
1906 const char **account_ou);
1908 /* The following definitions come from libads/ldap_printer.c */
1910 ADS_STATUS ads_mod_printer_entry(ADS_STRUCT *ads, char *prt_dn,
1911 TALLOC_CTX *ctx, const ADS_MODLIST *mods);
1912 ADS_STATUS ads_add_printer_entry(ADS_STRUCT *ads, char *prt_dn,
1913 TALLOC_CTX *ctx, ADS_MODLIST *mods);
1914 WERROR get_remote_printer_publishing_data(struct rpc_pipe_client *cli,
1915 TALLOC_CTX *mem_ctx,
1917 const char *printer);
1918 bool get_local_printer_publishing_data(TALLOC_CTX *mem_ctx,
1920 NT_PRINTER_DATA *data);
1922 /* The following definitions come from libads/ldap_schema.c */
1924 ADS_STATUS ads_get_attrnames_by_oids(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
1925 const char *schema_path,
1926 const char **OIDs, size_t num_OIDs,
1927 char ***OIDs_out, char ***names, size_t *count);
1928 const char *ads_get_attrname_by_guid(ADS_STRUCT *ads,
1929 const char *schema_path,
1930 TALLOC_CTX *mem_ctx,
1931 const struct GUID *schema_guid);
1932 const char *ads_get_attrname_by_oid(ADS_STRUCT *ads, const char *schema_path, TALLOC_CTX *mem_ctx, const char * OID);
1933 ADS_STATUS ads_schema_path(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char **schema_path);
1934 ADS_STATUS ads_check_posix_schema_mapping(TALLOC_CTX *mem_ctx,
1936 enum wb_posix_mapping map_type,
1937 struct posix_schema **s ) ;
1939 /* The following definitions come from libads/ldap_user.c */
1941 ADS_STATUS ads_add_user_acct(ADS_STRUCT *ads, const char *user,
1942 const char *container, const char *fullname);
1943 ADS_STATUS ads_add_group_acct(ADS_STRUCT *ads, const char *group,
1944 const char *container, const char *comment);
1946 /* The following definitions come from libads/ldap_utils.c */
1948 ADS_STATUS ads_ranged_search(ADS_STRUCT *ads,
1949 TALLOC_CTX *mem_ctx,
1954 const char *range_attr,
1956 size_t *num_strings);
1957 ADS_STATUS ads_ranged_search_internal(ADS_STRUCT *ads,
1958 TALLOC_CTX *mem_ctx,
1964 const char *range_attr,
1966 size_t *num_strings,
1971 /* The following definitions come from libads/ndr.c */
1973 void ndr_print_ads_auth_flags(struct ndr_print *ndr, const char *name, uint32_t r);
1974 void ndr_print_ads_struct(struct ndr_print *ndr, const char *name, const struct ads_struct *r);
1976 /* The following definitions come from libads/sasl.c */
1978 ADS_STATUS ads_sasl_bind(ADS_STRUCT *ads);
1980 /* The following definitions come from libads/sasl_wrapping.c */
1982 ADS_STATUS ads_setup_sasl_wrapping(ADS_STRUCT *ads,
1983 const struct ads_saslwrap_ops *ops,
1984 void *private_data);
1985 ADS_STATUS ads_setup_sasl_wrapping(ADS_STRUCT *ads,
1986 const struct ads_saslwrap_ops *ops,
1987 void *private_data);
1989 /* The following definitions come from libads/util.c */
1991 ADS_STATUS ads_change_trust_account_password(ADS_STRUCT *ads, char *host_principal);
1992 ADS_STATUS ads_guess_service_principal(ADS_STRUCT *ads,
1993 char **returned_principal);
1995 /* The following definitions come from libgpo/gpext/gpext.c */
1997 struct gp_extension *get_gp_extension_list(void);
1998 NTSTATUS unregister_gp_extension(const char *name);
1999 NTSTATUS register_gp_extension(TALLOC_CTX *gpext_ctx,
2003 struct gp_extension_methods *methods);
2004 NTSTATUS gp_ext_info_add_entry(TALLOC_CTX *mem_ctx,
2006 const char *ext_guid,
2007 struct gp_extension_reg_table *table,
2008 struct gp_extension_reg_info *info);
2009 NTSTATUS shutdown_gp_extensions(void);
2010 NTSTATUS init_gp_extensions(TALLOC_CTX *mem_ctx);
2011 NTSTATUS free_gp_extensions(void);
2012 void debug_gpext_header(int lvl,
2015 struct GROUP_POLICY_OBJECT *gpo,
2016 const char *extension_guid,
2017 const char *snapin_guid);
2018 NTSTATUS process_gpo_list_with_extension(ADS_STRUCT *ads,
2019 TALLOC_CTX *mem_ctx,
2021 const struct nt_user_token *token,
2022 struct GROUP_POLICY_OBJECT *gpo_list,
2023 const char *extension_guid,
2024 const char *snapin_guid);
2025 NTSTATUS gpext_process_extension(ADS_STRUCT *ads,
2026 TALLOC_CTX *mem_ctx,
2028 const struct nt_user_token *token,
2029 struct registry_key *root_key,
2030 struct GROUP_POLICY_OBJECT *gpo,
2031 const char *extension_guid,
2032 const char *snapin_guid);
2034 /* The following definitions come from libgpo/gpo_fetch.c */
2036 NTSTATUS gpo_explode_filesyspath(TALLOC_CTX *mem_ctx,
2037 const char *file_sys_path,
2042 NTSTATUS gpo_fetch_files(TALLOC_CTX *mem_ctx,
2043 struct cli_state *cli,
2044 struct GROUP_POLICY_OBJECT *gpo);
2045 NTSTATUS gpo_get_sysvol_gpt_version(TALLOC_CTX *mem_ctx,
2046 const char *unix_path,
2047 uint32_t *sysvol_version,
2048 char **display_name);
2050 /* The following definitions come from libgpo/gpo_filesync.c */
2052 NTSTATUS gpo_copy_file(TALLOC_CTX *mem_ctx,
2053 struct cli_state *cli,
2054 const char *nt_path,
2055 const char *unix_path);
2056 NTSTATUS gpo_sync_directories(TALLOC_CTX *mem_ctx,
2057 struct cli_state *cli,
2058 const char *nt_path,
2059 const char *local_path);
2061 /* The following definitions come from libgpo/gpo_ini.c */
2063 NTSTATUS parse_gpt_ini(TALLOC_CTX *mem_ctx,
2064 const char *filename,
2066 char **display_name);
2068 /* The following definitions come from libgpo/gpo_ldap.c */
2070 bool ads_parse_gp_ext(TALLOC_CTX *mem_ctx,
2071 const char *extension_raw,
2072 struct GP_EXT **gp_ext);
2073 ADS_STATUS ads_get_gpo_link(ADS_STRUCT *ads,
2074 TALLOC_CTX *mem_ctx,
2075 const char *link_dn,
2076 struct GP_LINK *gp_link_struct);
2077 ADS_STATUS ads_add_gpo_link(ADS_STRUCT *ads,
2078 TALLOC_CTX *mem_ctx,
2079 const char *link_dn,
2082 ADS_STATUS ads_delete_gpo_link(ADS_STRUCT *ads,
2083 TALLOC_CTX *mem_ctx,
2084 const char *link_dn,
2085 const char *gpo_dn);
2086 ADS_STATUS ads_get_gpo(ADS_STRUCT *ads,
2087 TALLOC_CTX *mem_ctx,
2089 const char *display_name,
2090 const char *guid_name,
2091 struct GROUP_POLICY_OBJECT *gpo);
2092 ADS_STATUS ads_get_sid_token(ADS_STRUCT *ads,
2093 TALLOC_CTX *mem_ctx,
2095 struct nt_user_token **token);
2096 ADS_STATUS ads_get_gpo_list(ADS_STRUCT *ads,
2097 TALLOC_CTX *mem_ctx,
2100 const struct nt_user_token *token,
2101 struct GROUP_POLICY_OBJECT **gpo_list);
2103 /* The following definitions come from libgpo/gpo_reg.c */
2105 struct nt_user_token *registry_create_system_token(TALLOC_CTX *mem_ctx);
2106 WERROR gp_init_reg_ctx(TALLOC_CTX *mem_ctx,
2107 const char *initial_path,
2108 uint32_t desired_access,
2109 const struct nt_user_token *token,
2110 struct gp_registry_context **reg_ctx);
2111 void gp_free_reg_ctx(struct gp_registry_context *reg_ctx);
2112 WERROR gp_store_reg_subkey(TALLOC_CTX *mem_ctx,
2113 const char *subkeyname,
2114 struct registry_key *curr_key,
2115 struct registry_key **new_key);
2116 WERROR gp_read_reg_subkey(TALLOC_CTX *mem_ctx,
2117 struct gp_registry_context *reg_ctx,
2118 const char *subkeyname,
2119 struct registry_key **key);
2120 WERROR gp_store_reg_val_sz(TALLOC_CTX *mem_ctx,
2121 struct registry_key *key,
2122 const char *val_name,
2124 WERROR gp_read_reg_val_sz(TALLOC_CTX *mem_ctx,
2125 struct registry_key *key,
2126 const char *val_name,
2128 WERROR gp_reg_state_store(TALLOC_CTX *mem_ctx,
2131 const struct nt_user_token *token,
2132 struct GROUP_POLICY_OBJECT *gpo_list);
2133 WERROR gp_reg_state_read(TALLOC_CTX *mem_ctx,
2136 struct GROUP_POLICY_OBJECT **gpo_list);
2137 WERROR gp_secure_key(TALLOC_CTX *mem_ctx,
2139 struct registry_key *key,
2140 const DOM_SID *sid);
2141 void dump_reg_val(int lvl, const char *direction,
2142 const char *key, const char *subkey,
2143 struct registry_value *val);
2144 void dump_reg_entry(uint32_t flags,
2146 struct gp_registry_entry *entry);
2147 void dump_reg_entries(uint32_t flags,
2149 struct gp_registry_entry *entries,
2150 size_t num_entries);
2151 bool add_gp_registry_entry_to_array(TALLOC_CTX *mem_ctx,
2152 struct gp_registry_entry *entry,
2153 struct gp_registry_entry **entries,
2155 WERROR reg_apply_registry_entry(TALLOC_CTX *mem_ctx,
2156 struct registry_key *root_key,
2157 struct gp_registry_context *reg_ctx,
2158 struct gp_registry_entry *entry,
2159 const struct nt_user_token *token,
2162 /* The following definitions come from libgpo/gpo_sec.c */
2164 NTSTATUS gpo_apply_security_filtering(const struct GROUP_POLICY_OBJECT *gpo,
2165 const struct nt_user_token *token);
2167 /* The following definitions come from libgpo/gpo_util.c */
2169 const char *cse_gpo_guid_string_to_name(const char *guid);
2170 const char *cse_gpo_name_to_guid_string(const char *name);
2171 const char *cse_snapin_gpo_guid_string_to_name(const char *guid);
2172 void dump_gp_ext(struct GP_EXT *gp_ext, int debuglevel);
2173 void dump_gpo(ADS_STRUCT *ads,
2174 TALLOC_CTX *mem_ctx,
2175 struct GROUP_POLICY_OBJECT *gpo,
2177 void dump_gpo_list(ADS_STRUCT *ads,
2178 TALLOC_CTX *mem_ctx,
2179 struct GROUP_POLICY_OBJECT *gpo_list,
2181 void dump_gplink(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, struct GP_LINK *gp_link);
2182 ADS_STATUS gpo_process_a_gpo(ADS_STRUCT *ads,
2183 TALLOC_CTX *mem_ctx,
2184 const struct nt_user_token *token,
2185 struct registry_key *root_key,
2186 struct GROUP_POLICY_OBJECT *gpo,
2187 const char *extension_guid_filter,
2189 ADS_STATUS gpo_process_gpo_list(ADS_STRUCT *ads,
2190 TALLOC_CTX *mem_ctx,
2191 const struct nt_user_token *token,
2192 struct GROUP_POLICY_OBJECT *gpo_list,
2193 const char *extensions_guid_filter,
2195 NTSTATUS check_refresh_gpo(ADS_STRUCT *ads,
2196 TALLOC_CTX *mem_ctx,
2198 struct GROUP_POLICY_OBJECT *gpo,
2199 struct cli_state **cli_out);
2200 NTSTATUS check_refresh_gpo_list(ADS_STRUCT *ads,
2201 TALLOC_CTX *mem_ctx,
2203 struct GROUP_POLICY_OBJECT *gpo_list);
2204 NTSTATUS gpo_get_unix_path(TALLOC_CTX *mem_ctx,
2205 struct GROUP_POLICY_OBJECT *gpo,
2207 char *gpo_flag_str(uint32_t flags);
2208 NTSTATUS gp_find_file(TALLOC_CTX *mem_ctx,
2210 const char *filename,
2212 const char **filename_out);
2213 ADS_STATUS gp_get_machine_token(ADS_STRUCT *ads,
2214 TALLOC_CTX *mem_ctx,
2216 struct nt_user_token **token);
2218 #include "librpc/gen_ndr/ndr_dfs.h"
2219 #include "librpc/gen_ndr/ndr_dssetup.h"
2220 #include "librpc/gen_ndr/ndr_echo.h"
2221 #include "librpc/gen_ndr/ndr_eventlog.h"
2222 #include "librpc/gen_ndr/ndr_krb5pac.h"
2223 #include "librpc/gen_ndr/ndr_lsa.h"
2224 #include "librpc/gen_ndr/ndr_misc.h"
2225 #include "librpc/gen_ndr/ndr_netlogon.h"
2226 #include "librpc/gen_ndr/ndr_notify.h"
2227 #include "librpc/gen_ndr/ndr_ntsvcs.h"
2228 #include "librpc/gen_ndr/ndr_samr.h"
2229 #include "librpc/gen_ndr/ndr_security.h"
2230 #include "librpc/gen_ndr/ndr_srvsvc.h"
2231 #include "librpc/gen_ndr/ndr_svcctl.h"
2232 #include "librpc/gen_ndr/ndr_winreg.h"
2233 #include "librpc/gen_ndr/ndr_wkssvc.h"
2235 #include "librpc/gen_ndr/srv_dfs.h"
2236 #include "librpc/gen_ndr/srv_dssetup.h"
2237 #include "librpc/gen_ndr/srv_echo.h"
2238 #include "librpc/gen_ndr/srv_eventlog.h"
2239 #include "librpc/gen_ndr/srv_initshutdown.h"
2240 #include "librpc/gen_ndr/srv_lsa.h"
2241 #include "librpc/gen_ndr/srv_netlogon.h"
2242 #include "librpc/gen_ndr/srv_ntsvcs.h"
2243 #include "librpc/gen_ndr/srv_samr.h"
2244 #include "librpc/gen_ndr/srv_srvsvc.h"
2245 #include "librpc/gen_ndr/srv_svcctl.h"
2246 #include "librpc/gen_ndr/srv_winreg.h"
2247 #include "librpc/gen_ndr/srv_wkssvc.h"
2248 #include "librpc/gen_ndr/srv_spoolss.h"
2250 #include "librpc/ndr/libndr.h"
2252 /* The following definitions come from librpc/ndr/util.c */
2254 enum ndr_err_code ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct server_id *r);
2255 enum ndr_err_code ndr_pull_server_id(struct ndr_pull *ndr, int ndr_flags, struct server_id *r);
2256 void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct server_id *r);
2257 enum ndr_err_code ndr_push_file_id(struct ndr_push *ndr, int ndr_flags, const struct file_id *r);
2258 enum ndr_err_code ndr_pull_file_id(struct ndr_pull *ndr, int ndr_flags, struct file_id *r);
2259 void ndr_print_file_id(struct ndr_print *ndr, const char *name, const struct file_id *r);
2260 _PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const bool b);
2261 _PUBLIC_ void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss);
2262 const char *ndr_errstr(enum ndr_err_code err);
2264 /* The following definitions come from librpc/ndr/sid.c */
2266 char *dom_sid_string(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
2268 /* The following definitions come from librpc/rpc/binding.c */
2270 const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor);
2271 _PUBLIC_ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_binding *b);
2272 _PUBLIC_ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_binding **b_out);
2273 _PUBLIC_ NTSTATUS dcerpc_floor_get_lhs_data(const struct epm_floor *epm_floor,
2274 struct ndr_syntax_id *syntax);
2275 const char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor);
2276 enum dcerpc_transport_t dcerpc_transport_by_endpoint_protocol(int prot);
2277 _PUBLIC_ enum dcerpc_transport_t dcerpc_transport_by_tower(const struct epm_tower *tower);
2278 _PUBLIC_ const char *derpc_transport_string_by_transport(enum dcerpc_transport_t t);
2279 _PUBLIC_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx,
2280 struct epm_tower *tower,
2281 struct dcerpc_binding **b_out);
2282 _PUBLIC_ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx,
2283 const struct dcerpc_binding *binding,
2284 struct epm_tower *tower);
2286 /* The following definitions come from librpc/rpc/dcerpc.c */
2288 struct rpc_request *dcerpc_ndr_request_send(struct dcerpc_pipe *p, const struct GUID *object,
2289 const struct ndr_interface_table *table, uint32_t opnum,
2290 TALLOC_CTX *mem_ctx, void *r);
2291 NTSTATUS dcerpc_ndr_request_recv(struct rpc_request *req);
2292 _PUBLIC_ NTSTATUS dcerpc_pipe_connect(TALLOC_CTX *parent_ctx, struct dcerpc_pipe **pp,
2293 const char *binding_string, const struct ndr_interface_table *table,
2294 struct cli_credentials *credentials, struct event_context *ev,
2295 struct loadparm_context *lp_ctx);
2297 /* The following definitions come from libsmb/cliconnect.c */
2299 ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
2300 const char *pass, const char *user_domain,
2301 const char * dest_realm);
2303 NTSTATUS cli_session_setup(struct cli_state *cli,
2305 const char *pass, int passlen,
2306 const char *ntpass, int ntpasslen,
2307 const char *workgroup);
2308 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
2309 struct event_context *ev,
2310 struct cli_state *cli);
2311 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
2312 bool cli_ulogoff(struct cli_state *cli);
2313 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
2314 struct event_context *ev,
2315 struct cli_state *cli,
2316 const char *share, const char *dev,
2317 const char *pass, int passlen);
2318 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
2319 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
2320 const char *dev, const char *pass, int passlen);
2321 bool cli_tdis(struct cli_state *cli);
2322 void cli_negprot_sendsync(struct cli_state *cli);
2323 NTSTATUS cli_negprot(struct cli_state *cli);
2324 struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
2325 struct event_context *ev,
2326 struct cli_state *cli);
2327 NTSTATUS cli_negprot_recv(struct tevent_req *req);
2328 bool cli_session_request(struct cli_state *cli,
2329 struct nmb_name *calling, struct nmb_name *called);
2330 NTSTATUS cli_connect(struct cli_state *cli,
2332 struct sockaddr_storage *dest_ss);
2333 NTSTATUS cli_start_connection(struct cli_state **output_cli,
2334 const char *my_name,
2335 const char *dest_host,
2336 struct sockaddr_storage *dest_ss, int port,
2337 int signing_state, int flags,
2339 NTSTATUS cli_full_connection(struct cli_state **output_cli,
2340 const char *my_name,
2341 const char *dest_host,
2342 struct sockaddr_storage *dest_ss, int port,
2343 const char *service, const char *service_type,
2344 const char *user, const char *domain,
2345 const char *password, int flags,
2348 bool attempt_netbios_session_request(struct cli_state **ppcli, const char *srchost, const char *desthost,
2349 struct sockaddr_storage *pdest_ss);
2350 NTSTATUS cli_raw_tcon(struct cli_state *cli,
2351 const char *service, const char *pass, const char *dev,
2352 uint16 *max_xmit, uint16 *tid);
2353 struct cli_state *get_ipc_connect(char *server,
2354 struct sockaddr_storage *server_ss,
2355 const struct user_auth_info *user_info);
2356 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
2357 struct ip_service *mb_ip,
2358 const struct user_auth_info *user_info,
2359 char **pp_workgroup_out);
2360 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
2361 const struct user_auth_info *user_info,
2362 char **pp_workgroup_out);
2364 /* The following definitions come from libsmb/clidfs.c */
2366 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
2367 const char *username,
2368 const char *password,
2370 const char *sharename);
2371 struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
2372 struct cli_state *referring_cli,
2375 const struct user_auth_info *auth_info,
2381 void cli_cm_display(const struct cli_state *c);
2382 bool cli_dfs_get_referral(TALLOC_CTX *ctx,
2383 struct cli_state *cli,
2385 CLIENT_DFS_REFERRAL**refs,
2388 bool cli_resolve_path(TALLOC_CTX *ctx,
2389 const char *mountpt,
2390 const struct user_auth_info *dfs_auth_info,
2391 struct cli_state *rootcli,
2393 struct cli_state **targetcli,
2394 char **pp_targetpath);
2396 /* The following definitions come from libsmb/clidgram.c */
2398 bool cli_send_mailslot(struct messaging_context *msg_ctx,
2399 bool unique, const char *mailslot,
2402 const char *srcname, int src_type,
2403 const char *dstname, int dest_type,
2404 const struct sockaddr_storage *dest_ss);
2405 bool send_getdc_request(TALLOC_CTX *mem_ctx,
2406 struct messaging_context *msg_ctx,
2407 struct sockaddr_storage *dc_ss,
2408 const char *domain_name,
2410 uint32_t nt_version);
2411 bool receive_getdc_response(TALLOC_CTX *mem_ctx,
2412 struct sockaddr_storage *dc_ss,
2413 const char *domain_name,
2414 uint32_t *nt_version,
2415 const char **dc_name,
2416 struct netlogon_samlogon_response **reply);
2418 /* The following definitions come from libsmb/clientgen.c */
2420 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
2421 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
2422 void cli_set_port(struct cli_state *cli, int port);
2423 bool cli_state_seqnum_persistent(struct cli_state *cli,
2425 bool cli_state_seqnum_remove(struct cli_state *cli,
2427 bool cli_receive_smb(struct cli_state *cli);
2428 ssize_t cli_receive_smb_data(struct cli_state *cli, char *buffer, size_t len);
2429 bool cli_receive_smb_readX_header(struct cli_state *cli);
2430 bool cli_send_smb(struct cli_state *cli);
2431 bool cli_send_smb_direct_writeX(struct cli_state *cli,
2434 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
2435 void cli_setup_packet(struct cli_state *cli);
2436 void cli_setup_bcc(struct cli_state *cli, void *p);
2437 NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
2438 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);
2439 NTSTATUS cli_set_password(struct cli_state *cli, const char *password);
2440 NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password);
2441 struct cli_state *cli_initialise(void);
2442 struct cli_state *cli_initialise_ex(int signing_state);
2443 void cli_nt_pipes_close(struct cli_state *cli);
2444 void cli_shutdown(struct cli_state *cli);
2445 void cli_sockopt(struct cli_state *cli, const char *options);
2446 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
2447 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
2448 bool cli_send_keepalive(struct cli_state *cli);
2449 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
2450 struct cli_state *cli, uint16_t num_echos,
2452 NTSTATUS cli_echo_recv(struct tevent_req *req);
2453 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
2454 bool cli_ucs2(struct cli_state *cli);
2455 bool is_andx_req(uint8_t cmd);
2457 /* The following definitions come from libsmb/clierror.c */
2459 const char *cli_errstr(struct cli_state *cli);
2460 NTSTATUS cli_nt_error(struct cli_state *cli);
2461 void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode);
2462 int cli_errno(struct cli_state *cli);
2463 bool cli_is_error(struct cli_state *cli);
2464 bool cli_is_nt_error(struct cli_state *cli);
2465 bool cli_is_dos_error(struct cli_state *cli);
2466 NTSTATUS cli_get_nt_error(struct cli_state *cli);
2467 void cli_set_nt_error(struct cli_state *cli, NTSTATUS status);
2468 void cli_reset_error(struct cli_state *cli);
2470 /* The following definitions come from libsmb/clifile.c */
2472 uint32 unix_perms_to_wire(mode_t perms);
2473 mode_t wire_perms_to_unix(uint32 perms);
2474 bool cli_unix_getfacl(struct cli_state *cli, const char *name, size_t *prb_size, char **retbuf);
2475 bool cli_unix_stat(struct cli_state *cli, const char *name, SMB_STRUCT_STAT *sbuf);
2476 bool cli_unix_symlink(struct cli_state *cli, const char *oldname, const char *newname);
2477 bool cli_unix_hardlink(struct cli_state *cli, const char *oldname, const char *newname);
2478 bool cli_unix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
2479 bool cli_unix_chown(struct cli_state *cli, const char *fname, uid_t uid, gid_t gid);
2480 bool cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
2481 bool cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
2482 bool cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
2483 bool cli_unlink_full(struct cli_state *cli, const char *fname, uint16 attrs);
2484 bool cli_unlink(struct cli_state *cli, const char *fname);
2485 bool cli_mkdir(struct cli_state *cli, const char *dname);
2486 bool cli_rmdir(struct cli_state *cli, const char *dname);
2487 int cli_nt_delete_on_close(struct cli_state *cli, int fnum, bool flag);
2488 int cli_nt_create_full(struct cli_state *cli, const char *fname,
2489 uint32 CreatFlags, uint32 DesiredAccess,
2490 uint32 FileAttributes, uint32 ShareAccess,
2491 uint32 CreateDisposition, uint32 CreateOptions,
2492 uint8 SecuityFlags);
2493 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
2494 struct event_context *ev,
2495 struct cli_state *cli,
2497 uint32_t CreatFlags,
2498 uint32_t DesiredAccess,
2499 uint32_t FileAttributes,
2500 uint32_t ShareAccess,
2501 uint32_t CreateDisposition,
2502 uint32_t CreateOptions,
2503 uint8_t SecurityFlags);
2504 NTSTATUS cli_ntcreate_recv(struct tevent_req *req, uint16_t *pfnum);
2505 NTSTATUS cli_ntcreate(struct cli_state *cli,
2507 uint32_t CreatFlags,
2508 uint32_t DesiredAccess,
2509 uint32_t FileAttributes,
2510 uint32_t ShareAccess,
2511 uint32_t CreateDisposition,
2512 uint32_t CreateOptions,
2513 uint8_t SecurityFlags,
2515 int cli_nt_create(struct cli_state *cli, const char *fname, uint32 DesiredAccess);
2516 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
2517 size_t str_len, size_t *pconverted_size);
2518 struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx,
2519 struct event_context *ev,
2520 struct cli_state *cli, const char *fname,
2521 int flags, int share_mode,
2522 struct tevent_req **psmbreq);
2523 struct tevent_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
2524 struct cli_state *cli, const char *fname,
2525 int flags, int share_mode);
2526 NTSTATUS cli_open_recv(struct tevent_req *req, int *fnum);
2527 int cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode);
2528 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
2529 struct event_context *ev,
2530 struct cli_state *cli, int fnum,
2531 struct tevent_req **psubreq);
2532 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
2533 struct event_context *ev,
2534 struct cli_state *cli, int fnum);
2535 NTSTATUS cli_close_recv(struct tevent_req *req);
2536 bool cli_close(struct cli_state *cli, int fnum);
2537 bool cli_ftruncate(struct cli_state *cli, int fnum, uint64_t size);
2538 NTSTATUS cli_locktype(struct cli_state *cli, int fnum,
2539 uint32 offset, uint32 len,
2540 int timeout, unsigned char locktype);
2541 bool cli_lock(struct cli_state *cli, int fnum,
2542 uint32 offset, uint32 len, int timeout, enum brl_type lock_type);
2543 bool cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len);
2544 bool cli_lock64(struct cli_state *cli, int fnum,
2545 uint64_t offset, uint64_t len, int timeout, enum brl_type lock_type);
2546 bool cli_unlock64(struct cli_state *cli, int fnum, uint64_t offset, uint64_t len);
2547 bool cli_posix_lock(struct cli_state *cli, int fnum,
2548 uint64_t offset, uint64_t len,
2549 bool wait_lock, enum brl_type lock_type);
2550 bool cli_posix_unlock(struct cli_state *cli, int fnum, uint64_t offset, uint64_t len);
2551 bool cli_posix_getlock(struct cli_state *cli, int fnum, uint64_t *poffset, uint64_t *plen);
2552 bool cli_getattrE(struct cli_state *cli, int fd,
2553 uint16 *attr, SMB_OFF_T *size,
2554 time_t *change_time,
2555 time_t *access_time,
2556 time_t *write_time);
2557 bool cli_getatr(struct cli_state *cli, const char *fname,
2558 uint16 *attr, SMB_OFF_T *size, time_t *write_time);
2559 bool cli_setattrE(struct cli_state *cli, int fd,
2563 bool cli_setatr(struct cli_state *cli, const char *fname, uint16 attr, time_t t);
2564 bool cli_chkpath(struct cli_state *cli, const char *path);
2565 bool cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
2566 int cli_ctemp(struct cli_state *cli, const char *path, char **tmp_path);
2567 NTSTATUS cli_raw_ioctl(struct cli_state *cli, int fnum, uint32 code, DATA_BLOB *blob);
2568 bool cli_set_ea_path(struct cli_state *cli, const char *path, const char *ea_name, const char *ea_val, size_t ea_len);
2569 bool cli_set_ea_fnum(struct cli_state *cli, int fnum, const char *ea_name, const char *ea_val, size_t ea_len);
2570 bool cli_get_ea_list_path(struct cli_state *cli, const char *path,
2573 struct ea_struct **pea_list);
2574 bool cli_get_ea_list_fnum(struct cli_state *cli, int fnum,
2577 struct ea_struct **pea_list);
2578 int cli_posix_open(struct cli_state *cli, const char *fname, int flags, mode_t mode);
2579 int cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
2580 bool cli_posix_unlink(struct cli_state *cli, const char *fname);
2581 int cli_posix_rmdir(struct cli_state *cli, const char *fname);
2583 /* The following definitions come from libsmb/clifsinfo.c */
2585 bool cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor, uint16 *pminor,
2586 uint32 *pcaplow, uint32 *pcaphigh);
2587 bool cli_set_unix_extensions_capabilities(struct cli_state *cli, uint16 major, uint16 minor,
2588 uint32 caplow, uint32 caphigh);
2589 bool cli_get_fs_attr_info(struct cli_state *cli, uint32 *fs_attr);
2590 bool cli_get_fs_volume_info_old(struct cli_state *cli, fstring volume_name, uint32 *pserial_number);
2591 bool cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name, uint32 *pserial_number, time_t *pdate);
2592 bool cli_get_fs_full_size_info(struct cli_state *cli,
2593 uint64_t *total_allocation_units,
2594 uint64_t *caller_allocation_units,
2595 uint64_t *actual_allocation_units,
2596 uint64_t *sectors_per_allocation_unit,
2597 uint64_t *bytes_per_sector);
2598 bool cli_get_posix_fs_info(struct cli_state *cli,
2599 uint32 *optimal_transfer_size,
2601 uint64_t *total_blocks,
2602 uint64_t *blocks_available,
2603 uint64_t *user_blocks_available,
2604 uint64_t *total_file_nodes,
2605 uint64_t *free_file_nodes,
2606 uint64_t *fs_identifier);
2607 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
2610 const char *domain);
2611 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
2612 NTSTATUS cli_force_encryption(struct cli_state *c,
2613 const char *username,
2614 const char *password,
2615 const char *domain);
2617 /* The following definitions come from libsmb/clikrb5.c */
2619 bool unwrap_edata_ntstatus(TALLOC_CTX *mem_ctx,
2621 DATA_BLOB *edata_out);
2622 bool unwrap_pac(TALLOC_CTX *mem_ctx, DATA_BLOB *auth_data, DATA_BLOB *unwrapped_pac_data);
2623 int cli_krb5_get_ticket(const char *principal, time_t time_offset,
2624 DATA_BLOB *ticket, DATA_BLOB *session_key_krb5,
2625 uint32 extra_ap_opts, const char *ccname,
2626 time_t *tgs_expire);
2628 /* The following definitions come from libsmb/clilist.c */
2630 int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute,
2631 void (*fn)(const char *, file_info *, const char *, void *), void *state);
2632 int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
2633 void (*fn)(const char *, file_info *, const char *, void *), void *state);
2634 int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
2635 void (*fn)(const char *, file_info *, const char *, void *), void *state);
2637 /* The following definitions come from libsmb/climessage.c */
2639 int cli_message_start_build(struct cli_state *cli, const char *host, const char *username);
2640 bool cli_message_start(struct cli_state *cli, const char *host, const char *username,
2642 int cli_message_text_build(struct cli_state *cli, const char *msg, int len, int grp);
2643 bool cli_message_text(struct cli_state *cli, const char *msg, int len, int grp);
2644 int cli_message_end_build(struct cli_state *cli, int grp);
2645 bool cli_message_end(struct cli_state *cli, int grp);
2647 /* The following definitions come from libsmb/clioplock.c */
2649 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
2650 struct tevent_context *ev,
2651 struct cli_state *cli,
2652 uint16_t fnum, uint8_t level);
2653 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
2654 bool cli_oplock_ack(struct cli_state *cli, int fnum, unsigned char level);
2655 void cli_oplock_handler(struct cli_state *cli,
2656 bool (*handler)(struct cli_state *, int, unsigned char));
2658 /* The following definitions come from libsmb/cliprint.c */
2660 int cli_print_queue(struct cli_state *cli,
2661 void (*fn)(struct print_job_info *));
2662 int cli_printjob_del(struct cli_state *cli, int job);
2663 int cli_spl_open(struct cli_state *cli, const char *fname, int flags, int share_mode);
2664 bool cli_spl_close(struct cli_state *cli, int fnum);
2666 /* The following definitions come from libsmb/cliquota.c */
2668 bool cli_get_quota_handle(struct cli_state *cli, int *quota_fnum);
2669 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
2670 bool cli_get_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
2671 bool cli_set_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
2672 bool cli_list_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_LIST **pqt_list);
2673 bool cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
2674 bool cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
2675 void dump_ntquota(SMB_NTQUOTA_STRUCT *qt, bool _verbose, bool _numeric, void (*_sidtostring)(fstring str, DOM_SID *sid, bool _numeric));
2676 void dump_ntquota_list(SMB_NTQUOTA_LIST **qtl, bool _verbose, bool _numeric, void (*_sidtostring)(fstring str, DOM_SID *sid, bool _numeric));
2678 /* The following definitions come from libsmb/clirap.c */
2680 bool cli_api(struct cli_state *cli,
2681 char *param, int prcnt, int mprcnt,
2682 char *data, int drcnt, int mdrcnt,
2683 char **rparam, unsigned int *rprcnt,
2684 char **rdata, unsigned int *rdrcnt);
2685 bool cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation);
2686 int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *, void *), void *state);
2687 bool cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
2688 void (*fn)(const char *, uint32, const char *, void *),
2690 bool cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
2691 const char *old_password);
2692 bool cli_qpathinfo(struct cli_state *cli,
2694 time_t *change_time,
2695 time_t *access_time,
2699 bool cli_setpathinfo(struct cli_state *cli, const char *fname,
2705 bool cli_qpathinfo2(struct cli_state *cli, const char *fname,
2706 struct timespec *create_time,
2707 struct timespec *access_time,
2708 struct timespec *write_time,
2709 struct timespec *change_time,
2710 SMB_OFF_T *size, uint16 *mode,
2712 bool cli_qpathinfo_streams(struct cli_state *cli, const char *fname,
2713 TALLOC_CTX *mem_ctx,
2714 unsigned int *pnum_streams,
2715 struct stream_struct **pstreams);
2716 bool cli_qfilename(struct cli_state *cli, int fnum, char *name, size_t namelen);
2717 bool cli_qfileinfo(struct cli_state *cli, int fnum,
2718 uint16 *mode, SMB_OFF_T *size,
2719 struct timespec *create_time,
2720 struct timespec *access_time,
2721 struct timespec *write_time,
2722 struct timespec *change_time,
2724 bool cli_qpathinfo_basic( struct cli_state *cli, const char *name,
2725 SMB_STRUCT_STAT *sbuf, uint32 *attributes );
2726 bool cli_qfileinfo_test(struct cli_state *cli, int fnum, int level, char **poutdata, uint32 *poutlen);
2727 NTSTATUS cli_qpathinfo_alt_name(struct cli_state *cli, const char *fname, fstring alt_name);
2729 /* The following definitions come from libsmb/clirap2.c */
2731 int cli_NetGroupDelete(struct cli_state *cli, const char *group_name);
2732 int cli_NetGroupAdd(struct cli_state *cli, RAP_GROUP_INFO_1 *grinfo);
2733 int cli_RNetGroupEnum(struct cli_state *cli, void (*fn)(const char *, const char *, void *), void *state);
2734 int cli_RNetGroupEnum0(struct cli_state *cli,
2735 void (*fn)(const char *, void *),
2737 int cli_NetGroupDelUser(struct cli_state * cli, const char *group_name, const char *user_name);
2738 int cli_NetGroupAddUser(struct cli_state * cli, const char *group_name, const char *user_name);
2739 int cli_NetGroupGetUsers(struct cli_state * cli, const char *group_name, void (*fn)(const char *, void *), void *state );
2740 int cli_NetUserGetGroups(struct cli_state * cli, const char *user_name, void (*fn)(const char *, void *), void *state );
2741 int cli_NetUserDelete(struct cli_state *cli, const char * user_name );
2742 int cli_NetUserAdd(struct cli_state *cli, RAP_USER_INFO_1 * userinfo );
2743 int cli_RNetUserEnum(struct cli_state *cli, void (*fn)(const char *, const char *, const char *, const char *, void *), void *state);
2744 int cli_RNetUserEnum0(struct cli_state *cli,
2745 void (*fn)(const char *, void *),
2747 int cli_NetFileClose(struct cli_state *cli, uint32 file_id );
2748 int cli_NetFileGetInfo(struct cli_state *cli, uint32 file_id, void (*fn)(const char *, const char *, uint16, uint16, uint32));
2749 int cli_NetFileEnum(struct cli_state *cli, const char * user,
2750 const char * base_path,
2751 void (*fn)(const char *, const char *, uint16, uint16,
2753 int cli_NetShareAdd(struct cli_state *cli, RAP_SHARE_INFO_2 * sinfo );
2754 int cli_NetShareDelete(struct cli_state *cli, const char * share_name );
2755 bool cli_get_pdc_name(struct cli_state *cli, const char *workgroup, char **pdc_name);
2756 bool cli_get_server_domain(struct cli_state *cli);
2757 bool cli_get_server_type(struct cli_state *cli, uint32 *pstype);
2758 bool cli_get_server_name(TALLOC_CTX *mem_ctx, struct cli_state *cli,
2760 bool cli_ns_check_server_type(struct cli_state *cli, char *workgroup, uint32 stype);
2761 bool cli_NetWkstaUserLogoff(struct cli_state *cli, const char *user, const char *workstation);
2762 int cli_NetPrintQEnum(struct cli_state *cli,
2763 void (*qfn)(const char*,uint16,uint16,uint16,const char*,const char*,const char*,const char*,const char*,uint16,uint16),
2764 void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,uint,uint,const char*));
2765 int cli_NetPrintQGetInfo(struct cli_state *cli, const char *printer,
2766 void (*qfn)(const char*,uint16,uint16,uint16,const char*,const char*,const char*,const char*,const char*,uint16,uint16),
2767 void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,uint,uint,const char*));
2768 int cli_RNetServiceEnum(struct cli_state *cli, void (*fn)(const char *, const char *, void *), void *state);
2769 int cli_NetSessionEnum(struct cli_state *cli, void (*fn)(char *, char *, uint16, uint16, uint16, uint, uint, uint, char *));
2770 int cli_NetSessionGetInfo(struct cli_state *cli, const char *workstation,
2771 void (*fn)(const char *, const char *, uint16, uint16, uint16, uint, uint, uint, const char *));
2772 int cli_NetSessionDel(struct cli_state *cli, const char *workstation);
2773 int cli_NetConnectionEnum(struct cli_state *cli, const char *qualifier,
2774 void (*fn)(uint16_t conid, uint16_t contype,
2775 uint16_t numopens, uint16_t numusers,
2776 uint32_t contime, const char *username,
2777 const char *netname));
2779 /* The following definitions come from libsmb/clireadwrite.c */
2781 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
2782 struct event_context *ev,
2783 struct cli_state *cli, int fnum,
2784 off_t offset, size_t size,
2785 struct tevent_req **psmbreq);
2786 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
2787 struct event_context *ev,
2788 struct cli_state *cli, int fnum,
2789 off_t offset, size_t size);
2790 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
2792 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
2793 struct event_context *ev,
2794 struct cli_state *cli,
2795 uint16_t fnum, off_t start_offset,
2796 SMB_OFF_T size, size_t window_size,
2797 NTSTATUS (*sink)(char *buf, size_t n,
2800 NTSTATUS cli_pull_recv(struct tevent_req *req, SMB_OFF_T *received);
2801 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
2802 off_t start_offset, SMB_OFF_T size, size_t window_size,
2803 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
2804 void *priv, SMB_OFF_T *received);
2805 ssize_t cli_read(struct cli_state *cli, int fnum, char *buf,
2806 off_t offset, size_t size);
2807 ssize_t cli_readraw(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size);
2808 ssize_t cli_write(struct cli_state *cli,
2809 int fnum, uint16 write_mode,
2810 const char *buf, off_t offset, size_t size);
2811 ssize_t cli_smbwrite(struct cli_state *cli,
2812 int fnum, char *buf, off_t offset, size_t size1);
2813 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
2814 struct event_context *ev,
2815 struct cli_state *cli, uint16_t fnum,
2816 uint16_t mode, const uint8_t *buf,
2817 off_t offset, size_t size,
2818 struct tevent_req **reqs_before,
2819 int num_reqs_before,
2820 struct tevent_req **psmbreq);
2821 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
2822 struct event_context *ev,
2823 struct cli_state *cli, uint16_t fnum,
2824 uint16_t mode, const uint8_t *buf,
2825 off_t offset, size_t size);
2826 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
2828 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
2829 struct cli_state *cli,
2830 uint16_t fnum, uint16_t mode,
2831 off_t start_offset, size_t window_size,
2832 size_t (*source)(uint8_t *buf, size_t n,
2835 NTSTATUS cli_push_recv(struct tevent_req *req);
2836 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
2837 off_t start_offset, size_t window_size,
2838 size_t (*source)(uint8_t *buf, size_t n, void *priv),
2841 /* The following definitions come from libsmb/clisecdesc.c */
2843 SEC_DESC *cli_query_secdesc(struct cli_state *cli, int fnum,
2844 TALLOC_CTX *mem_ctx);
2845 bool cli_set_secdesc(struct cli_state *cli, int fnum, SEC_DESC *sd);
2847 /* The following definitions come from libsmb/clispnego.c */
2849 DATA_BLOB spnego_gen_negTokenInit(char guid[16],
2851 const char *principal);
2852 DATA_BLOB gen_negTokenInit(const char *OID, DATA_BLOB blob);
2853 bool spnego_parse_negTokenInit(DATA_BLOB blob,
2854 char *OIDs[ASN1_MAX_OIDS],
2856 DATA_BLOB gen_negTokenTarg(const char *OIDs[], DATA_BLOB blob);
2857 bool parse_negTokenTarg(DATA_BLOB blob, char *OIDs[ASN1_MAX_OIDS], DATA_BLOB *secblob);
2858 DATA_BLOB spnego_gen_krb5_wrap(const DATA_BLOB ticket, const uint8 tok_id[2]);
2859 bool spnego_parse_krb5_wrap(DATA_BLOB blob, DATA_BLOB *ticket, uint8 tok_id[2]);
2860 int spnego_gen_negTokenTarg(const char *principal, int time_offset,
2862 DATA_BLOB *session_key_krb5, uint32 extra_ap_opts,
2863 time_t *expire_time);
2864 bool spnego_parse_challenge(const DATA_BLOB blob,
2865 DATA_BLOB *chal1, DATA_BLOB *chal2);
2866 DATA_BLOB spnego_gen_auth(DATA_BLOB blob);
2867 bool spnego_parse_auth(DATA_BLOB blob, DATA_BLOB *auth);
2868 DATA_BLOB spnego_gen_auth_response(DATA_BLOB *reply, NTSTATUS nt_status,
2869 const char *mechOID);
2870 bool spnego_parse_auth_response(DATA_BLOB blob, NTSTATUS nt_status,
2871 const char *mechOID,
2874 /* The following definitions come from libsmb/clistr.c */
2876 size_t clistr_push_fn(const char *function,
2878 struct cli_state *cli,
2883 size_t clistr_pull_fn(const char *function,
2891 size_t clistr_pull_talloc_fn(const char *function,
2899 size_t clistr_align_out(struct cli_state *cli, const void *p, int flags);
2900 size_t clistr_align_in(struct cli_state *cli, const void *p, int flags);
2902 /* The following definitions come from libsmb/clitrans.c */
2904 bool cli_send_trans(struct cli_state *cli, int trans,
2905 const char *pipe_name,
2907 uint16 *setup, unsigned int lsetup, unsigned int msetup,
2908 const char *param, unsigned int lparam, unsigned int mparam,
2909 const char *data, unsigned int ldata, unsigned int mdata);
2910 bool cli_receive_trans(struct cli_state *cli,int trans,
2911 char **param, unsigned int *param_len,
2912 char **data, unsigned int *data_len);
2913 bool cli_send_nt_trans(struct cli_state *cli,
2916 uint16 *setup, unsigned int lsetup, unsigned int msetup,
2917 char *param, unsigned int lparam, unsigned int mparam,
2918 char *data, unsigned int ldata, unsigned int mdata);
2919 bool cli_receive_nt_trans(struct cli_state *cli,
2920 char **param, unsigned int *param_len,
2921 char **data, unsigned int *data_len);
2922 struct tevent_req *cli_trans_send(
2923 TALLOC_CTX *mem_ctx, struct event_context *ev,
2924 struct cli_state *cli, uint8_t cmd,
2925 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
2926 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
2927 uint8_t *param, uint32_t num_param, uint32_t max_param,
2928 uint8_t *data, uint32_t num_data, uint32_t max_data);
2929 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
2930 uint16_t **setup, uint8_t *num_setup,
2931 uint8_t **param, uint32_t *num_param,
2932 uint8_t **data, uint32_t *num_data);
2933 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
2935 const char *pipe_name, uint16_t fid, uint16_t function,
2937 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
2938 uint8_t *param, uint32_t num_param, uint32_t max_param,
2939 uint8_t *data, uint32_t num_data, uint32_t max_data,
2940 uint16_t **rsetup, uint8_t *num_rsetup,
2941 uint8_t **rparam, uint32_t *num_rparam,
2942 uint8_t **rdata, uint32_t *num_rdata);
2944 /* The following definitions come from libsmb/conncache.c */
2946 NTSTATUS check_negative_conn_cache_timeout( const char *domain, const char *server, unsigned int failed_cache_timeout );
2947 NTSTATUS check_negative_conn_cache( const char *domain, const char *server);
2948 void add_failed_connection_entry(const char *domain, const char *server, NTSTATUS result) ;
2949 void delete_negative_conn_cache(const char *domain, const char *server);
2950 void flush_negative_conn_cache( void );
2951 void flush_negative_conn_cache_for_domain(const char *domain);
2953 /* The following definitions come from ../librpc/rpc/dcerpc_error.c */
2955 const char *dcerpc_errstr(TALLOC_CTX *mem_ctx, uint32_t fault_code);
2957 /* The following definitions come from libsmb/dsgetdcname.c */
2959 void debug_dsdcinfo_flags(int lvl, uint32_t flags);
2960 NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx,
2961 struct messaging_context *msg_ctx,
2962 const char *domain_name,
2963 struct GUID *domain_guid,
2964 const char *site_name,
2966 struct netr_DsRGetDCNameInfo **info);
2968 /* The following definitions come from libsmb/errormap.c */
2970 NTSTATUS dos_to_ntstatus(uint8 eclass, uint32 ecode);
2971 void ntstatus_to_dos(NTSTATUS ntstatus, uint8 *eclass, uint32 *ecode);
2972 NTSTATUS werror_to_ntstatus(WERROR error);
2973 WERROR ntstatus_to_werror(NTSTATUS error);
2974 NTSTATUS map_nt_error_from_gss(uint32 gss_maj, uint32 minor);
2976 /* The following definitions come from libsmb/namecache.c */
2978 bool namecache_enable(void);
2979 bool namecache_store(const char *name,
2982 struct ip_service *ip_list);
2983 bool namecache_fetch(const char *name,
2985 struct ip_service **ip_list,
2987 bool namecache_delete(const char *name, int name_type);
2988 void namecache_flush(void);
2989 bool namecache_status_store(const char *keyname, int keyname_type,
2990 int name_type, const struct sockaddr_storage *keyip,
2991 const char *srvname);
2992 bool namecache_status_fetch(const char *keyname,
2995 const struct sockaddr_storage *keyip,
2998 /* The following definitions come from libsmb/namequery.c */
3000 bool saf_store( const char *domain, const char *servername );
3001 bool saf_join_store( const char *domain, const char *servername );
3002 bool saf_delete( const char *domain );
3003 char *saf_fetch( const char *domain );
3004 NODE_STATUS_STRUCT *node_status_query(int fd,
3005 struct nmb_name *name,
3006 const struct sockaddr_storage *to_ss,
3008 struct node_status_extra *extra);
3009 bool name_status_find(const char *q_name,
3012 const struct sockaddr_storage *to_ss,
3014 int ip_service_compare(struct ip_service *ss1, struct ip_service *ss2);
3015 struct sockaddr_storage *name_query(int fd,
3020 const struct sockaddr_storage *to_ss,
3024 XFILE *startlmhosts(const char *fname);
3025 bool getlmhostsent(TALLOC_CTX *ctx, XFILE *fp, char **pp_name, int *name_type,
3026 struct sockaddr_storage *pss);
3027 void endlmhosts(XFILE *fp);
3028 NTSTATUS name_resolve_bcast(const char *name,
3030 struct ip_service **return_iplist,
3032 NTSTATUS resolve_wins(const char *name,
3034 struct ip_service **return_iplist,
3036 NTSTATUS internal_resolve_name(const char *name,
3038 const char *sitename,
3039 struct ip_service **return_iplist,
3041 const char *resolve_order);
3042 bool resolve_name(const char *name,
3043 struct sockaddr_storage *return_ss,
3045 NTSTATUS resolve_name_list(TALLOC_CTX *ctx,
3048 struct sockaddr_storage **return_ss_arr,
3049 unsigned int *p_num_entries);
3050 bool find_master_ip(const char *group, struct sockaddr_storage *master_ss);
3051 bool get_pdc_ip(const char *domain, struct sockaddr_storage *pss);
3052 NTSTATUS get_sorted_dc_list( const char *domain,
3053 const char *sitename,
3054 struct ip_service **ip_list,
3057 NTSTATUS get_kdc_list( const char *realm,
3058 const char *sitename,
3059 struct ip_service **ip_list,
3062 /* The following definitions come from libsmb/namequery_dc.c */
3064 bool get_dc_name(const char *domain,
3067 struct sockaddr_storage *ss_out);
3069 /* The following definitions come from libsmb/nmblib.c */
3071 void debug_nmb_packet(struct packet_struct *p);
3072 void put_name(char *dest, const char *name, int pad, unsigned int name_type);
3073 char *nmb_namestr(const struct nmb_name *n);
3074 struct packet_struct *copy_packet(struct packet_struct *packet);
3075 void free_packet(struct packet_struct *packet);
3076 struct packet_struct *parse_packet(char *buf,int length,
3077 enum packet_type packet_type,