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(struct auth_context *actx, bool global_encrypted,
43 const char *session_workgroup,
44 const char *smb_name, DATA_BLOB password_blob);
46 /* The following definitions come from auth/auth_domain.c */
48 void attempt_machine_password_change(void);
49 NTSTATUS auth_domain_init(void);
51 NTSTATUS auth_netlogond_init(void);
53 /* The following definitions come from auth/auth_ntlmssp.c */
55 NTSTATUS auth_ntlmssp_start(AUTH_NTLMSSP_STATE **auth_ntlmssp_state);
56 void auth_ntlmssp_end(AUTH_NTLMSSP_STATE **auth_ntlmssp_state);
57 NTSTATUS auth_ntlmssp_update(AUTH_NTLMSSP_STATE *auth_ntlmssp_state,
58 const DATA_BLOB request, DATA_BLOB *reply) ;
60 /* The following definitions come from auth/auth_sam.c */
62 NTSTATUS auth_sam_init(void);
64 /* The following definitions come from auth/auth_server.c */
66 NTSTATUS auth_server_init(void);
68 /* The following definitions come from auth/auth_unix.c */
70 NTSTATUS auth_unix_init(void);
72 /* The following definitions come from auth/auth_util.c */
74 NTSTATUS make_user_info_map(auth_usersupplied_info **user_info,
76 const char *client_domain,
77 const char *wksta_name,
78 DATA_BLOB *lm_pwd, DATA_BLOB *nt_pwd,
79 DATA_BLOB *lm_interactive_pwd, DATA_BLOB *nt_interactive_pwd,
82 bool make_user_info_netlogon_network(auth_usersupplied_info **user_info,
84 const char *client_domain,
85 const char *wksta_name,
86 uint32 logon_parameters,
87 const uchar *lm_network_pwd,
89 const uchar *nt_network_pwd,
91 bool make_user_info_netlogon_interactive(auth_usersupplied_info **user_info,
93 const char *client_domain,
94 const char *wksta_name,
95 uint32 logon_parameters,
97 const uchar lm_interactive_pwd[16],
98 const uchar nt_interactive_pwd[16],
99 const uchar *dc_sess_key);
100 bool make_user_info_for_reply(auth_usersupplied_info **user_info,
101 const char *smb_name,
102 const char *client_domain,
104 DATA_BLOB plaintext_password);
105 NTSTATUS make_user_info_for_reply_enc(auth_usersupplied_info **user_info,
106 const char *smb_name,
107 const char *client_domain,
108 DATA_BLOB lm_resp, DATA_BLOB nt_resp);
109 bool make_user_info_guest(auth_usersupplied_info **user_info) ;
110 NTSTATUS make_server_info_sam(auth_serversupplied_info **server_info,
111 struct samu *sampass);
112 NTSTATUS create_local_token(auth_serversupplied_info *server_info);
113 NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
115 uid_t *uid, gid_t *gid,
116 char **found_username,
117 struct nt_user_token **token);
118 bool user_in_group_sid(const char *username, const DOM_SID *group_sid);
119 bool user_in_group(const char *username, const char *groupname);
120 NTSTATUS make_server_info_pw(auth_serversupplied_info **server_info,
123 NTSTATUS make_serverinfo_from_username(TALLOC_CTX *mem_ctx,
124 const char *username,
126 struct auth_serversupplied_info **presult);
127 struct auth_serversupplied_info *copy_serverinfo(TALLOC_CTX *mem_ctx,
128 const auth_serversupplied_info *src);
129 bool init_guest_info(void);
130 bool server_info_set_session_key(struct auth_serversupplied_info *info,
131 DATA_BLOB session_key);
132 NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx,
133 auth_serversupplied_info **server_info);
134 bool copy_current_user(struct current_user *dst, struct current_user *src);
135 struct passwd *smb_getpwnam( TALLOC_CTX *mem_ctx, char *domuser,
136 fstring save_username, bool create );
137 NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
138 const char *sent_nt_username,
140 auth_serversupplied_info **server_info,
141 struct netr_SamInfo3 *info3);
142 NTSTATUS make_server_info_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
143 const char *sent_nt_username,
145 const struct wbcAuthUserInfo *info,
146 auth_serversupplied_info **server_info);
147 void free_user_info(auth_usersupplied_info **user_info);
148 bool make_auth_methods(struct auth_context *auth_context, auth_methods **auth_method) ;
149 bool is_trusted_domain(const char* dom_name);
151 /* The following definitions come from auth/auth_winbind.c */
153 NTSTATUS auth_winbind_init(void);
155 /* The following definitions come from auth/auth_wbc.c */
157 NTSTATUS auth_wbc_init(void);
159 /* The following definitions come from auth/pampass.c */
161 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
162 bool smb_pam_close_session(char *user, char *tty, char *rhost);
163 NTSTATUS smb_pam_accountcheck(const char * user);
164 NTSTATUS smb_pam_passcheck(const char * user, const char * password);
165 bool smb_pam_passchange(const char * user, const char * oldpassword, const char * newpassword);
166 NTSTATUS smb_pam_accountcheck(const char * user);
167 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
168 bool smb_pam_close_session(char *in_user, char *tty, char *rhost);
170 /* The following definitions come from auth/pass_check.c */
172 void dfs_unlogin(void);
173 NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *password,
174 int pwlen, bool (*fn) (const char *, const char *), bool run_cracker);
176 /* The following definitions come from auth/token_util.c */
178 bool nt_token_check_sid ( const DOM_SID *sid, const NT_USER_TOKEN *token );
179 bool nt_token_check_domain_rid( NT_USER_TOKEN *token, uint32 rid );
180 NT_USER_TOKEN *get_root_nt_token( void );
181 NTSTATUS add_aliases(const DOM_SID *domain_sid,
182 struct nt_user_token *token);
183 NTSTATUS create_builtin_users(const DOM_SID *sid);
184 NTSTATUS create_builtin_administrators(const DOM_SID *sid);
185 struct nt_user_token *create_local_nt_token(TALLOC_CTX *mem_ctx,
186 const DOM_SID *user_sid,
189 const DOM_SID *groupsids);
190 void debug_nt_user_token(int dbg_class, int dbg_lev, NT_USER_TOKEN *token);
191 void debug_unix_user_token(int dbg_class, int dbg_lev, uid_t uid, gid_t gid,
192 int n_groups, gid_t *groups);
194 /* The following definitions come from groupdb/mapping.c */
196 NTSTATUS add_initial_entry(gid_t gid, const char *sid, enum lsa_SidType sid_name_use, const char *nt_name, const char *comment);
197 bool get_domain_group_from_sid(DOM_SID sid, GROUP_MAP *map);
198 int smb_create_group(const char *unix_group, gid_t *new_gid);
199 int smb_delete_group(const char *unix_group);
200 int smb_set_primary_group(const char *unix_group, const char* unix_user);
201 int smb_add_user_group(const char *unix_group, const char *unix_user);
202 int smb_delete_user_group(const char *unix_group, const char *unix_user);
203 NTSTATUS pdb_default_getgrsid(struct pdb_methods *methods, GROUP_MAP *map,
205 NTSTATUS pdb_default_getgrgid(struct pdb_methods *methods, GROUP_MAP *map,
207 NTSTATUS pdb_default_getgrnam(struct pdb_methods *methods, GROUP_MAP *map,
209 NTSTATUS pdb_default_add_group_mapping_entry(struct pdb_methods *methods,
211 NTSTATUS pdb_default_update_group_mapping_entry(struct pdb_methods *methods,
213 NTSTATUS pdb_default_delete_group_mapping_entry(struct pdb_methods *methods,
215 NTSTATUS pdb_default_enum_group_mapping(struct pdb_methods *methods,
216 const DOM_SID *sid, enum lsa_SidType sid_name_use,
217 GROUP_MAP **pp_rmap, size_t *p_num_entries,
219 NTSTATUS pdb_default_create_alias(struct pdb_methods *methods,
220 const char *name, uint32 *rid);
221 NTSTATUS pdb_default_delete_alias(struct pdb_methods *methods,
223 NTSTATUS pdb_default_get_aliasinfo(struct pdb_methods *methods,
225 struct acct_info *info);
226 NTSTATUS pdb_default_set_aliasinfo(struct pdb_methods *methods,
228 struct acct_info *info);
229 NTSTATUS pdb_default_add_aliasmem(struct pdb_methods *methods,
230 const DOM_SID *alias, const DOM_SID *member);
231 NTSTATUS pdb_default_del_aliasmem(struct pdb_methods *methods,
232 const DOM_SID *alias, const DOM_SID *member);
233 NTSTATUS pdb_default_enum_aliasmem(struct pdb_methods *methods,
234 const DOM_SID *alias, TALLOC_CTX *mem_ctx,
235 DOM_SID **pp_members,
236 size_t *p_num_members);
237 NTSTATUS pdb_default_alias_memberships(struct pdb_methods *methods,
239 const DOM_SID *domain_sid,
240 const DOM_SID *members,
242 uint32 **pp_alias_rids,
243 size_t *p_num_alias_rids);
244 NTSTATUS pdb_nop_getgrsid(struct pdb_methods *methods, GROUP_MAP *map,
246 NTSTATUS pdb_nop_getgrgid(struct pdb_methods *methods, GROUP_MAP *map,
248 NTSTATUS pdb_nop_getgrnam(struct pdb_methods *methods, GROUP_MAP *map,
250 NTSTATUS pdb_nop_add_group_mapping_entry(struct pdb_methods *methods,
252 NTSTATUS pdb_nop_update_group_mapping_entry(struct pdb_methods *methods,
254 NTSTATUS pdb_nop_delete_group_mapping_entry(struct pdb_methods *methods,
256 NTSTATUS pdb_nop_enum_group_mapping(struct pdb_methods *methods,
257 enum lsa_SidType sid_name_use,
258 GROUP_MAP **rmap, size_t *num_entries,
260 bool pdb_get_dom_grp_info(const DOM_SID *sid, struct acct_info *info);
261 bool pdb_set_dom_grp_info(const DOM_SID *sid, const struct acct_info *info);
262 NTSTATUS pdb_create_builtin_alias(uint32 rid);
264 /* The following definitions come from groupdb/mapping_ldb.c */
266 const struct mapping_backend *groupdb_ldb_init(void);
268 /* The following definitions come from groupdb/mapping_tdb.c */
270 const struct mapping_backend *groupdb_tdb_init(void);
272 /* The following definitions come from intl/lang_tdb.c */
274 bool lang_tdb_init(const char *lang);
275 const char *lang_msg(const char *msgid);
276 void lang_msg_free(const char *msgstr);
277 char *lang_tdb_current(void);
279 /* The following definitions come from lib/access.c */
281 bool client_match(const char *tok, const void *item);
282 bool list_match(const char **list,const void *item,
283 bool (*match_fn)(const char *, const void *));
284 bool allow_access(const char **deny_list,
285 const char **allow_list,
288 bool check_access(int sock, const char **allow_list, const char **deny_list);
290 /* The following definitions come from lib/account_pol.c */
292 void account_policy_names_list(const char ***names, int *num_names);
293 const char *decode_account_policy_name(enum pdb_policy_type type);
294 const char *get_account_policy_attr(enum pdb_policy_type type);
295 const char *account_policy_get_desc(enum pdb_policy_type type);
296 enum pdb_policy_type account_policy_name_to_typenum(const char *name);
297 bool account_policy_get_default(enum pdb_policy_type type, uint32_t *val);
298 bool init_account_policy(void);
299 bool account_policy_get(enum pdb_policy_type type, uint32_t *value);
300 bool account_policy_set(enum pdb_policy_type type, uint32_t value);
301 bool cache_account_policy_set(enum pdb_policy_type type, uint32_t value);
302 bool cache_account_policy_get(enum pdb_policy_type type, uint32_t *value);
303 struct db_context *get_account_pol_db( void );
305 /* The following definitions come from lib/adt_tree.c */
308 /* The following definitions come from lib/afs.c */
310 char *afs_createtoken_str(const char *username, const char *cell);
311 bool afs_login(connection_struct *conn);
312 bool afs_login(connection_struct *conn);
313 char *afs_createtoken_str(const char *username, const char *cell);
315 /* The following definitions come from lib/afs_settoken.c */
317 int afs_syscall( int subcall,
322 bool afs_settoken_str(const char *token_string);
323 bool afs_settoken_str(const char *token_string);
325 /* The following definitions come from lib/audit.c */
327 const char *audit_category_str(uint32 category);
328 const char *audit_param_str(uint32 category);
329 const char *audit_description_str(uint32 category);
330 bool get_audit_category_from_param(const char *param, uint32 *audit_category);
331 const char *audit_policy_str(TALLOC_CTX *mem_ctx, uint32 policy);
333 /* The following definitions come from lib/bitmap.c */
335 struct bitmap *bitmap_allocate(int n);
336 void bitmap_free(struct bitmap *bm);
337 struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n);
338 int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src);
339 bool bitmap_set(struct bitmap *bm, unsigned i);
340 bool bitmap_clear(struct bitmap *bm, unsigned i);
341 bool bitmap_query(struct bitmap *bm, unsigned i);
342 int bitmap_find(struct bitmap *bm, unsigned ofs);
344 /* The following definitions come from lib/charcnv.c */
346 NTSTATUS smb_register_charset(struct charset_functions *funcs);
347 char lp_failed_convert_char(void);
348 void lazy_initialize_conv(void);
349 void gfree_charcnv(void);
350 void init_iconv(void);
351 size_t convert_string(charset_t from, charset_t to,
352 void const *src, size_t srclen,
353 void *dest, size_t destlen, bool allow_bad_conv);
354 size_t unix_strupper(const char *src, size_t srclen, char *dest, size_t destlen);
355 char *talloc_strdup_upper(TALLOC_CTX *ctx, const char *s);
356 char *strupper_talloc(TALLOC_CTX *ctx, const char *s);
357 size_t unix_strlower(const char *src, size_t srclen, char *dest, size_t destlen);
358 char *talloc_strdup_lower(TALLOC_CTX *ctx, const char *s);
359 char *strlower_talloc(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 size_t pull_ascii(char *dest, const void *src, size_t dest_len, size_t src_len, int flags);
365 size_t pull_ascii_fstring(char *dest, const void *src);
366 size_t pull_ascii_nstring(char *dest, size_t dest_len, const void *src);
367 size_t push_ucs2(const void *base_ptr, void *dest, const char *src, size_t dest_len, int flags);
368 size_t push_utf8_fstring(void *dest, const char *src);
369 bool push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
370 size_t *converted_size);
371 size_t pull_ucs2(const void *base_ptr, char *dest, const void *src, size_t dest_len, size_t src_len, int flags);
372 size_t pull_ucs2_base_talloc(TALLOC_CTX *ctx,
373 const void *base_ptr,
378 size_t pull_ucs2_fstring(char *dest, const void *src);
379 bool push_ucs2_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src,
380 size_t *converted_size);
381 bool pull_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
382 size_t *converted_size);
383 bool pull_ucs2_talloc(TALLOC_CTX *ctx, char **dest, const smb_ucs2_t *src,
384 size_t *converted_size);
385 bool pull_ascii_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
386 size_t *converted_size);
387 size_t push_string_check_fn(const char *function, unsigned int line,
388 void *dest, const char *src,
389 size_t dest_len, int flags);
390 size_t push_string_base(const char *function, unsigned int line,
391 const char *base, uint16 flags2,
392 void *dest, const char *src,
393 size_t dest_len, int flags);
394 size_t pull_string_fn(const char *function,
396 const void *base_ptr,
403 size_t pull_string_talloc_fn(const char *function,
406 const void *base_ptr,
412 size_t align_string(const void *base_ptr, const char *p, int flags);
413 codepoint_t next_codepoint(const char *str, size_t *size);
415 /* The following definitions come from lib/clobber.c */
417 void clobber_region(const char *fn, unsigned int line, char *dest, size_t len);
419 /* The following definitions come from lib/conn_tdb.c */
421 struct db_record *connections_fetch_record(TALLOC_CTX *mem_ctx,
423 struct db_record *connections_fetch_entry(TALLOC_CTX *mem_ctx,
424 connection_struct *conn,
426 int connections_traverse(int (*fn)(struct db_record *rec,
429 int connections_forall(int (*fn)(struct db_record *rec,
430 const struct connections_key *key,
431 const struct connections_data *data,
434 bool connections_init(bool rw);
436 /* The following definitions come from lib/dbwrap_util.c */
438 int32_t dbwrap_fetch_int32(struct db_context *db, const char *keystr);
439 int dbwrap_store_int32(struct db_context *db, const char *keystr, int32_t v);
440 bool dbwrap_fetch_uint32(struct db_context *db, const char *keystr,
442 int dbwrap_store_uint32(struct db_context *db, const char *keystr, uint32_t v);
443 NTSTATUS dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr,
444 uint32_t *oldval, uint32_t change_val);
445 NTSTATUS dbwrap_trans_change_uint32_atomic(struct db_context *db,
448 uint32_t change_val);
449 NTSTATUS dbwrap_change_int32_atomic(struct db_context *db, const char *keystr,
450 int32_t *oldval, int32_t change_val);
451 NTSTATUS dbwrap_trans_change_int32_atomic(struct db_context *db,
455 NTSTATUS dbwrap_trans_store(struct db_context *db, TDB_DATA key, TDB_DATA dbuf,
457 NTSTATUS dbwrap_trans_delete(struct db_context *db, TDB_DATA key);
458 NTSTATUS dbwrap_trans_store_int32(struct db_context *db, const char *keystr,
460 NTSTATUS dbwrap_trans_store_uint32(struct db_context *db, const char *keystr,
462 NTSTATUS dbwrap_trans_store_bystring(struct db_context *db, const char *key,
463 TDB_DATA data, int flags);
464 NTSTATUS dbwrap_trans_delete_bystring(struct db_context *db, const char *key);
465 NTSTATUS dbwrap_trans_do(struct db_context *db,
466 NTSTATUS (*action)(struct db_context *, void *),
468 NTSTATUS dbwrap_delete_bystring_upper(struct db_context *db, const char *key);
469 NTSTATUS dbwrap_store_bystring_upper(struct db_context *db, const char *key,
470 TDB_DATA data, int flags);
471 TDB_DATA dbwrap_fetch_bystring_upper(struct db_context *db, TALLOC_CTX *mem_ctx,
474 /* The following definitions come from lib/debug.c */
476 void gfree_debugsyms(void);
477 const char *debug_classname_from_index(int ndx);
478 int debug_add_class(const char *classname);
479 int debug_lookup_classname(const char *classname);
480 bool debug_parse_levels(const char *params_str);
481 void debug_message(struct messaging_context *msg_ctx, void *private_data, uint32_t msg_type, struct server_id src, DATA_BLOB *data);
482 void debug_init(void);
483 void debug_register_msgs(struct messaging_context *msg_ctx);
484 void setup_logging(const char *pname, bool interactive);
485 void setup_logging_stdout( void );
486 void debug_set_logfile(const char *name);
487 bool reopen_logs( void );
488 void force_check_log_size( void );
489 bool need_to_check_log_size( void );
490 void check_log_size( void );
491 void dbgflush( void );
492 bool dbghdrclass(int level, int cls, const char *location, const char *func);
493 bool dbghdr(int level, const char *location, const char *func);
495 /* The following definitions come from lib/display_sec.c */
497 char *get_sec_mask_str(TALLOC_CTX *ctx, uint32 type);
498 void display_sec_access(uint32_t *info);
499 void display_sec_ace_flags(uint8_t flags);
500 void display_sec_ace(SEC_ACE *ace);
501 void display_sec_acl(SEC_ACL *sec_acl);
502 void display_acl_type(uint16 type);
503 void display_sec_desc(SEC_DESC *sec);
505 /* The following definitions come from lib/dmallocmsg.c */
507 void register_dmalloc_msgs(struct messaging_context *msg_ctx);
509 /* The following definitions come from lib/dprintf.c */
511 void display_set_stderr(void);
513 /* The following definitions come from lib/errmap_unix.c */
515 NTSTATUS map_nt_error_from_unix(int unix_error);
516 int map_errno_from_nt_status(NTSTATUS status);
518 /* The following definitions come from lib/fault.c */
519 void fault_setup(void (*fn)(void *));
520 void dump_core_setup(const char *progname);
522 /* The following definitions come from lib/file_id.c */
524 struct file_id vfs_file_id_from_sbuf(connection_struct *conn, const SMB_STRUCT_STAT *sbuf);
525 bool file_id_equal(const struct file_id *id1, const struct file_id *id2);
526 const char *file_id_string_tos(const struct file_id *id);
527 void push_file_id_16(char *buf, const struct file_id *id);
528 void push_file_id_24(char *buf, const struct file_id *id);
529 void pull_file_id_24(char *buf, struct file_id *id);
531 /* The following definitions come from lib/gencache.c */
533 bool gencache_set(const char *keystr, const char *value, time_t timeout);
534 bool gencache_del(const char *keystr);
535 bool gencache_get(const char *keystr, char **valstr, time_t *timeout);
536 bool gencache_get_data_blob(const char *keystr, DATA_BLOB *blob,
537 time_t *timeout, bool *was_expired);
538 bool gencache_stabilize(void);
539 bool gencache_set_data_blob(const char *keystr, const DATA_BLOB *blob, time_t timeout);
540 void gencache_iterate(void (*fn)(const char* key, const char *value, time_t timeout, void* dptr),
541 void* data, const char* keystr_pattern);
543 /* The following definitions come from lib/interface.c */
545 bool ismyaddr(const struct sockaddr *ip);
546 bool ismyip_v4(struct in_addr ip);
547 bool is_local_net(const struct sockaddr *from);
548 void setup_linklocal_scope_id(struct sockaddr *pss);
549 bool is_local_net_v4(struct in_addr from);
550 int iface_count(void);
551 int iface_count_v4_nl(void);
552 const struct in_addr *first_ipv4_iface(void);
553 struct interface *get_interface(int n);
554 const struct sockaddr_storage *iface_n_sockaddr_storage(int n);
555 const struct in_addr *iface_n_ip_v4(int n);
556 const struct in_addr *iface_n_bcast_v4(int n);
557 const struct sockaddr_storage *iface_n_bcast(int n);
558 const struct sockaddr_storage *iface_ip(const struct sockaddr *ip);
559 bool iface_local(const struct sockaddr *ip);
560 void load_interfaces(void);
561 void gfree_interfaces(void);
562 bool interfaces_changed(void);
564 /* The following definitions come from lib/ldap_debug_handler.c */
566 void init_ldap_debugging(void);
568 /* The following definitions come from lib/ldap_escape.c */
570 char *escape_ldap_string(TALLOC_CTX *mem_ctx, const char *s);
571 char *escape_rdn_val_string_alloc(const char *s);
573 /* The following definitions come from lib/module.c */
575 NTSTATUS smb_load_module(const char *module_name);
576 int smb_load_modules(const char **modules);
577 NTSTATUS smb_probe_module(const char *subsystem, const char *module);
578 NTSTATUS smb_load_module(const char *module_name);
579 int smb_load_modules(const char **modules);
580 NTSTATUS smb_probe_module(const char *subsystem, const char *module);
581 void init_modules(void);
583 /* The following definitions come from lib/ms_fnmatch.c */
585 int ms_fnmatch(const char *pattern, const char *string, bool translate_pattern,
586 bool is_case_sensitive);
587 int gen_fnmatch(const char *pattern, const char *string);
589 /* The following definitions come from lib/pam_errors.c */
591 NTSTATUS pam_to_nt_status(int pam_error);
592 int nt_status_to_pam(NTSTATUS nt_status);
593 NTSTATUS pam_to_nt_status(int pam_error);
594 int nt_status_to_pam(NTSTATUS nt_status);
596 /* The following definitions come from lib/pidfile.c */
598 pid_t pidfile_pid(const char *name);
599 void pidfile_create(const char *program_name);
600 void pidfile_unlink(void);
602 /* The following definitions come from lib/popt_common.c */
604 void popt_common_set_auth_info(struct user_auth_info *auth_info);
606 /* The following definitions come from lib/privileges.c */
608 bool get_privileges_for_sids(SE_PRIV *privileges, DOM_SID *slist, int scount);
609 NTSTATUS privilege_enumerate_accounts(DOM_SID **sids, int *num_sids);
610 NTSTATUS privilege_enum_sids(const SE_PRIV *mask, TALLOC_CTX *mem_ctx,
611 DOM_SID **sids, int *num_sids);
612 bool grant_privilege(const DOM_SID *sid, const SE_PRIV *priv_mask);
613 bool grant_privilege_by_name(DOM_SID *sid, const char *name);
614 bool revoke_privilege(const DOM_SID *sid, const SE_PRIV *priv_mask);
615 bool revoke_all_privileges( DOM_SID *sid );
616 bool revoke_privilege_by_name(DOM_SID *sid, const char *name);
617 NTSTATUS privilege_create_account(const DOM_SID *sid );
618 NTSTATUS privilege_delete_account(const struct dom_sid *sid);
619 NTSTATUS privilege_set_init(PRIVILEGE_SET *priv_set);
620 NTSTATUS privilege_set_init_by_ctx(TALLOC_CTX *mem_ctx, PRIVILEGE_SET *priv_set);
621 void privilege_set_free(PRIVILEGE_SET *priv_set);
622 NTSTATUS dup_luid_attr(TALLOC_CTX *mem_ctx, LUID_ATTR **new_la, LUID_ATTR *old_la, int count);
623 bool is_privileged_sid( const DOM_SID *sid );
624 bool grant_all_privileges( const DOM_SID *sid );
626 /* The following definitions come from lib/privileges_basic.c */
628 bool se_priv_copy( SE_PRIV *dst, const SE_PRIV *src );
629 bool se_priv_put_all_privileges(SE_PRIV *mask);
630 void se_priv_add( SE_PRIV *mask, const SE_PRIV *addpriv );
631 void se_priv_remove( SE_PRIV *mask, const SE_PRIV *removepriv );
632 bool se_priv_equal( const SE_PRIV *mask1, const SE_PRIV *mask2 );
633 bool se_priv_from_name( const char *name, SE_PRIV *mask );
634 void dump_se_priv( int dbg_cl, int dbg_lvl, const SE_PRIV *mask );
635 bool is_privilege_assigned(const SE_PRIV *privileges,
636 const SE_PRIV *check);
637 const char* get_privilege_dispname( const char *name );
638 bool user_has_privileges(const NT_USER_TOKEN *token, const SE_PRIV *privilege);
639 bool user_has_any_privilege(NT_USER_TOKEN *token, const SE_PRIV *privilege);
640 int count_all_privileges( void );
641 LUID_ATTR get_privilege_luid( SE_PRIV *mask );
642 const char *luid_to_privilege_name(const LUID *set);
643 bool se_priv_to_privilege_set( PRIVILEGE_SET *set, SE_PRIV *mask );
644 bool privilege_set_to_se_priv( SE_PRIV *mask, struct lsa_PrivilegeSet *privset );
646 /* The following definitions come from lib/readline.c */
648 void smb_readline_done(void);
649 char *smb_readline(const char *prompt, void (*callback)(void),
650 char **(completion_fn)(const char *text, int start, int end));
651 const char *smb_readline_get_line_buffer(void);
652 void smb_readline_ca_char(char c);
653 int cmd_history(void);
655 /* The following definitions come from lib/recvfile.c */
657 ssize_t sys_recvfile(int fromfd,
661 ssize_t sys_recvfile(int fromfd,
665 ssize_t drain_socket(int sockfd, size_t count);
667 /* The following definitions come from lib/secdesc.c */
669 uint32_t get_sec_info(const SEC_DESC *sd);
670 SEC_DESC_BUF *sec_desc_merge(TALLOC_CTX *ctx, SEC_DESC_BUF *new_sdb, SEC_DESC_BUF *old_sdb);
671 SEC_DESC *make_sec_desc(TALLOC_CTX *ctx,
672 enum security_descriptor_revision revision,
674 const DOM_SID *owner_sid, const DOM_SID *grp_sid,
675 SEC_ACL *sacl, SEC_ACL *dacl, size_t *sd_size);
676 SEC_DESC *dup_sec_desc(TALLOC_CTX *ctx, const SEC_DESC *src);
677 NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx,
678 struct security_descriptor *secdesc,
679 uint8 **data, size_t *len);
680 NTSTATUS marshall_sec_desc_buf(TALLOC_CTX *mem_ctx,
681 struct sec_desc_buf *secdesc_buf,
682 uint8_t **data, size_t *len);
683 NTSTATUS unmarshall_sec_desc(TALLOC_CTX *mem_ctx, uint8 *data, size_t len,
684 struct security_descriptor **psecdesc);
685 NTSTATUS unmarshall_sec_desc_buf(TALLOC_CTX *mem_ctx, uint8_t *data, size_t len,
686 struct sec_desc_buf **psecdesc_buf);
687 SEC_DESC *make_standard_sec_desc(TALLOC_CTX *ctx, const DOM_SID *owner_sid, const DOM_SID *grp_sid,
688 SEC_ACL *dacl, size_t *sd_size);
689 SEC_DESC_BUF *make_sec_desc_buf(TALLOC_CTX *ctx, size_t len, SEC_DESC *sec_desc);
690 SEC_DESC_BUF *dup_sec_desc_buf(TALLOC_CTX *ctx, SEC_DESC_BUF *src);
691 NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, uint32 mask, size_t *sd_size);
692 NTSTATUS sec_desc_mod_sid(SEC_DESC *sd, DOM_SID *sid, uint32 mask);
693 NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, size_t *sd_size);
694 NTSTATUS se_create_child_secdesc(TALLOC_CTX *ctx,
697 const SEC_DESC *parent_ctr,
698 const DOM_SID *owner_sid,
699 const DOM_SID *group_sid,
701 NTSTATUS se_create_child_secdesc_buf(TALLOC_CTX *ctx,
702 SEC_DESC_BUF **ppsdb,
703 const SEC_DESC *parent_ctr,
706 /* The following definitions come from lib/select.c */
708 void sys_select_signal(char c);
709 int sys_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *tval);
710 int sys_select_intr(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *tval);
712 /* The following definitions come from lib/sendfile.c */
714 ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
716 /* The following definitions come from lib/server_mutex.c */
718 struct named_mutex *grab_named_mutex(TALLOC_CTX *mem_ctx, const char *name,
721 /* The following definitions come from lib/sharesec.c */
723 bool share_info_db_init(void);
724 SEC_DESC *get_share_security_default( TALLOC_CTX *ctx, size_t *psize, uint32 def_access);
725 SEC_DESC *get_share_security( TALLOC_CTX *ctx, const char *servicename,
727 bool set_share_security(const char *share_name, SEC_DESC *psd);
728 bool delete_share_security(const char *servicename);
729 bool share_access_check(const NT_USER_TOKEN *token, const char *sharename,
730 uint32 desired_access);
731 bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, SEC_DESC **ppsd);
733 /* The following definitions come from lib/smbldap.c */
735 int smb_ldap_start_tls(LDAP *ldap_struct, int version);
736 int smb_ldap_setup_conn(LDAP **ldap_struct, const char *uri);
737 int smb_ldap_upgrade_conn(LDAP *ldap_struct, int *new_version) ;
738 int smb_ldap_setup_full_conn(LDAP **ldap_struct, const char *uri);
739 int smbldap_search(struct smbldap_state *ldap_state,
740 const char *base, int scope, const char *filter,
741 const char *attrs[], int attrsonly,
743 int smbldap_search_paged(struct smbldap_state *ldap_state,
744 const char *base, int scope, const char *filter,
745 const char **attrs, int attrsonly, int pagesize,
746 LDAPMessage **res, void **cookie);
747 int smbldap_modify(struct smbldap_state *ldap_state, const char *dn, LDAPMod *attrs[]);
748 int smbldap_add(struct smbldap_state *ldap_state, const char *dn, LDAPMod *attrs[]);
749 int smbldap_delete(struct smbldap_state *ldap_state, const char *dn);
750 int smbldap_extended_operation(struct smbldap_state *ldap_state,
751 LDAP_CONST char *reqoid, struct berval *reqdata,
752 LDAPControl **serverctrls, LDAPControl **clientctrls,
753 char **retoidp, struct berval **retdatap);
754 int smbldap_search_suffix (struct smbldap_state *ldap_state,
755 const char *filter, const char **search_attr,
756 LDAPMessage ** result);
757 void smbldap_free_struct(struct smbldap_state **ldap_state) ;
758 NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx, struct event_context *event_ctx,
759 const char *location,
760 struct smbldap_state **smbldap_state);
761 bool smbldap_has_control(LDAP *ld, const char *control);
762 bool smbldap_has_extension(LDAP *ld, const char *extension);
763 bool smbldap_has_naming_context(LDAP *ld, const char *naming_context);
764 bool smbldap_set_creds(struct smbldap_state *ldap_state, bool anon, const char *dn, const char *secret);
766 /* The following definitions come from lib/smbldap_util.c */
768 NTSTATUS smbldap_search_domain_info(struct smbldap_state *ldap_state,
769 LDAPMessage ** result, const char *domain_name,
772 /* The following definitions come from lib/smbrun.c */
774 int smbrun_no_sanitize(const char *cmd, int *outfd);
775 int smbrun(const char *cmd, int *outfd);
776 int smbrunsecret(const char *cmd, const char *secret);
778 /* The following definitions come from lib/sock_exec.c */
780 int sock_exec(const char *prog);
782 /* The following definitions come from lib/substitute.c */
784 void free_local_machine_name(void);
785 bool set_local_machine_name(const char *local_name, bool perm);
786 const char *get_local_machine_name(void);
787 bool set_remote_machine_name(const char *remote_name, bool perm);
788 const char *get_remote_machine_name(void);
789 void sub_set_smb_name(const char *name);
790 void set_current_user_info(const char *smb_name, const char *unix_name,
792 const char *get_current_username(void);
793 void standard_sub_basic(const char *smb_name, const char *domain_name,
794 char *str, size_t len);
795 char *talloc_sub_basic(TALLOC_CTX *mem_ctx, const char *smb_name,
796 const char *domain_name, const char *str);
797 char *alloc_sub_basic(const char *smb_name, const char *domain_name,
799 char *talloc_sub_specified(TALLOC_CTX *mem_ctx,
800 const char *input_string,
801 const char *username,
805 char *talloc_sub_advanced(TALLOC_CTX *mem_ctx,
806 const char *servicename, const char *user,
807 const char *connectpath, gid_t gid,
808 const char *smb_name, const char *domain_name,
810 void standard_sub_advanced(const char *servicename, const char *user,
811 const char *connectpath, gid_t gid,
812 const char *smb_name, const char *domain_name,
813 char *str, size_t len);
814 char *standard_sub_conn(TALLOC_CTX *ctx, connection_struct *conn, const char *str);
816 /* The following definitions come from lib/sysacls.c */
818 int sys_acl_get_entry(SMB_ACL_T acl_d, int entry_id, SMB_ACL_ENTRY_T *entry_p);
819 int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *type_p);
820 int sys_acl_get_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
821 void *sys_acl_get_qualifier(SMB_ACL_ENTRY_T entry_d);
822 int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset_d);
823 int sys_acl_add_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
824 int sys_acl_get_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
825 char *sys_acl_to_text(SMB_ACL_T acl_d, ssize_t *len_p);
826 SMB_ACL_T sys_acl_init(int count);
827 int sys_acl_create_entry(SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p);
828 int sys_acl_set_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type);
829 int sys_acl_set_qualifier(SMB_ACL_ENTRY_T entry_d, void *qual_p);
830 int sys_acl_set_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d);
831 int sys_acl_free_text(char *text);
832 int sys_acl_free_acl(SMB_ACL_T acl_d) ;
833 int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype);
834 int sys_acl_valid(SMB_ACL_T acl_d);
835 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
836 const char *path_p, SMB_ACL_TYPE_T type);
837 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
838 int sys_acl_set_file(vfs_handle_struct *handle,
839 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
840 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
842 int sys_acl_delete_def_file(vfs_handle_struct *handle,
844 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
845 const char *path_p, SMB_ACL_TYPE_T type);
846 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
847 int sys_acl_set_file(vfs_handle_struct *handle,
848 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
849 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
851 int sys_acl_delete_def_file(vfs_handle_struct *handle,
853 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
854 const char *path_p, SMB_ACL_TYPE_T type);
855 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
856 int sys_acl_set_file(vfs_handle_struct *handle,
857 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
858 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
860 int sys_acl_delete_def_file(vfs_handle_struct *handle,
862 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
863 const char *path_p, SMB_ACL_TYPE_T type);
864 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
865 int sys_acl_set_file(vfs_handle_struct *handle,
866 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
867 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
869 int sys_acl_delete_def_file(vfs_handle_struct *handle,
871 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
872 const char *path_p, SMB_ACL_TYPE_T type);
873 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
874 int sys_acl_set_file(vfs_handle_struct *handle,
875 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
876 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
878 int sys_acl_delete_def_file(vfs_handle_struct *handle,
880 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
881 const char *path_p, SMB_ACL_TYPE_T type);
882 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
883 int sys_acl_set_file(vfs_handle_struct *handle,
884 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
885 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
887 int sys_acl_delete_def_file(vfs_handle_struct *handle,
889 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
890 const char *path_p, SMB_ACL_TYPE_T type);
891 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
892 int sys_acl_set_file(vfs_handle_struct *handle,
893 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
894 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
896 int sys_acl_delete_def_file(vfs_handle_struct *handle,
898 int no_acl_syscall_error(int err);
900 /* The following definitions come from lib/sysquotas.c */
902 int sys_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
903 int sys_set_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
905 /* The following definitions come from lib/sysquotas_*.c */
907 int sys_get_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
908 int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
910 int sys_get_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
911 int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
913 /* The following definitions come from lib/system.c */
915 void *sys_memalign( size_t align, size_t size );
916 int sys_usleep(long usecs);
917 ssize_t sys_read(int fd, void *buf, size_t count);
918 ssize_t sys_write(int fd, const void *buf, size_t count);
919 ssize_t sys_writev(int fd, const struct iovec *iov, int iovcnt);
920 ssize_t sys_pread(int fd, void *buf, size_t count, SMB_OFF_T off);
921 ssize_t sys_pwrite(int fd, const void *buf, size_t count, SMB_OFF_T off);
922 ssize_t sys_send(int s, const void *msg, size_t len, int flags);
923 ssize_t sys_sendto(int s, const void *msg, size_t len, int flags, const struct sockaddr *to, socklen_t tolen);
924 ssize_t sys_recv(int fd, void *buf, size_t count, int flags);
925 ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen);
926 int sys_fcntl_ptr(int fd, int cmd, void *arg);
927 int sys_fcntl_long(int fd, int cmd, long arg);
928 void update_stat_ex_mtime(struct stat_ex *dst, struct timespec write_ts);
929 int sys_stat(const char *fname,SMB_STRUCT_STAT *sbuf);
930 int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf);
931 int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf);
932 int sys_ftruncate(int fd, SMB_OFF_T offset);
933 SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence);
934 int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence);
935 SMB_OFF_T sys_ftell(FILE *fp);
936 int sys_creat(const char *path, mode_t mode);
937 int sys_open(const char *path, int oflag, mode_t mode);
938 FILE *sys_fopen(const char *path, const char *type);
939 void kernel_flock(int fd, uint32 share_mode, uint32 access_mask);
940 SMB_STRUCT_DIR *sys_opendir(const char *name);
941 SMB_STRUCT_DIRENT *sys_readdir(SMB_STRUCT_DIR *dirp);
942 void sys_seekdir(SMB_STRUCT_DIR *dirp, long offset);
943 long sys_telldir(SMB_STRUCT_DIR *dirp);
944 void sys_rewinddir(SMB_STRUCT_DIR *dirp);
945 int sys_closedir(SMB_STRUCT_DIR *dirp);
946 int sys_mknod(const char *path, mode_t mode, SMB_DEV_T dev);
947 int sys_waitpid(pid_t pid,int *status,int options);
948 char *sys_getwd(char *s);
949 void set_effective_capability(enum smbd_capability capability);
950 void drop_effective_capability(enum smbd_capability capability);
951 long sys_random(void);
952 void sys_srandom(unsigned int seed);
953 int groups_max(void);
954 int sys_getgroups(int setlen, gid_t *gidset);
955 int sys_setgroups(gid_t UNUSED(primary_gid), int setlen, gid_t *gidset);
956 void sys_setpwent(void);
957 struct passwd *sys_getpwent(void);
958 void sys_endpwent(void);
959 struct passwd *sys_getpwnam(const char *name);
960 struct passwd *sys_getpwuid(uid_t uid);
961 struct group *sys_getgrnam(const char *name);
962 struct group *sys_getgrgid(gid_t gid);
963 int sys_popen(const char *command);
964 int sys_pclose(int fd);
965 ssize_t sys_getxattr (const char *path, const char *name, void *value, size_t size);
966 ssize_t sys_lgetxattr (const char *path, const char *name, void *value, size_t size);
967 ssize_t sys_fgetxattr (int filedes, const char *name, void *value, size_t size);
968 ssize_t sys_listxattr (const char *path, char *list, size_t size);
969 ssize_t sys_llistxattr (const char *path, char *list, size_t size);
970 ssize_t sys_flistxattr (int filedes, char *list, size_t size);
971 int sys_removexattr (const char *path, const char *name);
972 int sys_lremovexattr (const char *path, const char *name);
973 int sys_fremovexattr (int filedes, const char *name);
974 int sys_setxattr (const char *path, const char *name, const void *value, size_t size, int flags);
975 int sys_lsetxattr (const char *path, const char *name, const void *value, size_t size, int flags);
976 int sys_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags);
977 uint32 unix_dev_major(SMB_DEV_T dev);
978 uint32 unix_dev_minor(SMB_DEV_T dev);
979 int sys_aio_read(SMB_STRUCT_AIOCB *aiocb);
980 int sys_aio_write(SMB_STRUCT_AIOCB *aiocb);
981 ssize_t sys_aio_return(SMB_STRUCT_AIOCB *aiocb);
982 int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb);
983 int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb);
984 int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb);
985 int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout);
986 int sys_aio_read(SMB_STRUCT_AIOCB *aiocb);
987 int sys_aio_write(SMB_STRUCT_AIOCB *aiocb);
988 ssize_t sys_aio_return(SMB_STRUCT_AIOCB *aiocb);
989 int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb);
990 int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb);
991 int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb);
992 int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout);
993 int sys_getpeereid( int s, uid_t *uid);
994 int sys_getnameinfo(const struct sockaddr *psa,
1001 int sys_connect(int fd, const struct sockaddr * addr);
1003 /* The following definitions come from lib/system_smbd.c */
1005 bool getgroups_unix_user(TALLOC_CTX *mem_ctx, const char *user,
1007 gid_t **ret_groups, size_t *p_ngroups);
1009 /* The following definitions come from lib/tallocmsg.c */
1011 void register_msg_pool_usage(struct messaging_context *msg_ctx);
1013 /* The following definitions come from lib/time.c */
1015 void push_dos_date(uint8_t *buf, int offset, time_t unixdate, int zone_offset);
1016 void push_dos_date2(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
1017 void push_dos_date3(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
1018 time_t pull_dos_date(const uint8_t *date_ptr, int zone_offset);
1019 time_t pull_dos_date2(const uint8_t *date_ptr, int zone_offset);
1020 time_t pull_dos_date3(const uint8_t *date_ptr, int zone_offset);
1021 uint32 convert_time_t_to_uint32(time_t t);
1022 time_t convert_uint32_to_time_t(uint32 u);
1023 bool nt_time_is_zero(const NTTIME *nt);
1024 time_t generalized_to_unix_time(const char *str);
1025 int get_server_zone_offset(void);
1026 int set_server_zone_offset(time_t t);
1027 char *current_timestring(TALLOC_CTX *ctx, bool hires);
1028 void srv_put_dos_date(char *buf,int offset,time_t unixdate);
1029 void srv_put_dos_date2(char *buf,int offset, time_t unixdate);
1030 void srv_put_dos_date3(char *buf,int offset,time_t unixdate);
1031 void round_timespec(enum timestamp_set_resolution res, struct timespec *ts);
1032 void put_long_date_timespec(enum timestamp_set_resolution res, char *p, struct timespec ts);
1033 void put_long_date(char *p, time_t t);
1034 void dos_filetime_timespec(struct timespec *tsp);
1035 time_t make_unix_date2(const void *date_ptr, int zone_offset);
1036 time_t make_unix_date3(const void *date_ptr, int zone_offset);
1037 time_t srv_make_unix_date(const void *date_ptr);
1038 time_t srv_make_unix_date2(const void *date_ptr);
1039 time_t srv_make_unix_date3(const void *date_ptr);
1040 time_t convert_timespec_to_time_t(struct timespec ts);
1041 struct timespec convert_time_t_to_timespec(time_t t);
1042 struct timespec convert_timeval_to_timespec(const struct timeval tv);
1043 struct timeval convert_timespec_to_timeval(const struct timespec ts);
1044 struct timespec timespec_current(void);
1045 struct timespec timespec_min(const struct timespec *ts1,
1046 const struct timespec *ts2);
1047 int timespec_compare(const struct timespec *ts1, const struct timespec *ts2);
1048 void round_timespec_to_sec(struct timespec *ts);
1049 void round_timespec_to_usec(struct timespec *ts);
1050 struct timespec interpret_long_date(const char *p);
1051 void cli_put_dos_date(struct cli_state *cli, char *buf, int offset, time_t unixdate);
1052 void cli_put_dos_date2(struct cli_state *cli, char *buf, int offset, time_t unixdate);
1053 void cli_put_dos_date3(struct cli_state *cli, char *buf, int offset, time_t unixdate);
1054 time_t cli_make_unix_date(struct cli_state *cli, const void *date_ptr);
1055 time_t cli_make_unix_date2(struct cli_state *cli, const void *date_ptr);
1056 time_t cli_make_unix_date3(struct cli_state *cli, const void *date_ptr);
1057 bool nt_time_equals(const NTTIME *nt1, const NTTIME *nt2);
1058 void TimeInit(void);
1059 void get_process_uptime(struct timeval *ret_time);
1060 time_t nt_time_to_unix_abs(const NTTIME *nt);
1061 time_t uint64s_nt_time_to_unix_abs(const uint64_t *src);
1062 void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts);
1063 void unix_to_nt_time_abs(NTTIME *nt, time_t t);
1064 bool null_mtime(time_t mtime);
1065 const char *time_to_asc(const time_t t);
1066 const char *display_time(NTTIME nttime);
1067 bool nt_time_is_set(const NTTIME *nt);
1069 /* The following definitions come from lib/username.c */
1071 char *get_user_home_dir(TALLOC_CTX *mem_ctx, const char *user);
1072 struct passwd *Get_Pwnam_alloc(TALLOC_CTX *mem_ctx, const char *user);
1074 /* The following definitions come from lib/util.c */
1076 enum protocol_types get_Protocol(void);
1077 void set_Protocol(enum protocol_types p);
1078 bool all_zero(const uint8_t *ptr, size_t size);
1079 bool set_global_myname(const char *myname);
1080 const char *global_myname(void);
1081 bool set_global_myworkgroup(const char *myworkgroup);
1082 const char *lp_workgroup(void);
1083 bool set_global_scope(const char *scope);
1084 const char *global_scope(void);
1085 void gfree_names(void);
1086 void gfree_all( void );
1087 const char *my_netbios_names(int i);
1088 bool set_netbios_aliases(const char **str_array);
1089 bool init_names(void);
1090 struct user_auth_info *user_auth_info_init(TALLOC_CTX *mem_ctx);
1091 const char *get_cmdline_auth_info_username(const struct user_auth_info *auth_info);
1092 void set_cmdline_auth_info_username(struct user_auth_info *auth_info,
1093 const char *username);
1094 const char *get_cmdline_auth_info_domain(const struct user_auth_info *auth_info);
1095 void set_cmdline_auth_info_domain(struct user_auth_info *auth_info,
1096 const char *domain);
1097 void set_cmdline_auth_info_password(struct user_auth_info *auth_info,
1098 const char *password);
1099 const char *get_cmdline_auth_info_password(const struct user_auth_info *auth_info);
1100 bool set_cmdline_auth_info_signing_state(struct user_auth_info *auth_info,
1102 int get_cmdline_auth_info_signing_state(const struct user_auth_info *auth_info);
1103 void set_cmdline_auth_info_use_kerberos(struct user_auth_info *auth_info,
1105 bool get_cmdline_auth_info_use_kerberos(const struct user_auth_info *auth_info);
1106 void set_cmdline_auth_info_fallback_after_kerberos(struct user_auth_info *auth_info,
1108 bool get_cmdline_auth_info_fallback_after_kerberos(const struct user_auth_info *auth_info);
1109 void set_cmdline_auth_info_use_krb5_ticket(struct user_auth_info *auth_info);
1110 void set_cmdline_auth_info_smb_encrypt(struct user_auth_info *auth_info);
1111 void set_cmdline_auth_info_use_machine_account(struct user_auth_info *auth_info);
1112 bool get_cmdline_auth_info_got_pass(const struct user_auth_info *auth_info);
1113 bool get_cmdline_auth_info_smb_encrypt(const struct user_auth_info *auth_info);
1114 bool get_cmdline_auth_info_use_machine_account(const struct user_auth_info *auth_info);
1115 struct user_auth_info *get_cmdline_auth_info_copy(TALLOC_CTX *mem_ctx,
1116 const struct user_auth_info *info);
1117 bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_info);
1118 void set_cmdline_auth_info_getpass(struct user_auth_info *auth_info);
1119 bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf);
1120 bool socket_exist(const char *fname);
1121 bool directory_exist_stat(char *dname,SMB_STRUCT_STAT *st);
1122 uint64_t get_file_size_stat(const SMB_STRUCT_STAT *sbuf);
1123 SMB_OFF_T get_file_size(char *file_name);
1124 char *attrib_string(uint16 mode);
1125 void show_msg(char *buf);
1126 void smb_set_enclen(char *buf,int len,uint16 enc_ctx_num);
1127 void smb_setlen(char *buf,int len);
1128 int set_message_bcc(char *buf,int num_bytes);
1129 ssize_t message_push_blob(uint8 **outbuf, DATA_BLOB blob);
1130 char *unix_clean_name(TALLOC_CTX *ctx, const char *s);
1131 char *clean_name(TALLOC_CTX *ctx, const char *s);
1132 ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, SMB_OFF_T pos);
1133 int set_blocking(int fd, bool set);
1134 void smb_msleep(unsigned int t);
1135 NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
1136 struct event_context *ev_ctx,
1137 bool parent_longlived);
1138 bool yesno(const char *p);
1139 void *malloc_(size_t size);
1140 void *memalign_array(size_t el_size, size_t align, unsigned int count);
1141 void *calloc_array(size_t size, size_t nmemb);
1142 void *Realloc(void *p, size_t size, bool free_old_on_error);
1143 void add_to_large_array(TALLOC_CTX *mem_ctx, size_t element_size,
1144 void *element, void *_array, uint32 *num_elements,
1145 ssize_t *array_size);
1146 char *get_myname(TALLOC_CTX *ctx);
1147 char *get_mydnsdomname(TALLOC_CTX *ctx);
1148 int interpret_protocol(const char *str,int def);
1149 char *automount_lookup(TALLOC_CTX *ctx, const char *user_name);
1150 char *automount_lookup(TALLOC_CTX *ctx, const char *user_name);
1151 bool process_exists(const struct server_id pid);
1152 const char *uidtoname(uid_t uid);
1153 char *gidtoname(gid_t gid);
1154 uid_t nametouid(const char *name);
1155 gid_t nametogid(const char *name);
1156 void smb_panic(const char *const why);
1157 void log_stack_trace(void);
1158 const char *readdirname(SMB_STRUCT_DIR *p);
1159 bool is_in_path(const char *name, name_compare_entry *namelist, bool case_sensitive);
1160 void set_namearray(name_compare_entry **ppname_array, const char *namelist);
1161 void free_namearray(name_compare_entry *name_array);
1162 bool fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
1163 bool fcntl_getlock(int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid);
1164 bool is_myname(const char *s);
1165 bool is_myworkgroup(const char *s);
1166 void ra_lanman_string( const char *native_lanman );
1167 const char *get_remote_arch_str(void);
1168 void set_remote_arch(enum remote_arch_types type);
1169 enum remote_arch_types get_remote_arch(void);
1170 const char *tab_depth(int level, int depth);
1171 int str_checksum(const char *s);
1172 void zero_free(void *p, size_t size);
1173 int set_maxfiles(int requested_max);
1174 int smb_mkstemp(char *name_template);
1175 void *smb_xmalloc_array(size_t size, unsigned int count);
1176 char *myhostname(void);
1177 char *lock_path(const char *name);
1178 char *pid_path(const char *name);
1179 char *lib_path(const char *name);
1180 char *modules_path(const char *name);
1181 char *data_path(const char *name);
1182 char *state_path(const char *name);
1183 char *cache_path(const char *name);
1184 const char *shlib_ext(void);
1185 bool parent_dirname(TALLOC_CTX *mem_ctx, const char *dir, char **parent,
1187 bool ms_has_wild(const char *s);
1188 bool ms_has_wild_w(const smb_ucs2_t *s);
1189 bool mask_match(const char *string, const char *pattern, bool is_case_sensitive);
1190 bool mask_match_search(const char *string, const char *pattern, bool is_case_sensitive);
1191 bool mask_match_list(const char *string, char **list, int listLen, bool is_case_sensitive);
1192 bool unix_wild_match(const char *pattern, const char *string);
1193 bool name_to_fqdn(fstring fqdn, const char *name);
1194 void *talloc_append_blob(TALLOC_CTX *mem_ctx, void *buf, DATA_BLOB blob);
1195 uint32 map_share_mode_to_deny_mode(uint32 share_access, uint32 private_options);
1196 pid_t procid_to_pid(const struct server_id *proc);
1197 void set_my_vnn(uint32 vnn);
1198 uint32 get_my_vnn(void);
1199 struct server_id pid_to_procid(pid_t pid);
1200 struct server_id procid_self(void);
1201 struct server_id server_id_self(void);
1202 bool procid_equal(const struct server_id *p1, const struct server_id *p2);
1203 bool cluster_id_equal(const struct server_id *id1,
1204 const struct server_id *id2);
1205 bool procid_is_me(const struct server_id *pid);
1206 struct server_id interpret_pid(const char *pid_string);
1207 char *procid_str(TALLOC_CTX *mem_ctx, const struct server_id *pid);
1208 char *procid_str_static(const struct server_id *pid);
1209 bool procid_valid(const struct server_id *pid);
1210 bool procid_is_local(const struct server_id *pid);
1211 int this_is_smp(void);
1212 bool trans_oob(uint32_t bufsize, uint32_t offset, uint32_t length);
1213 bool is_offset_safe(const char *buf_base, size_t buf_len, char *ptr, size_t off);
1214 char *get_safe_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
1215 char *get_safe_str_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
1216 int get_safe_SVAL(const char *buf_base, size_t buf_len, char *ptr, size_t off, int failval);
1217 int get_safe_IVAL(const char *buf_base, size_t buf_len, char *ptr, size_t off, int failval);
1218 void split_domain_user(TALLOC_CTX *mem_ctx,
1219 const char *full_name,
1222 void *_talloc_zero_zeronull(const void *ctx, size_t size, const char *name);
1223 void *_talloc_memdup_zeronull(const void *t, const void *p, size_t size, const char *name);
1224 void *_talloc_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
1225 void *_talloc_zero_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
1226 void *talloc_zeronull(const void *context, size_t size, const char *name);
1227 bool is_valid_policy_hnd(const struct policy_handle *hnd);
1228 bool policy_hnd_equal(const struct policy_handle *hnd1,
1229 const struct policy_handle *hnd2);
1230 const char *strip_hostname(const char *s);
1232 /* The following definitions come from lib/util_file.c */
1234 char **file_lines_pload(const char *syscmd, int *numlines);
1235 void file_lines_free(char **lines);
1237 /* The following definitions come from lib/util_nscd.c */
1239 void smb_nscd_flush_user_cache(void);
1240 void smb_nscd_flush_group_cache(void);
1242 /* The following definitions come from lib/util_nttoken.c */
1244 NT_USER_TOKEN *dup_nt_token(TALLOC_CTX *mem_ctx, const NT_USER_TOKEN *ptoken);
1245 NTSTATUS merge_nt_token(TALLOC_CTX *mem_ctx,
1246 const struct nt_user_token *token_1,
1247 const struct nt_user_token *token_2,
1248 struct nt_user_token **token_out);
1249 bool token_sid_in_ace(const NT_USER_TOKEN *token, const SEC_ACE *ace);
1251 /* The following definitions come from lib/util_pw.c */
1253 struct passwd *tcopy_passwd(TALLOC_CTX *mem_ctx, const struct passwd *from) ;
1254 void flush_pwnam_cache(void);
1255 struct passwd *getpwnam_alloc(TALLOC_CTX *mem_ctx, const char *name);
1256 struct passwd *getpwuid_alloc(TALLOC_CTX *mem_ctx, uid_t uid) ;
1258 /* The following definitions come from lib/util_reg.c */
1260 const char *reg_type_lookup(enum winreg_Type type);
1261 WERROR reg_pull_multi_sz(TALLOC_CTX *mem_ctx, const void *buf, size_t len,
1262 uint32 *num_values, char ***values);
1263 bool push_reg_sz(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char *s);
1264 bool push_reg_multi_sz(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char **a);
1265 bool pull_reg_sz(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, const char **s);
1266 bool pull_reg_multi_sz(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, const char ***a);
1268 /* The following definitions come from lib/util_reg_api.c */
1270 WERROR registry_pull_value(TALLOC_CTX *mem_ctx,
1271 struct registry_value **pvalue,
1272 enum winreg_Type type, uint8 *data,
1273 uint32 size, uint32 length);
1274 WERROR registry_push_value(TALLOC_CTX *mem_ctx,
1275 const struct registry_value *value,
1276 DATA_BLOB *presult);
1278 /* The following definitions come from lib/util_seaccess.c */
1280 void se_map_generic(uint32 *access_mask, const struct generic_mapping *mapping);
1281 void security_acl_map_generic(struct security_acl *sa, const struct generic_mapping *mapping);
1282 void se_map_standard(uint32 *access_mask, struct standard_mapping *mapping);
1283 NTSTATUS se_access_check(const SEC_DESC *sd, const NT_USER_TOKEN *token,
1284 uint32 acc_desired, uint32 *acc_granted);
1285 NTSTATUS samr_make_sam_obj_sd(TALLOC_CTX *ctx, SEC_DESC **psd, size_t *sd_size);
1287 /* The following definitions come from lib/util_sec.c */
1289 void sec_init(void);
1290 uid_t sec_initial_uid(void);
1291 gid_t sec_initial_gid(void);
1292 bool non_root_mode(void);
1293 void gain_root_privilege(void);
1294 void gain_root_group_privilege(void);
1295 void set_effective_uid(uid_t uid);
1296 void set_effective_gid(gid_t gid);
1297 void save_re_uid(void);
1298 void restore_re_uid_fromroot(void);
1299 void restore_re_uid(void);
1300 void save_re_gid(void);
1301 void restore_re_gid(void);
1302 int set_re_uid(void);
1303 void become_user_permanently(uid_t uid, gid_t gid);
1304 bool is_setuid_root(void) ;
1306 /* The following definitions come from lib/util_sid.c */
1308 const char *sid_type_lookup(uint32 sid_type) ;
1309 NT_USER_TOKEN *get_system_token(void) ;
1310 const char *get_global_sam_name(void) ;
1311 char *sid_to_fstring(fstring sidstr_out, const DOM_SID *sid);
1312 char *sid_string_talloc(TALLOC_CTX *mem_ctx, const DOM_SID *sid);
1313 char *sid_string_dbg(const DOM_SID *sid);
1314 char *sid_string_tos(const DOM_SID *sid);
1315 bool string_to_sid(DOM_SID *sidout, const char *sidstr);
1316 DOM_SID *string_sid_talloc(TALLOC_CTX *mem_ctx, const char *sidstr);
1317 bool sid_append_rid(DOM_SID *sid, uint32 rid);
1318 bool sid_compose(DOM_SID *dst, const DOM_SID *domain_sid, uint32 rid);
1319 bool sid_split_rid(DOM_SID *sid, uint32 *rid);
1320 bool sid_peek_rid(const DOM_SID *sid, uint32 *rid);
1321 bool sid_peek_check_rid(const DOM_SID *exp_dom_sid, const DOM_SID *sid, uint32 *rid);
1322 void sid_copy(DOM_SID *dst, const DOM_SID *src);
1323 bool sid_linearize(char *outbuf, size_t len, const DOM_SID *sid);
1324 bool sid_parse(const char *inbuf, size_t len, DOM_SID *sid);
1325 int sid_compare(const DOM_SID *sid1, const DOM_SID *sid2);
1326 int sid_compare_domain(const DOM_SID *sid1, const DOM_SID *sid2);
1327 bool sid_equal(const DOM_SID *sid1, const DOM_SID *sid2);
1328 bool non_mappable_sid(DOM_SID *sid);
1329 char *sid_binstring(TALLOC_CTX *mem_ctx, const DOM_SID *sid);
1330 char *sid_binstring_hex(const DOM_SID *sid);
1331 DOM_SID *sid_dup_talloc(TALLOC_CTX *ctx, const DOM_SID *src);
1332 NTSTATUS add_sid_to_array(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
1333 DOM_SID **sids, size_t *num);
1334 NTSTATUS add_sid_to_array_unique(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
1335 DOM_SID **sids, size_t *num_sids);
1336 void del_sid_from_array(const DOM_SID *sid, DOM_SID **sids, size_t *num);
1337 bool add_rid_to_array_unique(TALLOC_CTX *mem_ctx,
1338 uint32 rid, uint32 **pp_rids, size_t *p_num);
1339 bool is_null_sid(const DOM_SID *sid);
1340 bool is_sid_in_token(const NT_USER_TOKEN *token, const DOM_SID *sid);
1341 NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx,
1342 const struct netr_SamInfo3 *info3,
1343 DOM_SID **user_sids,
1344 size_t *num_user_sids,
1345 bool include_user_group_rid,
1346 bool skip_ressource_groups);
1348 /* The following definitions come from lib/util_sock.c */
1350 bool is_broadcast_addr(const struct sockaddr *pss);
1351 bool is_loopback_ip_v4(struct in_addr ip);
1352 bool is_loopback_addr(const struct sockaddr *pss);
1353 bool is_zero_addr(const struct sockaddr *pss);
1354 void zero_ip_v4(struct in_addr *ip);
1355 void in_addr_to_sockaddr_storage(struct sockaddr_storage *ss,
1357 bool same_net(const struct sockaddr *ip1,
1358 const struct sockaddr *ip2,
1359 const struct sockaddr *mask);
1360 bool sockaddr_equal(const struct sockaddr *ip1,
1361 const struct sockaddr *ip2);
1362 bool is_address_any(const struct sockaddr *psa);
1363 uint16_t get_sockaddr_port(const struct sockaddr_storage *pss);
1364 char *print_sockaddr(char *dest,
1366 const struct sockaddr_storage *psa);
1367 char *print_canonical_sockaddr(TALLOC_CTX *ctx,
1368 const struct sockaddr_storage *pss);
1369 void set_sockaddr_port(struct sockaddr *psa, uint16_t port);
1370 const char *client_name(int fd);
1371 int get_socket_port(int fd);
1372 const char *client_addr(int fd, char *addr, size_t addrlen);
1373 const char *client_socket_addr(int fd, char *addr, size_t addr_len);
1374 int client_socket_port(int fd);
1375 void set_smb_read_error(enum smb_read_errors *pre,
1376 enum smb_read_errors newerr);
1377 void cond_set_smb_read_error(enum smb_read_errors *pre,
1378 enum smb_read_errors newerr);
1379 bool is_a_socket(int fd);
1380 void set_socket_options(int fd, const char *options);
1381 ssize_t read_udp_v4_socket(int fd,
1384 struct sockaddr_storage *psa);
1385 NTSTATUS read_fd_with_timeout(int fd, char *buf,
1386 size_t mincnt, size_t maxcnt,
1387 unsigned int time_out,
1389 NTSTATUS read_data(int fd, char *buffer, size_t N);
1390 ssize_t write_data(int fd, const char *buffer, size_t N);
1391 ssize_t write_data_iov(int fd, const struct iovec *orig_iov, int iovcnt);
1392 bool send_keepalive(int client);
1393 NTSTATUS read_smb_length_return_keepalive(int fd, char *inbuf,
1394 unsigned int timeout,
1396 NTSTATUS read_smb_length(int fd, char *inbuf, unsigned int timeout,
1398 NTSTATUS receive_smb_raw(int fd,
1401 unsigned int timeout,
1404 int open_socket_in(int type,
1407 const struct sockaddr_storage *psock,
1409 NTSTATUS open_socket_out(const struct sockaddr_storage *pss, uint16_t port,
1410 int timeout, int *pfd);
1411 struct tevent_req *open_socket_out_send(TALLOC_CTX *mem_ctx,
1412 struct event_context *ev,
1413 const struct sockaddr_storage *pss,
1416 NTSTATUS open_socket_out_recv(struct tevent_req *req, int *pfd);
1417 struct tevent_req *open_socket_out_defer_send(TALLOC_CTX *mem_ctx,
1418 struct event_context *ev,
1419 struct timeval wait_time,
1420 const struct sockaddr_storage *pss,
1423 NTSTATUS open_socket_out_defer_recv(struct tevent_req *req, int *pfd);
1424 bool open_any_socket_out(struct sockaddr_storage *addrs, int num_addrs,
1425 int timeout, int *fd_index, int *fd);
1426 int open_udp_socket(const char *host, int port);
1427 const char *get_peer_name(int fd, bool force_lookup);
1428 const char *get_peer_addr(int fd, char *addr, size_t addr_len);
1429 int create_pipe_sock(const char *socket_dir,
1430 const char *socket_name,
1432 const char *get_mydnsfullname(void);
1433 bool is_myname_or_ipaddr(const char *s);
1434 struct tevent_req *getaddrinfo_send(TALLOC_CTX *mem_ctx,
1435 struct tevent_context *ev,
1436 struct fncall_context *ctx,
1438 const char *service,
1439 const struct addrinfo *hints);
1440 int getaddrinfo_recv(struct tevent_req *req, struct addrinfo **res);
1441 struct tevent_req *tstream_read_packet_send(TALLOC_CTX *mem_ctx,
1442 struct tevent_context *ev,
1443 struct tstream_context *stream,
1445 ssize_t (*more)(uint8_t *buf,
1447 void *private_data),
1448 void *private_data);
1449 ssize_t tstream_read_packet_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1450 uint8_t **pbuf, int *perrno);
1452 /* The following definitions come from lib/util_str.c */
1454 bool next_token(const char **ptr, char *buff, const char *sep, size_t bufsize);
1455 bool next_token_talloc(TALLOC_CTX *ctx,
1459 bool next_token_no_ltrim_talloc(TALLOC_CTX *ctx,
1463 int StrCaseCmp(const char *s, const char *t);
1464 int StrnCaseCmp(const char *s, const char *t, size_t len);
1465 bool strnequal(const char *s1,const char *s2,size_t n);
1466 bool strcsequal(const char *s1,const char *s2);
1467 void strnorm(char *s, int case_default);
1468 bool strisnormal(const char *s, int case_default);
1469 char *push_skip_string(char *buf);
1470 char *skip_string(const char *base, size_t len, char *buf);
1471 size_t str_charnum(const char *s);
1472 size_t str_ascii_charnum(const char *s);
1473 bool trim_char(char *s,char cfront,char cback);
1474 bool strhasupper(const char *s);
1475 bool strhaslower(const char *s);
1476 char *safe_strcpy_fn(const char *fn,
1481 char *safe_strcat_fn(const char *fn,
1486 char *alpha_strcpy_fn(const char *fn,
1490 const char *other_safe_chars,
1492 char *StrnCpy_fn(const char *fn, int line,char *dest,const char *src,size_t n);
1493 bool in_list(const char *s, const char *list, bool casesensitive);
1494 void string_free(char **s);
1495 bool string_set(char **dest,const char *src);
1496 void string_sub2(char *s,const char *pattern, const char *insert, size_t len,
1497 bool remove_unsafe_characters, bool replace_once,
1498 bool allow_trailing_dollar);
1499 void string_sub_once(char *s, const char *pattern,
1500 const char *insert, size_t len);
1501 void string_sub(char *s,const char *pattern, const char *insert, size_t len);
1502 void fstring_sub(char *s,const char *pattern,const char *insert);
1503 char *realloc_string_sub2(char *string,
1504 const char *pattern,
1506 bool remove_unsafe_characters,
1507 bool allow_trailing_dollar);
1508 char *realloc_string_sub(char *string,
1509 const char *pattern,
1510 const char *insert);
1511 char *talloc_string_sub2(TALLOC_CTX *mem_ctx, const char *src,
1512 const char *pattern,
1514 bool remove_unsafe_characters,
1516 bool allow_trailing_dollar);
1517 char *talloc_string_sub(TALLOC_CTX *mem_ctx,
1519 const char *pattern,
1520 const char *insert);
1521 void all_string_sub(char *s,const char *pattern,const char *insert, size_t len);
1522 char *talloc_all_string_sub(TALLOC_CTX *ctx,
1524 const char *pattern,
1525 const char *insert);
1526 char *octal_string(int i);
1527 char *string_truncate(char *s, unsigned int length);
1528 char *strchr_m(const char *src, char c);
1529 char *strrchr_m(const char *s, char c);
1530 char *strnrchr_m(const char *s, char c, unsigned int n);
1531 char *strstr_m(const char *src, const char *findstr);
1532 void strlower_m(char *s);
1533 void strupper_m(char *s);
1534 size_t strlen_m(const char *s);
1535 size_t strlen_m_term(const char *s);
1536 size_t strlen_m_term_null(const char *s);
1537 char *binary_string_rfc2254(TALLOC_CTX *mem_ctx, const uint8_t *buf, int len);
1538 char *binary_string(char *buf, int len);
1539 int fstr_sprintf(fstring s, const char *fmt, ...);
1540 bool str_list_sub_basic( char **list, const char *smb_name,
1541 const char *domain_name );
1542 bool str_list_substitute(char **list, const char *pattern, const char *insert);
1543 bool str_list_check(const char **list, const char *s);
1544 bool str_list_check_ci(const char **list, const char *s);
1546 char *ipstr_list_make(char **ipstr_list,
1547 const struct ip_service *ip_list,
1549 int ipstr_list_parse(const char *ipstr_list, struct ip_service **ip_list);
1550 void ipstr_list_free(char* ipstr_list);
1551 void rfc1738_unescape(char *buf);
1552 DATA_BLOB base64_decode_data_blob(const char *s);
1553 void base64_decode_inplace(char *s);
1554 char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data);
1555 uint64_t STR_TO_SMB_BIG_UINT(const char *nptr, const char **entptr);
1556 SMB_OFF_T conv_str_size(const char * str);
1557 void string_append(char **left, const char *right);
1558 bool add_string_to_array(TALLOC_CTX *mem_ctx,
1559 const char *str, const char ***strings,
1561 void sprintf_append(TALLOC_CTX *mem_ctx, char **string, ssize_t *len,
1562 size_t *bufsize, const char *fmt, ...);
1563 int asprintf_strupper_m(char **strp, const char *fmt, ...);
1564 char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...);
1565 char *talloc_asprintf_strlower_m(TALLOC_CTX *t, const char *fmt, ...);
1566 char *sstring_sub(const char *src, char front, char back);
1567 bool validate_net_name( const char *name,
1568 const char *invalid_chars,
1570 char *escape_shell_string(const char *src);
1571 char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep);
1573 /* The following definitions come from lib/util_unistr.c */
1575 void gfree_case_tables(void);
1576 void load_case_tables(void);
1577 void init_valid_table(void);
1578 size_t dos_PutUniCode(char *dst,const char *src, size_t len, bool null_terminate);
1579 char *skip_unibuf(char *src, size_t len);
1580 int rpcstr_push(void *dest, const char *src, size_t dest_len, int flags);
1581 int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src);
1582 smb_ucs2_t toupper_w(smb_ucs2_t val);
1583 smb_ucs2_t tolower_w( smb_ucs2_t val );
1584 bool islower_w(smb_ucs2_t c);
1585 bool isupper_w(smb_ucs2_t c);
1586 bool isvalid83_w(smb_ucs2_t c);
1587 size_t strlen_w(const smb_ucs2_t *src);
1588 size_t strnlen_w(const smb_ucs2_t *src, size_t max);
1589 smb_ucs2_t *strchr_w(const smb_ucs2_t *s, smb_ucs2_t c);
1590 smb_ucs2_t *strchr_wa(const smb_ucs2_t *s, char c);
1591 smb_ucs2_t *strrchr_w(const smb_ucs2_t *s, smb_ucs2_t c);
1592 smb_ucs2_t *strnrchr_w(const smb_ucs2_t *s, smb_ucs2_t c, unsigned int n);
1593 smb_ucs2_t *strstr_w(const smb_ucs2_t *s, const smb_ucs2_t *ins);
1594 bool strlower_w(smb_ucs2_t *s);
1595 bool strupper_w(smb_ucs2_t *s);
1596 void strnorm_w(smb_ucs2_t *s, int case_default);
1597 int strcmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b);
1598 int strncmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len);
1599 int strcasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b);
1600 int strncasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len);
1601 bool strequal_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2);
1602 bool strnequal_w(const smb_ucs2_t *s1,const smb_ucs2_t *s2,size_t n);
1603 smb_ucs2_t *strdup_w(const smb_ucs2_t *src);
1604 smb_ucs2_t *strndup_w(const smb_ucs2_t *src, size_t len);
1605 smb_ucs2_t *strncpy_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const size_t max);
1606 smb_ucs2_t *strncat_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const size_t max);
1607 smb_ucs2_t *strcat_w(smb_ucs2_t *dest, const smb_ucs2_t *src);
1608 void string_replace_w(smb_ucs2_t *s, smb_ucs2_t oldc, smb_ucs2_t newc);
1609 bool trim_string_w(smb_ucs2_t *s, const smb_ucs2_t *front,
1610 const smb_ucs2_t *back);
1611 int strcmp_wa(const smb_ucs2_t *a, const char *b);
1612 int strncmp_wa(const smb_ucs2_t *a, const char *b, size_t len);
1613 smb_ucs2_t *strpbrk_wa(const smb_ucs2_t *s, const char *p);
1614 smb_ucs2_t *strstr_wa(const smb_ucs2_t *s, const char *ins);
1615 int toupper_ascii(int c);
1616 int tolower_ascii(int c);
1617 int isupper_ascii(int c);
1618 int islower_ascii(int c);
1620 /* The following definitions come from lib/util_uuid.c */
1622 void smb_uuid_pack(const struct GUID uu, UUID_FLAT *ptr);
1623 void smb_uuid_unpack(const UUID_FLAT in, struct GUID *uu);
1624 char *guid_binstring(TALLOC_CTX *mem_ctx, const struct GUID *guid);
1626 /* The following definitions come from lib/version.c */
1628 const char *samba_version_string(void);
1630 /* The following definitions come from lib/winbind_util.c */
1632 bool winbind_lookup_name(const char *dom_name, const char *name, DOM_SID *sid,
1633 enum lsa_SidType *name_type);
1634 bool winbind_lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
1635 const char **domain, const char **name,
1636 enum lsa_SidType *name_type);
1637 bool winbind_ping(void);
1638 bool winbind_sid_to_uid(uid_t *puid, const DOM_SID *sid);
1639 bool winbind_uid_to_sid(DOM_SID *sid, uid_t uid);
1640 bool winbind_sid_to_gid(gid_t *pgid, const DOM_SID *sid);
1641 bool winbind_gid_to_sid(DOM_SID *sid, gid_t gid);
1642 struct passwd * winbind_getpwnam(const char * sname);
1643 struct passwd * winbind_getpwsid(const DOM_SID *sid);
1644 wbcErr wb_is_trusted_domain(const char *domain);
1645 bool winbind_lookup_rids(TALLOC_CTX *mem_ctx,
1646 const DOM_SID *domain_sid,
1647 int num_rids, uint32 *rids,
1648 const char **domain_name,
1649 const char ***names, enum lsa_SidType **types);
1650 bool winbind_allocate_uid(uid_t *uid);
1651 bool winbind_allocate_gid(gid_t *gid);
1652 bool winbind_get_groups(TALLOC_CTX *mem_ctx,
1653 const char *account,
1654 uint32_t *num_groups,
1656 bool winbind_get_sid_aliases(TALLOC_CTX *mem_ctx,
1657 const DOM_SID *dom_sid,
1658 const DOM_SID *members,
1660 uint32_t **pp_alias_rids,
1661 size_t *p_num_alias_rids);
1664 /* The following definitions come from lib/wins_srv.c */
1666 bool wins_srv_is_dead(struct in_addr wins_ip, struct in_addr src_ip);
1667 void wins_srv_alive(struct in_addr wins_ip, struct in_addr src_ip);
1668 void wins_srv_died(struct in_addr wins_ip, struct in_addr src_ip);
1669 unsigned wins_srv_count(void);
1670 char **wins_srv_tags(void);
1671 void wins_srv_tags_free(char **list);
1672 struct in_addr wins_srv_ip_tag(const char *tag, struct in_addr src_ip);
1673 unsigned wins_srv_count_tag(const char *tag);
1675 /* The following definitions come from libads/ads_status.c */
1677 ADS_STATUS ads_build_error(enum ads_error_type etype,
1678 int rc, int minor_status);
1679 ADS_STATUS ads_build_nt_error(enum ads_error_type etype,
1680 NTSTATUS nt_status);
1681 NTSTATUS ads_ntstatus(ADS_STATUS status);
1682 const char *ads_errstr(ADS_STATUS status);
1683 NTSTATUS gss_err_to_ntstatus(uint32 maj, uint32 min);
1685 /* The following definitions come from libads/ads_struct.c */
1687 char *ads_build_path(const char *realm, const char *sep, const char *field, int reverse);
1688 char *ads_build_dn(const char *realm);
1689 char *ads_build_domain(const char *dn);
1690 ADS_STRUCT *ads_init(const char *realm,
1691 const char *workgroup,
1692 const char *ldap_server);
1693 void ads_destroy(ADS_STRUCT **ads);
1695 const char *ads_get_ldap_server_name(ADS_STRUCT *ads);
1697 /* The following definitions come from libads/authdata.c */
1699 struct PAC_LOGON_INFO *get_logon_info_from_pac(struct PAC_DATA *pac_data);
1700 NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
1704 time_t *expire_time,
1705 time_t *renew_till_time,
1706 const char *cache_name,
1708 bool add_netbios_addr,
1709 time_t renewable_time,
1710 const char *impersonate_princ_s,
1711 struct PAC_DATA **pac_ret);
1712 NTSTATUS kerberos_return_info3_from_pac(TALLOC_CTX *mem_ctx,
1716 time_t *expire_time,
1717 time_t *renew_till_time,
1718 const char *cache_name,
1720 bool add_netbios_addr,
1721 time_t renewable_time,
1722 const char *impersonate_princ_s,
1723 struct netr_SamInfo3 **info3);
1725 /* The following definitions come from libads/cldap.c */
1726 bool ads_cldap_netlogon(TALLOC_CTX *mem_ctx,
1729 uint32_t nt_version,
1730 struct netlogon_samlogon_response **reply);
1731 bool ads_cldap_netlogon_5(TALLOC_CTX *mem_ctx,
1734 struct NETLOGON_SAM_LOGON_RESPONSE_EX *reply5);
1736 /* The following definitions come from libads/disp_sec.c */
1738 void ads_disp_sd(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, SEC_DESC *sd);
1740 /* The following definitions come from libads/dns.c */
1742 NTSTATUS ads_dns_lookup_ns(TALLOC_CTX *ctx,
1743 const char *dnsdomain,
1744 struct dns_rr_ns **nslist,
1746 bool sitename_store(const char *realm, const char *sitename);
1747 char *sitename_fetch(const char *realm);
1748 bool stored_sitename_changed(const char *realm, const char *sitename);
1749 NTSTATUS ads_dns_query_dcs(TALLOC_CTX *ctx,
1751 const char *sitename,
1752 struct dns_rr_srv **dclist,
1754 NTSTATUS ads_dns_query_gcs(TALLOC_CTX *ctx,
1756 const char *sitename,
1757 struct dns_rr_srv **dclist,
1759 NTSTATUS ads_dns_query_kdcs(TALLOC_CTX *ctx,
1760 const char *dns_forest_name,
1761 const char *sitename,
1762 struct dns_rr_srv **dclist,
1764 NTSTATUS ads_dns_query_pdc(TALLOC_CTX *ctx,
1765 const char *dns_domain_name,
1766 struct dns_rr_srv **dclist,
1768 NTSTATUS ads_dns_query_dcs_guid(TALLOC_CTX *ctx,
1769 const char *dns_forest_name,
1770 const struct GUID *domain_guid,
1771 struct dns_rr_srv **dclist,
1774 /* The following definitions come from libads/kerberos.c */
1776 int kerberos_kinit_password_ext(const char *principal,
1777 const char *password,
1779 time_t *expire_time,
1780 time_t *renew_till_time,
1781 const char *cache_name,
1783 bool add_netbios_addr,
1784 time_t renewable_time,
1785 NTSTATUS *ntstatus);
1786 int ads_kinit_password(ADS_STRUCT *ads);
1787 int ads_kdestroy(const char *cc_name);
1788 char* kerberos_standard_des_salt( void );
1789 bool kerberos_secrets_store_des_salt( const char* salt );
1790 char* kerberos_secrets_fetch_des_salt( void );
1791 char *kerberos_get_default_realm_from_ccache( void );
1792 bool kerberos_secrets_store_salting_principal(const char *service,
1794 const char *principal);
1795 int kerberos_kinit_password(const char *principal,
1796 const char *password,
1798 const char *cache_name);
1799 bool create_local_private_krb5_conf_for_domain(const char *realm,
1801 const char *sitename,
1802 struct sockaddr_storage *pss);
1804 /* The following definitions come from libads/kerberos_keytab.c */
1806 int ads_keytab_add_entry(ADS_STRUCT *ads, const char *srvPrinc);
1807 int ads_keytab_flush(ADS_STRUCT *ads);
1808 int ads_keytab_create_default(ADS_STRUCT *ads);
1809 int ads_keytab_list(const char *keytab_name);
1811 /* The following definitions come from libads/kerberos_verify.c */
1813 NTSTATUS ads_verify_ticket(TALLOC_CTX *mem_ctx,
1816 const DATA_BLOB *ticket,
1818 struct PAC_DATA **pac_data,
1820 DATA_BLOB *session_key,
1821 bool use_replay_cache);
1823 /* The following definitions come from libads/krb5_errs.c */
1826 /* The following definitions come from libads/krb5_setpw.c */
1828 ADS_STATUS ads_krb5_set_password(const char *kdc_host, const char *princ,
1829 const char *newpw, int time_offset);
1830 ADS_STATUS kerberos_set_password(const char *kpasswd_server,
1831 const char *auth_principal, const char *auth_password,
1832 const char *target_principal, const char *new_password,
1834 ADS_STATUS ads_set_machine_password(ADS_STRUCT *ads,
1835 const char *machine_account,
1836 const char *password);
1838 /* The following definitions come from libads/ldap.c */
1840 bool ads_sitename_match(ADS_STRUCT *ads);
1841 bool ads_closest_dc(ADS_STRUCT *ads);
1842 ADS_STATUS ads_connect(ADS_STRUCT *ads);
1843 ADS_STATUS ads_connect_user_creds(ADS_STRUCT *ads);
1844 ADS_STATUS ads_connect_gc(ADS_STRUCT *ads);
1845 void ads_disconnect(ADS_STRUCT *ads);
1846 ADS_STATUS ads_do_search_all_fn(ADS_STRUCT *ads, const char *bind_path,
1847 int scope, const char *expr, const char **attrs,
1848 bool (*fn)(ADS_STRUCT *, char *, void **, void *),
1850 char *ads_parent_dn(const char *dn);
1851 ADS_MODLIST ads_init_mods(TALLOC_CTX *ctx);
1852 ADS_STATUS ads_mod_str(TALLOC_CTX *ctx, ADS_MODLIST *mods,
1853 const char *name, const char *val);
1854 ADS_STATUS ads_mod_strlist(TALLOC_CTX *ctx, ADS_MODLIST *mods,
1855 const char *name, const char **vals);
1856 ADS_STATUS ads_gen_mod(ADS_STRUCT *ads, const char *mod_dn, ADS_MODLIST mods);
1857 ADS_STATUS ads_gen_add(ADS_STRUCT *ads, const char *new_dn, ADS_MODLIST mods);
1858 ADS_STATUS ads_del_dn(ADS_STRUCT *ads, char *del_dn);
1859 char *ads_ou_string(ADS_STRUCT *ads, const char *org_unit);
1860 char *ads_default_ou_string(ADS_STRUCT *ads, const char *wknguid);
1861 ADS_STATUS ads_add_strlist(TALLOC_CTX *ctx, ADS_MODLIST *mods,
1862 const char *name, const char **vals);
1863 uint32 ads_get_kvno(ADS_STRUCT *ads, const char *account_name);
1864 uint32_t ads_get_machine_kvno(ADS_STRUCT *ads, const char *machine_name);
1865 ADS_STATUS ads_clear_service_principal_names(ADS_STRUCT *ads, const char *machine_name);
1866 ADS_STATUS ads_add_service_principal_name(ADS_STRUCT *ads, const char *machine_name,
1867 const char *my_fqdn, const char *spn);
1868 ADS_STATUS ads_create_machine_acct(ADS_STRUCT *ads, const char *machine_name,
1869 const char *org_unit);
1870 ADS_STATUS ads_move_machine_acct(ADS_STRUCT *ads, const char *machine_name,
1871 const char *org_unit, bool *moved);
1872 int ads_count_replies(ADS_STRUCT *ads, void *res);
1873 ADS_STATUS ads_USN(ADS_STRUCT *ads, uint32 *usn);
1874 ADS_STATUS ads_current_time(ADS_STRUCT *ads);
1875 ADS_STATUS ads_domain_func_level(ADS_STRUCT *ads, uint32 *val);
1876 ADS_STATUS ads_domain_sid(ADS_STRUCT *ads, DOM_SID *sid);
1877 ADS_STATUS ads_site_dn(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const char **site_name);
1878 ADS_STATUS ads_site_dn_for_machine(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const char *computer_name, const char **site_dn);
1879 ADS_STATUS ads_upn_suffixes(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char ***suffixes, size_t *num_suffixes);
1880 ADS_STATUS ads_get_joinable_ous(ADS_STRUCT *ads,
1881 TALLOC_CTX *mem_ctx,
1884 ADS_STATUS ads_get_sid_from_extended_dn(TALLOC_CTX *mem_ctx,
1885 const char *extended_dn,
1886 enum ads_extended_dn_flags flags,
1888 char* ads_get_dnshostname( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name );
1889 char* ads_get_upn( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name );
1890 char* ads_get_samaccountname( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name );
1891 ADS_STATUS ads_join_realm(ADS_STRUCT *ads, const char *machine_name,
1892 uint32 account_type, const char *org_unit);
1893 ADS_STATUS ads_leave_realm(ADS_STRUCT *ads, const char *hostname);
1894 ADS_STATUS ads_find_samaccount(ADS_STRUCT *ads,
1895 TALLOC_CTX *mem_ctx,
1896 const char *samaccountname,
1898 const char **dn_ret);
1899 ADS_STATUS ads_config_path(ADS_STRUCT *ads,
1900 TALLOC_CTX *mem_ctx,
1901 char **config_path);
1902 const char *ads_get_extended_right_name_by_guid(ADS_STRUCT *ads,
1903 const char *config_path,
1904 TALLOC_CTX *mem_ctx,
1905 const struct GUID *rights_guid);
1906 ADS_STATUS ads_check_ou_dn(TALLOC_CTX *mem_ctx,
1908 const char **account_ou);
1910 /* The following definitions come from libads/ldap_printer.c */
1912 ADS_STATUS ads_mod_printer_entry(ADS_STRUCT *ads, char *prt_dn,
1913 TALLOC_CTX *ctx, const ADS_MODLIST *mods);
1914 ADS_STATUS ads_add_printer_entry(ADS_STRUCT *ads, char *prt_dn,
1915 TALLOC_CTX *ctx, ADS_MODLIST *mods);
1916 WERROR get_remote_printer_publishing_data(struct rpc_pipe_client *cli,
1917 TALLOC_CTX *mem_ctx,
1919 const char *printer);
1920 bool get_local_printer_publishing_data(TALLOC_CTX *mem_ctx,
1922 NT_PRINTER_DATA *data);
1924 /* The following definitions come from libads/ldap_schema.c */
1926 ADS_STATUS ads_get_attrnames_by_oids(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
1927 const char *schema_path,
1928 const char **OIDs, size_t num_OIDs,
1929 char ***OIDs_out, char ***names, size_t *count);
1930 const char *ads_get_attrname_by_guid(ADS_STRUCT *ads,
1931 const char *schema_path,
1932 TALLOC_CTX *mem_ctx,
1933 const struct GUID *schema_guid);
1934 const char *ads_get_attrname_by_oid(ADS_STRUCT *ads, const char *schema_path, TALLOC_CTX *mem_ctx, const char * OID);
1935 ADS_STATUS ads_schema_path(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char **schema_path);
1936 ADS_STATUS ads_check_posix_schema_mapping(TALLOC_CTX *mem_ctx,
1938 enum wb_posix_mapping map_type,
1939 struct posix_schema **s ) ;
1941 /* The following definitions come from libads/ldap_user.c */
1943 ADS_STATUS ads_add_user_acct(ADS_STRUCT *ads, const char *user,
1944 const char *container, const char *fullname);
1945 ADS_STATUS ads_add_group_acct(ADS_STRUCT *ads, const char *group,
1946 const char *container, const char *comment);
1948 /* The following definitions come from libads/ldap_utils.c */
1950 ADS_STATUS ads_ranged_search(ADS_STRUCT *ads,
1951 TALLOC_CTX *mem_ctx,
1956 const char *range_attr,
1958 size_t *num_strings);
1959 ADS_STATUS ads_ranged_search_internal(ADS_STRUCT *ads,
1960 TALLOC_CTX *mem_ctx,
1966 const char *range_attr,
1968 size_t *num_strings,
1973 /* The following definitions come from libads/ndr.c */
1975 void ndr_print_ads_auth_flags(struct ndr_print *ndr, const char *name, uint32_t r);
1976 void ndr_print_ads_struct(struct ndr_print *ndr, const char *name, const struct ads_struct *r);
1978 /* The following definitions come from libads/sasl.c */
1980 ADS_STATUS ads_sasl_bind(ADS_STRUCT *ads);
1982 /* The following definitions come from libads/sasl_wrapping.c */
1984 ADS_STATUS ads_setup_sasl_wrapping(ADS_STRUCT *ads,
1985 const struct ads_saslwrap_ops *ops,
1986 void *private_data);
1987 ADS_STATUS ads_setup_sasl_wrapping(ADS_STRUCT *ads,
1988 const struct ads_saslwrap_ops *ops,
1989 void *private_data);
1991 /* The following definitions come from libads/util.c */
1993 ADS_STATUS ads_change_trust_account_password(ADS_STRUCT *ads, char *host_principal);
1994 ADS_STATUS ads_guess_service_principal(ADS_STRUCT *ads,
1995 char **returned_principal);
1997 /* The following definitions come from libgpo/gpo_filesync.c */
1999 NTSTATUS gpo_copy_file(TALLOC_CTX *mem_ctx,
2000 struct cli_state *cli,
2001 const char *nt_path,
2002 const char *unix_path);
2003 NTSTATUS gpo_sync_directories(TALLOC_CTX *mem_ctx,
2004 struct cli_state *cli,
2005 const char *nt_path,
2006 const char *local_path);
2008 /* The following definitions come from libgpo/gpo_ini.c */
2010 NTSTATUS parse_gpt_ini(TALLOC_CTX *mem_ctx,
2011 const char *filename,
2013 char **display_name);
2015 /* The following definitions come from libgpo/gpo_reg.c */
2017 struct nt_user_token *registry_create_system_token(TALLOC_CTX *mem_ctx);
2018 WERROR gp_init_reg_ctx(TALLOC_CTX *mem_ctx,
2019 const char *initial_path,
2020 uint32_t desired_access,
2021 const struct nt_user_token *token,
2022 struct gp_registry_context **reg_ctx);
2023 void gp_free_reg_ctx(struct gp_registry_context *reg_ctx);
2024 WERROR gp_store_reg_subkey(TALLOC_CTX *mem_ctx,
2025 const char *subkeyname,
2026 struct registry_key *curr_key,
2027 struct registry_key **new_key);
2028 WERROR gp_read_reg_subkey(TALLOC_CTX *mem_ctx,
2029 struct gp_registry_context *reg_ctx,
2030 const char *subkeyname,
2031 struct registry_key **key);
2032 WERROR gp_store_reg_val_sz(TALLOC_CTX *mem_ctx,
2033 struct registry_key *key,
2034 const char *val_name,
2036 WERROR gp_read_reg_val_sz(TALLOC_CTX *mem_ctx,
2037 struct registry_key *key,
2038 const char *val_name,
2040 WERROR gp_reg_state_store(TALLOC_CTX *mem_ctx,
2043 const struct nt_user_token *token,
2044 struct GROUP_POLICY_OBJECT *gpo_list);
2045 WERROR gp_reg_state_read(TALLOC_CTX *mem_ctx,
2048 struct GROUP_POLICY_OBJECT **gpo_list);
2049 WERROR gp_secure_key(TALLOC_CTX *mem_ctx,
2051 struct registry_key *key,
2052 const DOM_SID *sid);
2053 void dump_reg_val(int lvl, const char *direction,
2054 const char *key, const char *subkey,
2055 struct registry_value *val);
2056 void dump_reg_entry(uint32_t flags,
2058 struct gp_registry_entry *entry);
2059 void dump_reg_entries(uint32_t flags,
2061 struct gp_registry_entry *entries,
2062 size_t num_entries);
2063 bool add_gp_registry_entry_to_array(TALLOC_CTX *mem_ctx,
2064 struct gp_registry_entry *entry,
2065 struct gp_registry_entry **entries,
2067 WERROR reg_apply_registry_entry(TALLOC_CTX *mem_ctx,
2068 struct registry_key *root_key,
2069 struct gp_registry_context *reg_ctx,
2070 struct gp_registry_entry *entry,
2071 const struct nt_user_token *token,
2075 #include "librpc/gen_ndr/ndr_dfs.h"
2076 #include "librpc/gen_ndr/ndr_dssetup.h"
2077 #include "librpc/gen_ndr/ndr_echo.h"
2078 #include "librpc/gen_ndr/ndr_eventlog.h"
2079 #include "librpc/gen_ndr/ndr_krb5pac.h"
2080 #include "librpc/gen_ndr/ndr_lsa.h"
2081 #include "librpc/gen_ndr/ndr_misc.h"
2082 #include "librpc/gen_ndr/ndr_netlogon.h"
2083 #include "librpc/gen_ndr/ndr_notify.h"
2084 #include "librpc/gen_ndr/ndr_ntsvcs.h"
2085 #include "librpc/gen_ndr/ndr_samr.h"
2086 #include "librpc/gen_ndr/ndr_security.h"
2087 #include "librpc/gen_ndr/ndr_srvsvc.h"
2088 #include "librpc/gen_ndr/ndr_svcctl.h"
2089 #include "librpc/gen_ndr/ndr_winreg.h"
2090 #include "librpc/gen_ndr/ndr_wkssvc.h"
2092 #include "librpc/gen_ndr/srv_dfs.h"
2093 #include "librpc/gen_ndr/srv_dssetup.h"
2094 #include "librpc/gen_ndr/srv_echo.h"
2095 #include "librpc/gen_ndr/srv_eventlog.h"
2096 #include "librpc/gen_ndr/srv_initshutdown.h"
2097 #include "librpc/gen_ndr/srv_lsa.h"
2098 #include "librpc/gen_ndr/srv_netlogon.h"
2099 #include "librpc/gen_ndr/srv_ntsvcs.h"
2100 #include "librpc/gen_ndr/srv_samr.h"
2101 #include "librpc/gen_ndr/srv_srvsvc.h"
2102 #include "librpc/gen_ndr/srv_svcctl.h"
2103 #include "librpc/gen_ndr/srv_winreg.h"
2104 #include "librpc/gen_ndr/srv_wkssvc.h"
2105 #include "librpc/gen_ndr/srv_spoolss.h"
2107 #include "librpc/ndr/libndr.h"
2109 /* The following definitions come from librpc/ndr/util.c */
2111 enum ndr_err_code ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct server_id *r);
2112 enum ndr_err_code ndr_pull_server_id(struct ndr_pull *ndr, int ndr_flags, struct server_id *r);
2113 void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct server_id *r);
2114 enum ndr_err_code ndr_push_file_id(struct ndr_push *ndr, int ndr_flags, const struct file_id *r);
2115 enum ndr_err_code ndr_pull_file_id(struct ndr_pull *ndr, int ndr_flags, struct file_id *r);
2116 void ndr_print_file_id(struct ndr_print *ndr, const char *name, const struct file_id *r);
2117 _PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const bool b);
2118 _PUBLIC_ void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss);
2119 const char *ndr_errstr(enum ndr_err_code err);
2120 extern const struct ndr_syntax_id null_ndr_syntax_id;
2122 /* The following definitions come from librpc/ndr/sid.c */
2124 char *dom_sid_string(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
2126 /* The following definitions come from librpc/rpc/binding.c */
2128 const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor);
2129 _PUBLIC_ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_binding *b);
2130 _PUBLIC_ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_binding **b_out);
2131 _PUBLIC_ NTSTATUS dcerpc_floor_get_lhs_data(const struct epm_floor *epm_floor,
2132 struct ndr_syntax_id *syntax);
2133 const char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor);
2134 enum dcerpc_transport_t dcerpc_transport_by_endpoint_protocol(int prot);
2135 _PUBLIC_ enum dcerpc_transport_t dcerpc_transport_by_tower(const struct epm_tower *tower);
2136 _PUBLIC_ const char *derpc_transport_string_by_transport(enum dcerpc_transport_t t);
2137 _PUBLIC_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx,
2138 struct epm_tower *tower,
2139 struct dcerpc_binding **b_out);
2140 _PUBLIC_ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx,
2141 const struct dcerpc_binding *binding,
2142 struct epm_tower *tower);
2144 /* The following definitions come from librpc/rpc/dcerpc.c */
2146 struct rpc_request *dcerpc_ndr_request_send(struct dcerpc_pipe *p, const struct GUID *object,
2147 const struct ndr_interface_table *table, uint32_t opnum,
2148 TALLOC_CTX *mem_ctx, void *r);
2149 NTSTATUS dcerpc_ndr_request_recv(struct rpc_request *req);
2150 _PUBLIC_ NTSTATUS dcerpc_pipe_connect(TALLOC_CTX *parent_ctx, struct dcerpc_pipe **pp,
2151 const char *binding_string, const struct ndr_interface_table *table,
2152 struct cli_credentials *credentials, struct event_context *ev,
2153 struct loadparm_context *lp_ctx);
2155 /* The following definitions come from libsmb/cliconnect.c */
2157 ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
2158 const char *pass, const char *user_domain,
2159 const char * dest_realm);
2161 NTSTATUS cli_session_setup(struct cli_state *cli,
2163 const char *pass, int passlen,
2164 const char *ntpass, int ntpasslen,
2165 const char *workgroup);
2166 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
2167 struct event_context *ev,
2168 struct cli_state *cli,
2169 struct tevent_req **psmbreq);
2170 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
2171 struct event_context *ev,
2172 struct cli_state *cli);
2173 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
2174 bool cli_ulogoff(struct cli_state *cli);
2175 struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
2176 struct event_context *ev,
2177 struct cli_state *cli,
2178 const char *share, const char *dev,
2179 const char *pass, int passlen,
2180 struct tevent_req **psmbreq);
2181 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
2182 struct event_context *ev,
2183 struct cli_state *cli,
2184 const char *share, const char *dev,
2185 const char *pass, int passlen);
2186 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
2187 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
2188 const char *dev, const char *pass, int passlen);
2189 bool cli_tdis(struct cli_state *cli);
2190 void cli_negprot_sendsync(struct cli_state *cli);
2191 NTSTATUS cli_negprot(struct cli_state *cli);
2192 struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
2193 struct event_context *ev,
2194 struct cli_state *cli);
2195 NTSTATUS cli_negprot_recv(struct tevent_req *req);
2196 bool cli_session_request(struct cli_state *cli,
2197 struct nmb_name *calling, struct nmb_name *called);
2198 NTSTATUS cli_connect(struct cli_state *cli,
2200 struct sockaddr_storage *dest_ss);
2201 NTSTATUS cli_start_connection(struct cli_state **output_cli,
2202 const char *my_name,
2203 const char *dest_host,
2204 struct sockaddr_storage *dest_ss, int port,
2205 int signing_state, int flags,
2207 NTSTATUS cli_full_connection(struct cli_state **output_cli,
2208 const char *my_name,
2209 const char *dest_host,
2210 struct sockaddr_storage *dest_ss, int port,
2211 const char *service, const char *service_type,
2212 const char *user, const char *domain,
2213 const char *password, int flags,
2216 bool attempt_netbios_session_request(struct cli_state **ppcli, const char *srchost, const char *desthost,
2217 struct sockaddr_storage *pdest_ss);
2218 NTSTATUS cli_raw_tcon(struct cli_state *cli,
2219 const char *service, const char *pass, const char *dev,
2220 uint16 *max_xmit, uint16 *tid);
2221 struct cli_state *get_ipc_connect(char *server,
2222 struct sockaddr_storage *server_ss,
2223 const struct user_auth_info *user_info);
2224 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
2225 struct ip_service *mb_ip,
2226 const struct user_auth_info *user_info,
2227 char **pp_workgroup_out);
2228 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
2229 const struct user_auth_info *user_info,
2230 char **pp_workgroup_out);
2232 /* The following definitions come from libsmb/clidfs.c */
2234 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
2235 const char *username,
2236 const char *password,
2238 const char *sharename);
2239 struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
2240 struct cli_state *referring_cli,
2243 const struct user_auth_info *auth_info,
2249 void cli_cm_display(const struct cli_state *c);
2250 bool cli_dfs_get_referral(TALLOC_CTX *ctx,
2251 struct cli_state *cli,
2253 CLIENT_DFS_REFERRAL**refs,
2256 bool cli_resolve_path(TALLOC_CTX *ctx,
2257 const char *mountpt,
2258 const struct user_auth_info *dfs_auth_info,
2259 struct cli_state *rootcli,
2261 struct cli_state **targetcli,
2262 char **pp_targetpath);
2264 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
2265 struct cli_state *cli,
2266 const char *sharename,
2267 char **pp_newserver,
2270 const char *username,
2271 const char *password,
2272 const char *domain);
2273 /* The following definitions come from libsmb/clidgram.c */
2275 bool send_getdc_request(TALLOC_CTX *mem_ctx,
2276 struct messaging_context *msg_ctx,
2277 struct sockaddr_storage *dc_ss,
2278 const char *domain_name,
2280 uint32_t nt_version);
2281 bool receive_getdc_response(TALLOC_CTX *mem_ctx,
2282 struct sockaddr_storage *dc_ss,
2283 const char *domain_name,
2284 uint32_t *nt_version,
2285 const char **dc_name,
2286 struct netlogon_samlogon_response **reply);
2288 /* The following definitions come from libsmb/clientgen.c */
2290 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
2291 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
2292 void cli_set_port(struct cli_state *cli, int port);
2293 bool cli_state_seqnum_persistent(struct cli_state *cli,
2295 bool cli_state_seqnum_remove(struct cli_state *cli,
2297 bool cli_receive_smb(struct cli_state *cli);
2298 ssize_t cli_receive_smb_data(struct cli_state *cli, char *buffer, size_t len);
2299 bool cli_receive_smb_readX_header(struct cli_state *cli);
2300 bool cli_send_smb(struct cli_state *cli);
2301 bool cli_send_smb_direct_writeX(struct cli_state *cli,
2304 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
2305 void cli_setup_packet(struct cli_state *cli);
2306 void cli_setup_bcc(struct cli_state *cli, void *p);
2307 NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
2308 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);
2309 NTSTATUS cli_set_password(struct cli_state *cli, const char *password);
2310 NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password);
2311 struct cli_state *cli_initialise(void);
2312 struct cli_state *cli_initialise_ex(int signing_state);
2313 void cli_nt_pipes_close(struct cli_state *cli);
2314 void cli_shutdown(struct cli_state *cli);
2315 void cli_sockopt(struct cli_state *cli, const char *options);
2316 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
2317 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
2318 bool cli_send_keepalive(struct cli_state *cli);
2319 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
2320 struct cli_state *cli, uint16_t num_echos,
2322 NTSTATUS cli_echo_recv(struct tevent_req *req);
2323 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
2324 bool cli_ucs2(struct cli_state *cli);
2325 bool is_andx_req(uint8_t cmd);
2327 /* The following definitions come from libsmb/clierror.c */
2329 const char *cli_errstr(struct cli_state *cli);
2330 NTSTATUS cli_nt_error(struct cli_state *cli);
2331 void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode);
2332 int cli_errno(struct cli_state *cli);
2333 bool cli_is_error(struct cli_state *cli);
2334 bool cli_is_nt_error(struct cli_state *cli);
2335 bool cli_is_dos_error(struct cli_state *cli);
2336 NTSTATUS cli_get_nt_error(struct cli_state *cli);
2337 void cli_set_nt_error(struct cli_state *cli, NTSTATUS status);
2338 void cli_reset_error(struct cli_state *cli);
2340 /* The following definitions come from libsmb/clifile.c */
2342 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
2343 struct event_context *ev,
2344 struct cli_state *cli,
2345 const char *oldname,
2346 const char *newname);
2347 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
2348 NTSTATUS cli_posix_symlink(struct cli_state *cli,
2349 const char *oldname,
2350 const char *newname);
2351 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
2352 struct event_context *ev,
2353 struct cli_state *cli,
2356 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
2357 char *retpath, size_t len);
2358 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
2359 char *linkpath, size_t len);
2360 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
2361 struct event_context *ev,
2362 struct cli_state *cli,
2363 const char *oldname,
2364 const char *newname);
2365 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
2366 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
2367 const char *oldname,
2368 const char *newname);
2369 uint32_t unix_perms_to_wire(mode_t perms);
2370 mode_t wire_perms_to_unix(uint32_t perms);
2371 struct tevent_req *cli_posix_getfacl_send(TALLOC_CTX *mem_ctx,
2372 struct event_context *ev,
2373 struct cli_state *cli,
2375 NTSTATUS cli_posix_getfacl_recv(struct tevent_req *req,
2376 TALLOC_CTX *mem_ctx,
2379 NTSTATUS cli_posix_getfacl(struct cli_state *cli,
2381 TALLOC_CTX *mem_ctx,
2384 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
2385 struct event_context *ev,
2386 struct cli_state *cli,
2388 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
2389 SMB_STRUCT_STAT *sbuf);
2390 NTSTATUS cli_posix_stat(struct cli_state *cli,
2392 SMB_STRUCT_STAT *sbuf);
2393 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
2394 struct event_context *ev,
2395 struct cli_state *cli,
2398 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
2399 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
2400 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
2401 struct event_context *ev,
2402 struct cli_state *cli,
2406 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
2407 NTSTATUS cli_posix_chown(struct cli_state *cli,
2411 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
2412 struct event_context *ev,
2413 struct cli_state *cli,
2414 const char *fname_src,
2415 const char *fname_dst);
2416 NTSTATUS cli_rename_recv(struct tevent_req *req);
2417 NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
2418 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
2419 struct event_context *ev,
2420 struct cli_state *cli,
2421 const char *fname_src,
2422 const char *fname_dst);
2423 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
2424 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
2426 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
2427 struct event_context *ev,
2428 struct cli_state *cli,
2429 const char *fname_src,
2430 const char *fname_dst);
2431 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
2432 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
2434 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
2435 struct event_context *ev,
2436 struct cli_state *cli,
2438 uint16_t mayhave_attrs);
2439 NTSTATUS cli_unlink_recv(struct tevent_req *req);
2440 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
2442 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
2443 struct event_context *ev,
2444 struct cli_state *cli,
2446 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
2447 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
2448 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
2449 struct event_context *ev,
2450 struct cli_state *cli,
2452 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
2453 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
2454 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
2455 struct event_context *ev,
2456 struct cli_state *cli,
2459 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
2460 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
2461 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
2462 struct event_context *ev,
2463 struct cli_state *cli,
2465 uint32_t CreatFlags,
2466 uint32_t DesiredAccess,
2467 uint32_t FileAttributes,
2468 uint32_t ShareAccess,
2469 uint32_t CreateDisposition,
2470 uint32_t CreateOptions,
2471 uint8_t SecurityFlags);
2472 NTSTATUS cli_ntcreate_recv(struct tevent_req *req, uint16_t *pfnum);
2473 NTSTATUS cli_ntcreate(struct cli_state *cli,
2475 uint32_t CreatFlags,
2476 uint32_t DesiredAccess,
2477 uint32_t FileAttributes,
2478 uint32_t ShareAccess,
2479 uint32_t CreateDisposition,
2480 uint32_t CreateOptions,
2481 uint8_t SecurityFlags,
2483 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
2484 size_t str_len, size_t *pconverted_size);
2485 struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx,
2486 struct event_context *ev,
2487 struct cli_state *cli, const char *fname,
2488 int flags, int share_mode,
2489 struct tevent_req **psmbreq);
2490 struct tevent_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
2491 struct cli_state *cli, const char *fname,
2492 int flags, int share_mode);
2493 NTSTATUS cli_open_recv(struct tevent_req *req, uint16_t *fnum);
2494 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
2495 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
2496 struct event_context *ev,
2497 struct cli_state *cli, uint16_t fnum,
2498 struct tevent_req **psubreq);
2499 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
2500 struct event_context *ev,
2501 struct cli_state *cli, uint16_t fnum);
2502 NTSTATUS cli_close_recv(struct tevent_req *req);
2503 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
2504 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
2505 struct event_context *ev,
2506 struct cli_state *cli,
2509 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
2510 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
2511 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
2512 uint32_t offset, uint32_t len,
2513 int timeout, unsigned char locktype);
2514 bool cli_lock(struct cli_state *cli, uint16_t fnum,
2515 uint32_t offset, uint32_t len, int timeout, enum brl_type lock_type);
2516 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
2517 struct event_context *ev,
2518 struct cli_state *cli,
2522 NTSTATUS cli_unlock_recv(struct tevent_req *req);
2523 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
2524 bool cli_lock64(struct cli_state *cli, uint16_t fnum,
2525 uint64_t offset, uint64_t len, int timeout, enum brl_type lock_type);
2526 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
2527 struct event_context *ev,
2528 struct cli_state *cli,
2532 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
2533 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
2534 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
2535 struct event_context *ev,
2536 struct cli_state *cli,
2541 enum brl_type lock_type);
2542 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
2543 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
2544 uint64_t offset, uint64_t len,
2545 bool wait_lock, enum brl_type lock_type);
2546 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
2547 struct event_context *ev,
2548 struct cli_state *cli,
2552 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
2553 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
2554 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
2555 struct event_context *ev,
2556 struct cli_state *cli,
2558 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
2561 time_t *change_time,
2562 time_t *access_time,
2563 time_t *write_time);
2564 NTSTATUS cli_getattrE(struct cli_state *cli,
2568 time_t *change_time,
2569 time_t *access_time,
2570 time_t *write_time);
2571 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
2572 struct event_context *ev,
2573 struct cli_state *cli,
2578 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
2579 NTSTATUS cli_setattrE(struct cli_state *cli,
2584 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
2585 struct event_context *ev,
2586 struct cli_state *cli,
2588 NTSTATUS cli_getatr_recv(struct tevent_req *req,
2591 time_t *write_time);
2592 NTSTATUS cli_getatr(struct cli_state *cli,
2596 time_t *write_time);
2597 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
2598 struct event_context *ev,
2599 struct cli_state *cli,
2603 NTSTATUS cli_setatr_recv(struct tevent_req *req);
2604 NTSTATUS cli_setatr(struct cli_state *cli,
2608 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
2609 struct event_context *ev,
2610 struct cli_state *cli,
2612 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
2613 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
2614 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
2615 struct event_context *ev,
2616 struct cli_state *cli);
2617 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
2619 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
2620 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
2621 struct event_context *ev,
2622 struct cli_state *cli,
2624 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
2628 NTSTATUS cli_ctemp(struct cli_state *cli,
2633 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
2634 bool cli_set_ea_path(struct cli_state *cli, const char *path, const char *ea_name, const char *ea_val, size_t ea_len);
2635 bool cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum, const char *ea_name, const char *ea_val, size_t ea_len);
2636 bool cli_get_ea_list_path(struct cli_state *cli, const char *path,
2639 struct ea_struct **pea_list);
2640 bool cli_get_ea_list_fnum(struct cli_state *cli, uint16_t fnum,
2643 struct ea_struct **pea_list);
2644 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
2645 struct event_context *ev,
2646 struct cli_state *cli,
2650 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
2651 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
2652 int flags, mode_t mode, uint16_t *fnum);
2653 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
2654 struct event_context *ev,
2655 struct cli_state *cli,
2658 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
2659 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
2661 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
2662 struct event_context *ev,
2663 struct cli_state *cli,
2665 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
2666 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
2668 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
2669 struct event_context *ev,
2670 struct cli_state *cli,
2672 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2673 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
2674 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
2675 struct tevent_context *ev,
2676 struct cli_state *cli, uint16_t fnum,
2677 uint32_t buffer_size,
2678 uint32_t completion_filter, bool recursive);
2679 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
2680 uint32_t *pnum_changes,
2681 struct notify_change **pchanges);
2683 /* The following definitions come from libsmb/clifsinfo.c */
2685 bool cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor, uint16 *pminor,
2686 uint32 *pcaplow, uint32 *pcaphigh);
2687 bool cli_set_unix_extensions_capabilities(struct cli_state *cli, uint16 major, uint16 minor,
2688 uint32 caplow, uint32 caphigh);
2689 bool cli_get_fs_attr_info(struct cli_state *cli, uint32 *fs_attr);
2690 bool cli_get_fs_volume_info_old(struct cli_state *cli, fstring volume_name, uint32 *pserial_number);
2691 bool cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name, uint32 *pserial_number, time_t *pdate);
2692 bool cli_get_fs_full_size_info(struct cli_state *cli,
2693 uint64_t *total_allocation_units,
2694 uint64_t *caller_allocation_units,
2695 uint64_t *actual_allocation_units,
2696 uint64_t *sectors_per_allocation_unit,
2697 uint64_t *bytes_per_sector);
2698 bool cli_get_posix_fs_info(struct cli_state *cli,
2699 uint32 *optimal_transfer_size,
2701 uint64_t *total_blocks,
2702 uint64_t *blocks_available,
2703 uint64_t *user_blocks_available,
2704 uint64_t *total_file_nodes,
2705 uint64_t *free_file_nodes,
2706 uint64_t *fs_identifier);
2707 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
2710 const char *domain);
2711 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
2712 NTSTATUS cli_force_encryption(struct cli_state *c,
2713 const char *username,
2714 const char *password,
2715 const char *domain);
2717 /* The following definitions come from libsmb/clikrb5.c */
2719 bool unwrap_edata_ntstatus(TALLOC_CTX *mem_ctx,
2721 DATA_BLOB *edata_out);
2722 bool unwrap_pac(TALLOC_CTX *mem_ctx, DATA_BLOB *auth_data, DATA_BLOB *unwrapped_pac_data);
2724 /* The following definitions come from libsmb/clilist.c */
2726 int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute,
2727 void (*fn)(const char *, file_info *, const char *, void *), void *state);
2728 int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
2729 void (*fn)(const char *, file_info *, const char *, void *), void *state);
2730 int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
2731 void (*fn)(const char *, file_info *, const char *, void *), void *state);
2733 /* The following definitions come from libsmb/climessage.c */
2735 int cli_message_start_build(struct cli_state *cli, const char *host, const char *username);
2736 bool cli_message_start(struct cli_state *cli, const char *host, const char *username,
2738 int cli_message_text_build(struct cli_state *cli, const char *msg, int len, int grp);
2739 bool cli_message_text(struct cli_state *cli, const char *msg, int len, int grp);
2740 int cli_message_end_build(struct cli_state *cli, int grp);
2741 bool cli_message_end(struct cli_state *cli, int grp);
2743 /* The following definitions come from libsmb/clioplock.c */
2745 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
2746 struct tevent_context *ev,
2747 struct cli_state *cli,
2748 uint16_t fnum, uint8_t level);
2749 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
2750 NTSTATUS cli_oplock_ack(struct cli_state *cli, uint16_t fnum, unsigned char level);
2751 void cli_oplock_handler(struct cli_state *cli,
2752 NTSTATUS (*handler)(struct cli_state *, uint16_t, unsigned char));
2754 /* The following definitions come from libsmb/cliprint.c */
2756 int cli_print_queue(struct cli_state *cli,
2757 void (*fn)(struct print_job_info *));
2758 int cli_printjob_del(struct cli_state *cli, int job);
2759 int cli_spl_open(struct cli_state *cli, const char *fname, int flags, int share_mode);
2760 bool cli_spl_close(struct cli_state *cli, uint16_t fnum);
2762 /* The following definitions come from libsmb/cliquota.c */
2764 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
2765 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
2766 bool cli_get_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
2767 bool cli_set_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
2768 bool cli_list_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_LIST **pqt_list);
2769 bool cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
2770 bool cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
2771 void dump_ntquota(SMB_NTQUOTA_STRUCT *qt, bool _verbose, bool _numeric, void (*_sidtostring)(fstring str, DOM_SID *sid, bool _numeric));
2772 void dump_ntquota_list(SMB_NTQUOTA_LIST **qtl, bool _verbose, bool _numeric, void (*_sidtostring)(fstring str, DOM_SID *sid, bool _numeric));
2774 /* The following definitions come from libsmb/clirap.c */
2776 bool cli_api(struct cli_state *cli,
2777 char *param, int prcnt, int mprcnt,
2778 char *data, int drcnt, int mdrcnt,
2779 char **rparam, unsigned int *rprcnt,
2780 char **rdata, unsigned int *rdrcnt);
2781 bool cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation);
2782 int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *, void *), void *state);
2783 bool cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
2784 void (*fn)(const char *, uint32, const char *, void *),
2786 bool cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
2787 const char *old_password);
2788 bool cli_qpathinfo(struct cli_state *cli,
2790 time_t *change_time,
2791 time_t *access_time,
2795 bool cli_setpathinfo(struct cli_state *cli, const char *fname,
2801 bool cli_qpathinfo2(struct cli_state *cli, const char *fname,
2802 struct timespec *create_time,
2803 struct timespec *access_time,
2804 struct timespec *write_time,
2805 struct timespec *change_time,
2806 SMB_OFF_T *size, uint16 *mode,
2808 bool cli_qpathinfo_streams(struct cli_state *cli, const char *fname,
2809 TALLOC_CTX *mem_ctx,
2810 unsigned int *pnum_streams,
2811 struct stream_struct **pstreams);
2812 bool cli_qfilename(struct cli_state *cli, uint16_t fnum, char *name, size_t namelen);
2813 bool cli_qfileinfo(struct cli_state *cli, uint16_t fnum,
2814 uint16 *mode, SMB_OFF_T *size,
2815 struct timespec *create_time,
2816 struct timespec *access_time,
2817 struct timespec *write_time,
2818 struct timespec *change_time,
2820 bool cli_qpathinfo_basic( struct cli_state *cli, const char *name,
2821 SMB_STRUCT_STAT *sbuf, uint32 *attributes );
2822 bool cli_qfileinfo_test(struct cli_state *cli, uint16_t fnum, int level, char **poutdata, uint32 *poutlen);
2823 NTSTATUS cli_qpathinfo_alt_name(struct cli_state *cli, const char *fname, fstring alt_name);
2825 /* The following definitions come from libsmb/clirap2.c */
2827 int cli_NetGroupDelete(struct cli_state *cli, const char *group_name);
2828 int cli_NetGroupAdd(struct cli_state *cli, RAP_GROUP_INFO_1 *grinfo);
2829 int cli_RNetGroupEnum(struct cli_state *cli, void (*fn)(const char *, const char *, void *), void *state);
2830 int cli_RNetGroupEnum0(struct cli_state *cli,
2831 void (*fn)(const char *, void *),
2833 int cli_NetGroupDelUser(struct cli_state * cli, const char *group_name, const char *user_name);
2834 int cli_NetGroupAddUser(struct cli_state * cli, const char *group_name, const char *user_name);
2835 int cli_NetGroupGetUsers(struct cli_state * cli, const char *group_name, void (*fn)(const char *, void *), void *state );
2836 int cli_NetUserGetGroups(struct cli_state * cli, const char *user_name, void (*fn)(const char *, void *), void *state );
2837 int cli_NetUserDelete(struct cli_state *cli, const char * user_name );
2838 int cli_NetUserAdd(struct cli_state *cli, RAP_USER_INFO_1 * userinfo );
2839 int cli_RNetUserEnum(struct cli_state *cli, void (*fn)(const char *, const char *, const char *, const char *, void *), void *state);
2840 int cli_RNetUserEnum0(struct cli_state *cli,
2841 void (*fn)(const char *, void *),
2843 int cli_NetFileClose(struct cli_state *cli, uint32 file_id );
2844 int cli_NetFileGetInfo(struct cli_state *cli, uint32 file_id, void (*fn)(const char *, const char *, uint16, uint16, uint32));
2845 int cli_NetFileEnum(struct cli_state *cli, const char * user,
2846 const char * base_path,
2847 void (*fn)(const char *, const char *, uint16, uint16,
2849 int cli_NetShareAdd(struct cli_state *cli, RAP_SHARE_INFO_2 * sinfo );
2850 int cli_NetShareDelete(struct cli_state *cli, const char * share_name );
2851 bool cli_get_pdc_name(struct cli_state *cli, const char *workgroup, char **pdc_name);
2852 bool cli_get_server_domain(struct cli_state *cli);
2853 bool cli_get_server_type(struct cli_state *cli, uint32 *pstype);
2854 bool cli_get_server_name(TALLOC_CTX *mem_ctx, struct cli_state *cli,
2856 bool cli_ns_check_server_type(struct cli_state *cli, char *workgroup, uint32 stype);
2857 bool cli_NetWkstaUserLogoff(struct cli_state *cli, const char *user, const char *workstation);
2858 int cli_NetPrintQEnum(struct cli_state *cli,
2859 void (*qfn)(const char*,uint16,uint16,uint16,const char*,const char*,const char*,const char*,const char*,uint16,uint16),
2860 void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,uint_t,uint_t,const char*));
2861 int cli_NetPrintQGetInfo(struct cli_state *cli, const char *printer,
2862 void (*qfn)(const char*,uint16,uint16,uint16,const char*,const char*,const char*,const char*,const char*,uint16,uint16),
2863 void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,uint_t,uint_t,const char*));
2864 int cli_RNetServiceEnum(struct cli_state *cli, void (*fn)(const char *, const char *, void *), void *state);
2865 int cli_NetSessionEnum(struct cli_state *cli, void (*fn)(char *, char *, uint16, uint16, uint16, uint_t, uint_t, uint_t, char *));
2866 int cli_NetSessionGetInfo(struct cli_state *cli, const char *workstation,
2867 void (*fn)(const char *, const char *, uint16, uint16, uint16, uint_t, uint_t, uint_t, const char *));
2868 int cli_NetSessionDel(struct cli_state *cli, const char *workstation);
2869 int cli_NetConnectionEnum(struct cli_state *cli, const char *qualifier,
2870 void (*fn)(uint16_t conid, uint16_t contype,
2871 uint16_t numopens, uint16_t numusers,
2872 uint32_t contime, const char *username,
2873 const char *netname));
2875 /* The following definitions come from libsmb/clireadwrite.c */
2877 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
2878 struct event_context *ev,
2879 struct cli_state *cli, uint16_t fnum,
2880 off_t offset, size_t size,
2881 struct tevent_req **psmbreq);
2882 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
2883 struct event_context *ev,
2884 struct cli_state *cli, uint16_t fnum,
2885 off_t offset, size_t size);
2886 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
2888 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
2889 struct event_context *ev,
2890 struct cli_state *cli,
2891 uint16_t fnum, off_t start_offset,
2892 SMB_OFF_T size, size_t window_size,
2893 NTSTATUS (*sink)(char *buf, size_t n,
2896 NTSTATUS cli_pull_recv(struct tevent_req *req, SMB_OFF_T *received);
2897 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
2898 off_t start_offset, SMB_OFF_T size, size_t window_size,
2899 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
2900 void *priv, SMB_OFF_T *received);
2901 ssize_t cli_read(struct cli_state *cli, uint16_t fnum, char *buf,
2902 off_t offset, size_t size);
2903 ssize_t cli_readraw(struct cli_state *cli, uint16_t fnum, char *buf, off_t offset, size_t size);
2904 ssize_t cli_write(struct cli_state *cli,
2905 uint16_t fnum, uint16 write_mode,
2906 const char *buf, off_t offset, size_t size);
2907 ssize_t cli_smbwrite(struct cli_state *cli,
2908 uint16_t fnum, char *buf, off_t offset, size_t size1);
2909 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
2910 struct event_context *ev,
2911 struct cli_state *cli, uint16_t fnum,
2912 uint16_t mode, const uint8_t *buf,
2913 off_t offset, size_t size,
2914 struct tevent_req **reqs_before,
2915 int num_reqs_before,
2916 struct tevent_req **psmbreq);
2917 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
2918 struct event_context *ev,
2919 struct cli_state *cli, uint16_t fnum,
2920 uint16_t mode, const uint8_t *buf,
2921 off_t offset, size_t size);
2922 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
2924 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
2925 struct cli_state *cli,
2926 uint16_t fnum, uint16_t mode,
2927 off_t start_offset, size_t window_size,
2928 size_t (*source)(uint8_t *buf, size_t n,
2931 NTSTATUS cli_push_recv(struct tevent_req *req);
2932 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
2933 off_t start_offset, size_t window_size,
2934 size_t (*source)(uint8_t *buf, size_t n, void *priv),
2937 /* The following definitions come from libsmb/clisecdesc.c */
2939 SEC_DESC *cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
2940 TALLOC_CTX *mem_ctx);
2941 bool cli_set_secdesc(struct cli_state *cli, uint16_t fnum, SEC_DESC *sd);
2943 /* The following definitions come from libsmb/clispnego.c */
2945 DATA_BLOB spnego_gen_negTokenInit(char guid[16],
2947 const char *principal);
2948 DATA_BLOB gen_negTokenInit(const char *OID, DATA_BLOB blob);
2949 bool spnego_parse_negTokenInit(DATA_BLOB blob,
2950 char *OIDs[ASN1_MAX_OIDS],
2952 DATA_BLOB gen_negTokenTarg(const char *OIDs[], DATA_BLOB blob);
2953 bool parse_negTokenTarg(DATA_BLOB blob, char *OIDs[ASN1_MAX_OIDS], DATA_BLOB *secblob);
2954 DATA_BLOB spnego_gen_krb5_wrap(const DATA_BLOB ticket, const uint8 tok_id[2]);
2955 bool spnego_parse_krb5_wrap(DATA_BLOB blob, DATA_BLOB *ticket, uint8 tok_id[2]);
2956 int spnego_gen_negTokenTarg(const char *principal, int time_offset,
2958 DATA_BLOB *session_key_krb5, uint32 extra_ap_opts,
2959 time_t *expire_time);
2960 bool spnego_parse_challenge(const DATA_BLOB blob,
2961 DATA_BLOB *chal1, DATA_BLOB *chal2);
2962 DATA_BLOB spnego_gen_auth(DATA_BLOB blob);
2963 bool spnego_parse_auth(DATA_BLOB blob, DATA_BLOB *auth);
2964 DATA_BLOB spnego_gen_auth_response(DATA_BLOB *reply, NTSTATUS nt_status,
2965 const char *mechOID);
2966 bool spnego_parse_auth_response(DATA_BLOB blob, NTSTATUS nt_status,
2967 const char *mechOID,
2970 /* The following definitions come from libsmb/clistr.c */
2972 size_t clistr_push_fn(const char *function,
2974 struct cli_state *cli,
2979 size_t clistr_pull_fn(const char *function,
2987 size_t clistr_pull_talloc_fn(const char *function,
2995 size_t clistr_align_out(struct cli_state *cli, const void *p, int flags);
2996 size_t clistr_align_in(struct cli_state *cli, const void *p, int flags);
2998 /* The following definitions come from libsmb/clitrans.c */
3000 bool cli_send_trans(struct cli_state *cli, int trans,
3001 const char *pipe_name,
3003 uint16 *setup, unsigned int lsetup, unsigned int msetup,
3004 const char *param, unsigned int lparam, unsigned int mparam,
3005 const char *data, unsigned int ldata, unsigned int mdata);
3006 bool cli_receive_trans(struct cli_state *cli,int trans,
3007 char **param, unsigned int *param_len,
3008 char **data, unsigned int *data_len);
3009 bool cli_send_nt_trans(struct cli_state *cli,
3012 uint16 *setup, unsigned int lsetup, unsigned int msetup,
3013 char *param, unsigned int lparam, unsigned int mparam,
3014 char *data, unsigned int ldata, unsigned int mdata);
3015 bool cli_receive_nt_trans(struct cli_state *cli,
3016 char **param, unsigned int *param_len,
3017 char **data, unsigned int *data_len);
3018 struct tevent_req *cli_trans_send(
3019 TALLOC_CTX *mem_ctx, struct event_context *ev,
3020 struct cli_state *cli, uint8_t cmd,
3021 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
3022 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
3023 uint8_t *param, uint32_t num_param, uint32_t max_param,
3024 uint8_t *data, uint32_t num_data, uint32_t max_data);
3025 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
3026 uint16_t **setup, uint8_t *num_setup,
3027 uint8_t **param, uint32_t *num_param,
3028 uint8_t **data, uint32_t *num_data);
3029 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
3031 const char *pipe_name, uint16_t fid, uint16_t function,