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 bool convert_string_allocate(TALLOC_CTX *ctx, charset_t from, charset_t to,
352 void const *src, size_t srclen, void *dst,
353 size_t *converted_size, bool allow_bad_conv);
354 size_t unix_strupper(const char *src, size_t srclen, char *dest, size_t destlen);
355 char *strdup_upper(const char *s);
356 char *talloc_strdup_upper(TALLOC_CTX *ctx, const char *s);
357 size_t unix_strlower(const char *src, size_t srclen, char *dest, size_t destlen);
358 char *strdup_lower(const char *s);
359 char *talloc_strdup_lower(TALLOC_CTX *ctx, const char *s);
360 size_t ucs2_align(const void *base_ptr, const void *p, int flags);
361 size_t push_ascii(void *dest, const char *src, size_t dest_len, int flags);
362 size_t push_ascii_fstring(void *dest, const char *src);
363 size_t push_ascii_nstring(void *dest, const char *src);
364 bool push_ascii_allocate(char **dest, const char *src, size_t *converted_size);
365 size_t pull_ascii(char *dest, const void *src, size_t dest_len, size_t src_len, int flags);
366 size_t pull_ascii_fstring(char *dest, const void *src);
367 size_t pull_ascii_nstring(char *dest, size_t dest_len, const void *src);
368 size_t push_ucs2(const void *base_ptr, void *dest, const char *src, size_t dest_len, int flags);
369 bool push_ucs2_allocate(smb_ucs2_t **dest, const char *src,
370 size_t *converted_size);
371 size_t push_utf8_fstring(void *dest, const char *src);
372 bool push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
373 size_t *converted_size);
374 bool push_utf8_allocate(char **dest, const char *src, size_t *converted_size);
375 size_t pull_ucs2(const void *base_ptr, char *dest, const void *src, size_t dest_len, size_t src_len, int flags);
376 size_t pull_ucs2_base_talloc(TALLOC_CTX *ctx,
377 const void *base_ptr,
382 size_t pull_ucs2_fstring(char *dest, const void *src);
383 bool push_ucs2_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src,
384 size_t *converted_size);
385 bool pull_ucs2_allocate(char **dest, const smb_ucs2_t *src,
386 size_t *converted_size);
387 bool pull_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
388 size_t *converted_size);
389 bool pull_utf8_allocate(char **dest, const char *src, size_t *converted_size);
390 bool pull_ucs2_talloc(TALLOC_CTX *ctx, char **dest, const smb_ucs2_t *src,
391 size_t *converted_size);
392 bool pull_ascii_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
393 size_t *converted_size);
394 size_t push_string_fn(const char *function, unsigned int line,
395 const void *base_ptr, uint16 flags2,
396 void *dest, const char *src,
397 size_t dest_len, int flags);
398 size_t pull_string_fn(const char *function,
400 const void *base_ptr,
407 size_t pull_string_talloc_fn(const char *function,
410 const void *base_ptr,
416 size_t align_string(const void *base_ptr, const char *p, int flags);
417 codepoint_t next_codepoint(const char *str, size_t *size);
419 /* The following definitions come from lib/clobber.c */
421 void clobber_region(const char *fn, unsigned int line, char *dest, size_t len);
423 /* The following definitions come from lib/conn_tdb.c */
425 struct db_record *connections_fetch_record(TALLOC_CTX *mem_ctx,
427 struct db_record *connections_fetch_entry(TALLOC_CTX *mem_ctx,
428 connection_struct *conn,
430 int connections_traverse(int (*fn)(struct db_record *rec,
433 int connections_forall(int (*fn)(struct db_record *rec,
434 const struct connections_key *key,
435 const struct connections_data *data,
438 bool connections_init(bool rw);
440 /* The following definitions come from lib/dbwrap_util.c */
442 int32_t dbwrap_fetch_int32(struct db_context *db, const char *keystr);
443 int dbwrap_store_int32(struct db_context *db, const char *keystr, int32_t v);
444 bool dbwrap_fetch_uint32(struct db_context *db, const char *keystr,
446 int dbwrap_store_uint32(struct db_context *db, const char *keystr, uint32_t v);
447 uint32_t dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr,
448 uint32_t *oldval, uint32_t change_val);
449 int32 dbwrap_change_int32_atomic(struct db_context *db, const char *keystr,
450 int32 *oldval, int32 change_val);
451 NTSTATUS dbwrap_trans_store(struct db_context *db, TDB_DATA key, TDB_DATA dbuf,
453 NTSTATUS dbwrap_trans_delete(struct db_context *db, TDB_DATA key);
454 NTSTATUS dbwrap_trans_store_int32(struct db_context *db, const char *keystr,
456 NTSTATUS dbwrap_trans_store_uint32(struct db_context *db, const char *keystr,
458 NTSTATUS dbwrap_trans_store_bystring(struct db_context *db, const char *key,
459 TDB_DATA data, int flags);
460 NTSTATUS dbwrap_trans_delete_bystring(struct db_context *db, const char *key);
462 /* The following definitions come from lib/debug.c */
464 void gfree_debugsyms(void);
465 const char *debug_classname_from_index(int ndx);
466 int debug_add_class(const char *classname);
467 int debug_lookup_classname(const char *classname);
468 bool debug_parse_levels(const char *params_str);
469 void debug_message(struct messaging_context *msg_ctx, void *private_data, uint32_t msg_type, struct server_id src, DATA_BLOB *data);
470 void debug_init(void);
471 void debug_register_msgs(struct messaging_context *msg_ctx);
472 void setup_logging(const char *pname, bool interactive);
473 void debug_set_logfile(const char *name);
474 bool reopen_logs( void );
475 void force_check_log_size( void );
476 bool need_to_check_log_size( void );
477 void check_log_size( void );
478 void dbgflush( void );
479 bool dbghdrclass(int level, int cls, const char *location, const char *func);
480 bool dbghdr(int level, const char *location, const char *func);
481 TALLOC_CTX *debug_ctx(void);
483 /* The following definitions come from lib/display_sec.c */
485 char *get_sec_mask_str(TALLOC_CTX *ctx, uint32 type);
486 void display_sec_access(uint32_t *info);
487 void display_sec_ace_flags(uint8_t flags);
488 void display_sec_ace(SEC_ACE *ace);
489 void display_sec_acl(SEC_ACL *sec_acl);
490 void display_acl_type(uint16 type);
491 void display_sec_desc(SEC_DESC *sec);
493 /* The following definitions come from lib/dmallocmsg.c */
495 void register_dmalloc_msgs(struct messaging_context *msg_ctx);
497 /* The following definitions come from lib/dprintf.c */
499 void display_set_stderr(void);
501 /* The following definitions come from lib/errmap_unix.c */
503 NTSTATUS map_nt_error_from_unix(int unix_error);
504 int map_errno_from_nt_status(NTSTATUS status);
506 /* The following definitions come from lib/fault.c */
507 void fault_setup(void (*fn)(void *));
508 void dump_core_setup(const char *progname);
510 /* The following definitions come from lib/file_id.c */
512 struct file_id vfs_file_id_from_sbuf(connection_struct *conn, const SMB_STRUCT_STAT *sbuf);
513 bool file_id_equal(const struct file_id *id1, const struct file_id *id2);
514 const char *file_id_string_tos(const struct file_id *id);
515 void push_file_id_16(char *buf, const struct file_id *id);
516 void push_file_id_24(char *buf, const struct file_id *id);
517 void pull_file_id_24(char *buf, struct file_id *id);
519 /* The following definitions come from lib/gencache.c */
521 bool gencache_init(void);
522 bool gencache_shutdown(void);
523 bool gencache_set(const char *keystr, const char *value, time_t timeout);
524 bool gencache_del(const char *keystr);
525 bool gencache_get(const char *keystr, char **valstr, time_t *timeout);
526 bool gencache_get_data_blob(const char *keystr, DATA_BLOB *blob, bool *expired);
527 bool gencache_set_data_blob(const char *keystr, const DATA_BLOB *blob, time_t timeout);
528 void gencache_iterate(void (*fn)(const char* key, const char *value, time_t timeout, void* dptr),
529 void* data, const char* keystr_pattern);
530 int gencache_lock_entry( const char *key );
531 void gencache_unlock_entry( const char *key );
533 /* The following definitions come from lib/interface.c */
535 bool ismyaddr(const struct sockaddr *ip);
536 bool ismyip_v4(struct in_addr ip);
537 bool is_local_net(const struct sockaddr *from);
538 void setup_linklocal_scope_id(struct sockaddr *pss);
539 bool is_local_net_v4(struct in_addr from);
540 int iface_count(void);
541 int iface_count_v4_nl(void);
542 const struct in_addr *first_ipv4_iface(void);
543 struct interface *get_interface(int n);
544 const struct sockaddr_storage *iface_n_sockaddr_storage(int n);
545 const struct in_addr *iface_n_ip_v4(int n);
546 const struct in_addr *iface_n_bcast_v4(int n);
547 const struct sockaddr_storage *iface_n_bcast(int n);
548 const struct sockaddr_storage *iface_ip(const struct sockaddr *ip);
549 bool iface_local(const struct sockaddr *ip);
550 void load_interfaces(void);
551 void gfree_interfaces(void);
552 bool interfaces_changed(void);
554 /* The following definitions come from lib/ldap_debug_handler.c */
556 void init_ldap_debugging(void);
558 /* The following definitions come from lib/ldap_escape.c */
560 char *escape_ldap_string_alloc(const char *s);
561 char *escape_rdn_val_string_alloc(const char *s);
563 /* The following definitions come from lib/module.c */
565 NTSTATUS smb_load_module(const char *module_name);
566 int smb_load_modules(const char **modules);
567 NTSTATUS smb_probe_module(const char *subsystem, const char *module);
568 NTSTATUS smb_load_module(const char *module_name);
569 int smb_load_modules(const char **modules);
570 NTSTATUS smb_probe_module(const char *subsystem, const char *module);
571 void init_modules(void);
573 /* The following definitions come from lib/ms_fnmatch.c */
575 int ms_fnmatch(const char *pattern, const char *string, bool translate_pattern,
576 bool is_case_sensitive);
577 int gen_fnmatch(const char *pattern, const char *string);
579 /* The following definitions come from lib/pam_errors.c */
581 NTSTATUS pam_to_nt_status(int pam_error);
582 int nt_status_to_pam(NTSTATUS nt_status);
583 NTSTATUS pam_to_nt_status(int pam_error);
584 int nt_status_to_pam(NTSTATUS nt_status);
586 /* The following definitions come from lib/pidfile.c */
588 pid_t pidfile_pid(const char *name);
589 void pidfile_create(const char *program_name);
591 /* The following definitions come from lib/popt_common.c */
593 void popt_common_set_auth_info(struct user_auth_info *auth_info);
595 /* The following definitions come from lib/privileges.c */
597 bool get_privileges_for_sids(SE_PRIV *privileges, DOM_SID *slist, int scount);
598 NTSTATUS privilege_enumerate_accounts(DOM_SID **sids, int *num_sids);
599 NTSTATUS privilege_enum_sids(const SE_PRIV *mask, TALLOC_CTX *mem_ctx,
600 DOM_SID **sids, int *num_sids);
601 bool grant_privilege(const DOM_SID *sid, const SE_PRIV *priv_mask);
602 bool grant_privilege_by_name(DOM_SID *sid, const char *name);
603 bool revoke_privilege(const DOM_SID *sid, const SE_PRIV *priv_mask);
604 bool revoke_all_privileges( DOM_SID *sid );
605 bool revoke_privilege_by_name(DOM_SID *sid, const char *name);
606 NTSTATUS privilege_create_account(const DOM_SID *sid );
607 NTSTATUS privilege_set_init(PRIVILEGE_SET *priv_set);
608 NTSTATUS privilege_set_init_by_ctx(TALLOC_CTX *mem_ctx, PRIVILEGE_SET *priv_set);
609 void privilege_set_free(PRIVILEGE_SET *priv_set);
610 NTSTATUS dup_luid_attr(TALLOC_CTX *mem_ctx, LUID_ATTR **new_la, LUID_ATTR *old_la, int count);
611 bool is_privileged_sid( const DOM_SID *sid );
612 bool grant_all_privileges( const DOM_SID *sid );
614 /* The following definitions come from lib/privileges_basic.c */
616 bool se_priv_copy( SE_PRIV *dst, const SE_PRIV *src );
617 bool se_priv_put_all_privileges(SE_PRIV *mask);
618 void se_priv_add( SE_PRIV *mask, const SE_PRIV *addpriv );
619 void se_priv_remove( SE_PRIV *mask, const SE_PRIV *removepriv );
620 bool se_priv_equal( const SE_PRIV *mask1, const SE_PRIV *mask2 );
621 bool se_priv_from_name( const char *name, SE_PRIV *mask );
622 void dump_se_priv( int dbg_cl, int dbg_lvl, const SE_PRIV *mask );
623 bool is_privilege_assigned(const SE_PRIV *privileges,
624 const SE_PRIV *check);
625 const char* get_privilege_dispname( const char *name );
626 bool user_has_privileges(const NT_USER_TOKEN *token, const SE_PRIV *privilege);
627 bool user_has_any_privilege(NT_USER_TOKEN *token, const SE_PRIV *privilege);
628 int count_all_privileges( void );
629 LUID_ATTR get_privilege_luid( SE_PRIV *mask );
630 const char *luid_to_privilege_name(const LUID *set);
631 bool se_priv_to_privilege_set( PRIVILEGE_SET *set, SE_PRIV *mask );
632 bool privilege_set_to_se_priv( SE_PRIV *mask, struct lsa_PrivilegeSet *privset );
634 /* The following definitions come from lib/readline.c */
636 void smb_readline_done(void);
637 char *smb_readline(const char *prompt, void (*callback)(void),
638 char **(completion_fn)(const char *text, int start, int end));
639 const char *smb_readline_get_line_buffer(void);
640 void smb_readline_ca_char(char c);
641 int cmd_history(void);
643 /* The following definitions come from lib/recvfile.c */
645 ssize_t sys_recvfile(int fromfd,
649 ssize_t sys_recvfile(int fromfd,
653 ssize_t drain_socket(int sockfd, size_t count);
655 /* The following definitions come from lib/secdesc.c */
657 bool sec_desc_equal(SEC_DESC *s1, SEC_DESC *s2);
658 uint32_t get_sec_info(const SEC_DESC *sd);
659 SEC_DESC_BUF *sec_desc_merge(TALLOC_CTX *ctx, SEC_DESC_BUF *new_sdb, SEC_DESC_BUF *old_sdb);
660 SEC_DESC *make_sec_desc(TALLOC_CTX *ctx,
661 enum security_descriptor_revision revision,
663 const DOM_SID *owner_sid, const DOM_SID *grp_sid,
664 SEC_ACL *sacl, SEC_ACL *dacl, size_t *sd_size);
665 SEC_DESC *dup_sec_desc(TALLOC_CTX *ctx, const SEC_DESC *src);
666 NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx,
667 struct security_descriptor *secdesc,
668 uint8 **data, size_t *len);
669 NTSTATUS marshall_sec_desc_buf(TALLOC_CTX *mem_ctx,
670 struct sec_desc_buf *secdesc_buf,
671 uint8_t **data, size_t *len);
672 NTSTATUS unmarshall_sec_desc(TALLOC_CTX *mem_ctx, uint8 *data, size_t len,
673 struct security_descriptor **psecdesc);
674 NTSTATUS unmarshall_sec_desc_buf(TALLOC_CTX *mem_ctx, uint8_t *data, size_t len,
675 struct sec_desc_buf **psecdesc_buf);
676 SEC_DESC *make_standard_sec_desc(TALLOC_CTX *ctx, const DOM_SID *owner_sid, const DOM_SID *grp_sid,
677 SEC_ACL *dacl, size_t *sd_size);
678 SEC_DESC_BUF *make_sec_desc_buf(TALLOC_CTX *ctx, size_t len, SEC_DESC *sec_desc);
679 SEC_DESC_BUF *dup_sec_desc_buf(TALLOC_CTX *ctx, SEC_DESC_BUF *src);
680 NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, uint32 mask, size_t *sd_size);
681 NTSTATUS sec_desc_mod_sid(SEC_DESC *sd, DOM_SID *sid, uint32 mask);
682 NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, size_t *sd_size);
683 NTSTATUS se_create_child_secdesc(TALLOC_CTX *ctx,
686 const SEC_DESC *parent_ctr,
687 const DOM_SID *owner_sid,
688 const DOM_SID *group_sid,
690 NTSTATUS se_create_child_secdesc_buf(TALLOC_CTX *ctx,
691 SEC_DESC_BUF **ppsdb,
692 const SEC_DESC *parent_ctr,
695 /* The following definitions come from lib/select.c */
697 void sys_select_signal(char c);
698 int sys_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *tval);
699 int sys_select_intr(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *tval);
701 /* The following definitions come from lib/sendfile.c */
703 ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
705 /* The following definitions come from lib/server_mutex.c */
707 struct named_mutex *grab_named_mutex(TALLOC_CTX *mem_ctx, const char *name,
710 /* The following definitions come from lib/sharesec.c */
712 SEC_DESC *get_share_security_default( TALLOC_CTX *ctx, size_t *psize, uint32 def_access);
713 SEC_DESC *get_share_security( TALLOC_CTX *ctx, const char *servicename,
715 bool set_share_security(const char *share_name, SEC_DESC *psd);
716 bool delete_share_security(const char *servicename);
717 bool share_access_check(const NT_USER_TOKEN *token, const char *sharename,
718 uint32 desired_access);
719 bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, SEC_DESC **ppsd);
721 /* The following definitions come from lib/smbldap.c */
723 int smb_ldap_start_tls(LDAP *ldap_struct, int version);
724 int smb_ldap_setup_conn(LDAP **ldap_struct, const char *uri);
725 int smb_ldap_upgrade_conn(LDAP *ldap_struct, int *new_version) ;
726 int smb_ldap_setup_full_conn(LDAP **ldap_struct, const char *uri);
727 int smbldap_search(struct smbldap_state *ldap_state,
728 const char *base, int scope, const char *filter,
729 const char *attrs[], int attrsonly,
731 int smbldap_search_paged(struct smbldap_state *ldap_state,
732 const char *base, int scope, const char *filter,
733 const char **attrs, int attrsonly, int pagesize,
734 LDAPMessage **res, void **cookie);
735 int smbldap_modify(struct smbldap_state *ldap_state, const char *dn, LDAPMod *attrs[]);
736 int smbldap_add(struct smbldap_state *ldap_state, const char *dn, LDAPMod *attrs[]);
737 int smbldap_delete(struct smbldap_state *ldap_state, const char *dn);
738 int smbldap_extended_operation(struct smbldap_state *ldap_state,
739 LDAP_CONST char *reqoid, struct berval *reqdata,
740 LDAPControl **serverctrls, LDAPControl **clientctrls,
741 char **retoidp, struct berval **retdatap);
742 int smbldap_search_suffix (struct smbldap_state *ldap_state,
743 const char *filter, const char **search_attr,
744 LDAPMessage ** result);
745 void smbldap_free_struct(struct smbldap_state **ldap_state) ;
746 NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx, struct event_context *event_ctx,
747 const char *location,
748 struct smbldap_state **smbldap_state);
749 char *smbldap_get_dn(LDAP *ld, LDAPMessage *entry);
750 bool smbldap_has_control(LDAP *ld, const char *control);
751 bool smbldap_has_extension(LDAP *ld, const char *extension);
752 bool smbldap_has_naming_context(LDAP *ld, const char *naming_context);
753 bool smbldap_set_creds(struct smbldap_state *ldap_state, bool anon, const char *dn, const char *secret);
755 /* The following definitions come from lib/smbldap_util.c */
757 NTSTATUS smbldap_search_domain_info(struct smbldap_state *ldap_state,
758 LDAPMessage ** result, const char *domain_name,
761 /* The following definitions come from lib/smbrun.c */
763 int smbrun_no_sanitize(const char *cmd, int *outfd);
764 int smbrun(const char *cmd, int *outfd);
765 int smbrunsecret(const char *cmd, const char *secret);
767 /* The following definitions come from lib/sock_exec.c */
769 int sock_exec(const char *prog);
771 /* The following definitions come from lib/substitute.c */
773 void free_local_machine_name(void);
774 bool set_local_machine_name(const char *local_name, bool perm);
775 const char *get_local_machine_name(void);
776 bool set_remote_machine_name(const char *remote_name, bool perm);
777 const char *get_remote_machine_name(void);
778 void sub_set_smb_name(const char *name);
779 void set_current_user_info(const char *smb_name, const char *unix_name,
781 const char *get_current_username(void);
782 void standard_sub_basic(const char *smb_name, const char *domain_name,
783 char *str, size_t len);
784 char *talloc_sub_basic(TALLOC_CTX *mem_ctx, const char *smb_name,
785 const char *domain_name, const char *str);
786 char *alloc_sub_basic(const char *smb_name, const char *domain_name,
788 char *talloc_sub_specified(TALLOC_CTX *mem_ctx,
789 const char *input_string,
790 const char *username,
794 char *talloc_sub_advanced(TALLOC_CTX *mem_ctx,
795 const char *servicename, const char *user,
796 const char *connectpath, gid_t gid,
797 const char *smb_name, const char *domain_name,
799 void standard_sub_advanced(const char *servicename, const char *user,
800 const char *connectpath, gid_t gid,
801 const char *smb_name, const char *domain_name,
802 char *str, size_t len);
803 char *standard_sub_conn(TALLOC_CTX *ctx, connection_struct *conn, const char *str);
805 /* The following definitions come from lib/sysacls.c */
807 int sys_acl_get_entry(SMB_ACL_T acl_d, int entry_id, SMB_ACL_ENTRY_T *entry_p);
808 int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *type_p);
809 int sys_acl_get_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
810 void *sys_acl_get_qualifier(SMB_ACL_ENTRY_T entry_d);
811 int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset_d);
812 int sys_acl_add_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
813 int sys_acl_get_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
814 char *sys_acl_to_text(SMB_ACL_T acl_d, ssize_t *len_p);
815 SMB_ACL_T sys_acl_init(int count);
816 int sys_acl_create_entry(SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p);
817 int sys_acl_set_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type);
818 int sys_acl_set_qualifier(SMB_ACL_ENTRY_T entry_d, void *qual_p);
819 int sys_acl_set_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d);
820 int sys_acl_free_text(char *text);
821 int sys_acl_free_acl(SMB_ACL_T acl_d) ;
822 int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype);
823 int sys_acl_valid(SMB_ACL_T acl_d);
824 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
825 const char *path_p, SMB_ACL_TYPE_T type);
826 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
827 int sys_acl_set_file(vfs_handle_struct *handle,
828 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
829 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
831 int sys_acl_delete_def_file(vfs_handle_struct *handle,
833 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
834 const char *path_p, SMB_ACL_TYPE_T type);
835 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
836 int sys_acl_set_file(vfs_handle_struct *handle,
837 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
838 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
840 int sys_acl_delete_def_file(vfs_handle_struct *handle,
842 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
843 const char *path_p, SMB_ACL_TYPE_T type);
844 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
845 int sys_acl_set_file(vfs_handle_struct *handle,
846 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
847 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
849 int sys_acl_delete_def_file(vfs_handle_struct *handle,
851 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
852 const char *path_p, SMB_ACL_TYPE_T type);
853 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
854 int sys_acl_set_file(vfs_handle_struct *handle,
855 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
856 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
858 int sys_acl_delete_def_file(vfs_handle_struct *handle,
860 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
861 const char *path_p, SMB_ACL_TYPE_T type);
862 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
863 int sys_acl_set_file(vfs_handle_struct *handle,
864 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
865 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
867 int sys_acl_delete_def_file(vfs_handle_struct *handle,
869 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
870 const char *path_p, SMB_ACL_TYPE_T type);
871 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
872 int sys_acl_set_file(vfs_handle_struct *handle,
873 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
874 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
876 int sys_acl_delete_def_file(vfs_handle_struct *handle,
878 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
879 const char *path_p, SMB_ACL_TYPE_T type);
880 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
881 int sys_acl_set_file(vfs_handle_struct *handle,
882 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
883 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
885 int sys_acl_delete_def_file(vfs_handle_struct *handle,
887 int no_acl_syscall_error(int err);
889 /* The following definitions come from lib/sysquotas.c */
891 int sys_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
892 int sys_set_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
894 /* The following definitions come from lib/sysquotas_*.c */
896 int sys_get_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
897 int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
899 int sys_get_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
900 int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
902 /* The following definitions come from lib/system.c */
904 void *sys_memalign( size_t align, size_t size );
905 int sys_usleep(long usecs);
906 ssize_t sys_read(int fd, void *buf, size_t count);
907 ssize_t sys_write(int fd, const void *buf, size_t count);
908 ssize_t sys_writev(int fd, const struct iovec *iov, int iovcnt);
909 ssize_t sys_pread(int fd, void *buf, size_t count, SMB_OFF_T off);
910 ssize_t sys_pwrite(int fd, const void *buf, size_t count, SMB_OFF_T off);
911 ssize_t sys_send(int s, const void *msg, size_t len, int flags);
912 ssize_t sys_sendto(int s, const void *msg, size_t len, int flags, const struct sockaddr *to, socklen_t tolen);
913 ssize_t sys_recv(int fd, void *buf, size_t count, int flags);
914 ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen);
915 int sys_fcntl_ptr(int fd, int cmd, void *arg);
916 int sys_fcntl_long(int fd, int cmd, long arg);
917 int sys_stat(const char *fname,SMB_STRUCT_STAT *sbuf);
918 int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf);
919 int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf);
920 int sys_ftruncate(int fd, SMB_OFF_T offset);
921 SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence);
922 int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence);
923 SMB_OFF_T sys_ftell(FILE *fp);
924 int sys_creat(const char *path, mode_t mode);
925 int sys_open(const char *path, int oflag, mode_t mode);
926 FILE *sys_fopen(const char *path, const char *type);
927 void kernel_flock(int fd, uint32 share_mode);
928 SMB_STRUCT_DIR *sys_opendir(const char *name);
929 SMB_STRUCT_DIRENT *sys_readdir(SMB_STRUCT_DIR *dirp);
930 void sys_seekdir(SMB_STRUCT_DIR *dirp, long offset);
931 long sys_telldir(SMB_STRUCT_DIR *dirp);
932 void sys_rewinddir(SMB_STRUCT_DIR *dirp);
933 int sys_closedir(SMB_STRUCT_DIR *dirp);
934 int sys_mknod(const char *path, mode_t mode, SMB_DEV_T dev);
935 int sys_waitpid(pid_t pid,int *status,int options);
936 char *sys_getwd(char *s);
937 void set_effective_capability(enum smbd_capability capability);
938 void drop_effective_capability(enum smbd_capability capability);
939 long sys_random(void);
940 void sys_srandom(unsigned int seed);
941 int groups_max(void);
942 int sys_getgroups(int setlen, gid_t *gidset);
943 int sys_setgroups(gid_t UNUSED(primary_gid), int setlen, gid_t *gidset);
944 void sys_setpwent(void);
945 struct passwd *sys_getpwent(void);
946 void sys_endpwent(void);
947 struct passwd *sys_getpwnam(const char *name);
948 struct passwd *sys_getpwuid(uid_t uid);
949 struct group *sys_getgrnam(const char *name);
950 struct group *sys_getgrgid(gid_t gid);
951 int sys_popen(const char *command);
952 int sys_pclose(int fd);
953 ssize_t sys_getxattr (const char *path, const char *name, void *value, size_t size);
954 ssize_t sys_lgetxattr (const char *path, const char *name, void *value, size_t size);
955 ssize_t sys_fgetxattr (int filedes, const char *name, void *value, size_t size);
956 ssize_t sys_listxattr (const char *path, char *list, size_t size);
957 ssize_t sys_llistxattr (const char *path, char *list, size_t size);
958 ssize_t sys_flistxattr (int filedes, char *list, size_t size);
959 int sys_removexattr (const char *path, const char *name);
960 int sys_lremovexattr (const char *path, const char *name);
961 int sys_fremovexattr (int filedes, const char *name);
962 int sys_setxattr (const char *path, const char *name, const void *value, size_t size, int flags);
963 int sys_lsetxattr (const char *path, const char *name, const void *value, size_t size, int flags);
964 int sys_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags);
965 uint32 unix_dev_major(SMB_DEV_T dev);
966 uint32 unix_dev_minor(SMB_DEV_T dev);
967 int sys_aio_read(SMB_STRUCT_AIOCB *aiocb);
968 int sys_aio_write(SMB_STRUCT_AIOCB *aiocb);
969 ssize_t sys_aio_return(SMB_STRUCT_AIOCB *aiocb);
970 int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb);
971 int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb);
972 int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb);
973 int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout);
974 int sys_aio_read(SMB_STRUCT_AIOCB *aiocb);
975 int sys_aio_write(SMB_STRUCT_AIOCB *aiocb);
976 ssize_t sys_aio_return(SMB_STRUCT_AIOCB *aiocb);
977 int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb);
978 int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb);
979 int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb);
980 int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout);
981 int sys_getpeereid( int s, uid_t *uid);
982 int sys_getnameinfo(const struct sockaddr *psa,
989 int sys_connect(int fd, const struct sockaddr * addr);
991 /* The following definitions come from lib/system_smbd.c */
993 bool getgroups_unix_user(TALLOC_CTX *mem_ctx, const char *user,
995 gid_t **ret_groups, size_t *p_ngroups);
997 /* The following definitions come from lib/tallocmsg.c */
999 void register_msg_pool_usage(struct messaging_context *msg_ctx);
1001 /* The following definitions come from lib/time.c */
1003 void push_dos_date(uint8_t *buf, int offset, time_t unixdate, int zone_offset);
1004 void push_dos_date2(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
1005 void push_dos_date3(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
1006 time_t pull_dos_date(const uint8_t *date_ptr, int zone_offset);
1007 time_t pull_dos_date2(const uint8_t *date_ptr, int zone_offset);
1008 time_t pull_dos_date3(const uint8_t *date_ptr, int zone_offset);
1009 uint32 convert_time_t_to_uint32(time_t t);
1010 time_t convert_uint32_to_time_t(uint32 u);
1011 bool nt_time_is_zero(const NTTIME *nt);
1012 time_t generalized_to_unix_time(const char *str);
1013 int get_server_zone_offset(void);
1014 int set_server_zone_offset(time_t t);
1015 char *current_timestring(TALLOC_CTX *ctx, bool hires);
1016 void srv_put_dos_date(char *buf,int offset,time_t unixdate);
1017 void srv_put_dos_date2(char *buf,int offset, time_t unixdate);
1018 void srv_put_dos_date3(char *buf,int offset,time_t unixdate);
1019 void put_long_date_timespec(char *p, struct timespec ts);
1020 void put_long_date(char *p, time_t t);
1021 struct timespec get_create_timespec(const SMB_STRUCT_STAT *st,bool fake_dirs);
1022 struct timespec get_atimespec(const SMB_STRUCT_STAT *pst);
1023 void set_atimespec(SMB_STRUCT_STAT *pst, struct timespec ts);
1024 struct timespec get_mtimespec(const SMB_STRUCT_STAT *pst);
1025 void set_mtimespec(SMB_STRUCT_STAT *pst, struct timespec ts);
1026 struct timespec get_ctimespec(const SMB_STRUCT_STAT *pst);
1027 void set_ctimespec(SMB_STRUCT_STAT *pst, struct timespec ts);
1028 void dos_filetime_timespec(struct timespec *tsp);
1029 time_t srv_make_unix_date(const void *date_ptr);
1030 time_t srv_make_unix_date2(const void *date_ptr);
1031 time_t srv_make_unix_date3(const void *date_ptr);
1032 time_t convert_timespec_to_time_t(struct timespec ts);
1033 struct timespec convert_time_t_to_timespec(time_t t);
1034 struct timespec convert_timeval_to_timespec(const struct timeval tv);
1035 struct timeval convert_timespec_to_timeval(const struct timespec ts);
1036 struct timespec timespec_current(void);
1037 struct timespec timespec_min(const struct timespec *ts1,
1038 const struct timespec *ts2);
1039 int timespec_compare(const struct timespec *ts1, const struct timespec *ts2);
1040 struct timespec interpret_long_date(const char *p);
1041 void cli_put_dos_date(struct cli_state *cli, char *buf, int offset, time_t unixdate);
1042 void cli_put_dos_date2(struct cli_state *cli, char *buf, int offset, time_t unixdate);
1043 void cli_put_dos_date3(struct cli_state *cli, char *buf, int offset, time_t unixdate);
1044 time_t cli_make_unix_date(struct cli_state *cli, const void *date_ptr);
1045 time_t cli_make_unix_date2(struct cli_state *cli, const void *date_ptr);
1046 time_t cli_make_unix_date3(struct cli_state *cli, const void *date_ptr);
1047 bool nt_time_equals(const NTTIME *nt1, const NTTIME *nt2);
1048 void TimeInit(void);
1049 void get_process_uptime(struct timeval *ret_time);
1050 time_t nt_time_to_unix_abs(const NTTIME *nt);
1051 time_t uint64s_nt_time_to_unix_abs(const uint64_t *src);
1052 void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts);
1053 void unix_to_nt_time_abs(NTTIME *nt, time_t t);
1054 bool null_mtime(time_t mtime);
1055 const char *time_to_asc(const time_t t);
1056 const char *display_time(NTTIME nttime);
1057 bool nt_time_is_set(const NTTIME *nt);
1059 /* The following definitions come from lib/username.c */
1061 char *get_user_home_dir(TALLOC_CTX *mem_ctx, const char *user);
1062 struct passwd *Get_Pwnam_alloc(TALLOC_CTX *mem_ctx, const char *user);
1064 /* The following definitions come from lib/util.c */
1066 bool all_zero(const uint8_t *ptr, size_t size);
1067 bool set_global_myname(const char *myname);
1068 const char *global_myname(void);
1069 bool set_global_myworkgroup(const char *myworkgroup);
1070 const char *lp_workgroup(void);
1071 bool set_global_scope(const char *scope);
1072 const char *global_scope(void);
1073 void gfree_names(void);
1074 void gfree_all( void );
1075 const char *my_netbios_names(int i);
1076 bool set_netbios_aliases(const char **str_array);
1077 bool init_names(void);
1078 struct user_auth_info *user_auth_info_init(TALLOC_CTX *mem_ctx);
1079 const char *get_cmdline_auth_info_username(const struct user_auth_info *auth_info);
1080 void set_cmdline_auth_info_username(struct user_auth_info *auth_info,
1081 const char *username);
1082 void set_cmdline_auth_info_password(struct user_auth_info *auth_info,
1083 const char *password);
1084 const char *get_cmdline_auth_info_password(const struct user_auth_info *auth_info);
1085 bool set_cmdline_auth_info_signing_state(struct user_auth_info *auth_info,
1087 int get_cmdline_auth_info_signing_state(const struct user_auth_info *auth_info);
1088 void set_cmdline_auth_info_use_kerberos(struct user_auth_info *auth_info,
1090 bool get_cmdline_auth_info_use_kerberos(const struct user_auth_info *auth_info);
1091 void set_cmdline_auth_info_fallback_after_kerberos(struct user_auth_info *auth_info,
1093 bool get_cmdline_auth_info_fallback_after_kerberos(const struct user_auth_info *auth_info);
1094 void set_cmdline_auth_info_use_krb5_ticket(struct user_auth_info *auth_info);
1095 void set_cmdline_auth_info_smb_encrypt(struct user_auth_info *auth_info);
1096 void set_cmdline_auth_info_use_machine_account(struct user_auth_info *auth_info);
1097 bool get_cmdline_auth_info_got_pass(const struct user_auth_info *auth_info);
1098 bool get_cmdline_auth_info_smb_encrypt(const struct user_auth_info *auth_info);
1099 bool get_cmdline_auth_info_use_machine_account(const struct user_auth_info *auth_info);
1100 struct user_auth_info *get_cmdline_auth_info_copy(TALLOC_CTX *mem_ctx,
1101 const struct user_auth_info *info);
1102 bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_info);
1103 void set_cmdline_auth_info_getpass(struct user_auth_info *auth_info);
1104 bool add_gid_to_array_unique(TALLOC_CTX *mem_ctx, gid_t gid,
1105 gid_t **gids, size_t *num_gids);
1106 bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf);
1107 bool socket_exist(const char *fname);
1108 bool directory_exist_stat(char *dname,SMB_STRUCT_STAT *st);
1109 uint64_t get_file_size_stat(const SMB_STRUCT_STAT *sbuf);
1110 SMB_OFF_T get_file_size(char *file_name);
1111 char *attrib_string(uint16 mode);
1112 void show_msg(char *buf);
1113 void smb_set_enclen(char *buf,int len,uint16 enc_ctx_num);
1114 void smb_setlen(char *buf,int len);
1115 int set_message_bcc(char *buf,int num_bytes);
1116 ssize_t message_push_blob(uint8 **outbuf, DATA_BLOB blob);
1117 char *unix_clean_name(TALLOC_CTX *ctx, const char *s);
1118 char *clean_name(TALLOC_CTX *ctx, const char *s);
1119 ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, SMB_OFF_T pos);
1120 int set_blocking(int fd, bool set);
1121 void smb_msleep(unsigned int t);
1122 bool reinit_after_fork(struct messaging_context *msg_ctx,
1123 struct event_context *ev_ctx,
1124 bool parent_longlived);
1125 bool yesno(const char *p);
1126 void *malloc_(size_t size);
1127 void *memalign_array(size_t el_size, size_t align, unsigned int count);
1128 void *calloc_array(size_t size, size_t nmemb);
1129 void *Realloc(void *p, size_t size, bool free_old_on_error);
1130 void add_to_large_array(TALLOC_CTX *mem_ctx, size_t element_size,
1131 void *element, void *_array, uint32 *num_elements,
1132 ssize_t *array_size);
1133 char *get_myname(TALLOC_CTX *ctx);
1134 char *get_mydnsdomname(TALLOC_CTX *ctx);
1135 int interpret_protocol(const char *str,int def);
1136 char *automount_lookup(TALLOC_CTX *ctx, const char *user_name);
1137 char *automount_lookup(TALLOC_CTX *ctx, const char *user_name);
1138 bool process_exists(const struct server_id pid);
1139 const char *uidtoname(uid_t uid);
1140 char *gidtoname(gid_t gid);
1141 uid_t nametouid(const char *name);
1142 gid_t nametogid(const char *name);
1143 void smb_panic(const char *const why);
1144 void log_stack_trace(void);
1145 const char *readdirname(SMB_STRUCT_DIR *p);
1146 bool is_in_path(const char *name, name_compare_entry *namelist, bool case_sensitive);
1147 void set_namearray(name_compare_entry **ppname_array, const char *namelist);
1148 void free_namearray(name_compare_entry *name_array);
1149 bool fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
1150 bool fcntl_getlock(int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid);
1151 bool is_myname(const char *s);
1152 bool is_myworkgroup(const char *s);
1153 void ra_lanman_string( const char *native_lanman );
1154 const char *get_remote_arch_str(void);
1155 void set_remote_arch(enum remote_arch_types type);
1156 enum remote_arch_types get_remote_arch(void);
1157 const char *tab_depth(int level, int depth);
1158 int str_checksum(const char *s);
1159 void zero_free(void *p, size_t size);
1160 int set_maxfiles(int requested_max);
1161 int smb_mkstemp(char *name_template);
1162 void *smb_xmalloc_array(size_t size, unsigned int count);
1163 char *myhostname(void);
1164 char *lock_path(const char *name);
1165 char *pid_path(const char *name);
1166 char *lib_path(const char *name);
1167 char *modules_path(const char *name);
1168 char *data_path(const char *name);
1169 char *state_path(const char *name);
1170 char *cache_path(const char *name);
1171 const char *shlib_ext(void);
1172 bool parent_dirname(TALLOC_CTX *mem_ctx, const char *dir, char **parent,
1174 bool ms_has_wild(const char *s);
1175 bool ms_has_wild_w(const smb_ucs2_t *s);
1176 bool mask_match(const char *string, const char *pattern, bool is_case_sensitive);
1177 bool mask_match_search(const char *string, const char *pattern, bool is_case_sensitive);
1178 bool mask_match_list(const char *string, char **list, int listLen, bool is_case_sensitive);
1179 bool unix_wild_match(const char *pattern, const char *string);
1180 bool name_to_fqdn(fstring fqdn, const char *name);
1181 void *talloc_append_blob(TALLOC_CTX *mem_ctx, void *buf, DATA_BLOB blob);
1182 uint32 map_share_mode_to_deny_mode(uint32 share_access, uint32 private_options);
1183 pid_t procid_to_pid(const struct server_id *proc);
1184 void set_my_vnn(uint32 vnn);
1185 uint32 get_my_vnn(void);
1186 struct server_id pid_to_procid(pid_t pid);
1187 struct server_id procid_self(void);
1188 struct server_id server_id_self(void);
1189 bool procid_equal(const struct server_id *p1, const struct server_id *p2);
1190 bool cluster_id_equal(const struct server_id *id1,
1191 const struct server_id *id2);
1192 bool procid_is_me(const struct server_id *pid);
1193 struct server_id interpret_pid(const char *pid_string);
1194 char *procid_str(TALLOC_CTX *mem_ctx, const struct server_id *pid);
1195 char *procid_str_static(const struct server_id *pid);
1196 bool procid_valid(const struct server_id *pid);
1197 bool procid_is_local(const struct server_id *pid);
1198 int this_is_smp(void);
1199 bool trans_oob(uint32_t bufsize, uint32_t offset, uint32_t length);
1200 bool is_offset_safe(const char *buf_base, size_t buf_len, char *ptr, size_t off);
1201 char *get_safe_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
1202 char *get_safe_str_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
1203 int get_safe_SVAL(const char *buf_base, size_t buf_len, char *ptr, size_t off, int failval);
1204 int get_safe_IVAL(const char *buf_base, size_t buf_len, char *ptr, size_t off, int failval);
1205 void split_domain_user(TALLOC_CTX *mem_ctx,
1206 const char *full_name,
1209 void *_talloc_zero_zeronull(const void *ctx, size_t size, const char *name);
1210 void *_talloc_memdup_zeronull(const void *t, const void *p, size_t size, const char *name);
1211 void *_talloc_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
1212 void *_talloc_zero_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
1213 void *talloc_zeronull(const void *context, size_t size, const char *name);
1214 NTSTATUS split_ntfs_stream_name(TALLOC_CTX *mem_ctx, const char *fname,
1215 char **pbase, char **pstream);
1216 bool is_valid_policy_hnd(const struct policy_handle *hnd);
1217 bool policy_hnd_equal(const struct policy_handle *hnd1,
1218 const struct policy_handle *hnd2);
1219 const char *strip_hostname(const char *s);
1221 /* The following definitions come from lib/util_file.c */
1223 char **file_lines_pload(const char *syscmd, int *numlines);
1224 void file_lines_free(char **lines);
1226 /* The following definitions come from lib/util_nscd.c */
1228 void smb_nscd_flush_user_cache(void);
1229 void smb_nscd_flush_group_cache(void);
1231 /* The following definitions come from lib/util_nttoken.c */
1233 NT_USER_TOKEN *dup_nt_token(TALLOC_CTX *mem_ctx, const NT_USER_TOKEN *ptoken);
1234 NTSTATUS merge_nt_token(TALLOC_CTX *mem_ctx,
1235 const struct nt_user_token *token_1,
1236 const struct nt_user_token *token_2,
1237 struct nt_user_token **token_out);
1238 bool token_sid_in_ace(const NT_USER_TOKEN *token, const SEC_ACE *ace);
1240 /* The following definitions come from lib/util_pw.c */
1242 struct passwd *tcopy_passwd(TALLOC_CTX *mem_ctx, const struct passwd *from) ;
1243 void flush_pwnam_cache(void);
1244 struct passwd *getpwnam_alloc(TALLOC_CTX *mem_ctx, const char *name);
1245 struct passwd *getpwuid_alloc(TALLOC_CTX *mem_ctx, uid_t uid) ;
1247 /* The following definitions come from lib/util_reg.c */
1249 const char *reg_type_lookup(enum winreg_Type type);
1250 WERROR reg_pull_multi_sz(TALLOC_CTX *mem_ctx, const void *buf, size_t len,
1251 uint32 *num_values, char ***values);
1253 /* The following definitions come from lib/util_reg_api.c */
1255 WERROR registry_pull_value(TALLOC_CTX *mem_ctx,
1256 struct registry_value **pvalue,
1257 enum winreg_Type type, uint8 *data,
1258 uint32 size, uint32 length);
1259 WERROR registry_push_value(TALLOC_CTX *mem_ctx,
1260 const struct registry_value *value,
1261 DATA_BLOB *presult);
1263 /* The following definitions come from lib/util_seaccess.c */
1265 void se_map_generic(uint32 *access_mask, const struct generic_mapping *mapping);
1266 void security_acl_map_generic(struct security_acl *sa, const struct generic_mapping *mapping);
1267 void se_map_standard(uint32 *access_mask, struct standard_mapping *mapping);
1268 NTSTATUS se_access_check(const SEC_DESC *sd, const NT_USER_TOKEN *token,
1269 uint32 acc_desired, uint32 *acc_granted);
1270 NTSTATUS samr_make_sam_obj_sd(TALLOC_CTX *ctx, SEC_DESC **psd, size_t *sd_size);
1272 /* The following definitions come from lib/util_sec.c */
1274 void sec_init(void);
1275 uid_t sec_initial_uid(void);
1276 gid_t sec_initial_gid(void);
1277 bool non_root_mode(void);
1278 void gain_root_privilege(void);
1279 void gain_root_group_privilege(void);
1280 void set_effective_uid(uid_t uid);
1281 void set_effective_gid(gid_t gid);
1282 void save_re_uid(void);
1283 void restore_re_uid_fromroot(void);
1284 void restore_re_uid(void);
1285 void save_re_gid(void);
1286 void restore_re_gid(void);
1287 int set_re_uid(void);
1288 void become_user_permanently(uid_t uid, gid_t gid);
1289 bool is_setuid_root(void) ;
1291 /* The following definitions come from lib/util_sid.c */
1293 const char *sid_type_lookup(uint32 sid_type) ;
1294 NT_USER_TOKEN *get_system_token(void) ;
1295 const char *get_global_sam_name(void) ;
1296 char *sid_to_fstring(fstring sidstr_out, const DOM_SID *sid);
1297 char *sid_string_talloc(TALLOC_CTX *mem_ctx, const DOM_SID *sid);
1298 char *sid_string_dbg(const DOM_SID *sid);
1299 char *sid_string_tos(const DOM_SID *sid);
1300 bool string_to_sid(DOM_SID *sidout, const char *sidstr);
1301 DOM_SID *string_sid_talloc(TALLOC_CTX *mem_ctx, const char *sidstr);
1302 bool sid_append_rid(DOM_SID *sid, uint32 rid);
1303 bool sid_compose(DOM_SID *dst, const DOM_SID *domain_sid, uint32 rid);
1304 bool sid_split_rid(DOM_SID *sid, uint32 *rid);
1305 bool sid_peek_rid(const DOM_SID *sid, uint32 *rid);
1306 bool sid_peek_check_rid(const DOM_SID *exp_dom_sid, const DOM_SID *sid, uint32 *rid);
1307 void sid_copy(DOM_SID *dst, const DOM_SID *src);
1308 bool sid_linearize(char *outbuf, size_t len, const DOM_SID *sid);
1309 bool sid_parse(const char *inbuf, size_t len, DOM_SID *sid);
1310 int sid_compare(const DOM_SID *sid1, const DOM_SID *sid2);
1311 int sid_compare_domain(const DOM_SID *sid1, const DOM_SID *sid2);
1312 bool sid_equal(const DOM_SID *sid1, const DOM_SID *sid2);
1313 bool non_mappable_sid(DOM_SID *sid);
1314 char *sid_binstring(const DOM_SID *sid);
1315 char *sid_binstring_hex(const DOM_SID *sid);
1316 DOM_SID *sid_dup_talloc(TALLOC_CTX *ctx, const DOM_SID *src);
1317 NTSTATUS add_sid_to_array(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
1318 DOM_SID **sids, size_t *num);
1319 NTSTATUS add_sid_to_array_unique(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
1320 DOM_SID **sids, size_t *num_sids);
1321 void del_sid_from_array(const DOM_SID *sid, DOM_SID **sids, size_t *num);
1322 bool add_rid_to_array_unique(TALLOC_CTX *mem_ctx,
1323 uint32 rid, uint32 **pp_rids, size_t *p_num);
1324 bool is_null_sid(const DOM_SID *sid);
1325 bool is_sid_in_token(const NT_USER_TOKEN *token, const DOM_SID *sid);
1326 NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx,
1327 const struct netr_SamInfo3 *info3,
1328 DOM_SID **user_sids,
1329 size_t *num_user_sids,
1330 bool include_user_group_rid,
1331 bool skip_ressource_groups);
1333 /* The following definitions come from lib/util_sock.c */
1335 bool interpret_string_addr_internal(struct addrinfo **ppres,
1336 const char *str, int flags);
1337 bool is_broadcast_addr(const struct sockaddr *pss);
1338 bool interpret_string_addr(struct sockaddr_storage *pss,
1341 bool is_loopback_ip_v4(struct in_addr ip);
1342 bool is_loopback_addr(const struct sockaddr *pss);
1343 bool is_zero_addr(const struct sockaddr *pss);
1344 void zero_ip_v4(struct in_addr *ip);
1345 void zero_sockaddr(struct sockaddr_storage *pss);
1346 void in_addr_to_sockaddr_storage(struct sockaddr_storage *ss,
1348 bool same_net(const struct sockaddr *ip1,
1349 const struct sockaddr *ip2,
1350 const struct sockaddr *mask);
1351 bool sockaddr_equal(const struct sockaddr *ip1,
1352 const struct sockaddr *ip2);
1353 bool is_address_any(const struct sockaddr *psa);
1354 uint16_t get_sockaddr_port(const struct sockaddr_storage *pss);
1355 char *print_sockaddr(char *dest,
1357 const struct sockaddr_storage *psa);
1358 char *print_canonical_sockaddr(TALLOC_CTX *ctx,
1359 const struct sockaddr_storage *pss);
1360 void set_sockaddr_port(struct sockaddr *psa, uint16_t port);
1361 const char *client_name(int fd);
1362 const char *client_addr(int fd, char *addr, size_t addrlen);
1363 const char *client_socket_addr(int fd, char *addr, size_t addr_len);
1364 int client_socket_port(int fd);
1365 void set_smb_read_error(enum smb_read_errors *pre,
1366 enum smb_read_errors newerr);
1367 void cond_set_smb_read_error(enum smb_read_errors *pre,
1368 enum smb_read_errors newerr);
1369 bool is_a_socket(int fd);
1370 void set_socket_options(int fd, const char *options);
1371 ssize_t read_udp_v4_socket(int fd,
1374 struct sockaddr_storage *psa);
1375 NTSTATUS read_socket_with_timeout(int fd, char *buf,
1376 size_t mincnt, size_t maxcnt,
1377 unsigned int time_out,
1379 NTSTATUS read_data(int fd, char *buffer, size_t N);
1380 ssize_t write_data(int fd, const char *buffer, size_t N);
1381 ssize_t write_data_iov(int fd, const struct iovec *orig_iov, int iovcnt);
1382 bool send_keepalive(int client);
1383 NTSTATUS read_smb_length_return_keepalive(int fd, char *inbuf,
1384 unsigned int timeout,
1386 NTSTATUS read_smb_length(int fd, char *inbuf, unsigned int timeout,
1388 NTSTATUS receive_smb_raw(int fd,
1391 unsigned int timeout,
1394 int open_socket_in(int type,
1397 const struct sockaddr_storage *psock,
1399 NTSTATUS open_socket_out(const struct sockaddr_storage *pss, uint16_t port,
1400 int timeout, int *pfd);
1401 struct tevent_req *open_socket_out_send(TALLOC_CTX *mem_ctx,
1402 struct event_context *ev,
1403 const struct sockaddr_storage *pss,
1406 NTSTATUS open_socket_out_recv(struct tevent_req *req, int *pfd);
1407 struct tevent_req *open_socket_out_defer_send(TALLOC_CTX *mem_ctx,
1408 struct event_context *ev,
1409 struct timeval wait_time,
1410 const struct sockaddr_storage *pss,
1413 NTSTATUS open_socket_out_defer_recv(struct tevent_req *req, int *pfd);
1414 bool open_any_socket_out(struct sockaddr_storage *addrs, int num_addrs,
1415 int timeout, int *fd_index, int *fd);
1416 int open_udp_socket(const char *host, int port);
1417 const char *get_peer_name(int fd, bool force_lookup);
1418 const char *get_peer_addr(int fd, char *addr, size_t addr_len);
1419 int create_pipe_sock(const char *socket_dir,
1420 const char *socket_name,
1422 const char *get_mydnsfullname(void);
1423 bool is_myname_or_ipaddr(const char *s);
1425 /* The following definitions come from lib/util_str.c */
1427 bool next_token(const char **ptr, char *buff, const char *sep, size_t bufsize);
1428 bool next_token_talloc(TALLOC_CTX *ctx,
1432 bool next_token_no_ltrim_talloc(TALLOC_CTX *ctx,
1436 int StrCaseCmp(const char *s, const char *t);
1437 int StrnCaseCmp(const char *s, const char *t, size_t len);
1438 bool strnequal(const char *s1,const char *s2,size_t n);
1439 bool strcsequal(const char *s1,const char *s2);
1440 void strnorm(char *s, int case_default);
1441 bool strisnormal(const char *s, int case_default);
1442 char *push_skip_string(char *buf);
1443 char *skip_string(const char *base, size_t len, char *buf);
1444 size_t str_charnum(const char *s);
1445 size_t str_ascii_charnum(const char *s);
1446 bool trim_char(char *s,char cfront,char cback);
1447 bool strhasupper(const char *s);
1448 bool strhaslower(const char *s);
1449 char *safe_strcpy_fn(const char *fn,
1454 char *safe_strcat_fn(const char *fn,
1459 char *alpha_strcpy_fn(const char *fn,
1463 const char *other_safe_chars,
1465 char *StrnCpy_fn(const char *fn, int line,char *dest,const char *src,size_t n);
1466 bool in_list(const char *s, const char *list, bool casesensitive);
1467 void string_free(char **s);
1468 bool string_set(char **dest,const char *src);
1469 void string_sub2(char *s,const char *pattern, const char *insert, size_t len,
1470 bool remove_unsafe_characters, bool replace_once,
1471 bool allow_trailing_dollar);
1472 void string_sub_once(char *s, const char *pattern,
1473 const char *insert, size_t len);
1474 void string_sub(char *s,const char *pattern, const char *insert, size_t len);
1475 void fstring_sub(char *s,const char *pattern,const char *insert);
1476 char *realloc_string_sub2(char *string,
1477 const char *pattern,
1479 bool remove_unsafe_characters,
1480 bool allow_trailing_dollar);
1481 char *realloc_string_sub(char *string,
1482 const char *pattern,
1483 const char *insert);
1484 char *talloc_string_sub2(TALLOC_CTX *mem_ctx, const char *src,
1485 const char *pattern,
1487 bool remove_unsafe_characters,
1489 bool allow_trailing_dollar);
1490 char *talloc_string_sub(TALLOC_CTX *mem_ctx,
1492 const char *pattern,
1493 const char *insert);
1494 void all_string_sub(char *s,const char *pattern,const char *insert, size_t len);
1495 char *talloc_all_string_sub(TALLOC_CTX *ctx,
1497 const char *pattern,
1498 const char *insert);
1499 char *octal_string(int i);
1500 char *string_truncate(char *s, unsigned int length);
1501 char *strchr_m(const char *src, char c);
1502 char *strrchr_m(const char *s, char c);
1503 char *strnrchr_m(const char *s, char c, unsigned int n);
1504 char *strstr_m(const char *src, const char *findstr);
1505 void strlower_m(char *s);
1506 void strupper_m(char *s);
1507 size_t strlen_m(const char *s);
1508 size_t strlen_m_term(const char *s);
1509 size_t strlen_m_term_null(const char *s);
1510 char *binary_string_rfc2254(char *buf, int len);
1511 char *binary_string(char *buf, int len);
1512 int fstr_sprintf(fstring s, const char *fmt, ...);
1513 bool str_list_sub_basic( char **list, const char *smb_name,
1514 const char *domain_name );
1515 bool str_list_substitute(char **list, const char *pattern, const char *insert);
1516 bool str_list_check(const char **list, const char *s);
1517 bool str_list_check_ci(const char **list, const char *s);
1519 char *ipstr_list_make(char **ipstr_list,
1520 const struct ip_service *ip_list,
1522 int ipstr_list_parse(const char *ipstr_list, struct ip_service **ip_list);
1523 void ipstr_list_free(char* ipstr_list);
1524 void rfc1738_unescape(char *buf);
1525 DATA_BLOB base64_decode_data_blob(const char *s);
1526 void base64_decode_inplace(char *s);
1527 char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data);
1528 uint64_t STR_TO_SMB_BIG_UINT(const char *nptr, const char **entptr);
1529 SMB_OFF_T conv_str_size(const char * str);
1530 void string_append(char **left, const char *right);
1531 bool add_string_to_array(TALLOC_CTX *mem_ctx,
1532 const char *str, const char ***strings,
1534 void sprintf_append(TALLOC_CTX *mem_ctx, char **string, ssize_t *len,
1535 size_t *bufsize, const char *fmt, ...);
1536 int asprintf_strupper_m(char **strp, const char *fmt, ...);
1537 char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...);
1538 char *talloc_asprintf_strlower_m(TALLOC_CTX *t, const char *fmt, ...);
1539 char *sstring_sub(const char *src, char front, char back);
1540 bool validate_net_name( const char *name,
1541 const char *invalid_chars,
1543 char *escape_shell_string(const char *src);
1544 char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep);
1546 /* The following definitions come from lib/util_unistr.c */
1548 void gfree_case_tables(void);
1549 void load_case_tables(void);
1550 void init_valid_table(void);
1551 size_t dos_PutUniCode(char *dst,const char *src, size_t len, bool null_terminate);
1552 char *skip_unibuf(char *src, size_t len);
1553 int rpcstr_pull(char* dest, void *src, int dest_len, int src_len, int flags);
1554 int rpcstr_pull_talloc(TALLOC_CTX *ctx,
1559 int rpcstr_pull_unistr2_fstring(char *dest, UNISTR2 *src);
1560 char *rpcstr_pull_unistr2_talloc(TALLOC_CTX *ctx, const UNISTR2 *src);
1561 int rpcstr_push(void *dest, const char *src, size_t dest_len, int flags);
1562 int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src);
1563 void unistr2_to_ascii(char *dest, const UNISTR2 *str, size_t maxlen);
1564 char *unistr2_to_ascii_talloc(TALLOC_CTX *ctx, const UNISTR2 *str);
1565 const char *unistr2_static(const UNISTR2 *str);
1566 smb_ucs2_t toupper_w(smb_ucs2_t val);
1567 smb_ucs2_t tolower_w( smb_ucs2_t val );
1568 bool islower_w(smb_ucs2_t c);
1569 bool isupper_w(smb_ucs2_t c);
1570 bool isvalid83_w(smb_ucs2_t c);
1571 size_t strlen_w(const smb_ucs2_t *src);
1572 size_t strnlen_w(const smb_ucs2_t *src, size_t max);
1573 smb_ucs2_t *strchr_w(const smb_ucs2_t *s, smb_ucs2_t c);
1574 smb_ucs2_t *strchr_wa(const smb_ucs2_t *s, char c);
1575 smb_ucs2_t *strrchr_w(const smb_ucs2_t *s, smb_ucs2_t c);
1576 smb_ucs2_t *strnrchr_w(const smb_ucs2_t *s, smb_ucs2_t c, unsigned int n);
1577 smb_ucs2_t *strstr_w(const smb_ucs2_t *s, const smb_ucs2_t *ins);
1578 bool strlower_w(smb_ucs2_t *s);
1579 bool strupper_w(smb_ucs2_t *s);
1580 void strnorm_w(smb_ucs2_t *s, int case_default);
1581 int strcmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b);
1582 int strncmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len);
1583 int strcasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b);
1584 int strncasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len);
1585 bool strequal_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2);
1586 bool strnequal_w(const smb_ucs2_t *s1,const smb_ucs2_t *s2,size_t n);
1587 smb_ucs2_t *strdup_w(const smb_ucs2_t *src);
1588 smb_ucs2_t *strndup_w(const smb_ucs2_t *src, size_t len);
1589 smb_ucs2_t *strncpy_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const size_t max);
1590 smb_ucs2_t *strncat_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const size_t max);
1591 smb_ucs2_t *strcat_w(smb_ucs2_t *dest, const smb_ucs2_t *src);
1592 void string_replace_w(smb_ucs2_t *s, smb_ucs2_t oldc, smb_ucs2_t newc);
1593 bool trim_string_w(smb_ucs2_t *s, const smb_ucs2_t *front,
1594 const smb_ucs2_t *back);
1595 int strcmp_wa(const smb_ucs2_t *a, const char *b);
1596 int strncmp_wa(const smb_ucs2_t *a, const char *b, size_t len);
1597 smb_ucs2_t *strpbrk_wa(const smb_ucs2_t *s, const char *p);
1598 smb_ucs2_t *strstr_wa(const smb_ucs2_t *s, const char *ins);
1599 int unistrlen(uint16 *s);
1600 int unistrcpy(uint16 *dst, uint16 *src);
1601 UNISTR2* ucs2_to_unistr2(TALLOC_CTX *ctx, UNISTR2* dst, smb_ucs2_t* src);
1602 int toupper_ascii(int c);
1603 int tolower_ascii(int c);
1604 int isupper_ascii(int c);
1605 int islower_ascii(int c);
1607 /* The following definitions come from lib/util_uuid.c */
1609 void smb_uuid_pack(const struct GUID uu, UUID_FLAT *ptr);
1610 void smb_uuid_unpack(const UUID_FLAT in, struct GUID *uu);
1611 char *guid_binstring(const struct GUID *guid);
1613 /* The following definitions come from lib/version.c */
1615 const char *samba_version_string(void);
1617 /* The following definitions come from lib/winbind_util.c */
1619 bool winbind_lookup_name(const char *dom_name, const char *name, DOM_SID *sid,
1620 enum lsa_SidType *name_type);
1621 bool winbind_lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
1622 const char **domain, const char **name,
1623 enum lsa_SidType *name_type);
1624 bool winbind_ping(void);
1625 bool winbind_sid_to_uid(uid_t *puid, const DOM_SID *sid);
1626 bool winbind_uid_to_sid(DOM_SID *sid, uid_t uid);
1627 bool winbind_sid_to_gid(gid_t *pgid, const DOM_SID *sid);
1628 bool winbind_gid_to_sid(DOM_SID *sid, gid_t gid);
1629 struct passwd * winbind_getpwnam(const char * sname);
1630 struct passwd * winbind_getpwsid(const DOM_SID *sid);
1631 wbcErr wb_is_trusted_domain(const char *domain);
1632 bool winbind_lookup_rids(TALLOC_CTX *mem_ctx,
1633 const DOM_SID *domain_sid,
1634 int num_rids, uint32 *rids,
1635 const char **domain_name,
1636 const char ***names, enum lsa_SidType **types);
1637 bool winbind_allocate_uid(uid_t *uid);
1638 bool winbind_allocate_gid(gid_t *gid);
1639 bool winbind_get_groups(TALLOC_CTX *mem_ctx,
1640 const char *account,
1641 uint32_t *num_groups,
1643 bool winbind_get_sid_aliases(TALLOC_CTX *mem_ctx,
1644 const DOM_SID *dom_sid,
1645 const DOM_SID *members,
1647 uint32_t **pp_alias_rids,
1648 size_t *p_num_alias_rids);
1651 /* The following definitions come from lib/wins_srv.c */
1653 bool wins_srv_is_dead(struct in_addr wins_ip, struct in_addr src_ip);
1654 void wins_srv_alive(struct in_addr wins_ip, struct in_addr src_ip);
1655 void wins_srv_died(struct in_addr wins_ip, struct in_addr src_ip);
1656 unsigned wins_srv_count(void);
1657 char **wins_srv_tags(void);
1658 void wins_srv_tags_free(char **list);
1659 struct in_addr wins_srv_ip_tag(const char *tag, struct in_addr src_ip);
1660 unsigned wins_srv_count_tag(const char *tag);
1662 /* The following definitions come from libads/ads_status.c */
1664 ADS_STATUS ads_build_error(enum ads_error_type etype,
1665 int rc, int minor_status);
1666 ADS_STATUS ads_build_nt_error(enum ads_error_type etype,
1667 NTSTATUS nt_status);
1668 NTSTATUS ads_ntstatus(ADS_STATUS status);
1669 const char *ads_errstr(ADS_STATUS status);
1670 NTSTATUS gss_err_to_ntstatus(uint32 maj, uint32 min);
1672 /* The following definitions come from libads/ads_struct.c */
1674 char *ads_build_path(const char *realm, const char *sep, const char *field, int reverse);
1675 char *ads_build_dn(const char *realm);
1676 char *ads_build_domain(const char *dn);
1677 ADS_STRUCT *ads_init(const char *realm,
1678 const char *workgroup,
1679 const char *ldap_server);
1680 void ads_destroy(ADS_STRUCT **ads);
1682 /* The following definitions come from libads/ads_utils.c */
1684 uint32 ads_acb2uf(uint32 acb);
1685 uint32 ads_uf2acb(uint32 uf);
1686 uint32 ads_uf2atype(uint32 uf);
1687 uint32 ads_gtype2atype(uint32 gtype);
1688 enum lsa_SidType ads_atype_map(uint32 atype);
1690 /* The following definitions come from libads/authdata.c */
1692 struct PAC_LOGON_INFO *get_logon_info_from_pac(struct PAC_DATA *pac_data);
1693 NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
1697 time_t *expire_time,
1698 time_t *renew_till_time,
1699 const char *cache_name,
1701 bool add_netbios_addr,
1702 time_t renewable_time,
1703 struct PAC_DATA **pac_ret);
1704 NTSTATUS kerberos_return_info3_from_pac(TALLOC_CTX *mem_ctx,
1708 time_t *expire_time,
1709 time_t *renew_till_time,
1710 const char *cache_name,
1712 bool add_netbios_addr,
1713 time_t renewable_time,
1714 struct netr_SamInfo3 **info3);
1716 /* The following definitions come from libads/cldap.c */
1717 bool ads_cldap_netlogon(TALLOC_CTX *mem_ctx,
1720 uint32_t nt_version,
1721 struct netlogon_samlogon_response **reply);
1722 bool ads_cldap_netlogon_5(TALLOC_CTX *mem_ctx,
1725 struct NETLOGON_SAM_LOGON_RESPONSE_EX *reply5);
1727 /* The following definitions come from libads/disp_sec.c */
1729 void ads_disp_sd(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, SEC_DESC *sd);
1731 /* The following definitions come from libads/dns.c */
1733 NTSTATUS ads_dns_lookup_ns(TALLOC_CTX *ctx,
1734 const char *dnsdomain,
1735 struct dns_rr_ns **nslist,
1737 bool sitename_store(const char *realm, const char *sitename);
1738 char *sitename_fetch(const char *realm);
1739 bool stored_sitename_changed(const char *realm, const char *sitename);
1740 NTSTATUS ads_dns_query_dcs(TALLOC_CTX *ctx,
1742 const char *sitename,
1743 struct dns_rr_srv **dclist,
1745 NTSTATUS ads_dns_query_gcs(TALLOC_CTX *ctx,
1747 const char *sitename,
1748 struct dns_rr_srv **dclist,
1750 NTSTATUS ads_dns_query_kdcs(TALLOC_CTX *ctx,
1751 const char *dns_forest_name,
1752 const char *sitename,
1753 struct dns_rr_srv **dclist,
1755 NTSTATUS ads_dns_query_pdc(TALLOC_CTX *ctx,
1756 const char *dns_domain_name,
1757 struct dns_rr_srv **dclist,
1759 NTSTATUS ads_dns_query_dcs_guid(TALLOC_CTX *ctx,
1760 const char *dns_forest_name,
1761 const struct GUID *domain_guid,
1762 struct dns_rr_srv **dclist,
1765 /* The following definitions come from libads/kerberos.c */
1767 int kerberos_kinit_password_ext(const char *principal,
1768 const char *password,
1770 time_t *expire_time,
1771 time_t *renew_till_time,
1772 const char *cache_name,
1774 bool add_netbios_addr,
1775 time_t renewable_time,
1776 NTSTATUS *ntstatus);
1777 int ads_kinit_password(ADS_STRUCT *ads);
1778 int ads_kdestroy(const char *cc_name);
1779 char* kerberos_standard_des_salt( void );
1780 bool kerberos_secrets_store_des_salt( const char* salt );
1781 char* kerberos_secrets_fetch_des_salt( void );
1782 char *kerberos_get_default_realm_from_ccache( void );
1783 bool kerberos_secrets_store_salting_principal(const char *service,
1785 const char *principal);
1786 int kerberos_kinit_password(const char *principal,
1787 const char *password,
1789 const char *cache_name);
1790 bool create_local_private_krb5_conf_for_domain(const char *realm,
1792 const char *sitename,
1793 struct sockaddr_storage *pss);
1795 /* The following definitions come from libads/kerberos_keytab.c */
1797 int ads_keytab_add_entry(ADS_STRUCT *ads, const char *srvPrinc);
1798 int ads_keytab_flush(ADS_STRUCT *ads);
1799 int ads_keytab_create_default(ADS_STRUCT *ads);
1800 int ads_keytab_list(const char *keytab_name);
1802 /* The following definitions come from libads/kerberos_verify.c */
1804 NTSTATUS ads_verify_ticket(TALLOC_CTX *mem_ctx,
1807 const DATA_BLOB *ticket,
1809 struct PAC_DATA **pac_data,
1811 DATA_BLOB *session_key,
1812 bool use_replay_cache);
1814 /* The following definitions come from libads/krb5_errs.c */
1817 /* The following definitions come from libads/krb5_setpw.c */
1819 ADS_STATUS ads_krb5_set_password(const char *kdc_host, const char *princ,
1820 const char *newpw, int time_offset);
1821 ADS_STATUS kerberos_set_password(const char *kpasswd_server,
1822 const char *auth_principal, const char *auth_password,
1823 const char *target_principal, const char *new_password,
1825 ADS_STATUS ads_set_machine_password(ADS_STRUCT *ads,
1826 const char *machine_account,
1827 const char *password);
1829 /* The following definitions come from libads/ldap.c */
1831 bool ads_sitename_match(ADS_STRUCT *ads);
1832 bool ads_closest_dc(ADS_STRUCT *ads);
1833 ADS_STATUS ads_connect(ADS_STRUCT *ads);
1834 ADS_STATUS ads_connect_user_creds(ADS_STRUCT *ads);
1835 ADS_STATUS ads_connect_gc(ADS_STRUCT *ads);
1836 void ads_disconnect(ADS_STRUCT *ads);
1837 ADS_STATUS ads_do_search_all_fn(ADS_STRUCT *ads, const char *bind_path,
1838 int scope, const char *expr, const char **attrs,
1839 bool (*fn)(ADS_STRUCT *, char *, void **, void *),
1841 void ads_memfree(ADS_STRUCT *ads, void *mem);
1842 char *ads_parent_dn(const char *dn);
1843 ADS_MODLIST ads_init_mods(TALLOC_CTX *ctx);
1844 ADS_STATUS ads_mod_str(TALLOC_CTX *ctx, ADS_MODLIST *mods,
1845 const char *name, const char *val);
1846 ADS_STATUS ads_mod_strlist(TALLOC_CTX *ctx, ADS_MODLIST *mods,
1847 const char *name, const char **vals);
1848 ADS_STATUS ads_gen_mod(ADS_STRUCT *ads, const char *mod_dn, ADS_MODLIST mods);
1849 ADS_STATUS ads_gen_add(ADS_STRUCT *ads, const char *new_dn, ADS_MODLIST mods);
1850 ADS_STATUS ads_del_dn(ADS_STRUCT *ads, char *del_dn);
1851 char *ads_ou_string(ADS_STRUCT *ads, const char *org_unit);
1852 char *ads_default_ou_string(ADS_STRUCT *ads, const char *wknguid);
1853 ADS_STATUS ads_add_strlist(TALLOC_CTX *ctx, ADS_MODLIST *mods,
1854 const char *name, const char **vals);
1855 uint32 ads_get_kvno(ADS_STRUCT *ads, const char *account_name);
1856 uint32_t ads_get_machine_kvno(ADS_STRUCT *ads, const char *machine_name);
1857 ADS_STATUS ads_clear_service_principal_names(ADS_STRUCT *ads, const char *machine_name);
1858 ADS_STATUS ads_add_service_principal_name(ADS_STRUCT *ads, const char *machine_name,
1859 const char *my_fqdn, const char *spn);
1860 ADS_STATUS ads_create_machine_acct(ADS_STRUCT *ads, const char *machine_name,
1861 const char *org_unit);
1862 ADS_STATUS ads_move_machine_acct(ADS_STRUCT *ads, const char *machine_name,
1863 const char *org_unit, bool *moved);
1864 int ads_count_replies(ADS_STRUCT *ads, void *res);
1865 ADS_STATUS ads_USN(ADS_STRUCT *ads, uint32 *usn);
1866 ADS_STATUS ads_current_time(ADS_STRUCT *ads);
1867 ADS_STATUS ads_domain_func_level(ADS_STRUCT *ads, uint32 *val);
1868 ADS_STATUS ads_domain_sid(ADS_STRUCT *ads, DOM_SID *sid);
1869 ADS_STATUS ads_site_dn(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const char **site_name);
1870 ADS_STATUS ads_site_dn_for_machine(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const char *computer_name, const char **site_dn);
1871 ADS_STATUS ads_upn_suffixes(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char ***suffixes, size_t *num_suffixes);
1872 ADS_STATUS ads_get_joinable_ous(ADS_STRUCT *ads,
1873 TALLOC_CTX *mem_ctx,
1876 ADS_STATUS ads_get_sid_from_extended_dn(TALLOC_CTX *mem_ctx,
1877 const char *extended_dn,
1878 enum ads_extended_dn_flags flags,
1880 char* ads_get_dnshostname( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name );
1881 char* ads_get_upn( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name );
1882 char* ads_get_samaccountname( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name );
1883 ADS_STATUS ads_join_realm(ADS_STRUCT *ads, const char *machine_name,
1884 uint32 account_type, const char *org_unit);
1885 ADS_STATUS ads_leave_realm(ADS_STRUCT *ads, const char *hostname);
1886 ADS_STATUS ads_find_samaccount(ADS_STRUCT *ads,
1887 TALLOC_CTX *mem_ctx,
1888 const char *samaccountname,
1890 const char **dn_ret);
1891 ADS_STATUS ads_config_path(ADS_STRUCT *ads,
1892 TALLOC_CTX *mem_ctx,
1893 char **config_path);
1894 const char *ads_get_extended_right_name_by_guid(ADS_STRUCT *ads,
1895 const char *config_path,
1896 TALLOC_CTX *mem_ctx,
1897 const struct GUID *rights_guid);
1898 ADS_STATUS ads_check_ou_dn(TALLOC_CTX *mem_ctx,
1900 const char **account_ou);
1902 /* The following definitions come from libads/ldap_printer.c */
1904 ADS_STATUS ads_mod_printer_entry(ADS_STRUCT *ads, char *prt_dn,
1905 TALLOC_CTX *ctx, const ADS_MODLIST *mods);
1906 ADS_STATUS ads_add_printer_entry(ADS_STRUCT *ads, char *prt_dn,
1907 TALLOC_CTX *ctx, ADS_MODLIST *mods);
1908 WERROR get_remote_printer_publishing_data(struct rpc_pipe_client *cli,
1909 TALLOC_CTX *mem_ctx,
1911 const char *printer);
1912 bool get_local_printer_publishing_data(TALLOC_CTX *mem_ctx,
1914 NT_PRINTER_DATA *data);
1916 /* The following definitions come from libads/ldap_schema.c */
1918 ADS_STATUS ads_get_attrnames_by_oids(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
1919 const char *schema_path,
1920 const char **OIDs, size_t num_OIDs,
1921 char ***OIDs_out, char ***names, size_t *count);
1922 const char *ads_get_attrname_by_guid(ADS_STRUCT *ads,
1923 const char *schema_path,
1924 TALLOC_CTX *mem_ctx,
1925 const struct GUID *schema_guid);
1926 const char *ads_get_attrname_by_oid(ADS_STRUCT *ads, const char *schema_path, TALLOC_CTX *mem_ctx, const char * OID);
1927 ADS_STATUS ads_schema_path(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char **schema_path);
1928 ADS_STATUS ads_check_posix_schema_mapping(TALLOC_CTX *mem_ctx,
1930 enum wb_posix_mapping map_type,
1931 struct posix_schema **s ) ;
1933 /* The following definitions come from libads/ldap_user.c */
1935 ADS_STATUS ads_add_user_acct(ADS_STRUCT *ads, const char *user,
1936 const char *container, const char *fullname);
1937 ADS_STATUS ads_add_group_acct(ADS_STRUCT *ads, const char *group,
1938 const char *container, const char *comment);
1940 /* The following definitions come from libads/ldap_utils.c */
1942 ADS_STATUS ads_ranged_search(ADS_STRUCT *ads,
1943 TALLOC_CTX *mem_ctx,
1948 const char *range_attr,
1950 size_t *num_strings);
1951 ADS_STATUS ads_ranged_search_internal(ADS_STRUCT *ads,
1952 TALLOC_CTX *mem_ctx,
1958 const char *range_attr,
1960 size_t *num_strings,
1965 /* The following definitions come from libads/ndr.c */
1967 void ndr_print_ads_auth_flags(struct ndr_print *ndr, const char *name, uint32_t r);
1968 void ndr_print_ads_struct(struct ndr_print *ndr, const char *name, const struct ads_struct *r);
1970 /* The following definitions come from libads/sasl.c */
1972 ADS_STATUS ads_sasl_bind(ADS_STRUCT *ads);
1974 /* The following definitions come from libads/sasl_wrapping.c */
1976 ADS_STATUS ads_setup_sasl_wrapping(ADS_STRUCT *ads,
1977 const struct ads_saslwrap_ops *ops,
1978 void *private_data);
1979 ADS_STATUS ads_setup_sasl_wrapping(ADS_STRUCT *ads,
1980 const struct ads_saslwrap_ops *ops,
1981 void *private_data);
1983 /* The following definitions come from libads/util.c */
1985 ADS_STATUS ads_change_trust_account_password(ADS_STRUCT *ads, char *host_principal);
1986 ADS_STATUS ads_guess_service_principal(ADS_STRUCT *ads,
1987 char **returned_principal);
1989 /* The following definitions come from libgpo/gpext/gpext.c */
1991 struct gp_extension *get_gp_extension_list(void);
1992 NTSTATUS unregister_gp_extension(const char *name);
1993 NTSTATUS register_gp_extension(TALLOC_CTX *gpext_ctx,
1997 struct gp_extension_methods *methods);
1998 NTSTATUS gp_ext_info_add_entry(TALLOC_CTX *mem_ctx,
2000 const char *ext_guid,
2001 struct gp_extension_reg_table *table,
2002 struct gp_extension_reg_info *info);
2003 NTSTATUS shutdown_gp_extensions(void);
2004 NTSTATUS init_gp_extensions(TALLOC_CTX *mem_ctx);
2005 NTSTATUS free_gp_extensions(void);
2006 void debug_gpext_header(int lvl,
2009 struct GROUP_POLICY_OBJECT *gpo,
2010 const char *extension_guid,
2011 const char *snapin_guid);
2012 NTSTATUS process_gpo_list_with_extension(ADS_STRUCT *ads,
2013 TALLOC_CTX *mem_ctx,
2015 const struct nt_user_token *token,
2016 struct GROUP_POLICY_OBJECT *gpo_list,
2017 const char *extension_guid,
2018 const char *snapin_guid);
2019 NTSTATUS gpext_process_extension(ADS_STRUCT *ads,
2020 TALLOC_CTX *mem_ctx,
2022 const struct nt_user_token *token,
2023 struct registry_key *root_key,
2024 struct GROUP_POLICY_OBJECT *gpo,
2025 const char *extension_guid,
2026 const char *snapin_guid);
2028 /* The following definitions come from libgpo/gpo_fetch.c */
2030 NTSTATUS gpo_explode_filesyspath(TALLOC_CTX *mem_ctx,
2031 const char *file_sys_path,
2036 NTSTATUS gpo_fetch_files(TALLOC_CTX *mem_ctx,
2037 struct cli_state *cli,
2038 struct GROUP_POLICY_OBJECT *gpo);
2039 NTSTATUS gpo_get_sysvol_gpt_version(TALLOC_CTX *mem_ctx,
2040 const char *unix_path,
2041 uint32_t *sysvol_version,
2042 char **display_name);
2044 /* The following definitions come from libgpo/gpo_filesync.c */
2046 NTSTATUS gpo_copy_file(TALLOC_CTX *mem_ctx,
2047 struct cli_state *cli,
2048 const char *nt_path,
2049 const char *unix_path);
2050 NTSTATUS gpo_sync_directories(TALLOC_CTX *mem_ctx,
2051 struct cli_state *cli,
2052 const char *nt_path,
2053 const char *local_path);
2055 /* The following definitions come from libgpo/gpo_ini.c */
2057 NTSTATUS parse_gpt_ini(TALLOC_CTX *mem_ctx,
2058 const char *filename,
2060 char **display_name);
2062 /* The following definitions come from libgpo/gpo_ldap.c */
2064 bool ads_parse_gp_ext(TALLOC_CTX *mem_ctx,
2065 const char *extension_raw,
2066 struct GP_EXT **gp_ext);
2067 ADS_STATUS ads_get_gpo_link(ADS_STRUCT *ads,
2068 TALLOC_CTX *mem_ctx,
2069 const char *link_dn,
2070 struct GP_LINK *gp_link_struct);
2071 ADS_STATUS ads_add_gpo_link(ADS_STRUCT *ads,
2072 TALLOC_CTX *mem_ctx,
2073 const char *link_dn,
2076 ADS_STATUS ads_delete_gpo_link(ADS_STRUCT *ads,
2077 TALLOC_CTX *mem_ctx,
2078 const char *link_dn,
2079 const char *gpo_dn);
2080 ADS_STATUS ads_get_gpo(ADS_STRUCT *ads,
2081 TALLOC_CTX *mem_ctx,
2083 const char *display_name,
2084 const char *guid_name,
2085 struct GROUP_POLICY_OBJECT *gpo);
2086 ADS_STATUS ads_get_sid_token(ADS_STRUCT *ads,
2087 TALLOC_CTX *mem_ctx,
2089 struct nt_user_token **token);
2090 ADS_STATUS ads_get_gpo_list(ADS_STRUCT *ads,
2091 TALLOC_CTX *mem_ctx,
2094 const struct nt_user_token *token,
2095 struct GROUP_POLICY_OBJECT **gpo_list);
2097 /* The following definitions come from libgpo/gpo_reg.c */
2099 struct nt_user_token *registry_create_system_token(TALLOC_CTX *mem_ctx);
2100 WERROR gp_init_reg_ctx(TALLOC_CTX *mem_ctx,
2101 const char *initial_path,
2102 uint32_t desired_access,
2103 const struct nt_user_token *token,
2104 struct gp_registry_context **reg_ctx);
2105 void gp_free_reg_ctx(struct gp_registry_context *reg_ctx);
2106 WERROR gp_store_reg_subkey(TALLOC_CTX *mem_ctx,
2107 const char *subkeyname,
2108 struct registry_key *curr_key,
2109 struct registry_key **new_key);
2110 WERROR gp_read_reg_subkey(TALLOC_CTX *mem_ctx,
2111 struct gp_registry_context *reg_ctx,
2112 const char *subkeyname,
2113 struct registry_key **key);
2114 WERROR gp_store_reg_val_sz(TALLOC_CTX *mem_ctx,
2115 struct registry_key *key,
2116 const char *val_name,
2118 WERROR gp_read_reg_val_sz(TALLOC_CTX *mem_ctx,
2119 struct registry_key *key,
2120 const char *val_name,
2122 WERROR gp_reg_state_store(TALLOC_CTX *mem_ctx,
2125 const struct nt_user_token *token,
2126 struct GROUP_POLICY_OBJECT *gpo_list);
2127 WERROR gp_reg_state_read(TALLOC_CTX *mem_ctx,
2130 struct GROUP_POLICY_OBJECT **gpo_list);
2131 WERROR gp_secure_key(TALLOC_CTX *mem_ctx,
2133 struct registry_key *key,
2134 const DOM_SID *sid);
2135 void dump_reg_val(int lvl, const char *direction,
2136 const char *key, const char *subkey,
2137 struct registry_value *val);
2138 void dump_reg_entry(uint32_t flags,
2140 struct gp_registry_entry *entry);
2141 void dump_reg_entries(uint32_t flags,
2143 struct gp_registry_entry *entries,
2144 size_t num_entries);
2145 bool add_gp_registry_entry_to_array(TALLOC_CTX *mem_ctx,
2146 struct gp_registry_entry *entry,
2147 struct gp_registry_entry **entries,
2149 WERROR reg_apply_registry_entry(TALLOC_CTX *mem_ctx,
2150 struct registry_key *root_key,
2151 struct gp_registry_context *reg_ctx,
2152 struct gp_registry_entry *entry,
2153 const struct nt_user_token *token,
2156 /* The following definitions come from libgpo/gpo_sec.c */
2158 NTSTATUS gpo_apply_security_filtering(const struct GROUP_POLICY_OBJECT *gpo,
2159 const struct nt_user_token *token);
2161 /* The following definitions come from libgpo/gpo_util.c */
2163 const char *cse_gpo_guid_string_to_name(const char *guid);
2164 const char *cse_gpo_name_to_guid_string(const char *name);
2165 const char *cse_snapin_gpo_guid_string_to_name(const char *guid);
2166 void dump_gp_ext(struct GP_EXT *gp_ext, int debuglevel);
2167 void dump_gpo(ADS_STRUCT *ads,
2168 TALLOC_CTX *mem_ctx,
2169 struct GROUP_POLICY_OBJECT *gpo,
2171 void dump_gpo_list(ADS_STRUCT *ads,
2172 TALLOC_CTX *mem_ctx,
2173 struct GROUP_POLICY_OBJECT *gpo_list,
2175 void dump_gplink(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, struct GP_LINK *gp_link);
2176 ADS_STATUS gpo_process_a_gpo(ADS_STRUCT *ads,
2177 TALLOC_CTX *mem_ctx,
2178 const struct nt_user_token *token,
2179 struct registry_key *root_key,
2180 struct GROUP_POLICY_OBJECT *gpo,
2181 const char *extension_guid_filter,
2183 ADS_STATUS gpo_process_gpo_list(ADS_STRUCT *ads,
2184 TALLOC_CTX *mem_ctx,
2185 const struct nt_user_token *token,
2186 struct GROUP_POLICY_OBJECT *gpo_list,
2187 const char *extensions_guid_filter,
2189 NTSTATUS check_refresh_gpo(ADS_STRUCT *ads,
2190 TALLOC_CTX *mem_ctx,
2192 struct GROUP_POLICY_OBJECT *gpo,
2193 struct cli_state **cli_out);
2194 NTSTATUS check_refresh_gpo_list(ADS_STRUCT *ads,
2195 TALLOC_CTX *mem_ctx,
2197 struct GROUP_POLICY_OBJECT *gpo_list);
2198 NTSTATUS gpo_get_unix_path(TALLOC_CTX *mem_ctx,
2199 struct GROUP_POLICY_OBJECT *gpo,
2201 char *gpo_flag_str(uint32_t flags);
2202 NTSTATUS gp_find_file(TALLOC_CTX *mem_ctx,
2204 const char *filename,
2206 const char **filename_out);
2207 ADS_STATUS gp_get_machine_token(ADS_STRUCT *ads,
2208 TALLOC_CTX *mem_ctx,
2210 struct nt_user_token **token);
2212 #include "librpc/gen_ndr/ndr_dfs.h"
2213 #include "librpc/gen_ndr/ndr_dssetup.h"
2214 #include "librpc/gen_ndr/ndr_echo.h"
2215 #include "librpc/gen_ndr/ndr_eventlog.h"
2216 #include "librpc/gen_ndr/ndr_krb5pac.h"
2217 #include "librpc/gen_ndr/ndr_lsa.h"
2218 #include "librpc/gen_ndr/ndr_misc.h"
2219 #include "librpc/gen_ndr/ndr_netlogon.h"
2220 #include "librpc/gen_ndr/ndr_notify.h"
2221 #include "librpc/gen_ndr/ndr_ntsvcs.h"
2222 #include "librpc/gen_ndr/ndr_samr.h"
2223 #include "librpc/gen_ndr/ndr_security.h"
2224 #include "librpc/gen_ndr/ndr_srvsvc.h"
2225 #include "librpc/gen_ndr/ndr_svcctl.h"
2226 #include "librpc/gen_ndr/ndr_winreg.h"
2227 #include "librpc/gen_ndr/ndr_wkssvc.h"
2229 #include "librpc/gen_ndr/srv_dfs.h"
2230 #include "librpc/gen_ndr/srv_dssetup.h"
2231 #include "librpc/gen_ndr/srv_echo.h"
2232 #include "librpc/gen_ndr/srv_eventlog.h"
2233 #include "librpc/gen_ndr/srv_initshutdown.h"
2234 #include "librpc/gen_ndr/srv_lsa.h"
2235 #include "librpc/gen_ndr/srv_netlogon.h"
2236 #include "librpc/gen_ndr/srv_ntsvcs.h"
2237 #include "librpc/gen_ndr/srv_samr.h"
2238 #include "librpc/gen_ndr/srv_srvsvc.h"
2239 #include "librpc/gen_ndr/srv_svcctl.h"
2240 #include "librpc/gen_ndr/srv_winreg.h"
2241 #include "librpc/gen_ndr/srv_wkssvc.h"
2242 #include "librpc/gen_ndr/srv_spoolss.h"
2244 #include "librpc/ndr/libndr.h"
2246 /* The following definitions come from librpc/ndr/util.c */
2248 enum ndr_err_code ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct server_id *r);
2249 enum ndr_err_code ndr_pull_server_id(struct ndr_pull *ndr, int ndr_flags, struct server_id *r);
2250 void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct server_id *r);
2251 enum ndr_err_code ndr_push_file_id(struct ndr_push *ndr, int ndr_flags, const struct file_id *r);
2252 enum ndr_err_code ndr_pull_file_id(struct ndr_pull *ndr, int ndr_flags, struct file_id *r);
2253 void ndr_print_file_id(struct ndr_print *ndr, const char *name, const struct file_id *r);
2254 _PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const bool b);
2255 _PUBLIC_ void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss);
2256 const char *ndr_errstr(enum ndr_err_code err);
2258 /* The following definitions come from librpc/ndr/sid.c */
2260 char *dom_sid_string(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
2262 /* The following definitions come from librpc/rpc/binding.c */
2264 const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor);
2265 _PUBLIC_ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_binding *b);
2266 _PUBLIC_ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_binding **b_out);
2267 _PUBLIC_ NTSTATUS dcerpc_floor_get_lhs_data(const struct epm_floor *epm_floor,
2268 struct ndr_syntax_id *syntax);
2269 const char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor);
2270 enum dcerpc_transport_t dcerpc_transport_by_endpoint_protocol(int prot);
2271 _PUBLIC_ enum dcerpc_transport_t dcerpc_transport_by_tower(const struct epm_tower *tower);
2272 _PUBLIC_ const char *derpc_transport_string_by_transport(enum dcerpc_transport_t t);
2273 _PUBLIC_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx,
2274 struct epm_tower *tower,
2275 struct dcerpc_binding **b_out);
2276 _PUBLIC_ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx,
2277 const struct dcerpc_binding *binding,
2278 struct epm_tower *tower);
2280 /* The following definitions come from librpc/rpc/dcerpc.c */
2282 struct rpc_request *dcerpc_ndr_request_send(struct dcerpc_pipe *p, const struct GUID *object,
2283 const struct ndr_interface_table *table, uint32_t opnum,
2284 TALLOC_CTX *mem_ctx, void *r);
2285 NTSTATUS dcerpc_ndr_request_recv(struct rpc_request *req);
2286 _PUBLIC_ NTSTATUS dcerpc_pipe_connect(TALLOC_CTX *parent_ctx, struct dcerpc_pipe **pp,
2287 const char *binding_string, const struct ndr_interface_table *table,
2288 struct cli_credentials *credentials, struct event_context *ev,
2289 struct loadparm_context *lp_ctx);
2291 /* The following definitions come from libsmb/cliconnect.c */
2293 ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
2294 const char *pass, const char *user_domain,
2295 const char * dest_realm);
2297 NTSTATUS cli_session_setup(struct cli_state *cli,
2299 const char *pass, int passlen,
2300 const char *ntpass, int ntpasslen,
2301 const char *workgroup);
2302 struct async_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
2303 struct event_context *ev,
2304 struct cli_state *cli);
2305 NTSTATUS cli_session_setup_guest_recv(struct async_req *req);
2306 bool cli_ulogoff(struct cli_state *cli);
2307 struct async_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
2308 struct event_context *ev,
2309 struct cli_state *cli,
2310 const char *share, const char *dev,
2311 const char *pass, int passlen);
2312 NTSTATUS cli_tcon_andx_recv(struct async_req *req);
2313 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
2314 const char *dev, const char *pass, int passlen);
2315 bool cli_tdis(struct cli_state *cli);
2316 void cli_negprot_sendsync(struct cli_state *cli);
2317 NTSTATUS cli_negprot(struct cli_state *cli);
2318 struct async_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
2319 struct event_context *ev,
2320 struct cli_state *cli);
2321 NTSTATUS cli_negprot_recv(struct async_req *req);
2322 bool cli_session_request(struct cli_state *cli,
2323 struct nmb_name *calling, struct nmb_name *called);
2324 NTSTATUS cli_connect(struct cli_state *cli,
2326 struct sockaddr_storage *dest_ss);
2327 NTSTATUS cli_start_connection(struct cli_state **output_cli,
2328 const char *my_name,
2329 const char *dest_host,
2330 struct sockaddr_storage *dest_ss, int port,
2331 int signing_state, int flags,
2333 NTSTATUS cli_full_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 const char *service, const char *service_type,
2338 const char *user, const char *domain,
2339 const char *password, int flags,
2342 bool attempt_netbios_session_request(struct cli_state **ppcli, const char *srchost, const char *desthost,
2343 struct sockaddr_storage *pdest_ss);
2344 NTSTATUS cli_raw_tcon(struct cli_state *cli,
2345 const char *service, const char *pass, const char *dev,
2346 uint16 *max_xmit, uint16 *tid);
2347 struct cli_state *get_ipc_connect(char *server,
2348 struct sockaddr_storage *server_ss,
2349 const struct user_auth_info *user_info);
2350 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
2351 struct ip_service *mb_ip,
2352 const struct user_auth_info *user_info,
2353 char **pp_workgroup_out);
2354 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
2355 const struct user_auth_info *user_info,
2356 char **pp_workgroup_out);
2358 /* The following definitions come from libsmb/clidfs.c */
2360 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
2361 const char *username,
2362 const char *password,
2364 const char *sharename);
2365 struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
2366 struct cli_state *referring_cli,
2369 const struct user_auth_info *auth_info,
2375 void cli_cm_display(const struct cli_state *c);
2376 bool cli_dfs_get_referral(TALLOC_CTX *ctx,
2377 struct cli_state *cli,
2379 CLIENT_DFS_REFERRAL**refs,
2382 bool cli_resolve_path(TALLOC_CTX *ctx,
2383 const char *mountpt,
2384 const struct user_auth_info *dfs_auth_info,
2385 struct cli_state *rootcli,
2387 struct cli_state **targetcli,
2388 char **pp_targetpath);
2390 /* The following definitions come from libsmb/clidgram.c */
2392 bool cli_send_mailslot(struct messaging_context *msg_ctx,
2393 bool unique, const char *mailslot,
2396 const char *srcname, int src_type,
2397 const char *dstname, int dest_type,
2398 const struct sockaddr_storage *dest_ss);
2399 bool send_getdc_request(TALLOC_CTX *mem_ctx,
2400 struct messaging_context *msg_ctx,
2401 struct sockaddr_storage *dc_ss,
2402 const char *domain_name,
2404 uint32_t nt_version);
2405 bool receive_getdc_response(TALLOC_CTX *mem_ctx,
2406 struct sockaddr_storage *dc_ss,
2407 const char *domain_name,
2408 uint32_t *nt_version,
2409 const char **dc_name,
2410 struct netlogon_samlogon_response **reply);
2412 /* The following definitions come from libsmb/clientgen.c */
2414 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
2415 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
2416 void cli_set_port(struct cli_state *cli, int port);
2417 bool cli_state_seqnum_persistent(struct cli_state *cli,
2419 bool cli_state_seqnum_remove(struct cli_state *cli,
2421 bool cli_receive_smb(struct cli_state *cli);
2422 ssize_t cli_receive_smb_data(struct cli_state *cli, char *buffer, size_t len);
2423 bool cli_receive_smb_readX_header(struct cli_state *cli);
2424 bool cli_send_smb(struct cli_state *cli);
2425 bool cli_send_smb_direct_writeX(struct cli_state *cli,
2428 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
2429 void cli_setup_packet(struct cli_state *cli);
2430 void cli_setup_bcc(struct cli_state *cli, void *p);
2431 NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
2432 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);
2433 NTSTATUS cli_set_password(struct cli_state *cli, const char *password);
2434 NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password);
2435 struct cli_state *cli_initialise(void);
2436 struct cli_state *cli_initialise_ex(int signing_state);
2437 void cli_nt_pipes_close(struct cli_state *cli);
2438 void cli_shutdown(struct cli_state *cli);
2439 void cli_sockopt(struct cli_state *cli, const char *options);
2440 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
2441 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
2442 bool cli_send_keepalive(struct cli_state *cli);
2443 struct async_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
2444 struct cli_state *cli, uint16_t num_echos,
2446 NTSTATUS cli_echo_recv(struct async_req *req);
2447 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
2448 bool cli_ucs2(struct cli_state *cli);
2449 bool is_andx_req(uint8_t cmd);
2451 /* The following definitions come from libsmb/clierror.c */
2453 const char *cli_errstr(struct cli_state *cli);
2454 NTSTATUS cli_nt_error(struct cli_state *cli);
2455 void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode);
2456 int cli_errno(struct cli_state *cli);
2457 bool cli_is_error(struct cli_state *cli);
2458 bool cli_is_nt_error(struct cli_state *cli);
2459 bool cli_is_dos_error(struct cli_state *cli);
2460 NTSTATUS cli_get_nt_error(struct cli_state *cli);
2461 void cli_set_nt_error(struct cli_state *cli, NTSTATUS status);
2462 void cli_reset_error(struct cli_state *cli);
2464 /* The following definitions come from libsmb/clifile.c */
2466 uint32 unix_perms_to_wire(mode_t perms);
2467 mode_t wire_perms_to_unix(uint32 perms);
2468 bool cli_unix_getfacl(struct cli_state *cli, const char *name, size_t *prb_size, char **retbuf);
2469 bool cli_unix_stat(struct cli_state *cli, const char *name, SMB_STRUCT_STAT *sbuf);
2470 bool cli_unix_symlink(struct cli_state *cli, const char *oldname, const char *newname);
2471 bool cli_unix_hardlink(struct cli_state *cli, const char *oldname, const char *newname);
2472 bool cli_unix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
2473 bool cli_unix_chown(struct cli_state *cli, const char *fname, uid_t uid, gid_t gid);
2474 bool cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
2475 bool cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
2476 bool cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
2477 bool cli_unlink_full(struct cli_state *cli, const char *fname, uint16 attrs);
2478 bool cli_unlink(struct cli_state *cli, const char *fname);
2479 bool cli_mkdir(struct cli_state *cli, const char *dname);
2480 bool cli_rmdir(struct cli_state *cli, const char *dname);
2481 int cli_nt_delete_on_close(struct cli_state *cli, int fnum, bool flag);
2482 int cli_nt_create_full(struct cli_state *cli, const char *fname,
2483 uint32 CreatFlags, uint32 DesiredAccess,
2484 uint32 FileAttributes, uint32 ShareAccess,
2485 uint32 CreateDisposition, uint32 CreateOptions,
2486 uint8 SecuityFlags);
2487 struct async_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
2488 struct event_context *ev,
2489 struct cli_state *cli,
2491 uint32_t CreatFlags,
2492 uint32_t DesiredAccess,
2493 uint32_t FileAttributes,
2494 uint32_t ShareAccess,
2495 uint32_t CreateDisposition,
2496 uint32_t CreateOptions,
2497 uint8_t SecurityFlags);
2498 NTSTATUS cli_ntcreate_recv(struct async_req *req, uint16_t *pfnum);
2499 NTSTATUS cli_ntcreate(struct cli_state *cli,
2501 uint32_t CreatFlags,
2502 uint32_t DesiredAccess,
2503 uint32_t FileAttributes,
2504 uint32_t ShareAccess,
2505 uint32_t CreateDisposition,
2506 uint32_t CreateOptions,
2507 uint8_t SecurityFlags,
2509 int cli_nt_create(struct cli_state *cli, const char *fname, uint32 DesiredAccess);
2510 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
2511 size_t str_len, size_t *pconverted_size);
2512 struct async_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
2513 struct cli_state *cli,
2514 const char *fname, int flags, int share_mode);
2515 NTSTATUS cli_open_recv(struct async_req *req, int *fnum);
2516 int cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode);
2517 struct async_req *cli_close_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
2518 struct cli_state *cli, int fnum);
2519 NTSTATUS cli_close_recv(struct async_req *req);
2520 bool cli_close(struct cli_state *cli, int fnum);
2521 bool cli_ftruncate(struct cli_state *cli, int fnum, uint64_t size);
2522 NTSTATUS cli_locktype(struct cli_state *cli, int fnum,
2523 uint32 offset, uint32 len,
2524 int timeout, unsigned char locktype);
2525 bool cli_lock(struct cli_state *cli, int fnum,
2526 uint32 offset, uint32 len, int timeout, enum brl_type lock_type);
2527 bool cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len);
2528 bool cli_lock64(struct cli_state *cli, int fnum,
2529 uint64_t offset, uint64_t len, int timeout, enum brl_type lock_type);
2530 bool cli_unlock64(struct cli_state *cli, int fnum, uint64_t offset, uint64_t len);
2531 bool cli_posix_lock(struct cli_state *cli, int fnum,
2532 uint64_t offset, uint64_t len,
2533 bool wait_lock, enum brl_type lock_type);
2534 bool cli_posix_unlock(struct cli_state *cli, int fnum, uint64_t offset, uint64_t len);
2535 bool cli_posix_getlock(struct cli_state *cli, int fnum, uint64_t *poffset, uint64_t *plen);
2536 bool cli_getattrE(struct cli_state *cli, int fd,
2537 uint16 *attr, SMB_OFF_T *size,
2538 time_t *change_time,
2539 time_t *access_time,
2540 time_t *write_time);
2541 bool cli_getatr(struct cli_state *cli, const char *fname,
2542 uint16 *attr, SMB_OFF_T *size, time_t *write_time);
2543 bool cli_setattrE(struct cli_state *cli, int fd,
2547 bool cli_setatr(struct cli_state *cli, const char *fname, uint16 attr, time_t t);
2548 bool cli_chkpath(struct cli_state *cli, const char *path);
2549 bool cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
2550 int cli_ctemp(struct cli_state *cli, const char *path, char **tmp_path);
2551 NTSTATUS cli_raw_ioctl(struct cli_state *cli, int fnum, uint32 code, DATA_BLOB *blob);
2552 bool cli_set_ea_path(struct cli_state *cli, const char *path, const char *ea_name, const char *ea_val, size_t ea_len);
2553 bool cli_set_ea_fnum(struct cli_state *cli, int fnum, const char *ea_name, const char *ea_val, size_t ea_len);
2554 bool cli_get_ea_list_path(struct cli_state *cli, const char *path,
2557 struct ea_struct **pea_list);
2558 bool cli_get_ea_list_fnum(struct cli_state *cli, int fnum,
2561 struct ea_struct **pea_list);
2562 int cli_posix_open(struct cli_state *cli, const char *fname, int flags, mode_t mode);
2563 int cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
2564 bool cli_posix_unlink(struct cli_state *cli, const char *fname);
2565 int cli_posix_rmdir(struct cli_state *cli, const char *fname);
2567 /* The following definitions come from libsmb/clifsinfo.c */
2569 bool cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor, uint16 *pminor,
2570 uint32 *pcaplow, uint32 *pcaphigh);
2571 bool cli_set_unix_extensions_capabilities(struct cli_state *cli, uint16 major, uint16 minor,
2572 uint32 caplow, uint32 caphigh);
2573 bool cli_get_fs_attr_info(struct cli_state *cli, uint32 *fs_attr);
2574 bool cli_get_fs_volume_info_old(struct cli_state *cli, fstring volume_name, uint32 *pserial_number);
2575 bool cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name, uint32 *pserial_number, time_t *pdate);
2576 bool cli_get_fs_full_size_info(struct cli_state *cli,
2577 uint64_t *total_allocation_units,
2578 uint64_t *caller_allocation_units,
2579 uint64_t *actual_allocation_units,
2580 uint64_t *sectors_per_allocation_unit,
2581 uint64_t *bytes_per_sector);
2582 bool cli_get_posix_fs_info(struct cli_state *cli,
2583 uint32 *optimal_transfer_size,
2585 uint64_t *total_blocks,
2586 uint64_t *blocks_available,
2587 uint64_t *user_blocks_available,
2588 uint64_t *total_file_nodes,
2589 uint64_t *free_file_nodes,
2590 uint64_t *fs_identifier);
2591 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
2594 const char *domain);
2595 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
2596 NTSTATUS cli_force_encryption(struct cli_state *c,
2597 const char *username,
2598 const char *password,
2599 const char *domain);
2601 /* The following definitions come from libsmb/clikrb5.c */
2603 bool unwrap_edata_ntstatus(TALLOC_CTX *mem_ctx,
2605 DATA_BLOB *edata_out);
2606 bool unwrap_pac(TALLOC_CTX *mem_ctx, DATA_BLOB *auth_data, DATA_BLOB *unwrapped_pac_data);
2607 int cli_krb5_get_ticket(const char *principal, time_t time_offset,
2608 DATA_BLOB *ticket, DATA_BLOB *session_key_krb5,
2609 uint32 extra_ap_opts, const char *ccname,
2610 time_t *tgs_expire);
2612 /* The following definitions come from libsmb/clilist.c */
2614 int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute,
2615 void (*fn)(const char *, file_info *, const char *, void *), void *state);
2616 int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
2617 void (*fn)(const char *, file_info *, const char *, void *), void *state);
2618 int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
2619 void (*fn)(const char *, file_info *, const char *, void *), void *state);
2621 /* The following definitions come from libsmb/climessage.c */
2623 int cli_message_start_build(struct cli_state *cli, const char *host, const char *username);
2624 bool cli_message_start(struct cli_state *cli, const char *host, const char *username,
2626 int cli_message_text_build(struct cli_state *cli, const char *msg, int len, int grp);
2627 bool cli_message_text(struct cli_state *cli, const char *msg, int len, int grp);
2628 int cli_message_end_build(struct cli_state *cli, int grp);
2629 bool cli_message_end(struct cli_state *cli, int grp);
2631 /* The following definitions come from libsmb/clioplock.c */
2633 bool cli_oplock_ack(struct cli_state *cli, int fnum, unsigned char level);
2634 void cli_oplock_handler(struct cli_state *cli,
2635 bool (*handler)(struct cli_state *, int, unsigned char));
2637 /* The following definitions come from libsmb/cliprint.c */
2639 int cli_print_queue(struct cli_state *cli,
2640 void (*fn)(struct print_job_info *));
2641 int cli_printjob_del(struct cli_state *cli, int job);
2642 int cli_spl_open(struct cli_state *cli, const char *fname, int flags, int share_mode);
2643 bool cli_spl_close(struct cli_state *cli, int fnum);
2645 /* The following definitions come from libsmb/cliquota.c */
2647 bool cli_get_quota_handle(struct cli_state *cli, int *quota_fnum);
2648 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
2649 bool cli_get_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
2650 bool cli_set_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
2651 bool cli_list_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_LIST **pqt_list);
2652 bool cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
2653 bool cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
2654 void dump_ntquota(SMB_NTQUOTA_STRUCT *qt, bool _verbose, bool _numeric, void (*_sidtostring)(fstring str, DOM_SID *sid, bool _numeric));
2655 void dump_ntquota_list(SMB_NTQUOTA_LIST **qtl, bool _verbose, bool _numeric, void (*_sidtostring)(fstring str, DOM_SID *sid, bool _numeric));
2657 /* The following definitions come from libsmb/clirap.c */
2659 bool cli_api(struct cli_state *cli,
2660 char *param, int prcnt, int mprcnt,
2661 char *data, int drcnt, int mdrcnt,
2662 char **rparam, unsigned int *rprcnt,
2663 char **rdata, unsigned int *rdrcnt);
2664 bool cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation);
2665 int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *, void *), void *state);
2666 bool cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
2667 void (*fn)(const char *, uint32, const char *, void *),
2669 bool cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
2670 const char *old_password);
2671 bool cli_qpathinfo(struct cli_state *cli,
2673 time_t *change_time,
2674 time_t *access_time,
2678 bool cli_setpathinfo(struct cli_state *cli, const char *fname,
2684 bool cli_qpathinfo2(struct cli_state *cli, const char *fname,
2685 struct timespec *create_time,
2686 struct timespec *access_time,
2687 struct timespec *write_time,
2688 struct timespec *change_time,
2689 SMB_OFF_T *size, uint16 *mode,
2691 bool cli_qpathinfo_streams(struct cli_state *cli, const char *fname,
2692 TALLOC_CTX *mem_ctx,
2693 unsigned int *pnum_streams,
2694 struct stream_struct **pstreams);
2695 bool cli_qfilename(struct cli_state *cli, int fnum, char *name, size_t namelen);
2696 bool cli_qfileinfo(struct cli_state *cli, int fnum,
2697 uint16 *mode, SMB_OFF_T *size,
2698 struct timespec *create_time,
2699 struct timespec *access_time,
2700 struct timespec *write_time,
2701 struct timespec *change_time,
2703 bool cli_qpathinfo_basic( struct cli_state *cli, const char *name,
2704 SMB_STRUCT_STAT *sbuf, uint32 *attributes );
2705 bool cli_qfileinfo_test(struct cli_state *cli, int fnum, int level, char **poutdata, uint32 *poutlen);
2706 NTSTATUS cli_qpathinfo_alt_name(struct cli_state *cli, const char *fname, fstring alt_name);
2708 /* The following definitions come from libsmb/clirap2.c */
2710 int cli_NetGroupDelete(struct cli_state *cli, const char *group_name);
2711 int cli_NetGroupAdd(struct cli_state *cli, RAP_GROUP_INFO_1 *grinfo);
2712 int cli_RNetGroupEnum(struct cli_state *cli, void (*fn)(const char *, const char *, void *), void *state);
2713 int cli_RNetGroupEnum0(struct cli_state *cli,
2714 void (*fn)(const char *, void *),
2716 int cli_NetGroupDelUser(struct cli_state * cli, const char *group_name, const char *user_name);
2717 int cli_NetGroupAddUser(struct cli_state * cli, const char *group_name, const char *user_name);
2718 int cli_NetGroupGetUsers(struct cli_state * cli, const char *group_name, void (*fn)(const char *, void *), void *state );
2719 int cli_NetUserGetGroups(struct cli_state * cli, const char *user_name, void (*fn)(const char *, void *), void *state );
2720 int cli_NetUserDelete(struct cli_state *cli, const char * user_name );
2721 int cli_NetUserAdd(struct cli_state *cli, RAP_USER_INFO_1 * userinfo );
2722 int cli_RNetUserEnum(struct cli_state *cli, void (*fn)(const char *, const char *, const char *, const char *, void *), void *state);
2723 int cli_RNetUserEnum0(struct cli_state *cli,
2724 void (*fn)(const char *, void *),
2726 int cli_NetFileClose(struct cli_state *cli, uint32 file_id );
2727 int cli_NetFileGetInfo(struct cli_state *cli, uint32 file_id, void (*fn)(const char *, const char *, uint16, uint16, uint32));
2728 int cli_NetFileEnum(struct cli_state *cli, const char * user,
2729 const char * base_path,
2730 void (*fn)(const char *, const char *, uint16, uint16,
2732 int cli_NetShareAdd(struct cli_state *cli, RAP_SHARE_INFO_2 * sinfo );
2733 int cli_NetShareDelete(struct cli_state *cli, const char * share_name );
2734 bool cli_get_pdc_name(struct cli_state *cli, const char *workgroup, char **pdc_name);
2735 bool cli_get_server_domain(struct cli_state *cli);
2736 bool cli_get_server_type(struct cli_state *cli, uint32 *pstype);
2737 bool cli_get_server_name(TALLOC_CTX *mem_ctx, struct cli_state *cli,
2739 bool cli_ns_check_server_type(struct cli_state *cli, char *workgroup, uint32 stype);
2740 bool cli_NetWkstaUserLogoff(struct cli_state *cli, const char *user, const char *workstation);
2741 int cli_NetPrintQEnum(struct cli_state *cli,
2742 void (*qfn)(const char*,uint16,uint16,uint16,const char*,const char*,const char*,const char*,const char*,uint16,uint16),
2743 void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,uint,uint,const char*));
2744 int cli_NetPrintQGetInfo(struct cli_state *cli, const char *printer,
2745 void (*qfn)(const char*,uint16,uint16,uint16,const char*,const char*,const char*,const char*,const char*,uint16,uint16),
2746 void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,uint,uint,const char*));
2747 int cli_RNetServiceEnum(struct cli_state *cli, void (*fn)(const char *, const char *, void *), void *state);
2748 int cli_NetSessionEnum(struct cli_state *cli, void (*fn)(char *, char *, uint16, uint16, uint16, uint, uint, uint, char *));
2749 int cli_NetSessionGetInfo(struct cli_state *cli, const char *workstation,
2750 void (*fn)(const char *, const char *, uint16, uint16, uint16, uint, uint, uint, const char *));
2751 int cli_NetSessionDel(struct cli_state *cli, const char *workstation);
2752 int cli_NetConnectionEnum(struct cli_state *cli, const char *qualifier,
2753 void (*fn)(uint16_t conid, uint16_t contype,
2754 uint16_t numopens, uint16_t numusers,
2755 uint32_t contime, const char *username,
2756 const char *netname));
2758 /* The following definitions come from libsmb/clireadwrite.c */
2760 struct async_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
2761 struct event_context *ev,
2762 struct cli_state *cli, int fnum,
2763 off_t offset, size_t size);
2764 NTSTATUS cli_read_andx_recv(struct async_req *req, ssize_t *received,
2766 struct async_req *cli_pull_send(TALLOC_CTX *mem_ctx,
2767 struct event_context *ev,
2768 struct cli_state *cli,
2769 uint16_t fnum, off_t start_offset,
2770 SMB_OFF_T size, size_t window_size,
2771 NTSTATUS (*sink)(char *buf, size_t n,
2774 NTSTATUS cli_pull_recv(struct async_req *req, SMB_OFF_T *received);
2775 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
2776 off_t start_offset, SMB_OFF_T size, size_t window_size,
2777 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
2778 void *priv, SMB_OFF_T *received);
2779 ssize_t cli_read(struct cli_state *cli, int fnum, char *buf,
2780 off_t offset, size_t size);
2781 ssize_t cli_readraw(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size);
2782 ssize_t cli_write(struct cli_state *cli,
2783 int fnum, uint16 write_mode,
2784 const char *buf, off_t offset, size_t size);
2785 ssize_t cli_smbwrite(struct cli_state *cli,
2786 int fnum, char *buf, off_t offset, size_t size1);
2787 struct async_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
2788 struct event_context *ev,
2789 struct cli_state *cli, uint16_t fnum,
2790 uint16_t mode, const uint8_t *buf,
2791 off_t offset, size_t size);
2792 NTSTATUS cli_write_andx_recv(struct async_req *req, size_t *pwritten);
2794 struct async_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
2795 struct cli_state *cli,
2796 uint16_t fnum, uint16_t mode,
2797 off_t start_offset, size_t window_size,
2798 size_t (*source)(uint8_t *buf, size_t n,
2801 NTSTATUS cli_push_recv(struct async_req *req);
2802 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
2803 off_t start_offset, size_t window_size,
2804 size_t (*source)(uint8_t *buf, size_t n, void *priv),
2807 /* The following definitions come from libsmb/clisecdesc.c */
2809 SEC_DESC *cli_query_secdesc(struct cli_state *cli, int fnum,
2810 TALLOC_CTX *mem_ctx);
2811 bool cli_set_secdesc(struct cli_state *cli, int fnum, SEC_DESC *sd);
2813 /* The following definitions come from libsmb/clispnego.c */
2815 DATA_BLOB spnego_gen_negTokenInit(char guid[16],
2817 const char *principal);
2818 DATA_BLOB gen_negTokenInit(const char *OID, DATA_BLOB blob);
2819 bool spnego_parse_negTokenInit(DATA_BLOB blob,
2820 char *OIDs[ASN1_MAX_OIDS],
2822 DATA_BLOB gen_negTokenTarg(const char *OIDs[], DATA_BLOB blob);
2823 bool parse_negTokenTarg(DATA_BLOB blob, char *OIDs[ASN1_MAX_OIDS], DATA_BLOB *secblob);
2824 DATA_BLOB spnego_gen_krb5_wrap(const DATA_BLOB ticket, const uint8 tok_id[2]);
2825 bool spnego_parse_krb5_wrap(DATA_BLOB blob, DATA_BLOB *ticket, uint8 tok_id[2]);
2826 int spnego_gen_negTokenTarg(const char *principal, int time_offset,
2828 DATA_BLOB *session_key_krb5, uint32 extra_ap_opts,
2829 time_t *expire_time);
2830 bool spnego_parse_challenge(const DATA_BLOB blob,
2831 DATA_BLOB *chal1, DATA_BLOB *chal2);
2832 DATA_BLOB spnego_gen_auth(DATA_BLOB blob);
2833 bool spnego_parse_auth(DATA_BLOB blob, DATA_BLOB *auth);
2834 DATA_BLOB spnego_gen_auth_response(DATA_BLOB *reply, NTSTATUS nt_status,
2835 const char *mechOID);
2836 bool spnego_parse_auth_response(DATA_BLOB blob, NTSTATUS nt_status,
2837 const char *mechOID,
2840 /* The following definitions come from libsmb/clistr.c */
2842 size_t clistr_push_fn(const char *function,
2844 struct cli_state *cli,
2849 size_t clistr_pull_fn(const char *function,
2857 size_t clistr_pull_talloc_fn(const char *function,
2865 size_t clistr_align_out(struct cli_state *cli, const void *p, int flags);
2866 size_t clistr_align_in(struct cli_state *cli, const void *p, int flags);
2868 /* The following definitions come from libsmb/clitrans.c */
2870 bool cli_send_trans(struct cli_state *cli, int trans,
2871 const char *pipe_name,
2873 uint16 *setup, unsigned int lsetup, unsigned int msetup,
2874 const char *param, unsigned int lparam, unsigned int mparam,
2875 const char *data, unsigned int ldata, unsigned int mdata);
2876 bool cli_receive_trans(struct cli_state *cli,int trans,
2877 char **param, unsigned int *param_len,
2878 char **data, unsigned int *data_len);
2879 bool cli_send_nt_trans(struct cli_state *cli,
2882 uint16 *setup, unsigned int lsetup, unsigned int msetup,
2883 char *param, unsigned int lparam, unsigned int mparam,
2884 char *data, unsigned int ldata, unsigned int mdata);
2885 bool cli_receive_nt_trans(struct cli_state *cli,
2886 char **param, unsigned int *param_len,
2887 char **data, unsigned int *data_len);
2888 struct async_req *cli_trans_send(
2889 TALLOC_CTX *mem_ctx, struct event_context *ev,
2890 struct cli_state *cli, uint8_t trans_cmd,
2891 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
2892 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
2893 uint8_t *param, uint32_t num_param, uint32_t max_param,
2894 uint8_t *data, uint32_t num_data, uint32_t max_data);
2895 NTSTATUS cli_trans_recv(struct async_req *req, TALLOC_CTX *mem_ctx,
2896 uint16_t **setup, uint8_t *num_setup,
2897 uint8_t **param, uint32_t *num_param,
2898 uint8_t **data, uint32_t *num_data);
2899 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
2901 const char *pipe_name, uint16_t fid, uint16_t function,
2903 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
2904 uint8_t *param, uint32_t num_param, uint32_t max_param,
2905 uint8_t *data, uint32_t num_data, uint32_t max_data,
2906 uint16_t **rsetup, uint8_t *num_rsetup,
2907 uint8_t **rparam, uint32_t *num_rparam,
2908 uint8_t **rdata, uint32_t *num_rdata);
2910 /* The following definitions come from libsmb/conncache.c */
2912 NTSTATUS check_negative_conn_cache_timeout( const char *domain, const char *server, unsigned int failed_cache_timeout );
2913 NTSTATUS check_negative_conn_cache( const char *domain, const char *server);
2914 void add_failed_connection_entry(const char *domain, const char *server, NTSTATUS result) ;
2915 void delete_negative_conn_cache(const char *domain, const char *server);
2916 void flush_negative_conn_cache( void );
2917 void flush_negative_conn_cache_for_domain(const char *domain);
2919 /* The following definitions come from libsmb/credentials.c */
2921 char *credstr(const unsigned char *cred);
2922 void creds_server_init(uint32 neg_flags,
2924 struct netr_Credential *clnt_chal,
2925 struct netr_Credential *srv_chal,
2926 const unsigned char mach_pw[16],
2927 struct netr_Credential *init_chal_out);
2928 bool netlogon_creds_server_check(const struct dcinfo *dc,
2929 const struct netr_Credential *rcv_cli_chal_in);
2930 bool netlogon_creds_server_step(struct dcinfo *dc,
2931 const struct netr_Authenticator *received_cred,
2932 struct netr_Authenticator *cred_out);
2933 void creds_client_init(uint32 neg_flags,
2935 struct netr_Credential *clnt_chal,
2936 struct netr_Credential *srv_chal,
2937 const unsigned char mach_pw[16],
2938 struct netr_Credential *init_chal_out);
2939 bool netlogon_creds_client_check(const struct dcinfo *dc,
2940 const struct netr_Credential *rcv_srv_chal_in);
2941 void netlogon_creds_client_step(struct dcinfo *dc,
2942 struct netr_Authenticator *next_cred_out);
2944 /* The following definitions come from ../librpc/rpc/dcerpc_error.c */
2946 const char *dcerpc_errstr(TALLOC_CTX *mem_ctx, uint32_t fault_code);
2948 /* The following definitions come from libsmb/dsgetdcname.c */
2950 void debug_dsdcinfo_flags(int lvl, uint32_t flags);
2951 NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx,
2952 struct messaging_context *msg_ctx,
2953 const char *domain_name,
2954 struct GUID *domain_guid,
2955 const char *site_name,
2957 struct netr_DsRGetDCNameInfo **info);
2959 /* The following definitions come from libsmb/errormap.c */
2961 NTSTATUS dos_to_ntstatus(uint8 eclass, uint32 ecode);
2962 void ntstatus_to_dos(NTSTATUS ntstatus, uint8 *eclass, uint32 *ecode);
2963 NTSTATUS werror_to_ntstatus(WERROR error);
2964 WERROR ntstatus_to_werror(NTSTATUS error);
2965 NTSTATUS map_nt_error_from_gss(uint32 gss_maj, uint32 minor);
2967 /* The following definitions come from libsmb/namecache.c */
2969 bool namecache_enable(void);
2970 bool namecache_store(const char *name,
2973 struct ip_service *ip_list);
2974 bool namecache_fetch(const char *name,
2976 struct ip_service **ip_list,
2978 bool namecache_delete(const char *name, int name_type);
2979 void namecache_flush(void);
2980 bool namecache_status_store(const char *keyname, int keyname_type,
2981 int name_type, const struct sockaddr_storage *keyip,
2982 const char *srvname);
2983 bool namecache_status_fetch(const char *keyname,
2986 const struct sockaddr_storage *keyip,
2989 /* The following definitions come from libsmb/namequery.c */
2991 bool saf_store( const char *domain, const char *servername );
2992 bool saf_join_store( const char *domain, const char *servername );
2993 bool saf_delete( const char *domain );
2994 char *saf_fetch( const char *domain );
2995 NODE_STATUS_STRUCT *node_status_query(int fd,
2996 struct nmb_name *name,
2997 const struct sockaddr_storage *to_ss,
2999 struct node_status_extra *extra);
3000 bool name_status_find(const char *q_name,
3003 const struct sockaddr_storage *to_ss,
3005 int ip_service_compare(struct ip_service *ss1, struct ip_service *ss2);
3006 struct sockaddr_storage *name_query(int fd,
3011 const struct sockaddr_storage *to_ss,
3015 XFILE *startlmhosts(const char *fname);
3016 bool getlmhostsent(TALLOC_CTX *ctx, XFILE *fp, char **pp_name, int *name_type,
3017 struct sockaddr_storage *pss);
3018 void endlmhosts(XFILE *fp);
3019 NTSTATUS name_resolve_bcast(const char *name,
3021 struct ip_service **return_iplist,
3023 NTSTATUS resolve_wins(const char *name,
3025 struct ip_service **return_iplist,
3027 NTSTATUS internal_resolve_name(const char *name,
3029 const char *sitename,
3030 struct ip_service **return_iplist,
3032 const char *resolve_order);
3033 bool resolve_name(const char *name,
3034 struct sockaddr_storage *return_ss,
3036 NTSTATUS resolve_name_list(TALLOC_CTX *ctx,
3039 struct sockaddr_storage **return_ss_arr,
3040 unsigned int *p_num_entries);
3041 bool find_master_ip(const char *group, struct sockaddr_storage *master_ss);
3042 bool get_pdc_ip(const char *domain, struct sockaddr_storage *pss);
3043 NTSTATUS get_sorted_dc_list( const char *domain,
3044 const char *sitename,
3045 struct ip_service **ip_list,
3048 NTSTATUS get_kdc_list( const char *realm,
3049 const char *sitename,
3050 struct ip_service **ip_list,
3053 /* The following definitions come from libsmb/namequery_dc.c */
3055 bool get_dc_name(const char *domain,
3058 struct sockaddr_storage *ss_out);
3060 /* The following definitions come from libsmb/nmblib.c */
3062 void debug_nmb_packet(struct packet_struct *p);
3063 void put_name(char *dest, const char *name, int pad, unsigned int name_type);
3064 char *nmb_namestr(const struct nmb_name *n);
3065 struct packet_struct *copy_packet(struct packet_struct *packet);
3066 void free_packet(struct packet_struct *packet);
3067 struct packet_struct *parse_packet(char *buf,int length,
3068 enum packet_type packet_type,
3071 struct packet_struct *read_packet(int fd,enum packet_type packet_type);
3072 void make_nmb_name( struct nmb_name *n, const char *name, int type);
3073 bool nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2);
3074 int build_packet(char *buf, size_t buflen, struct packet_struct *p);
3075 bool send_packet(struct packet_struct *p);
3076 struct packet_struct *receive_packet(int fd,enum packet_type type,int t);
3077 struct packet_struct *receive_nmb_packet(int fd, int t, int trn_id);
3078 struct packet_struct *receive_dgram_packet(int fd, int t,
3079 const char *mailslot_name);
3080 bool match_mailslot_name(struct packet_struct *p, const char *mailslot_name);
3081 int matching_len_bits(unsigned char *p1, unsigned char *p2, size_t len);
3082 void sort_query_replies(char *data, int n, struct in_addr ip);
3083 char *name_mangle(TALLOC_CTX *mem_ctx, char *In, char name_type);
3084 int name_extract(char *buf,int ofs, fstring name);
3085 int name_len(char *s1);
3087 /* The following definitions come from libsmb/nterr.c */
3089 const char *nt_errstr(NTSTATUS nt_code);