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(TALLOC_CTX *mem_ctx,
33 struct auth_context **auth_context);
34 NTSTATUS make_auth_context_fixed(TALLOC_CTX *mem_ctx,
35 struct auth_context **auth_context,
38 /* The following definitions come from auth/auth_builtin.c */
40 NTSTATUS auth_builtin_init(void);
42 /* The following definitions come from auth/auth_compat.c */
44 NTSTATUS check_plaintext_password(const char *smb_name,
45 DATA_BLOB plaintext_password,
46 struct auth_serversupplied_info **server_info);
47 bool password_ok(struct auth_context *actx, bool global_encrypted,
48 const char *session_workgroup,
49 const char *smb_name, DATA_BLOB password_blob);
51 /* The following definitions come from auth/auth_domain.c */
53 void attempt_machine_password_change(void);
54 NTSTATUS auth_domain_init(void);
56 NTSTATUS auth_netlogond_init(void);
58 /* The following definitions come from auth/auth_ntlmssp.c */
60 NTSTATUS auth_ntlmssp_steal_session_info(TALLOC_CTX *mem_ctx,
61 struct auth_ntlmssp_state *auth_ntlmssp_state,
62 struct auth_serversupplied_info **session_info);
63 NTSTATUS auth_ntlmssp_start(struct auth_ntlmssp_state **auth_ntlmssp_state);
66 /* The following definitions come from auth/auth_sam.c */
68 NTSTATUS check_sam_security(const DATA_BLOB *challenge,
70 const struct auth_usersupplied_info *user_info,
71 struct auth_serversupplied_info **server_info);
72 NTSTATUS check_sam_security_info3(const DATA_BLOB *challenge,
74 const struct auth_usersupplied_info *user_info,
75 struct netr_SamInfo3 **pinfo3);
76 NTSTATUS auth_sam_init(void);
78 /* The following definitions come from auth/auth_server.c */
80 NTSTATUS auth_server_init(void);
82 /* The following definitions come from auth/auth_unix.c */
84 NTSTATUS auth_unix_init(void);
86 /* The following definitions come from auth/auth_util.c */
88 NTSTATUS make_user_info_map(struct auth_usersupplied_info **user_info,
90 const char *client_domain,
91 const char *workstation_name,
94 const struct samr_Password *lm_interactive_pwd,
95 const struct samr_Password *nt_interactive_pwd,
96 const char *plaintext,
97 enum auth_password_state password_state);
98 bool make_user_info_netlogon_network(struct auth_usersupplied_info **user_info,
100 const char *client_domain,
101 const char *workstation_name,
102 uint32 logon_parameters,
103 const uchar *lm_network_pwd,
105 const uchar *nt_network_pwd,
107 bool make_user_info_netlogon_interactive(struct auth_usersupplied_info **user_info,
108 const char *smb_name,
109 const char *client_domain,
110 const char *workstation_name,
111 uint32 logon_parameters,
113 const uchar lm_interactive_pwd[16],
114 const uchar nt_interactive_pwd[16],
115 const uchar *dc_sess_key);
116 bool make_user_info_for_reply(struct auth_usersupplied_info **user_info,
117 const char *smb_name,
118 const char *client_domain,
120 DATA_BLOB plaintext_password);
121 NTSTATUS make_user_info_for_reply_enc(struct auth_usersupplied_info **user_info,
122 const char *smb_name,
123 const char *client_domain,
124 DATA_BLOB lm_resp, DATA_BLOB nt_resp);
125 bool make_user_info_guest(struct auth_usersupplied_info **user_info) ;
127 NTSTATUS make_server_info_sam(struct auth_serversupplied_info **server_info,
128 struct samu *sampass);
129 NTSTATUS create_local_token(struct auth_serversupplied_info *server_info);
130 NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
132 uid_t *uid, gid_t *gid,
133 char **found_username,
134 struct security_token **token);
135 bool user_in_group_sid(const char *username, const struct dom_sid *group_sid);
136 bool user_in_group(const char *username, const char *groupname);
138 NTSTATUS make_server_info_pw(struct auth_serversupplied_info **server_info,
141 NTSTATUS make_serverinfo_from_username(TALLOC_CTX *mem_ctx,
142 const char *username,
144 struct auth_serversupplied_info **presult);
145 struct auth_serversupplied_info *copy_serverinfo(TALLOC_CTX *mem_ctx,
146 const struct auth_serversupplied_info *src);
147 bool init_guest_info(void);
148 NTSTATUS init_system_info(void);
149 bool session_info_set_session_key(struct auth_serversupplied_info *info,
150 DATA_BLOB session_key);
151 NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx,
152 struct auth_serversupplied_info **server_info);
153 NTSTATUS make_session_info_system(TALLOC_CTX *mem_ctx,
154 struct auth_serversupplied_info **session_info);
155 const struct auth_serversupplied_info *get_session_info_system(void);
156 bool copy_current_user(struct current_user *dst, struct current_user *src);
157 struct passwd *smb_getpwnam( TALLOC_CTX *mem_ctx, const char *domuser,
158 char **p_save_username, bool create );
159 NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
160 const char *sent_nt_username,
162 struct auth_serversupplied_info **server_info,
163 struct netr_SamInfo3 *info3);
164 struct wbcAuthUserInfo;
165 NTSTATUS make_server_info_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
166 const char *sent_nt_username,
168 const struct wbcAuthUserInfo *info,
169 struct auth_serversupplied_info **server_info);
170 void free_user_info(struct auth_usersupplied_info **user_info);
171 bool make_auth_methods(struct auth_context *auth_context, auth_methods **auth_method) ;
172 bool is_trusted_domain(const char* dom_name);
174 /* The following definitions come from auth/user_info.c */
176 NTSTATUS make_user_info(struct auth_usersupplied_info **ret_user_info,
177 const char *smb_name,
178 const char *internal_username,
179 const char *client_domain,
181 const char *workstation_name,
182 const DATA_BLOB *lm_pwd,
183 const DATA_BLOB *nt_pwd,
184 const struct samr_Password *lm_interactive_pwd,
185 const struct samr_Password *nt_interactive_pwd,
186 const char *plaintext_password,
187 enum auth_password_state password_state);
188 void free_user_info(struct auth_usersupplied_info **user_info);
190 /* The following definitions come from auth/auth_winbind.c */
192 NTSTATUS auth_winbind_init(void);
194 /* The following definitions come from auth/server_info.c */
196 struct netr_SamInfo2;
197 struct netr_SamInfo3;
198 struct netr_SamInfo6;
200 struct auth_serversupplied_info *make_server_info(TALLOC_CTX *mem_ctx);
201 NTSTATUS serverinfo_to_SamInfo2(struct auth_serversupplied_info *server_info,
202 uint8_t *pipe_session_key,
203 size_t pipe_session_key_len,
204 struct netr_SamInfo2 *sam2);
205 NTSTATUS serverinfo_to_SamInfo3(const struct auth_serversupplied_info *server_info,
206 uint8_t *pipe_session_key,
207 size_t pipe_session_key_len,
208 struct netr_SamInfo3 *sam3);
209 NTSTATUS serverinfo_to_SamInfo6(struct auth_serversupplied_info *server_info,
210 uint8_t *pipe_session_key,
211 size_t pipe_session_key_len,
212 struct netr_SamInfo6 *sam6);
213 NTSTATUS samu_to_SamInfo3(TALLOC_CTX *mem_ctx,
215 const char *login_server,
216 struct netr_SamInfo3 **_info3,
217 struct extra_auth_info *extra);
218 struct netr_SamInfo3 *copy_netr_SamInfo3(TALLOC_CTX *mem_ctx,
219 struct netr_SamInfo3 *orig);
220 struct netr_SamInfo3 *wbcAuthUserInfo_to_netr_SamInfo3(TALLOC_CTX *mem_ctx,
221 const struct wbcAuthUserInfo *info);
223 /* The following definitions come from auth/auth_wbc.c */
225 NTSTATUS auth_wbc_init(void);
227 /* The following definitions come from auth/pampass.c */
229 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
230 bool smb_pam_close_session(char *user, char *tty, char *rhost);
231 NTSTATUS smb_pam_accountcheck(const char *user, const char *rhost);
232 NTSTATUS smb_pam_passcheck(const char * user, const char * rhost,
233 const char * password);
234 bool smb_pam_passchange(const char *user, const char *rhost,
235 const char *oldpassword, const char *newpassword);
236 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
237 bool smb_pam_close_session(char *in_user, char *tty, char *rhost);
239 /* The following definitions come from auth/pass_check.c */
241 void dfs_unlogin(void);
242 NTSTATUS pass_check(const struct passwd *pass,
245 const char *password,
248 /* The following definitions come from auth/token_util.c */
250 bool nt_token_check_sid ( const struct dom_sid *sid, const struct security_token *token );
251 bool nt_token_check_domain_rid( struct security_token *token, uint32 rid );
252 struct security_token *get_root_nt_token( void );
253 NTSTATUS add_aliases(const struct dom_sid *domain_sid,
254 struct security_token *token);
255 struct security_token *create_local_nt_token(TALLOC_CTX *mem_ctx,
256 const struct dom_sid *user_sid,
259 const struct dom_sid *groupsids);
260 NTSTATUS create_local_nt_token_from_info3(TALLOC_CTX *mem_ctx,
262 struct netr_SamInfo3 *info3,
263 struct extra_auth_info *extra,
264 struct security_token **ntok);
265 void debug_unix_user_token(int dbg_class, int dbg_lev, uid_t uid, gid_t gid,
266 int n_groups, gid_t *groups);
268 /* The following definitions come from lib/access.c */
270 bool client_match(const char *tok, const void *item);
271 bool list_match(const char **list,const void *item,
272 bool (*match_fn)(const char *, const void *));
273 bool allow_access(const char **deny_list,
274 const char **allow_list,
278 /* The following definitions come from lib/adt_tree.c */
281 /* The following definitions come from lib/afs.c */
283 char *afs_createtoken_str(const char *username, const char *cell);
284 bool afs_login(connection_struct *conn);
285 bool afs_login(connection_struct *conn);
286 char *afs_createtoken_str(const char *username, const char *cell);
288 /* The following definitions come from lib/afs_settoken.c */
290 int afs_syscall( int subcall,
295 bool afs_settoken_str(const char *token_string);
296 bool afs_settoken_str(const char *token_string);
298 /* The following definitions come from lib/audit.c */
300 const char *audit_category_str(uint32 category);
301 const char *audit_param_str(uint32 category);
302 const char *audit_description_str(uint32 category);
303 bool get_audit_category_from_param(const char *param, uint32 *audit_category);
304 const char *audit_policy_str(TALLOC_CTX *mem_ctx, uint32 policy);
306 /* The following definitions come from lib/bitmap.c */
308 struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n);
309 int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src);
310 bool bitmap_set(struct bitmap *bm, unsigned i);
311 bool bitmap_clear(struct bitmap *bm, unsigned i);
312 bool bitmap_query(struct bitmap *bm, unsigned i);
313 int bitmap_find(struct bitmap *bm, unsigned ofs);
315 /* The following definitions come from lib/charcnv.c */
317 void lazy_initialize_conv(void);
318 void gfree_charcnv(void);
319 void init_iconv(void);
320 size_t convert_string(charset_t from, charset_t to,
321 void const *src, size_t srclen,
322 void *dest, size_t destlen);
323 size_t convert_string_error(charset_t from, charset_t to,
324 void const *src, size_t srclen,
325 void *dest, size_t destlen,
326 size_t *converted_size);
327 size_t unix_strupper(const char *src, size_t srclen, char *dest, size_t destlen);
328 char *talloc_strdup_upper(TALLOC_CTX *ctx, const char *s);
329 char *strupper_talloc(TALLOC_CTX *ctx, const char *s);
330 size_t unix_strlower(const char *src, size_t srclen, char *dest, size_t destlen);
331 char *talloc_strdup_lower(TALLOC_CTX *ctx, const char *s);
332 char *strlower_talloc(TALLOC_CTX *ctx, const char *s);
333 size_t ucs2_align(const void *base_ptr, const void *p, int flags);
334 size_t push_ascii(void *dest, const char *src, size_t dest_len, int flags);
335 size_t push_ascii_fstring(void *dest, const char *src);
336 size_t push_ascii_nstring(void *dest, const char *src);
337 size_t pull_ascii(char *dest, const void *src, size_t dest_len, size_t src_len, int flags);
338 size_t pull_ascii_fstring(char *dest, const void *src);
339 size_t pull_ascii_nstring(char *dest, size_t dest_len, const void *src);
340 size_t push_ucs2(const void *base_ptr, void *dest, const char *src, size_t dest_len, int flags);
341 size_t push_utf8_fstring(void *dest, const char *src);
342 bool push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
343 size_t *converted_size);
344 size_t pull_ucs2(const void *base_ptr, char *dest, const void *src, size_t dest_len, size_t src_len, int flags);
345 size_t pull_ucs2_fstring(char *dest, const void *src);
346 bool push_ucs2_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src,
347 size_t *converted_size);
348 bool pull_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
349 size_t *converted_size);
350 bool pull_ucs2_talloc(TALLOC_CTX *ctx, char **dest, const smb_ucs2_t *src,
351 size_t *converted_size);
352 bool pull_ascii_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
353 size_t *converted_size);
354 size_t push_string_check_fn(void *dest, const char *src,
355 size_t dest_len, int flags);
356 size_t push_string_base(const char *base, uint16 flags2,
357 void *dest, const char *src,
358 size_t dest_len, int flags);
359 size_t pull_string_fn(const void *base_ptr,
366 size_t pull_string_talloc(TALLOC_CTX *ctx,
367 const void *base_ptr,
373 size_t align_string(const void *base_ptr, const char *p, int flags);
375 /* The following definitions come from lib/conn_tdb.c */
377 struct db_record *connections_fetch_entry(TALLOC_CTX *mem_ctx,
378 connection_struct *conn,
380 int connections_traverse(int (*fn)(struct db_record *rec,
383 int connections_forall(int (*fn)(struct db_record *rec,
384 const struct connections_key *key,
385 const struct connections_data *data,
388 int connections_forall_read(int (*fn)(const struct connections_key *key,
389 const struct connections_data *data,
392 bool connections_init(bool rw);
394 /* The following definitions come from lib/dmallocmsg.c */
396 void register_dmalloc_msgs(struct messaging_context *msg_ctx);
398 /* The following definitions come from lib/dprintf.c */
400 void display_set_stderr(void);
402 /* The following definitions come from lib/errmap_unix.c */
404 NTSTATUS map_nt_error_from_unix(int unix_error);
405 int map_errno_from_nt_status(NTSTATUS status);
407 /* The following definitions come from lib/file_id.c */
409 struct file_id vfs_file_id_from_sbuf(connection_struct *conn, const SMB_STRUCT_STAT *sbuf);
410 bool file_id_equal(const struct file_id *id1, const struct file_id *id2);
411 const char *file_id_string_tos(const struct file_id *id);
412 void push_file_id_16(char *buf, const struct file_id *id);
413 void push_file_id_24(char *buf, const struct file_id *id);
414 void pull_file_id_24(char *buf, struct file_id *id);
416 /* The following definitions come from lib/gencache.c */
418 bool gencache_set(const char *keystr, const char *value, time_t timeout);
419 bool gencache_del(const char *keystr);
420 bool gencache_get(const char *keystr, char **valstr, time_t *timeout);
421 bool gencache_parse(const char *keystr,
422 void (*parser)(time_t timeout, DATA_BLOB blob,
425 bool gencache_get_data_blob(const char *keystr, DATA_BLOB *blob,
426 time_t *timeout, bool *was_expired);
427 bool gencache_stabilize(void);
428 bool gencache_set_data_blob(const char *keystr, const DATA_BLOB *blob, time_t timeout);
429 void gencache_iterate_blobs(void (*fn)(const char *key, DATA_BLOB value,
430 time_t timeout, void *private_data),
431 void *private_data, const char *pattern);
432 void gencache_iterate(void (*fn)(const char* key, const char *value, time_t timeout, void* dptr),
433 void* data, const char* keystr_pattern);
435 /* The following definitions come from lib/interface.c */
437 bool ismyaddr(const struct sockaddr *ip);
438 bool ismyip_v4(struct in_addr ip);
439 bool is_local_net(const struct sockaddr *from);
440 void setup_linklocal_scope_id(struct sockaddr *pss);
441 bool is_local_net_v4(struct in_addr from);
442 int iface_count(void);
443 int iface_count_v4_nl(void);
444 const struct in_addr *first_ipv4_iface(void);
445 struct interface *get_interface(int n);
446 const struct sockaddr_storage *iface_n_sockaddr_storage(int n);
447 const struct in_addr *iface_n_ip_v4(int n);
448 const struct in_addr *iface_n_bcast_v4(int n);
449 const struct sockaddr_storage *iface_n_bcast(int n);
450 const struct sockaddr_storage *iface_ip(const struct sockaddr *ip);
451 bool iface_local(const struct sockaddr *ip);
452 void load_interfaces(void);
453 void gfree_interfaces(void);
454 bool interfaces_changed(void);
456 /* The following definitions come from lib/ldap_debug_handler.c */
458 void init_ldap_debugging(void);
460 /* The following definitions come from lib/ldap_escape.c */
462 char *escape_ldap_string(TALLOC_CTX *mem_ctx, const char *s);
463 char *escape_rdn_val_string_alloc(const char *s);
465 /* The following definitions come from lib/module.c */
467 NTSTATUS smb_load_module(const char *module_name);
468 int smb_load_modules(const char **modules);
469 NTSTATUS smb_probe_module(const char *subsystem, const char *module);
470 NTSTATUS smb_load_module(const char *module_name);
471 int smb_load_modules(const char **modules);
472 NTSTATUS smb_probe_module(const char *subsystem, const char *module);
473 void init_modules(void);
475 /* The following definitions come from lib/ms_fnmatch.c */
477 int ms_fnmatch(const char *pattern, const char *string, bool translate_pattern,
478 bool is_case_sensitive);
479 int gen_fnmatch(const char *pattern, const char *string);
481 /* The following definitions come from lib/pidfile.c */
483 pid_t pidfile_pid(const char *name);
484 void pidfile_create(const char *program_name);
485 void pidfile_unlink(void);
487 /* The following definitions come from lib/privileges.c */
489 bool get_privileges_for_sids(uint64_t *privileges, struct dom_sid *slist, int scount);
490 NTSTATUS get_privileges_for_sid_as_set(TALLOC_CTX *mem_ctx, PRIVILEGE_SET **privileges, struct dom_sid *sid);
491 NTSTATUS privilege_enumerate_accounts(struct dom_sid **sids, int *num_sids);
492 NTSTATUS privilege_enum_sids(enum sec_privilege privilege, TALLOC_CTX *mem_ctx,
493 struct dom_sid **sids, int *num_sids);
494 bool grant_privilege_set(const struct dom_sid *sid, struct lsa_PrivilegeSet *set);
495 bool grant_privilege_by_name( const struct dom_sid *sid, const char *name);
496 bool revoke_all_privileges( const struct dom_sid *sid );
497 bool revoke_privilege_set(const struct dom_sid *sid, struct lsa_PrivilegeSet *set);
498 bool revoke_privilege_by_name(const struct dom_sid *sid, const char *name);
499 NTSTATUS privilege_create_account(const struct dom_sid *sid );
500 NTSTATUS privilege_delete_account(const struct dom_sid *sid);
501 bool is_privileged_sid( const struct dom_sid *sid );
502 bool grant_all_privileges( const struct dom_sid *sid );
504 /* The following definitions come from lib/recvfile.c */
506 ssize_t sys_recvfile(int fromfd,
510 ssize_t sys_recvfile(int fromfd,
514 ssize_t drain_socket(int sockfd, size_t count);
516 /* The following definitions come from lib/secdesc.c */
518 uint32_t get_sec_info(const struct security_descriptor *sd);
519 struct security_descriptor *sec_desc_merge(TALLOC_CTX *ctx, struct security_descriptor *new_sdb, struct security_descriptor *old_sdb);
520 struct sec_desc_buf *sec_desc_merge_buf(TALLOC_CTX *ctx, struct sec_desc_buf *new_sdb, struct sec_desc_buf *old_sdb);
521 struct security_descriptor *make_sec_desc(TALLOC_CTX *ctx,
522 enum security_descriptor_revision revision,
524 const struct dom_sid *owner_sid, const struct dom_sid *grp_sid,
525 struct security_acl *sacl, struct security_acl *dacl, size_t *sd_size);
526 struct security_descriptor *dup_sec_desc(TALLOC_CTX *ctx, const struct security_descriptor *src);
527 NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx,
528 struct security_descriptor *secdesc,
529 uint8 **data, size_t *len);
530 NTSTATUS marshall_sec_desc_buf(TALLOC_CTX *mem_ctx,
531 struct sec_desc_buf *secdesc_buf,
532 uint8_t **data, size_t *len);
533 NTSTATUS unmarshall_sec_desc(TALLOC_CTX *mem_ctx, uint8 *data, size_t len,
534 struct security_descriptor **psecdesc);
535 NTSTATUS unmarshall_sec_desc_buf(TALLOC_CTX *mem_ctx, uint8_t *data, size_t len,
536 struct sec_desc_buf **psecdesc_buf);
537 struct security_descriptor *make_standard_sec_desc(TALLOC_CTX *ctx, const struct dom_sid *owner_sid, const struct dom_sid *grp_sid,
538 struct security_acl *dacl, size_t *sd_size);
539 struct sec_desc_buf *make_sec_desc_buf(TALLOC_CTX *ctx, size_t len, struct security_descriptor *sec_desc);
540 struct sec_desc_buf *dup_sec_desc_buf(TALLOC_CTX *ctx, struct sec_desc_buf *src);
541 NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, struct security_descriptor **psd, const struct dom_sid *sid, uint32 mask, size_t *sd_size);
542 NTSTATUS sec_desc_mod_sid(struct security_descriptor *sd, struct dom_sid *sid, uint32 mask);
543 NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, struct security_descriptor **psd, struct dom_sid *sid, size_t *sd_size);
544 bool sd_has_inheritable_components(const struct security_descriptor *parent_ctr, bool container);
545 NTSTATUS se_create_child_secdesc(TALLOC_CTX *ctx,
546 struct security_descriptor **ppsd,
548 const struct security_descriptor *parent_ctr,
549 const struct dom_sid *owner_sid,
550 const struct dom_sid *group_sid,
552 NTSTATUS se_create_child_secdesc_buf(TALLOC_CTX *ctx,
553 struct sec_desc_buf **ppsdb,
554 const struct security_descriptor *parent_ctr,
557 /* The following definitions come from lib/sendfile.c */
559 ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
561 /* The following definitions come from lib/server_mutex.c */
563 struct named_mutex *grab_named_mutex(TALLOC_CTX *mem_ctx, const char *name,
566 /* The following definitions come from lib/sharesec.c */
568 bool share_info_db_init(void);
569 struct security_descriptor *get_share_security_default( TALLOC_CTX *ctx, size_t *psize, uint32 def_access);
570 struct security_descriptor *get_share_security( TALLOC_CTX *ctx, const char *servicename,
572 bool set_share_security(const char *share_name, struct security_descriptor *psd);
573 bool delete_share_security(const char *servicename);
574 bool share_access_check(const struct security_token *token, const char *sharename,
575 uint32 desired_access);
576 bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, struct security_descriptor **ppsd);
578 /* The following definitions come from lib/smbrun.c */
580 int smbrun_no_sanitize(const char *cmd, int *outfd);
581 int smbrun(const char *cmd, int *outfd);
582 int smbrunsecret(const char *cmd, const char *secret);
584 /* The following definitions come from lib/sock_exec.c */
586 int sock_exec(const char *prog);
588 /* The following definitions come from lib/substitute.c */
590 void free_local_machine_name(void);
591 bool set_local_machine_name(const char *local_name, bool perm);
592 const char *get_local_machine_name(void);
593 bool set_remote_machine_name(const char *remote_name, bool perm);
594 const char *get_remote_machine_name(void);
595 void sub_set_smb_name(const char *name);
596 void set_current_user_info(const char *smb_name, const char *unix_name,
598 void sub_set_socket_ids(const char *peeraddr, const char *peername,
599 const char *sockaddr);
600 const char *get_current_username(void);
601 void standard_sub_basic(const char *smb_name, const char *domain_name,
602 char *str, size_t len);
603 char *talloc_sub_basic(TALLOC_CTX *mem_ctx, const char *smb_name,
604 const char *domain_name, const char *str);
605 char *talloc_sub_specified(TALLOC_CTX *mem_ctx,
606 const char *input_string,
607 const char *username,
611 char *talloc_sub_advanced(TALLOC_CTX *mem_ctx,
612 const char *servicename, const char *user,
613 const char *connectpath, gid_t gid,
614 const char *smb_name, const char *domain_name,
616 void standard_sub_advanced(const char *servicename, const char *user,
617 const char *connectpath, gid_t gid,
618 const char *smb_name, const char *domain_name,
619 char *str, size_t len);
620 char *standard_sub_conn(TALLOC_CTX *ctx, connection_struct *conn, const char *str);
622 /* The following definitions come from lib/sysacls.c */
624 int sys_acl_get_entry(SMB_ACL_T acl_d, int entry_id, SMB_ACL_ENTRY_T *entry_p);
625 int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *type_p);
626 int sys_acl_get_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
627 void *sys_acl_get_qualifier(SMB_ACL_ENTRY_T entry_d);
628 int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset_d);
629 int sys_acl_add_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
630 int sys_acl_get_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
631 char *sys_acl_to_text(SMB_ACL_T acl_d, ssize_t *len_p);
632 SMB_ACL_T sys_acl_init(int count);
633 int sys_acl_create_entry(SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p);
634 int sys_acl_set_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type);
635 int sys_acl_set_qualifier(SMB_ACL_ENTRY_T entry_d, void *qual_p);
636 int sys_acl_set_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d);
637 int sys_acl_free_text(char *text);
638 int sys_acl_free_acl(SMB_ACL_T acl_d) ;
639 int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype);
640 int sys_acl_valid(SMB_ACL_T acl_d);
641 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
642 const char *path_p, SMB_ACL_TYPE_T type);
643 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
644 int sys_acl_set_file(vfs_handle_struct *handle,
645 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
646 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
648 int sys_acl_delete_def_file(vfs_handle_struct *handle,
650 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
651 const char *path_p, SMB_ACL_TYPE_T type);
652 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
653 int sys_acl_set_file(vfs_handle_struct *handle,
654 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
655 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
657 int sys_acl_delete_def_file(vfs_handle_struct *handle,
659 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
660 const char *path_p, SMB_ACL_TYPE_T type);
661 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
662 int sys_acl_set_file(vfs_handle_struct *handle,
663 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
664 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
666 int sys_acl_delete_def_file(vfs_handle_struct *handle,
668 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
669 const char *path_p, SMB_ACL_TYPE_T type);
670 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
671 int sys_acl_set_file(vfs_handle_struct *handle,
672 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
673 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
675 int sys_acl_delete_def_file(vfs_handle_struct *handle,
677 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
678 const char *path_p, SMB_ACL_TYPE_T type);
679 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
680 int sys_acl_set_file(vfs_handle_struct *handle,
681 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
682 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
684 int sys_acl_delete_def_file(vfs_handle_struct *handle,
686 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
687 const char *path_p, SMB_ACL_TYPE_T type);
688 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
689 int sys_acl_set_file(vfs_handle_struct *handle,
690 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
691 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
693 int sys_acl_delete_def_file(vfs_handle_struct *handle,
695 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
696 const char *path_p, SMB_ACL_TYPE_T type);
697 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
698 int sys_acl_set_file(vfs_handle_struct *handle,
699 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
700 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
702 int sys_acl_delete_def_file(vfs_handle_struct *handle,
704 int no_acl_syscall_error(int err);
706 /* The following definitions come from lib/sysquotas.c */
708 int sys_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
709 int sys_set_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
711 /* The following definitions come from lib/sysquotas_*.c */
713 int sys_get_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
714 int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
716 int sys_get_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
717 int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
719 int sys_get_nfs_quota(const char *path, const char *bdev,
720 enum SMB_QUOTA_TYPE qtype,
721 unid_t id, SMB_DISK_QUOTA *dp);
722 int sys_set_nfs_quota(const char *path, const char *bdev,
723 enum SMB_QUOTA_TYPE qtype,
724 unid_t id, SMB_DISK_QUOTA *dp);
726 /* The following definitions come from lib/system.c */
728 void *sys_memalign( size_t align, size_t size );
729 int sys_usleep(long usecs);
730 ssize_t sys_read(int fd, void *buf, size_t count);
731 ssize_t sys_write(int fd, const void *buf, size_t count);
732 ssize_t sys_writev(int fd, const struct iovec *iov, int iovcnt);
733 ssize_t sys_pread(int fd, void *buf, size_t count, SMB_OFF_T off);
734 ssize_t sys_pwrite(int fd, const void *buf, size_t count, SMB_OFF_T off);
735 ssize_t sys_send(int s, const void *msg, size_t len, int flags);
736 ssize_t sys_sendto(int s, const void *msg, size_t len, int flags, const struct sockaddr *to, socklen_t tolen);
737 ssize_t sys_recv(int fd, void *buf, size_t count, int flags);
738 ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen);
739 int sys_fcntl_ptr(int fd, int cmd, void *arg);
740 int sys_fcntl_long(int fd, int cmd, long arg);
741 void update_stat_ex_mtime(struct stat_ex *dst, struct timespec write_ts);
742 void update_stat_ex_create_time(struct stat_ex *dst, struct timespec create_time);
743 int sys_stat(const char *fname, SMB_STRUCT_STAT *sbuf,
744 bool fake_dir_create_times);
745 int sys_fstat(int fd, SMB_STRUCT_STAT *sbuf,
746 bool fake_dir_create_times);
747 int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf,
748 bool fake_dir_create_times);
749 int sys_ftruncate(int fd, SMB_OFF_T offset);
750 int sys_posix_fallocate(int fd, SMB_OFF_T offset, SMB_OFF_T len);
751 int sys_fallocate(int fd, enum vfs_fallocate_mode mode, SMB_OFF_T offset, SMB_OFF_T len);
752 SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence);
753 int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence);
754 SMB_OFF_T sys_ftell(FILE *fp);
755 int sys_creat(const char *path, mode_t mode);
756 int sys_open(const char *path, int oflag, mode_t mode);
757 FILE *sys_fopen(const char *path, const char *type);
758 void kernel_flock(int fd, uint32 share_mode, uint32 access_mask);
759 SMB_STRUCT_DIR *sys_opendir(const char *name);
760 SMB_STRUCT_DIR *sys_fdopendir(int fd);
761 SMB_STRUCT_DIRENT *sys_readdir(SMB_STRUCT_DIR *dirp);
762 void sys_seekdir(SMB_STRUCT_DIR *dirp, long offset);
763 long sys_telldir(SMB_STRUCT_DIR *dirp);
764 void sys_rewinddir(SMB_STRUCT_DIR *dirp);
765 int sys_closedir(SMB_STRUCT_DIR *dirp);
766 int sys_mknod(const char *path, mode_t mode, SMB_DEV_T dev);
767 int sys_waitpid(pid_t pid,int *status,int options);
768 char *sys_getwd(char *s);
769 void set_effective_capability(enum smbd_capability capability);
770 void drop_effective_capability(enum smbd_capability capability);
771 long sys_random(void);
772 void sys_srandom(unsigned int seed);
773 int groups_max(void);
774 int sys_getgroups(int setlen, gid_t *gidset);
775 int sys_setgroups(gid_t UNUSED(primary_gid), int setlen, gid_t *gidset);
776 int sys_popen(const char *command);
777 int sys_pclose(int fd);
778 ssize_t sys_getxattr (const char *path, const char *name, void *value, size_t size);
779 ssize_t sys_lgetxattr (const char *path, const char *name, void *value, size_t size);
780 ssize_t sys_fgetxattr (int filedes, const char *name, void *value, size_t size);
781 ssize_t sys_listxattr (const char *path, char *list, size_t size);
782 ssize_t sys_llistxattr (const char *path, char *list, size_t size);
783 ssize_t sys_flistxattr (int filedes, char *list, size_t size);
784 int sys_removexattr (const char *path, const char *name);
785 int sys_lremovexattr (const char *path, const char *name);
786 int sys_fremovexattr (int filedes, const char *name);
787 int sys_setxattr (const char *path, const char *name, const void *value, size_t size, int flags);
788 int sys_lsetxattr (const char *path, const char *name, const void *value, size_t size, int flags);
789 int sys_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags);
790 uint32 unix_dev_major(SMB_DEV_T dev);
791 uint32 unix_dev_minor(SMB_DEV_T dev);
792 int sys_aio_read(SMB_STRUCT_AIOCB *aiocb);
793 int sys_aio_write(SMB_STRUCT_AIOCB *aiocb);
794 ssize_t sys_aio_return(SMB_STRUCT_AIOCB *aiocb);
795 int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb);
796 int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb);
797 int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb);
798 int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout);
799 int sys_aio_read(SMB_STRUCT_AIOCB *aiocb);
800 int sys_aio_write(SMB_STRUCT_AIOCB *aiocb);
801 ssize_t sys_aio_return(SMB_STRUCT_AIOCB *aiocb);
802 int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb);
803 int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb);
804 int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb);
805 int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout);
806 int sys_getpeereid( int s, uid_t *uid);
807 int sys_getnameinfo(const struct sockaddr *psa,
814 int sys_connect(int fd, const struct sockaddr * addr);
816 /* The following definitions come from lib/system_smbd.c */
818 bool getgroups_unix_user(TALLOC_CTX *mem_ctx, const char *user,
820 gid_t **ret_groups, uint32_t *p_ngroups);
822 /* The following definitions come from lib/tallocmsg.c */
824 void register_msg_pool_usage(struct messaging_context *msg_ctx);
826 /* The following definitions come from lib/time.c */
828 void push_dos_date(uint8_t *buf, int offset, time_t unixdate, int zone_offset);
829 void push_dos_date2(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
830 void push_dos_date3(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
831 uint32_t convert_time_t_to_uint32_t(time_t t);
832 time_t convert_uint32_t_to_time_t(uint32_t u);
833 bool nt_time_is_zero(const NTTIME *nt);
834 time_t generalized_to_unix_time(const char *str);
835 int get_server_zone_offset(void);
836 int set_server_zone_offset(time_t t);
837 char *timeval_string(TALLOC_CTX *ctx, const struct timeval *tp, bool hires);
838 char *current_timestring(TALLOC_CTX *ctx, bool hires);
839 void srv_put_dos_date(char *buf,int offset,time_t unixdate);
840 void srv_put_dos_date2(char *buf,int offset, time_t unixdate);
841 void srv_put_dos_date3(char *buf,int offset,time_t unixdate);
842 void round_timespec(enum timestamp_set_resolution res, struct timespec *ts);
843 void put_long_date_timespec(enum timestamp_set_resolution res, char *p, struct timespec ts);
844 void put_long_date(char *p, time_t t);
845 void dos_filetime_timespec(struct timespec *tsp);
846 time_t make_unix_date(const void *date_ptr, int zone_offset);
847 time_t make_unix_date2(const void *date_ptr, int zone_offset);
848 time_t make_unix_date3(const void *date_ptr, int zone_offset);
849 time_t srv_make_unix_date(const void *date_ptr);
850 time_t srv_make_unix_date2(const void *date_ptr);
851 time_t srv_make_unix_date3(const void *date_ptr);
852 struct timespec convert_time_t_to_timespec(time_t t);
853 struct timespec convert_timeval_to_timespec(const struct timeval tv);
854 struct timeval convert_timespec_to_timeval(const struct timespec ts);
855 struct timespec timespec_current(void);
856 struct timespec timespec_min(const struct timespec *ts1,
857 const struct timespec *ts2);
858 int timespec_compare(const struct timespec *ts1, const struct timespec *ts2);
859 void round_timespec_to_sec(struct timespec *ts);
860 void round_timespec_to_usec(struct timespec *ts);
861 struct timespec interpret_long_date(const char *p);
863 void get_process_uptime(struct timeval *ret_time);
864 void get_startup_time(struct timeval *ret_time);
865 time_t nt_time_to_unix_abs(const NTTIME *nt);
866 time_t uint64s_nt_time_to_unix_abs(const uint64_t *src);
867 void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts);
868 void unix_to_nt_time_abs(NTTIME *nt, time_t t);
869 const char *time_to_asc(const time_t t);
870 const char *display_time(NTTIME nttime);
871 bool nt_time_is_set(const NTTIME *nt);
873 /* The following definitions come from lib/username.c */
875 void flush_pwnam_cache(void);
876 char *get_user_home_dir(TALLOC_CTX *mem_ctx, const char *user);
877 struct passwd *Get_Pwnam_alloc(TALLOC_CTX *mem_ctx, const char *user);
879 /* The following definitions come from lib/util_names.c */
880 void gfree_netbios_names(void);
881 bool set_global_myname(const char *myname);
882 const char *global_myname(void);
883 bool set_global_myworkgroup(const char *myworkgroup);
884 const char *lp_workgroup(void);
885 const char *get_global_sam_name(void);
887 /* The following definitions come from lib/util.c */
889 enum protocol_types get_Protocol(void);
890 void set_Protocol(enum protocol_types p);
891 bool all_zero(const uint8_t *ptr, size_t size);
892 bool set_global_scope(const char *scope);
893 const char *global_scope(void);
894 void gfree_names(void);
895 void gfree_all( void );
896 const char *my_netbios_names(int i);
897 bool set_netbios_aliases(const char **str_array);
898 bool init_names(void);
899 struct user_auth_info *user_auth_info_init(TALLOC_CTX *mem_ctx);
900 const char *get_cmdline_auth_info_username(const struct user_auth_info *auth_info);
901 void set_cmdline_auth_info_username(struct user_auth_info *auth_info,
902 const char *username);
903 const char *get_cmdline_auth_info_domain(const struct user_auth_info *auth_info);
904 void set_cmdline_auth_info_domain(struct user_auth_info *auth_info,
906 void set_cmdline_auth_info_password(struct user_auth_info *auth_info,
907 const char *password);
908 const char *get_cmdline_auth_info_password(const struct user_auth_info *auth_info);
909 bool set_cmdline_auth_info_signing_state(struct user_auth_info *auth_info,
911 int get_cmdline_auth_info_signing_state(const struct user_auth_info *auth_info);
912 void set_cmdline_auth_info_use_ccache(struct user_auth_info *auth_info,
914 bool get_cmdline_auth_info_use_ccache(const struct user_auth_info *auth_info);
915 void set_cmdline_auth_info_use_kerberos(struct user_auth_info *auth_info,
917 bool get_cmdline_auth_info_use_kerberos(const struct user_auth_info *auth_info);
918 void set_cmdline_auth_info_fallback_after_kerberos(struct user_auth_info *auth_info,
920 bool get_cmdline_auth_info_fallback_after_kerberos(const struct user_auth_info *auth_info);
921 void set_cmdline_auth_info_use_krb5_ticket(struct user_auth_info *auth_info);
922 void set_cmdline_auth_info_smb_encrypt(struct user_auth_info *auth_info);
923 void set_cmdline_auth_info_use_machine_account(struct user_auth_info *auth_info);
924 bool get_cmdline_auth_info_got_pass(const struct user_auth_info *auth_info);
925 bool get_cmdline_auth_info_smb_encrypt(const struct user_auth_info *auth_info);
926 bool get_cmdline_auth_info_use_machine_account(const struct user_auth_info *auth_info);
927 struct user_auth_info *get_cmdline_auth_info_copy(TALLOC_CTX *mem_ctx,
928 const struct user_auth_info *info);
929 bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_info);
930 void set_cmdline_auth_info_getpass(struct user_auth_info *auth_info);
931 bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf,
932 bool fake_dir_create_times);
933 bool socket_exist(const char *fname);
934 uint64_t get_file_size_stat(const SMB_STRUCT_STAT *sbuf);
935 SMB_OFF_T get_file_size(char *file_name);
936 char *attrib_string(uint16 mode);
937 void show_msg(char *buf);
938 void smb_set_enclen(char *buf,int len,uint16 enc_ctx_num);
939 void smb_setlen(char *buf,int len);
940 int set_message_bcc(char *buf,int num_bytes);
941 ssize_t message_push_blob(uint8 **outbuf, DATA_BLOB blob);
942 char *unix_clean_name(TALLOC_CTX *ctx, const char *s);
943 char *clean_name(TALLOC_CTX *ctx, const char *s);
944 ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, SMB_OFF_T pos);
945 int set_blocking(int fd, bool set);
946 NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
947 struct event_context *ev_ctx,
949 bool parent_longlived);
950 void *malloc_(size_t size);
951 void *memalign_array(size_t el_size, size_t align, unsigned int count);
952 void *calloc_array(size_t size, size_t nmemb);
953 void *Realloc(void *p, size_t size, bool free_old_on_error);
954 void add_to_large_array(TALLOC_CTX *mem_ctx, size_t element_size,
955 void *element, void *_array, uint32 *num_elements,
956 ssize_t *array_size);
957 char *get_myname(TALLOC_CTX *ctx);
958 char *get_mydnsdomname(TALLOC_CTX *ctx);
959 int interpret_protocol(const char *str,int def);
960 char *automount_lookup(TALLOC_CTX *ctx, const char *user_name);
961 char *automount_lookup(TALLOC_CTX *ctx, const char *user_name);
962 bool process_exists(const struct server_id pid);
963 const char *uidtoname(uid_t uid);
964 char *gidtoname(gid_t gid);
965 uid_t nametouid(const char *name);
966 gid_t nametogid(const char *name);
967 void smb_panic_s3(const char *why);
968 void log_stack_trace(void);
969 const char *readdirname(SMB_STRUCT_DIR *p);
970 bool is_in_path(const char *name, name_compare_entry *namelist, bool case_sensitive);
971 void set_namearray(name_compare_entry **ppname_array, const char *namelist);
972 void free_namearray(name_compare_entry *name_array);
973 bool fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
974 bool fcntl_getlock(int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid);
975 bool is_myname(const char *s);
976 bool is_myworkgroup(const char *s);
977 void ra_lanman_string( const char *native_lanman );
978 const char *get_remote_arch_str(void);
979 void set_remote_arch(enum remote_arch_types type);
980 enum remote_arch_types get_remote_arch(void);
981 const char *tab_depth(int level, int depth);
982 int str_checksum(const char *s);
983 void zero_free(void *p, size_t size);
984 int set_maxfiles(int requested_max);
985 int smb_mkstemp(char *name_template);
986 void *smb_xmalloc_array(size_t size, unsigned int count);
987 char *myhostname(void);
988 char *lock_path(const char *name);
989 char *pid_path(const char *name);
990 char *lib_path(const char *name);
991 char *modules_path(const char *name);
992 char *data_path(const char *name);
993 char *state_path(const char *name);
994 char *cache_path(const char *name);
995 const char *shlib_ext(void);
996 bool parent_dirname(TALLOC_CTX *mem_ctx, const char *dir, char **parent,
998 bool ms_has_wild(const char *s);
999 bool ms_has_wild_w(const smb_ucs2_t *s);
1000 bool mask_match(const char *string, const char *pattern, bool is_case_sensitive);
1001 bool mask_match_search(const char *string, const char *pattern, bool is_case_sensitive);
1002 bool mask_match_list(const char *string, char **list, int listLen, bool is_case_sensitive);
1003 bool unix_wild_match(const char *pattern, const char *string);
1004 bool name_to_fqdn(fstring fqdn, const char *name);
1005 void *talloc_append_blob(TALLOC_CTX *mem_ctx, void *buf, DATA_BLOB blob);
1006 uint32 map_share_mode_to_deny_mode(uint32 share_access, uint32 private_options);
1007 pid_t procid_to_pid(const struct server_id *proc);
1008 void set_my_vnn(uint32 vnn);
1009 uint32 get_my_vnn(void);
1010 void set_my_unique_id(uint64_t unique_id);
1011 struct server_id pid_to_procid(pid_t pid);
1012 struct server_id procid_self(void);
1013 bool procid_equal(const struct server_id *p1, const struct server_id *p2);
1014 bool cluster_id_equal(const struct server_id *id1,
1015 const struct server_id *id2);
1016 bool procid_is_me(const struct server_id *pid);
1017 struct server_id interpret_pid(const char *pid_string);
1018 char *procid_str(TALLOC_CTX *mem_ctx, const struct server_id *pid);
1019 char *procid_str_static(const struct server_id *pid);
1020 bool procid_valid(const struct server_id *pid);
1021 bool procid_is_local(const struct server_id *pid);
1022 bool trans_oob(uint32_t bufsize, uint32_t offset, uint32_t length);
1023 bool is_offset_safe(const char *buf_base, size_t buf_len, char *ptr, size_t off);
1024 char *get_safe_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
1025 char *get_safe_str_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
1026 int get_safe_SVAL(const char *buf_base, size_t buf_len, char *ptr, size_t off, int failval);
1027 int get_safe_IVAL(const char *buf_base, size_t buf_len, char *ptr, size_t off, int failval);
1028 void split_domain_user(TALLOC_CTX *mem_ctx,
1029 const char *full_name,
1032 void *_talloc_zero_zeronull(const void *ctx, size_t size, const char *name);
1033 void *_talloc_memdup_zeronull(const void *t, const void *p, size_t size, const char *name);
1034 void *_talloc_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
1035 void *_talloc_zero_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
1036 void *talloc_zeronull(const void *context, size_t size, const char *name);
1037 const char *strip_hostname(const char *s);
1038 bool tevent_req_poll_ntstatus(struct tevent_req *req,
1039 struct tevent_context *ev,
1041 bool any_nt_status_not_ok(NTSTATUS err1, NTSTATUS err2, NTSTATUS *result);
1042 int timeval_to_msec(struct timeval t);
1044 /* The following definitions come from lib/util_builtin.c */
1046 bool lookup_builtin_rid(TALLOC_CTX *mem_ctx, uint32 rid, const char **name);
1047 bool lookup_builtin_name(const char *name, uint32 *rid);
1048 const char *builtin_domain_name(void);
1049 bool sid_check_is_builtin(const struct dom_sid *sid);
1050 bool sid_check_is_in_builtin(const struct dom_sid *sid);
1052 /* The following definitions come from lib/util_file.c */
1054 char **file_lines_pload(const char *syscmd, int *numlines);
1055 void file_lines_free(char **lines);
1057 /* The following definitions come from lib/util_nscd.c */
1059 void smb_nscd_flush_user_cache(void);
1060 void smb_nscd_flush_group_cache(void);
1062 /* The following definitions come from lib/util_nttoken.c */
1064 struct security_token *dup_nt_token(TALLOC_CTX *mem_ctx, const struct security_token *ptoken);
1065 NTSTATUS merge_nt_token(TALLOC_CTX *mem_ctx,
1066 const struct security_token *token_1,
1067 const struct security_token *token_2,
1068 struct security_token **token_out);
1069 bool token_sid_in_ace(const struct security_token *token, const struct security_ace *ace);
1071 /* The following definitions come from lib/util_sec.c */
1073 void sec_init(void);
1074 uid_t sec_initial_uid(void);
1075 gid_t sec_initial_gid(void);
1076 bool non_root_mode(void);
1077 void gain_root_privilege(void);
1078 void gain_root_group_privilege(void);
1079 void set_effective_uid(uid_t uid);
1080 void set_effective_gid(gid_t gid);
1081 void save_re_uid(void);
1082 void restore_re_uid_fromroot(void);
1083 void restore_re_uid(void);
1084 void save_re_gid(void);
1085 void restore_re_gid(void);
1086 int set_re_uid(void);
1087 void become_user_permanently(uid_t uid, gid_t gid);
1088 bool is_setuid_root(void) ;
1090 /* The following definitions come from lib/util_sid.c */
1092 char *sid_to_fstring(fstring sidstr_out, const struct dom_sid *sid);
1093 char *sid_string_talloc(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
1094 char *sid_string_dbg(const struct dom_sid *sid);
1095 char *sid_string_tos(const struct dom_sid *sid);
1096 bool sid_linearize(char *outbuf, size_t len, const struct dom_sid *sid);
1097 bool non_mappable_sid(struct dom_sid *sid);
1098 char *sid_binstring_hex(const struct dom_sid *sid);
1099 NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx,
1100 const struct netr_SamInfo3 *info3,
1101 struct dom_sid **user_sids,
1102 uint32_t *num_user_sids,
1103 bool include_user_group_rid,
1104 bool skip_ressource_groups);
1106 /* The following definitions come from lib/util_sock.c */
1108 bool is_broadcast_addr(const struct sockaddr *pss);
1109 bool is_loopback_ip_v4(struct in_addr ip);
1110 bool is_loopback_addr(const struct sockaddr *pss);
1111 bool is_zero_addr(const struct sockaddr_storage *pss);
1112 void zero_ip_v4(struct in_addr *ip);
1113 void in_addr_to_sockaddr_storage(struct sockaddr_storage *ss,
1115 bool same_net(const struct sockaddr *ip1,
1116 const struct sockaddr *ip2,
1117 const struct sockaddr *mask);
1118 bool sockaddr_equal(const struct sockaddr *ip1,
1119 const struct sockaddr *ip2);
1120 bool is_address_any(const struct sockaddr *psa);
1121 uint16_t get_sockaddr_port(const struct sockaddr_storage *pss);
1122 char *print_sockaddr(char *dest,
1124 const struct sockaddr_storage *psa);
1125 char *print_canonical_sockaddr(TALLOC_CTX *ctx,
1126 const struct sockaddr_storage *pss);
1127 const char *client_name(int fd);
1128 int get_socket_port(int fd);
1129 const char *client_addr(int fd, char *addr, size_t addrlen);
1130 const char *client_socket_addr(int fd, char *addr, size_t addr_len);
1131 int client_socket_port(int fd);
1132 void set_smb_read_error(enum smb_read_errors *pre,
1133 enum smb_read_errors newerr);
1134 void cond_set_smb_read_error(enum smb_read_errors *pre,
1135 enum smb_read_errors newerr);
1136 bool is_a_socket(int fd);
1137 void set_socket_options(int fd, const char *options);
1138 ssize_t read_udp_v4_socket(int fd,
1141 struct sockaddr_storage *psa);
1142 NTSTATUS read_fd_with_timeout(int fd, char *buf,
1143 size_t mincnt, size_t maxcnt,
1144 unsigned int time_out,
1146 NTSTATUS read_data(int fd, char *buffer, size_t N);
1147 ssize_t write_data(int fd, const char *buffer, size_t N);
1148 ssize_t write_data_iov(int fd, const struct iovec *orig_iov, int iovcnt);
1149 bool send_keepalive(int client);
1150 NTSTATUS read_smb_length_return_keepalive(int fd, char *inbuf,
1151 unsigned int timeout,
1153 NTSTATUS receive_smb_raw(int fd,
1156 unsigned int timeout,
1159 int open_socket_in(int type,
1162 const struct sockaddr_storage *psock,
1164 NTSTATUS open_socket_out(const struct sockaddr_storage *pss, uint16_t port,
1165 int timeout, int *pfd);
1166 struct tevent_req *open_socket_out_send(TALLOC_CTX *mem_ctx,
1167 struct event_context *ev,
1168 const struct sockaddr_storage *pss,
1171 NTSTATUS open_socket_out_recv(struct tevent_req *req, int *pfd);
1172 struct tevent_req *open_socket_out_defer_send(TALLOC_CTX *mem_ctx,
1173 struct event_context *ev,
1174 struct timeval wait_time,
1175 const struct sockaddr_storage *pss,
1178 NTSTATUS open_socket_out_defer_recv(struct tevent_req *req, int *pfd);
1179 int open_udp_socket(const char *host, int port);
1180 const char *get_peer_name(int fd, bool force_lookup);
1181 const char *get_peer_addr(int fd, char *addr, size_t addr_len);
1182 int create_pipe_sock(const char *socket_dir,
1183 const char *socket_name,
1185 const char *get_mydnsfullname(void);
1186 bool is_myname_or_ipaddr(const char *s);
1187 struct tevent_req *getaddrinfo_send(TALLOC_CTX *mem_ctx,
1188 struct tevent_context *ev,
1189 struct fncall_context *ctx,
1191 const char *service,
1192 const struct addrinfo *hints);
1193 int getaddrinfo_recv(struct tevent_req *req, struct addrinfo **res);
1194 int poll_one_fd(int fd, int events, int timeout, int *revents);
1195 int poll_intr_one_fd(int fd, int events, int timeout, int *revents);
1196 struct tevent_req *tstream_read_packet_send(TALLOC_CTX *mem_ctx,
1197 struct tevent_context *ev,
1198 struct tstream_context *stream,
1200 ssize_t (*more)(uint8_t *buf,
1202 void *private_data),
1203 void *private_data);
1204 ssize_t tstream_read_packet_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1205 uint8_t **pbuf, int *perrno);
1207 /* The following definitions come from lib/util_str.c */
1209 bool next_token(const char **ptr, char *buff, const char *sep, size_t bufsize);
1210 int StrCaseCmp(const char *s, const char *t);
1211 int StrnCaseCmp(const char *s, const char *t, size_t len);
1212 bool strnequal(const char *s1,const char *s2,size_t n);
1213 bool strcsequal(const char *s1,const char *s2);
1214 void strnorm(char *s, int case_default);
1215 bool strisnormal(const char *s, int case_default);
1216 char *push_skip_string(char *buf);
1217 char *skip_string(const char *base, size_t len, char *buf);
1218 size_t str_charnum(const char *s);
1219 size_t str_ascii_charnum(const char *s);
1220 bool trim_char(char *s,char cfront,char cback);
1221 bool strhasupper(const char *s);
1222 bool strhaslower(const char *s);
1223 char *safe_strcpy_fn(char *dest,
1226 char *safe_strcat_fn(char *dest,
1229 char *alpha_strcpy(char *dest,
1231 const char *other_safe_chars,
1233 char *StrnCpy(char *dest,const char *src,size_t n);
1234 bool in_list(const char *s, const char *list, bool casesensitive);
1235 void string_free(char **s);
1236 bool string_set(char **dest,const char *src);
1237 void string_sub2(char *s,const char *pattern, const char *insert, size_t len,
1238 bool remove_unsafe_characters, bool replace_once,
1239 bool allow_trailing_dollar);
1240 void string_sub_once(char *s, const char *pattern,
1241 const char *insert, size_t len);
1242 void string_sub(char *s,const char *pattern, const char *insert, size_t len);
1243 void fstring_sub(char *s,const char *pattern,const char *insert);
1244 char *realloc_string_sub2(char *string,
1245 const char *pattern,
1247 bool remove_unsafe_characters,
1248 bool allow_trailing_dollar);
1249 char *realloc_string_sub(char *string,
1250 const char *pattern,
1251 const char *insert);
1252 char *talloc_string_sub2(TALLOC_CTX *mem_ctx, const char *src,
1253 const char *pattern,
1255 bool remove_unsafe_characters,
1257 bool allow_trailing_dollar);
1258 char *talloc_string_sub(TALLOC_CTX *mem_ctx,
1260 const char *pattern,
1261 const char *insert);
1262 void all_string_sub(char *s,const char *pattern,const char *insert, size_t len);
1263 char *talloc_all_string_sub(TALLOC_CTX *ctx,
1265 const char *pattern,
1266 const char *insert);
1267 char *octal_string(int i);
1268 char *string_truncate(char *s, unsigned int length);
1269 char *strchr_m(const char *src, char c);
1270 char *strrchr_m(const char *s, char c);
1271 char *strnrchr_m(const char *s, char c, unsigned int n);
1272 char *strstr_m(const char *src, const char *findstr);
1273 void strlower_m(char *s);
1274 void strupper_m(char *s);
1275 size_t strlen_m(const char *s);
1276 size_t strlen_m_term(const char *s);
1277 size_t strlen_m_term_null(const char *s);
1278 int fstr_sprintf(fstring s, const char *fmt, ...);
1279 bool str_list_sub_basic( char **list, const char *smb_name,
1280 const char *domain_name );
1281 bool str_list_substitute(char **list, const char *pattern, const char *insert);
1283 char *ipstr_list_make(char **ipstr_list,
1284 const struct ip_service *ip_list,
1286 int ipstr_list_parse(const char *ipstr_list, struct ip_service **ip_list);
1287 void ipstr_list_free(char* ipstr_list);
1288 DATA_BLOB base64_decode_data_blob(const char *s);
1289 void base64_decode_inplace(char *s);
1290 char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data);
1291 uint64_t STR_TO_SMB_BIG_UINT(const char *nptr, const char **entptr);
1292 SMB_OFF_T conv_str_size(const char * str);
1293 void string_append(char **left, const char *right);
1294 bool add_string_to_array(TALLOC_CTX *mem_ctx,
1295 const char *str, const char ***strings,
1297 void sprintf_append(TALLOC_CTX *mem_ctx, char **string, ssize_t *len,
1298 size_t *bufsize, const char *fmt, ...);
1299 int asprintf_strupper_m(char **strp, const char *fmt, ...);
1300 char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...);
1301 char *talloc_asprintf_strlower_m(TALLOC_CTX *t, const char *fmt, ...);
1302 char *sstring_sub(const char *src, char front, char back);
1303 bool validate_net_name( const char *name,
1304 const char *invalid_chars,
1306 char *escape_shell_string(const char *src);
1307 char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep);
1308 char *sanitize_username(TALLOC_CTX *mem_ctx, const char *username);
1310 /* The following definitions come from lib/util_unistr.c */
1312 void gfree_case_tables(void);
1313 void load_case_tables(void);
1314 size_t dos_PutUniCode(char *dst,const char *src, size_t len, bool null_terminate);
1315 char *skip_unibuf(char *src, size_t len);
1316 int rpcstr_push(void *dest, const char *src, size_t dest_len, int flags);
1317 int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src);
1318 bool isvalid83_w(smb_ucs2_t c);
1319 size_t strlen_w(const smb_ucs2_t *src);
1320 size_t strnlen_w(const smb_ucs2_t *src, size_t max);
1321 smb_ucs2_t *strchr_w(const smb_ucs2_t *s, smb_ucs2_t c);
1322 smb_ucs2_t *strchr_wa(const smb_ucs2_t *s, char c);
1323 smb_ucs2_t *strrchr_w(const smb_ucs2_t *s, smb_ucs2_t c);
1324 smb_ucs2_t *strnrchr_w(const smb_ucs2_t *s, smb_ucs2_t c, unsigned int n);
1325 smb_ucs2_t *strstr_w(const smb_ucs2_t *s, const smb_ucs2_t *ins);
1326 bool strlower_w(smb_ucs2_t *s);
1327 bool strupper_w(smb_ucs2_t *s);
1328 void strnorm_w(smb_ucs2_t *s, int case_default);
1329 int strcmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b);
1330 int strncmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len);
1331 int strcasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b);
1332 int strncasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len);
1333 bool strequal_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2);
1334 bool strnequal_w(const smb_ucs2_t *s1,const smb_ucs2_t *s2,size_t n);
1335 smb_ucs2_t *strdup_w(const smb_ucs2_t *src);
1336 smb_ucs2_t *strndup_w(const smb_ucs2_t *src, size_t len);
1337 smb_ucs2_t *strncpy_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const size_t max);
1338 smb_ucs2_t *strncat_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const size_t max);
1339 smb_ucs2_t *strcat_w(smb_ucs2_t *dest, const smb_ucs2_t *src);
1340 void string_replace_w(smb_ucs2_t *s, smb_ucs2_t oldc, smb_ucs2_t newc);
1341 bool trim_string_w(smb_ucs2_t *s, const smb_ucs2_t *front,
1342 const smb_ucs2_t *back);
1343 int strcmp_wa(const smb_ucs2_t *a, const char *b);
1344 int strncmp_wa(const smb_ucs2_t *a, const char *b, size_t len);
1345 smb_ucs2_t *strpbrk_wa(const smb_ucs2_t *s, const char *p);
1346 smb_ucs2_t *strstr_wa(const smb_ucs2_t *s, const char *ins);
1347 int toupper_ascii(int c);
1348 int tolower_ascii(int c);
1349 int isupper_ascii(int c);
1350 int islower_ascii(int c);
1352 /* The following definitions come from lib/version.c */
1354 const char *samba_version_string(void);
1356 /* The following definitions come from lib/wins_srv.c */
1358 bool wins_srv_is_dead(struct in_addr wins_ip, struct in_addr src_ip);
1359 void wins_srv_alive(struct in_addr wins_ip, struct in_addr src_ip);
1360 void wins_srv_died(struct in_addr wins_ip, struct in_addr src_ip);
1361 unsigned wins_srv_count(void);
1362 char **wins_srv_tags(void);
1363 void wins_srv_tags_free(char **list);
1364 struct in_addr wins_srv_ip_tag(const char *tag, struct in_addr src_ip);
1365 unsigned wins_srv_count_tag(const char *tag);
1367 /* The following definitions come from libsmb/cliconnect.c */
1369 ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
1370 const char *pass, const char *user_domain,
1371 const char * dest_realm);
1373 NTSTATUS cli_session_setup(struct cli_state *cli,
1375 const char *pass, int passlen,
1376 const char *ntpass, int ntpasslen,
1377 const char *workgroup);
1378 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
1379 struct event_context *ev,
1380 struct cli_state *cli,
1381 struct tevent_req **psmbreq);
1382 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
1383 struct event_context *ev,
1384 struct cli_state *cli);
1385 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
1386 struct tevent_req *cli_ulogoff_send(TALLOC_CTX *mem_ctx,
1387 struct tevent_context *ev,
1388 struct cli_state *cli);
1389 NTSTATUS cli_ulogoff_recv(struct tevent_req *req);
1390 NTSTATUS cli_ulogoff(struct cli_state *cli);
1391 struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
1392 struct event_context *ev,
1393 struct cli_state *cli,
1394 const char *share, const char *dev,
1395 const char *pass, int passlen,
1396 struct tevent_req **psmbreq);
1397 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
1398 struct event_context *ev,
1399 struct cli_state *cli,
1400 const char *share, const char *dev,
1401 const char *pass, int passlen);
1402 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
1403 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
1404 const char *dev, const char *pass, int passlen);
1405 struct tevent_req *cli_tdis_send(TALLOC_CTX *mem_ctx,
1406 struct tevent_context *ev,
1407 struct cli_state *cli);
1408 NTSTATUS cli_tdis_recv(struct tevent_req *req);
1409 NTSTATUS cli_tdis(struct cli_state *cli);
1410 NTSTATUS cli_negprot(struct cli_state *cli);
1411 struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
1412 struct event_context *ev,
1413 struct cli_state *cli);
1414 NTSTATUS cli_negprot_recv(struct tevent_req *req);
1415 bool cli_session_request(struct cli_state *cli,
1416 struct nmb_name *calling, struct nmb_name *called);
1417 NTSTATUS cli_connect(struct cli_state *cli,
1419 struct sockaddr_storage *dest_ss);
1420 NTSTATUS cli_start_connection(struct cli_state **output_cli,
1421 const char *my_name,
1422 const char *dest_host,
1423 struct sockaddr_storage *dest_ss, int port,
1424 int signing_state, int flags);
1425 NTSTATUS cli_full_connection(struct cli_state **output_cli,
1426 const char *my_name,
1427 const char *dest_host,
1428 struct sockaddr_storage *dest_ss, int port,
1429 const char *service, const char *service_type,
1430 const char *user, const char *domain,
1431 const char *password, int flags,
1433 bool attempt_netbios_session_request(struct cli_state **ppcli, const char *srchost, const char *desthost,
1434 struct sockaddr_storage *pdest_ss);
1435 NTSTATUS cli_raw_tcon(struct cli_state *cli,
1436 const char *service, const char *pass, const char *dev,
1437 uint16 *max_xmit, uint16 *tid);
1438 struct cli_state *get_ipc_connect(char *server,
1439 struct sockaddr_storage *server_ss,
1440 const struct user_auth_info *user_info);
1441 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
1442 struct ip_service *mb_ip,
1443 const struct user_auth_info *user_info,
1444 char **pp_workgroup_out);
1445 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
1446 const struct user_auth_info *user_info,
1447 char **pp_workgroup_out);
1449 /* The following definitions come from libsmb/clidfs.c */
1451 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
1452 const char *username,
1453 const char *password,
1455 const char *sharename);
1456 struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
1457 struct cli_state *referring_cli,
1460 const struct user_auth_info *auth_info,
1466 void cli_cm_display(const struct cli_state *c);
1467 struct client_dfs_referral;
1468 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
1469 struct cli_state *cli,
1471 struct client_dfs_referral **refs,
1474 bool cli_resolve_path(TALLOC_CTX *ctx,
1475 const char *mountpt,
1476 const struct user_auth_info *dfs_auth_info,
1477 struct cli_state *rootcli,
1479 struct cli_state **targetcli,
1480 char **pp_targetpath);
1482 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
1483 struct cli_state *cli,
1484 const char *sharename,
1485 char **pp_newserver,
1488 const char *username,
1489 const char *password,
1490 const char *domain);
1492 /* The following definitions come from libsmb/clientgen.c */
1494 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
1495 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
1496 void cli_set_port(struct cli_state *cli, int port);
1497 bool cli_state_seqnum_persistent(struct cli_state *cli,
1499 bool cli_state_seqnum_remove(struct cli_state *cli,
1501 bool cli_receive_smb(struct cli_state *cli);
1502 bool cli_send_smb(struct cli_state *cli);
1503 bool cli_send_smb_direct_writeX(struct cli_state *cli,
1506 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
1507 void cli_setup_packet(struct cli_state *cli);
1508 void cli_setup_bcc(struct cli_state *cli, void *p);
1509 NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
1510 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);
1511 NTSTATUS cli_set_password(struct cli_state *cli, const char *password);
1512 NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password);
1513 struct cli_state *cli_initialise(void);
1514 struct cli_state *cli_initialise_ex(int signing_state);
1515 void cli_nt_pipes_close(struct cli_state *cli);
1516 void cli_shutdown(struct cli_state *cli);
1517 void cli_sockopt(struct cli_state *cli, const char *options);
1518 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
1519 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
1520 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
1521 struct cli_state *cli, uint16_t num_echos,
1523 NTSTATUS cli_echo_recv(struct tevent_req *req);
1524 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
1525 bool cli_ucs2(struct cli_state *cli);
1526 bool is_andx_req(uint8_t cmd);
1527 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
1528 uint8_t smb_command, uint8_t additional_flags,
1529 uint8_t wct, uint16_t *vwv,
1530 uint32_t num_bytes, const uint8_t *bytes,
1531 struct tevent_req **result_parent,
1532 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
1533 uint32_t *pnum_bytes, uint8_t **pbytes);
1535 /* The following definitions come from libsmb/clierror.c */
1537 const char *cli_errstr(struct cli_state *cli);
1538 NTSTATUS cli_nt_error(struct cli_state *cli);
1539 void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode);
1540 int cli_errno(struct cli_state *cli);
1541 bool cli_is_error(struct cli_state *cli);
1542 bool cli_is_nt_error(struct cli_state *cli);
1543 bool cli_is_dos_error(struct cli_state *cli);
1544 NTSTATUS cli_get_nt_error(struct cli_state *cli);
1545 void cli_set_nt_error(struct cli_state *cli, NTSTATUS status);
1546 void cli_reset_error(struct cli_state *cli);
1547 bool cli_state_is_connected(struct cli_state *cli);
1549 /* The following definitions come from libsmb/clifile.c */
1551 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
1552 struct tevent_context *ev,
1553 struct cli_state *cli,
1558 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
1559 NTSTATUS cli_setpathinfo(struct cli_state *cli,
1565 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
1566 struct event_context *ev,
1567 struct cli_state *cli,
1568 const char *oldname,
1569 const char *newname);
1570 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
1571 NTSTATUS cli_posix_symlink(struct cli_state *cli,
1572 const char *oldname,
1573 const char *newname);
1574 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
1575 struct event_context *ev,
1576 struct cli_state *cli,
1579 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
1580 char *retpath, size_t len);
1581 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
1582 char *linkpath, size_t len);
1583 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
1584 struct event_context *ev,
1585 struct cli_state *cli,
1586 const char *oldname,
1587 const char *newname);
1588 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
1589 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
1590 const char *oldname,
1591 const char *newname);
1592 uint32_t unix_perms_to_wire(mode_t perms);
1593 mode_t wire_perms_to_unix(uint32_t perms);
1594 struct tevent_req *cli_posix_getfacl_send(TALLOC_CTX *mem_ctx,
1595 struct event_context *ev,
1596 struct cli_state *cli,
1598 NTSTATUS cli_posix_getfacl_recv(struct tevent_req *req,
1599 TALLOC_CTX *mem_ctx,
1602 NTSTATUS cli_posix_getfacl(struct cli_state *cli,
1604 TALLOC_CTX *mem_ctx,
1607 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
1608 struct event_context *ev,
1609 struct cli_state *cli,
1611 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
1612 SMB_STRUCT_STAT *sbuf);
1613 NTSTATUS cli_posix_stat(struct cli_state *cli,
1615 SMB_STRUCT_STAT *sbuf);
1616 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
1617 struct event_context *ev,
1618 struct cli_state *cli,
1621 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
1622 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
1623 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
1624 struct event_context *ev,
1625 struct cli_state *cli,
1629 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
1630 NTSTATUS cli_posix_chown(struct cli_state *cli,
1634 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
1635 struct event_context *ev,
1636 struct cli_state *cli,
1637 const char *fname_src,
1638 const char *fname_dst);
1639 NTSTATUS cli_rename_recv(struct tevent_req *req);
1640 NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
1641 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
1642 struct event_context *ev,
1643 struct cli_state *cli,
1644 const char *fname_src,
1645 const char *fname_dst);
1646 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
1647 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
1649 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
1650 struct event_context *ev,
1651 struct cli_state *cli,
1652 const char *fname_src,
1653 const char *fname_dst);
1654 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
1655 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
1657 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
1658 struct event_context *ev,
1659 struct cli_state *cli,
1661 uint16_t mayhave_attrs);
1662 NTSTATUS cli_unlink_recv(struct tevent_req *req);
1663 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
1665 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
1666 struct event_context *ev,
1667 struct cli_state *cli,
1669 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
1670 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
1671 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
1672 struct event_context *ev,
1673 struct cli_state *cli,
1675 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
1676 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
1677 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
1678 struct event_context *ev,
1679 struct cli_state *cli,
1682 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
1683 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
1684 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
1685 struct event_context *ev,
1686 struct cli_state *cli,
1688 uint32_t CreatFlags,
1689 uint32_t DesiredAccess,
1690 uint32_t FileAttributes,
1691 uint32_t ShareAccess,
1692 uint32_t CreateDisposition,
1693 uint32_t CreateOptions,
1694 uint8_t SecurityFlags);
1695 NTSTATUS cli_ntcreate_recv(struct tevent_req *req, uint16_t *pfnum);
1696 NTSTATUS cli_ntcreate(struct cli_state *cli,
1698 uint32_t CreatFlags,
1699 uint32_t DesiredAccess,
1700 uint32_t FileAttributes,
1701 uint32_t ShareAccess,
1702 uint32_t CreateDisposition,
1703 uint32_t CreateOptions,
1704 uint8_t SecurityFlags,
1706 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
1707 size_t str_len, size_t *pconverted_size);
1708 uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
1709 const uint8_t *bytes, size_t num_bytes);
1710 struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx,
1711 struct event_context *ev,
1712 struct cli_state *cli, const char *fname,
1713 int flags, int share_mode,
1714 struct tevent_req **psmbreq);
1715 struct tevent_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
1716 struct cli_state *cli, const char *fname,
1717 int flags, int share_mode);
1718 NTSTATUS cli_open_recv(struct tevent_req *req, uint16_t *fnum);
1719 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
1720 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
1721 struct event_context *ev,
1722 struct cli_state *cli, uint16_t fnum,
1723 struct tevent_req **psubreq);
1724 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
1725 struct event_context *ev,
1726 struct cli_state *cli, uint16_t fnum);
1727 NTSTATUS cli_close_recv(struct tevent_req *req);
1728 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
1729 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
1730 struct event_context *ev,
1731 struct cli_state *cli,
1734 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
1735 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
1736 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
1737 uint32_t offset, uint32_t len,
1738 int timeout, unsigned char locktype);
1739 bool cli_lock(struct cli_state *cli, uint16_t fnum,
1740 uint32_t offset, uint32_t len, int timeout, enum brl_type lock_type);
1741 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
1742 struct event_context *ev,
1743 struct cli_state *cli,
1747 NTSTATUS cli_unlock_recv(struct tevent_req *req);
1748 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
1749 bool cli_lock64(struct cli_state *cli, uint16_t fnum,
1750 uint64_t offset, uint64_t len, int timeout, enum brl_type lock_type);
1751 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
1752 struct event_context *ev,
1753 struct cli_state *cli,
1757 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
1758 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
1759 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
1760 struct event_context *ev,
1761 struct cli_state *cli,
1766 enum brl_type lock_type);
1767 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
1768 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
1769 uint64_t offset, uint64_t len,
1770 bool wait_lock, enum brl_type lock_type);
1771 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
1772 struct event_context *ev,
1773 struct cli_state *cli,
1777 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
1778 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
1779 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
1780 struct event_context *ev,
1781 struct cli_state *cli,
1783 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
1786 time_t *change_time,
1787 time_t *access_time,
1788 time_t *write_time);
1789 NTSTATUS cli_getattrE(struct cli_state *cli,
1793 time_t *change_time,
1794 time_t *access_time,
1795 time_t *write_time);
1796 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
1797 struct event_context *ev,
1798 struct cli_state *cli,
1803 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
1804 NTSTATUS cli_setattrE(struct cli_state *cli,
1809 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
1810 struct event_context *ev,
1811 struct cli_state *cli,
1813 NTSTATUS cli_getatr_recv(struct tevent_req *req,
1816 time_t *write_time);
1817 NTSTATUS cli_getatr(struct cli_state *cli,
1821 time_t *write_time);
1822 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
1823 struct event_context *ev,
1824 struct cli_state *cli,
1828 NTSTATUS cli_setatr_recv(struct tevent_req *req);
1829 NTSTATUS cli_setatr(struct cli_state *cli,
1833 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
1834 struct event_context *ev,
1835 struct cli_state *cli,
1837 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
1838 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
1839 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
1840 struct event_context *ev,
1841 struct cli_state *cli);
1842 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
1844 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
1845 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
1846 struct event_context *ev,
1847 struct cli_state *cli,
1849 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
1853 NTSTATUS cli_ctemp(struct cli_state *cli,
1858 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
1859 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
1860 const char *ea_name, const char *ea_val,
1862 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
1863 const char *ea_name, const char *ea_val,
1865 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
1866 struct tevent_context *ev,
1867 struct cli_state *cli,
1869 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1870 size_t *pnum_eas, struct ea_struct **peas);
1871 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
1874 struct ea_struct **pea_list);
1875 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
1876 struct event_context *ev,
1877 struct cli_state *cli,
1881 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
1882 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
1883 int flags, mode_t mode, uint16_t *fnum);
1884 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
1885 struct event_context *ev,
1886 struct cli_state *cli,
1889 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
1890 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
1892 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
1893 struct event_context *ev,
1894 struct cli_state *cli,
1896 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
1897 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
1899 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
1900 struct event_context *ev,
1901 struct cli_state *cli,
1903 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1904 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
1905 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
1906 struct tevent_context *ev,
1907 struct cli_state *cli, uint16_t fnum,
1908 uint32_t buffer_size,
1909 uint32_t completion_filter, bool recursive);
1910 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1911 uint32_t *pnum_changes,
1912 struct notify_change **pchanges);
1914 /* The following definitions come from libsmb/clifsinfo.c */
1916 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
1917 struct tevent_context *ev,
1918 struct cli_state *cli);
1919 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
1920 uint16_t *pmajor, uint16_t *pminor,
1922 uint32_t *pcaphigh);
1923 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor,
1924 uint16 *pminor, uint32 *pcaplow,
1926 struct tevent_req *cli_set_unix_extensions_capabilities_send(
1927 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
1928 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
1929 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
1930 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
1931 uint16 major, uint16 minor,
1932 uint32 caplow, uint32 caphigh);
1933 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
1934 struct tevent_context *ev,
1935 struct cli_state *cli);
1936 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
1937 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
1938 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name,
1939 uint32 *pserial_number, time_t *pdate);
1940 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
1941 uint64_t *total_allocation_units,
1942 uint64_t *caller_allocation_units,
1943 uint64_t *actual_allocation_units,
1944 uint64_t *sectors_per_allocation_unit,
1945 uint64_t *bytes_per_sector);
1946 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
1947 uint32 *optimal_transfer_size,
1949 uint64_t *total_blocks,
1950 uint64_t *blocks_available,
1951 uint64_t *user_blocks_available,
1952 uint64_t *total_file_nodes,
1953 uint64_t *free_file_nodes,
1954 uint64_t *fs_identifier);
1955 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
1958 const char *domain);
1959 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
1960 NTSTATUS cli_force_encryption(struct cli_state *c,
1961 const char *username,
1962 const char *password,
1963 const char *domain);
1965 /* The following definitions come from libsmb/clikrb5.c */
1967 bool unwrap_edata_ntstatus(TALLOC_CTX *mem_ctx,
1969 DATA_BLOB *edata_out);
1970 bool unwrap_pac(TALLOC_CTX *mem_ctx, DATA_BLOB *auth_data, DATA_BLOB *unwrapped_pac_data);
1972 /* The following definitions come from libsmb/clilist.c */
1974 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
1975 NTSTATUS (*fn)(const char *, struct file_info *,
1976 const char *, void *), void *state);
1977 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
1978 uint16_t attribute, int info_level,
1979 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
1980 const char *mask, void *private_data),
1981 void *private_data);
1982 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
1983 struct tevent_context *ev,
1984 struct cli_state *cli,
1987 uint16_t info_level);
1988 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1989 struct file_info **finfo, size_t *num_finfo);
1990 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
1991 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
1992 void *), void *state);
1994 /* The following definitions come from libsmb/climessage.c */
1996 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
1997 struct tevent_context *ev,
1998 struct cli_state *cli,
1999 const char *host, const char *username,
2000 const char *message);
2001 NTSTATUS cli_message_recv(struct tevent_req *req);
2002 NTSTATUS cli_message(struct cli_state *cli, const char *host,
2003 const char *username, const char *message);
2005 /* The following definitions come from libsmb/clioplock.c */
2007 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
2008 struct tevent_context *ev,
2009 struct cli_state *cli,
2010 uint16_t fnum, uint8_t level);
2011 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
2012 NTSTATUS cli_oplock_ack(struct cli_state *cli, uint16_t fnum, unsigned char level);
2013 void cli_oplock_handler(struct cli_state *cli,
2014 NTSTATUS (*handler)(struct cli_state *, uint16_t, unsigned char));
2016 /* The following definitions come from libsmb/cliprint.c */
2018 int cli_print_queue(struct cli_state *cli,
2019 void (*fn)(struct print_job_info *));
2020 int cli_printjob_del(struct cli_state *cli, int job);
2022 /* The following definitions come from libsmb/cliquota.c */
2024 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
2025 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
2026 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
2027 SMB_NTQUOTA_STRUCT *pqt);
2028 NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
2029 SMB_NTQUOTA_STRUCT *pqt);
2030 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
2031 SMB_NTQUOTA_LIST **pqt_list);
2032 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
2033 SMB_NTQUOTA_STRUCT *pqt);
2034 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
2035 SMB_NTQUOTA_STRUCT *pqt);
2037 /* The following definitions come from libsmb/clireadwrite.c */
2039 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
2040 struct event_context *ev,
2041 struct cli_state *cli, uint16_t fnum,
2042 off_t offset, size_t size,
2043 struct tevent_req **psmbreq);
2044 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
2045 struct event_context *ev,
2046 struct cli_state *cli, uint16_t fnum,
2047 off_t offset, size_t size);
2048 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
2050 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
2051 struct event_context *ev,
2052 struct cli_state *cli,
2053 uint16_t fnum, off_t start_offset,
2054 SMB_OFF_T size, size_t window_size,
2055 NTSTATUS (*sink)(char *buf, size_t n,
2058 NTSTATUS cli_pull_recv(struct tevent_req *req, SMB_OFF_T *received);
2059 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
2060 off_t start_offset, SMB_OFF_T size, size_t window_size,
2061 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
2062 void *priv, SMB_OFF_T *received);
2063 ssize_t cli_read(struct cli_state *cli, uint16_t fnum, char *buf,
2064 off_t offset, size_t size);
2065 ssize_t cli_write(struct cli_state *cli,
2066 uint16_t fnum, uint16 write_mode,
2067 const char *buf, off_t offset, size_t size);
2068 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
2069 off_t offset, size_t size1, size_t *ptotal);
2070 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
2071 struct event_context *ev,
2072 struct cli_state *cli, uint16_t fnum,
2073 uint16_t mode, const uint8_t *buf,
2074 off_t offset, size_t size,
2075 struct tevent_req **reqs_before,
2076 int num_reqs_before,
2077 struct tevent_req **psmbreq);
2078 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
2079 struct event_context *ev,
2080 struct cli_state *cli, uint16_t fnum,
2081 uint16_t mode, const uint8_t *buf,
2082 off_t offset, size_t size);
2083 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
2085 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
2086 struct cli_state *cli,
2087 uint16_t fnum, uint16_t mode,
2088 off_t start_offset, size_t window_size,
2089 size_t (*source)(uint8_t *buf, size_t n,
2092 NTSTATUS cli_push_recv(struct tevent_req *req);
2093 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
2094 off_t start_offset, size_t window_size,
2095 size_t (*source)(uint8_t *buf, size_t n, void *priv),
2098 /* The following definitions come from libsmb/clisecdesc.c */
2100 struct security_descriptor *cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
2101 TALLOC_CTX *mem_ctx);
2102 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
2103 struct security_descriptor *sd);
2105 /* The following definitions come from libsmb/clispnego.c */
2107 DATA_BLOB spnego_gen_negTokenInit(TALLOC_CTX *ctx,
2109 DATA_BLOB *psecblob,
2110 const char *principal);
2112 #ifndef ASN1_MAX_OIDS
2113 #define ASN1_MAX_OIDS 20
2115 bool spnego_parse_negTokenInit(TALLOC_CTX *ctx,
2117 char *OIDs[ASN1_MAX_OIDS],
2119 DATA_BLOB *secblob);
2120 DATA_BLOB spnego_gen_krb5_wrap(TALLOC_CTX *ctx, const DATA_BLOB ticket, const uint8 tok_id[2]);
2121 bool spnego_parse_krb5_wrap(TALLOC_CTX *ctx, DATA_BLOB blob, DATA_BLOB *ticket, uint8 tok_id[2]);
2122 int spnego_gen_krb5_negTokenInit(TALLOC_CTX *ctx,
2123 const char *principal, int time_offset,
2125 DATA_BLOB *session_key_krb5, uint32 extra_ap_opts,
2126 time_t *expire_time);
2127 bool spnego_parse_challenge(TALLOC_CTX *ctx, const DATA_BLOB blob,
2128 DATA_BLOB *chal1, DATA_BLOB *chal2);
2129 DATA_BLOB spnego_gen_auth(TALLOC_CTX *ctx, DATA_BLOB blob);
2130 bool spnego_parse_auth(TALLOC_CTX *ctx, DATA_BLOB blob, DATA_BLOB *auth);
2131 DATA_BLOB spnego_gen_auth_response(TALLOC_CTX *ctx, DATA_BLOB *reply, NTSTATUS nt_status,
2132 const char *mechOID);
2133 bool spnego_parse_auth_response(TALLOC_CTX *ctx,
2134 DATA_BLOB blob, NTSTATUS nt_status,
2135 const char *mechOID,
2138 bool spnego_parse_auth_and_mic(TALLOC_CTX *ctx, DATA_BLOB blob,
2139 DATA_BLOB *auth, DATA_BLOB *signature);
2140 DATA_BLOB spnego_gen_auth_response_and_mic(TALLOC_CTX *ctx,
2142 const char *mechOID,
2144 DATA_BLOB *mechlistMIC);
2145 bool spnego_mech_list_blob(TALLOC_CTX *mem_ctx,
2146 char **oid_list, DATA_BLOB *data);
2148 /* The following definitions come from libsmb/clistr.c */
2150 size_t clistr_push_fn(struct cli_state *cli,
2155 size_t clistr_pull_fn(const char *inbuf,
2161 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
2168 size_t clistr_align_out(struct cli_state *cli, const void *p, int flags);
2170 /* The following definitions come from libsmb/clitrans.c */
2172 struct tevent_req *cli_trans_send(
2173 TALLOC_CTX *mem_ctx, struct event_context *ev,
2174 struct cli_state *cli, uint8_t cmd,
2175 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
2176 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
2177 uint8_t *param, uint32_t num_param, uint32_t max_param,
2178 uint8_t *data, uint32_t num_data, uint32_t max_data);
2179 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
2180 uint16_t *recv_flags2,
2181 uint16_t **setup, uint8_t min_setup,
2183 uint8_t **param, uint32_t min_param,
2184 uint32_t *num_param,
2185 uint8_t **data, uint32_t min_data,
2186 uint32_t *num_data);
2187 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
2189 const char *pipe_name, uint16_t fid, uint16_t function,
2191 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
2192 uint8_t *param, uint32_t num_param, uint32_t max_param,
2193 uint8_t *data, uint32_t num_data, uint32_t max_data,
2194 uint16_t *recv_flags2,
2195 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
2196 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
2197 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
2199 /* The following definitions come from libsmb/conncache.c */
2201 NTSTATUS check_negative_conn_cache( const char *domain, const char *server);
2202 void add_failed_connection_entry(const char *domain, const char *server, NTSTATUS result) ;
2203 void flush_negative_conn_cache_for_domain(const char *domain);
2205 /* The following definitions come from libsmb/dsgetdcname.c */
2207 struct netr_DsRGetDCNameInfo;
2209 void debug_dsdcinfo_flags(int lvl, uint32_t flags);
2210 NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx,
2211 struct messaging_context *msg_ctx,
2212 const char *domain_name,
2213 const struct GUID *domain_guid,
2214 const char *site_name,
2216 struct netr_DsRGetDCNameInfo **info);
2218 /* The following definitions come from libsmb/errormap.c */
2220 NTSTATUS dos_to_ntstatus(uint8 eclass, uint32 ecode);
2221 void ntstatus_to_dos(NTSTATUS ntstatus, uint8 *eclass, uint32 *ecode);
2222 NTSTATUS werror_to_ntstatus(WERROR error);
2223 WERROR ntstatus_to_werror(NTSTATUS error);
2224 NTSTATUS map_nt_error_from_gss(uint32 gss_maj, uint32 minor);
2226 /* The following definitions come from libsmb/namecache.c */
2228 bool namecache_store(const char *name,
2231 struct ip_service *ip_list);
2232 bool namecache_fetch(const char *name,
2234 struct ip_service **ip_list,
2236 bool namecache_delete(const char *name, int name_type);
2237 void namecache_flush(void);
2238 bool namecache_status_store(const char *keyname, int keyname_type,
2239 int name_type, const struct sockaddr_storage *keyip,
2240 const char *srvname);
2241 bool namecache_status_fetch(const char *keyname,
2244 const struct sockaddr_storage *keyip,
2247 /* The following definitions come from libsmb/namequery.c */
2249 bool saf_store( const char *domain, const char *servername );
2250 bool saf_join_store( const char *domain, const char *servername );
2251 bool saf_delete( const char *domain );
2252 char *saf_fetch( const char *domain );
2253 struct tevent_req *node_status_query_send(TALLOC_CTX *mem_ctx,
2254 struct tevent_context *ev,
2255 struct nmb_name *name,
2256 const struct sockaddr_storage *addr);
2257 NTSTATUS node_status_query_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
2258 struct node_status **pnode_status,
2260 struct node_status_extra *extra);
2261 NTSTATUS node_status_query(TALLOC_CTX *mem_ctx, struct nmb_name *name,
2262 const struct sockaddr_storage *addr,
2263 struct node_status **pnode_status,
2265 struct node_status_extra *extra);
2266 bool name_status_find(const char *q_name,
2269 const struct sockaddr_storage *to_ss,
2271 int ip_service_compare(struct ip_service *ss1, struct ip_service *ss2);
2272 struct tevent_req *name_query_send(TALLOC_CTX *mem_ctx,
2273 struct tevent_context *ev,
2274 const char *name, int name_type,
2275 bool bcast, bool recurse,
2276 const struct sockaddr_storage *addr);
2277 NTSTATUS name_query_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
2278 struct sockaddr_storage **addrs, int *num_addrs,
2280 NTSTATUS name_query(const char *name, int name_type,
2281 bool bcast, bool recurse,
2282 const struct sockaddr_storage *to_ss,
2283 TALLOC_CTX *mem_ctx,
2284 struct sockaddr_storage **addrs,
2285 int *num_addrs, uint8_t *flags);
2286 NTSTATUS name_resolve_bcast(const char *name,
2288 struct ip_service **return_iplist,
2290 NTSTATUS resolve_wins(const char *name,
2292 struct ip_service **return_iplist,
2294 NTSTATUS internal_resolve_name(const char *name,
2296 const char *sitename,
2297 struct ip_service **return_iplist,
2299 const char *resolve_order);
2300 bool resolve_name(const char *name,
2301 struct sockaddr_storage *return_ss,
2304 NTSTATUS resolve_name_list(TALLOC_CTX *ctx,
2307 struct sockaddr_storage **return_ss_arr,
2308 unsigned int *p_num_entries);
2309 bool find_master_ip(const char *group, struct sockaddr_storage *master_ss);
2310 bool get_pdc_ip(const char *domain, struct sockaddr_storage *pss);
2311 NTSTATUS get_sorted_dc_list( const char *domain,
2312 const char *sitename,
2313 struct ip_service **ip_list,
2316 NTSTATUS get_kdc_list( const char *realm,
2317 const char *sitename,
2318 struct ip_service **ip_list,
2321 /* The following definitions come from libsmb/namequery_dc.c */
2323 bool get_dc_name(const char *domain,
2326 struct sockaddr_storage *ss_out);
2328 /* The following definitions come from libsmb/nmblib.c */
2330 void debug_nmb_packet(struct packet_struct *p);
2331 void put_name(char *dest, const char *name, int pad, unsigned int name_type);
2332 char *nmb_namestr(const struct nmb_name *n);
2333 struct packet_struct *copy_packet(struct packet_struct *packet);
2334 void free_packet(struct packet_struct *packet);
2335 int packet_trn_id(struct packet_struct *p);
2336 struct packet_struct *parse_packet(char *buf,int length,
2337 enum packet_type packet_type,
2340 struct packet_struct *read_packet(int fd,enum packet_type packet_type);
2341 void make_nmb_name( struct nmb_name *n, const char *name, int type);
2342 bool nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2);
2343 int build_packet(char *buf, size_t buflen, struct packet_struct *p);
2344 bool send_packet(struct packet_struct *p);
2345 bool match_mailslot_name(struct packet_struct *p, const char *mailslot_name);
2346 int matching_len_bits(unsigned char *p1, unsigned char *p2, size_t len);
2347 void sort_query_replies(char *data, int n, struct in_addr ip);
2348 char *name_mangle(TALLOC_CTX *mem_ctx, const char *In, char name_type);
2349 int name_extract(unsigned char *buf,size_t buf_len, unsigned int ofs, fstring name);
2350 int name_len(unsigned char *s1, size_t buf_len);
2352 /* The following definitions come from libsmb/nterr.c */
2354 const char *nt_errstr(NTSTATUS nt_code);
2355 const char *get_friendly_nt_error_msg(NTSTATUS nt_code);
2356 const char *get_nt_error_c_code(NTSTATUS nt_code);
2357 NTSTATUS nt_status_string_to_code(const char *nt_status_str);
2358 NTSTATUS nt_status_squash(NTSTATUS nt_status);
2360 /* The following definitions come from libsmb/ntlmssp.c */
2361 struct ntlmssp_state;
2362 NTSTATUS ntlmssp_set_username(struct ntlmssp_state *ntlmssp_state, const char *user) ;
2363 NTSTATUS ntlmssp_set_hashes(struct ntlmssp_state *ntlmssp_state,
2364 const uint8_t lm_hash[16],
2365 const uint8_t nt_hash[16]) ;
2366 NTSTATUS ntlmssp_set_password(struct ntlmssp_state *ntlmssp_state, const char *password) ;
2367 NTSTATUS ntlmssp_set_domain(struct ntlmssp_state *ntlmssp_state, const char *domain) ;
2368 void ntlmssp_want_feature_list(struct ntlmssp_state *ntlmssp_state, char *feature_list);
2369 void ntlmssp_want_feature(struct ntlmssp_state *ntlmssp_state, uint32_t feature);
2370 NTSTATUS ntlmssp_update(struct ntlmssp_state *ntlmssp_state,
2371 const DATA_BLOB in, DATA_BLOB *out) ;
2372 NTSTATUS ntlmssp_server_start(TALLOC_CTX *mem_ctx,
2374 const char *netbios_name,
2375 const char *netbios_domain,
2376 const char *dns_name,
2377 const char *dns_domain,
2378 struct ntlmssp_state **ntlmssp_state);
2379 NTSTATUS ntlmssp_client_start(TALLOC_CTX *mem_ctx,
2380 const char *netbios_name,
2381 const char *netbios_domain,
2383 struct ntlmssp_state **_ntlmssp_state);
2385 /* The following definitions come from libsmb/passchange.c */
2387 NTSTATUS remote_password_change(const char *remote_machine, const char *user_name,
2388 const char *old_passwd, const char *new_passwd,
2391 /* The following definitions come from libsmb/samlogon_cache.c */
2393 bool netsamlogon_cache_init(void);
2394 bool netsamlogon_cache_shutdown(void);
2395 void netsamlogon_clear_cached_user(const struct dom_sid *user_sid);
2396 bool netsamlogon_cache_store(const char *username, struct netr_SamInfo3 *info3);
2397 struct netr_SamInfo3 *netsamlogon_cache_get(TALLOC_CTX *mem_ctx, const struct dom_sid *user_sid);
2398 bool netsamlogon_cache_have(const struct dom_sid *user_sid);
2400 /* The following definitions come from libsmb/smb_seal.c */
2402 NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16 *p_enc_ctx_num);
2403 bool common_encryption_on(struct smb_trans_enc_state *es);
2404 NTSTATUS common_ntlm_decrypt_buffer(struct ntlmssp_state *ntlmssp_state, char *buf);
2405 NTSTATUS common_ntlm_encrypt_buffer(struct ntlmssp_state *ntlmssp_state,
2409 NTSTATUS common_encrypt_buffer(struct smb_trans_enc_state *es, char *buffer, char **buf_out);
2410 NTSTATUS common_decrypt_buffer(struct smb_trans_enc_state *es, char *buf);
2411 void common_free_encryption_state(struct smb_trans_enc_state **pp_es);
2412 void common_free_enc_buffer(struct smb_trans_enc_state *es, char *buf);
2413 bool cli_encryption_on(struct cli_state *cli);
2414 void cli_free_encryption_context(struct cli_state *cli);
2415 void cli_free_enc_buffer(struct cli_state *cli, char *buf);
2416 NTSTATUS cli_decrypt_message(struct cli_state *cli);
2417 NTSTATUS cli_encrypt_message(struct cli_state *cli, char *buf, char **buf_out);
2419 /* The following definitions come from libsmb/clisigning.c */
2421 bool cli_simple_set_signing(struct cli_state *cli,
2422 const DATA_BLOB user_session_key,
2423 const DATA_BLOB response);
2424 bool cli_temp_set_signing(struct cli_state *cli);
2425 void cli_calculate_sign_mac(struct cli_state *cli, char *buf, uint32_t *seqnum);
2426 bool cli_check_sign_mac(struct cli_state *cli, const char *buf, uint32_t seqnum);
2427 bool client_is_signing_on(struct cli_state *cli);
2428 bool client_is_signing_allowed(struct cli_state *cli);
2429 bool client_is_signing_mandatory(struct cli_state *cli);
2430 void cli_set_signing_negotiated(struct cli_state *cli);
2432 /* The following definitions come from smbd/signing.c */
2434 struct smbd_server_connection;
2435 bool srv_check_sign_mac(struct smbd_server_connection *conn,
2436 const char *inbuf, uint32_t *seqnum, bool trusted_channel);
2437 void srv_calculate_sign_mac(struct smbd_server_connection *conn,
2438 char *outbuf, uint32_t seqnum);
2439 void srv_cancel_sign_response(struct smbd_server_connection *conn);
2440 bool srv_init_signing(struct smbd_server_connection *conn);
2441 void srv_set_signing_negotiated(struct smbd_server_connection *conn);
2442 bool srv_is_signing_active(struct smbd_server_connection *conn);
2443 bool srv_is_signing_negotiated(struct smbd_server_connection *conn);
2444 void srv_set_signing(struct smbd_server_connection *conn,
2445 const DATA_BLOB user_session_key,
2446 const DATA_BLOB response);
2448 /* The following definitions come from libsmb/smberr.c */
2450 const char *smb_dos_err_name(uint8 e_class, uint16 num);
2451 const char *get_dos_error_msg(WERROR result);
2452 const char *smb_dos_err_class(uint8 e_class);
2453 char *smb_dos_errstr(char *inbuf);
2454 WERROR map_werror_from_unix(int error);
2456 /* The following definitions come from libsmb/trustdom_cache.c */
2458 bool trustdom_cache_enable(void);
2459 bool trustdom_cache_shutdown(void);
2460 bool trustdom_cache_store(char* name, char* alt_name, const struct dom_sid *sid,
2462 bool trustdom_cache_fetch(const char* name, struct dom_sid* sid);
2463 uint32 trustdom_cache_fetch_timestamp( void );
2464 bool trustdom_cache_store_timestamp( uint32 t, time_t timeout );
2465 void trustdom_cache_flush(void);
2466 void update_trustdom_cache( void );
2468 /* The following definitions come from libsmb/trusts_util.c */
2470 NTSTATUS trust_pw_change_and_store_it(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
2472 const char *account_name,
2473 unsigned char orig_trust_passwd_hash[16],
2474 enum netr_SchannelType sec_channel_type);
2475 NTSTATUS trust_pw_find_change_and_store_it(struct rpc_pipe_client *cli,
2476 TALLOC_CTX *mem_ctx,
2477 const char *domain) ;
2478 bool enumerate_domain_trusts( TALLOC_CTX *mem_ctx, const char *domain,
2479 char ***domain_names, uint32 *num_domains,
2480 struct dom_sid **sids );
2481 NTSTATUS change_trust_account_password( const char *domain, const char *remote_machine);
2483 /* The following definitions come from libsmb/unexpected.c */
2485 struct nb_packet_server;
2486 struct nb_packet_reader;
2488 NTSTATUS nb_packet_server_create(TALLOC_CTX *mem_ctx,
2489 struct tevent_context *ev,
2491 struct nb_packet_server **presult);
2492 void nb_packet_dispatch(struct nb_packet_server *server,
2493 struct packet_struct *p);
2494 struct tevent_req *nb_packet_reader_send(TALLOC_CTX *mem_ctx,
2495 struct tevent_context *ev,
2496 enum packet_type type,
2498 const char *mailslot_name);
2499 NTSTATUS nb_packet_reader_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
2500 struct nb_packet_reader **preader);
2501 struct tevent_req *nb_packet_read_send(TALLOC_CTX *mem_ctx,
2502 struct tevent_context *ev,
2503 struct nb_packet_reader *reader);
2504 NTSTATUS nb_packet_read_recv(struct tevent_req *req,
2505 struct packet_struct **ppacket);
2507 /* The following definitions come from locking/brlock.c */
2509 bool brl_same_context(const struct lock_context *ctx1,
2510 const struct lock_context *ctx2);
2511 NTSTATUS brl_lock_failed(files_struct *fsp, const struct lock_struct *lock, bool blocking_lock);
2512 void brl_init(bool read_only);
2513 void brl_shutdown(void);
2515 NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck,
2516 struct lock_struct *plock,
2517 bool blocking_lock);
2519 NTSTATUS brl_lock(struct messaging_context *msg_ctx,
2520 struct byte_range_lock *br_lck,
2522 struct server_id pid,
2525 enum brl_type lock_type,
2526 enum brl_flavour lock_flav,
2529 struct blocking_lock_record *blr);
2530 bool brl_unlock(struct messaging_context *msg_ctx,
2531 struct byte_range_lock *br_lck,
2533 struct server_id pid,
2536 enum brl_flavour lock_flav);
2537 bool brl_unlock_windows_default(struct messaging_context *msg_ctx,
2538 struct byte_range_lock *br_lck,
2539 const struct lock_struct *plock);
2540 bool brl_locktest(struct byte_range_lock *br_lck,
2542 struct server_id pid,
2545 enum brl_type lock_type,
2546 enum brl_flavour lock_flav);
2547 NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
2549 struct server_id pid,
2552 enum brl_type *plock_type,
2553 enum brl_flavour lock_flav);
2554 bool brl_lock_cancel(struct byte_range_lock *br_lck,
2556 struct server_id pid,
2559 enum brl_flavour lock_flav,
2560 struct blocking_lock_record *blr);
2561 bool brl_lock_cancel_default(struct byte_range_lock *br_lck,
2562 struct lock_struct *plock);
2563 void brl_close_fnum(struct messaging_context *msg_ctx,
2564 struct byte_range_lock *br_lck);
2565 int brl_forall(void (*fn)(struct file_id id, struct server_id pid,
2566 enum brl_type lock_type,
2567 enum brl_flavour lock_flav,
2568 br_off start, br_off size,
2569 void *private_data),
2570 void *private_data);
2571 struct byte_range_lock *brl_get_locks(TALLOC_CTX *mem_ctx,
2573 struct byte_range_lock *brl_get_locks_readonly(files_struct *fsp);
2574 void brl_register_msgs(struct messaging_context *msg_ctx);
2576 /* The following definitions come from locking/locking.c */
2578 const char *lock_type_name(enum brl_type lock_type);
2579 const char *lock_flav_name(enum brl_flavour lock_flav);
2580 void init_strict_lock_struct(files_struct *fsp,
2584 enum brl_type lock_type,
2585 struct lock_struct *plock);
2586 bool strict_lock_default(files_struct *fsp,
2587 struct lock_struct *plock);
2588 void strict_unlock_default(files_struct *fsp,
2589 struct lock_struct *plock);
2590 NTSTATUS query_lock(files_struct *fsp,
2594 enum brl_type *plock_type,
2595 enum brl_flavour lock_flav);
2596 struct byte_range_lock *do_lock(struct messaging_context *msg_ctx,
2601 enum brl_type lock_type,
2602 enum brl_flavour lock_flav,
2606 struct blocking_lock_record *blr);
2607 NTSTATUS do_unlock(struct messaging_context *msg_ctx,
2612 enum brl_flavour lock_flav);
2613 NTSTATUS do_lock_cancel(files_struct *fsp,
2617 enum brl_flavour lock_flav,
2618 struct blocking_lock_record *blr);
2619 void locking_close_file(struct messaging_context *msg_ctx,
2621 enum file_close_type close_type);
2622 bool locking_init(void);
2623 bool locking_init_readonly(void);
2624 bool locking_end(void);
2625 char *share_mode_str(TALLOC_CTX *ctx, int num, const struct share_mode_entry *e);
2626 struct share_mode_lock *get_share_mode_lock(TALLOC_CTX *mem_ctx,
2627 const struct file_id id,
2628 const char *servicepath,
2629 const struct smb_filename *smb_fname,
2630 const struct timespec *old_write_time);
2631 struct share_mode_lock *fetch_share_mode_unlocked(TALLOC_CTX *mem_ctx,
2632 const struct file_id id);
2633 bool rename_share_filename(struct messaging_context *msg_ctx,
2634 struct share_mode_lock *lck,
2635 const char *servicepath,
2636 uint32_t orig_name_hash,
2637 uint32_t new_name_hash,
2638 const struct smb_filename *smb_fname);
2639 void get_file_infos(struct file_id id,
2641 bool *delete_on_close,
2642 struct timespec *write_time);
2643 bool is_valid_share_mode_entry(const struct share_mode_entry *e);
2644 bool is_deferred_open_entry(const struct share_mode_entry *e);
2645 bool is_unused_share_mode_entry(const struct share_mode_entry *e);
2646 void set_share_mode(struct share_mode_lock *lck, files_struct *fsp,
2647 uid_t uid, uint64_t mid, uint16 op_type);
2648 void add_deferred_open(struct share_mode_lock *lck, uint64_t mid,
2649 struct timeval request_time,
2650 struct server_id pid, struct file_id id);
2651 bool del_share_mode(struct share_mode_lock *lck, files_struct *fsp);
2652 void del_deferred_open_entry(struct share_mode_lock *lck, uint64_t mid,
2653 struct server_id pid);
2654 bool remove_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
2655 bool downgrade_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
2656 NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32 dosmode);
2657 const struct security_unix_token *get_delete_on_close_token(struct share_mode_lock *lck, uint32_t name_hash);
2658 void set_delete_on_close_lck(files_struct *fsp,
2659 struct share_mode_lock *lck,
2660 bool delete_on_close,
2661 const struct security_unix_token *tok);
2662 bool set_delete_on_close(files_struct *fsp, bool delete_on_close, const struct security_unix_token *tok);
2663 bool is_delete_on_close_set(struct share_mode_lock *lck, uint32_t name_hash);
2664 bool set_sticky_write_time(struct file_id fileid, struct timespec write_time);
2665 bool set_write_time(struct file_id fileid, struct timespec write_time);
2666 int share_mode_forall(void (*fn)(const struct share_mode_entry *, const char *,
2667 const char *, void *),
2668 void *private_data);
2670 /* The following definitions come from locking/posix.c */
2672 bool is_posix_locked(files_struct *fsp,
2673 uint64_t *pu_offset,
2675 enum brl_type *plock_type,
2676 enum brl_flavour lock_flav);
2677 bool posix_locking_init(bool read_only);
2678 bool posix_locking_end(void);
2679 void reduce_windows_lock_ref_count(files_struct *fsp, unsigned int dcount);
2680 int fd_close_posix(struct files_struct *fsp);
2681 bool set_posix_lock_windows_flavour(files_struct *fsp,
2684 enum brl_type lock_type,
2685 const struct lock_context *lock_ctx,
2686 const struct lock_struct *plocks,
2689 bool release_posix_lock_windows_flavour(files_struct *fsp,
2692 enum brl_type deleted_lock_type,
2693 const struct lock_context *lock_ctx,
2694 const struct lock_struct *plocks,
2696 bool set_posix_lock_posix_flavour(files_struct *fsp,
2699 enum brl_type lock_type,
2701 bool release_posix_lock_posix_flavour(files_struct *fsp,
2704 const struct lock_context *lock_ctx,
2705 const struct lock_struct *plocks,
2708 /* The following definitions come from modules/vfs_default.c */
2710 ssize_t vfswrap_llistxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size);
2711 ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size);
2712 NTSTATUS vfs_default_init(void);
2714 /* The following definitions come from param/loadparm.c */
2716 char *lp_smb_ports(void);
2717 char *lp_dos_charset(void);
2718 char *lp_unix_charset(void);
2719 char *lp_display_charset(void);
2720 char *lp_logfile(void);
2721 char *lp_configfile(void);
2722 char *lp_smb_passwd_file(void);
2723 char *lp_private_dir(void);
2724 char *lp_serverstring(void);
2725 int lp_printcap_cache_time(void);
2726 char *lp_addport_cmd(void);
2727 char *lp_enumports_cmd(void);
2728 char *lp_addprinter_cmd(void);
2729 char *lp_deleteprinter_cmd(void);
2730 char *lp_os2_driver_map(void);
2731 char *lp_lockdir(void);
2732 char *lp_statedir(void);
2733 char *lp_cachedir(void);
2734 char *lp_piddir(void);
2735 char *lp_mangling_method(void);
2736 int lp_mangle_prefix(void);
2737 char *lp_utmpdir(void);
2738 char *lp_wtmpdir(void);
2740 char *lp_rootdir(void);
2741 char *lp_defaultservice(void);
2742 char *lp_msg_command(void);
2743 char *lp_get_quota_command(void);
2744 char *lp_set_quota_command(void);
2745 char *lp_auto_services(void);
2746 char *lp_passwd_program(void);
2747 char *lp_passwd_chat(void);
2748 char *lp_passwordserver(void);
2749 char *lp_name_resolve_order(void);
2750 char *lp_realm(void);
2751 const char *lp_afs_username_map(void);
2752 int lp_afs_token_lifetime(void);
2753 char *lp_log_nt_token_command(void);
2754 char *lp_username_map(void);
2755 const char *lp_logon_script(void);
2756 const char *lp_logon_path(void);
2757 const char *lp_logon_drive(void);
2758 const char *lp_logon_home(void);
2759 char *lp_remote_announce(void);
2760 char *lp_remote_browse_sync(void);
2761 bool lp_nmbd_bind_explicit_broadcast(void);
2762 const char **lp_wins_server_list(void);
2763 const char **lp_interfaces(void);
2764 const char *lp_socket_address(void);
2765 char *lp_nis_home_map_name(void);
2766 const char **lp_netbios_aliases(void);
2767 const char *lp_passdb_backend(void);
2768 const char **lp_preload_modules(void);
2769 char *lp_panic_action(void);
2770 char *lp_adduser_script(void);
2771 char *lp_renameuser_script(void);
2772 char *lp_deluser_script(void);
2773 const char *lp_guestaccount(void);
2774 char *lp_addgroup_script(void);
2775 char *lp_delgroup_script(void);
2776 char *lp_addusertogroup_script(void);
2777 char *lp_deluserfromgroup_script(void);
2778 char *lp_setprimarygroup_script(void);
2779 char *lp_addmachine_script(void);
2780 char *lp_shutdown_script(void);
2781 char *lp_abort_shutdown_script(void);
2782 char *lp_username_map_script(void);
2783 int lp_username_map_cache_time(void);
2784 char *lp_check_password_script(void);
2785 char *lp_wins_hook(void);
2786 const char *lp_template_homedir(void);
2787 const char *lp_template_shell(void);
2788 const char *lp_winbind_separator(void);
2789 int lp_acl_compatibility(void);
2790 bool lp_winbind_enum_users(void);
2791 bool lp_winbind_enum_groups(void);
2792 bool lp_winbind_use_default_domain(void);
2793 bool lp_winbind_trusted_domains_only(void);
2794 bool lp_winbind_nested_groups(void);
2795 int lp_winbind_expand_groups(void);
2796 bool lp_winbind_refresh_tickets(void);
2797 bool lp_winbind_offline_logon(void);
2798 bool lp_winbind_normalize_names(void);
2799 bool lp_winbind_rpc_only(void);
2800 bool lp_create_krb5_conf(void);
2801 int lp_winbind_max_domain_connections(void);
2802 const char *lp_idmap_backend(void);
2803 int lp_idmap_cache_time(void);
2804 int lp_idmap_negative_cache_time(void);
2805 int lp_keepalive(void);
2806 bool lp_passdb_expand_explicit(void);
2807 char *lp_ldap_suffix(void);
2808 char *lp_ldap_admin_dn(void);
2809 int lp_ldap_ssl(void);
2810 bool lp_ldap_ssl_ads(void);
2811 int lp_ldap_deref(void);
2812 int lp_ldap_follow_referral(void);
2813 int lp_ldap_passwd_sync(void);
2814 bool lp_ldap_delete_dn(void);
2815 int lp_ldap_replication_sleep(void);
2816 int lp_ldap_timeout(void);
2817 int lp_ldap_connection_timeout(void);
2818 int lp_ldap_page_size(void);
2819 int lp_ldap_debug_level(void);
2820 int lp_ldap_debug_threshold(void);
2821 char *lp_add_share_cmd(void);
2822 char *lp_change_share_cmd(void);
2823 char *lp_delete_share_cmd(void);
2824 char *lp_usershare_path(void);
2825 const char **lp_usershare_prefix_allow_list(void);
2826 const char **lp_usershare_prefix_deny_list(void);
2827 const char **lp_eventlog_list(void);
2828 bool lp_registry_shares(void);
2829 bool lp_usershare_allow_guests(void);
2830 bool lp_usershare_owner_only(void);
2831 bool lp_disable_netbios(void);
2832 bool lp_reset_on_zero_vc(void);
2833 bool lp_log_writeable_files_on_exit(void);
2834 bool lp_ms_add_printer_wizard(void);
2835 bool lp_dns_proxy(void);
2836 bool lp_wins_support(void);
2837 bool lp_we_are_a_wins_server(void);
2838 bool lp_wins_proxy(void);
2839 bool lp_local_master(void);
2840 bool lp_domain_logons(void);
2841 const char **lp_init_logon_delayed_hosts(void);
2842 int lp_init_logon_delay(void);
2843 bool lp_load_printers(void);
2844 bool lp_readraw(void);
2845 bool _lp_readraw(void);
2846 bool lp_large_readwrite(void);
2847 bool lp_writeraw(void);
2848 bool _lp_writeraw(void);
2849 bool lp_null_passwords(void);
2850 bool lp_obey_pam_restrictions(void);
2851 bool lp_encrypted_passwords(void);
2852 int lp_client_schannel(void);
2853 int lp_server_schannel(void);
2854 bool lp_syslog_only(void);
2855 bool lp_timestamp_logs(void);
2856 bool lp_debug_prefix_timestamp(void);
2857 bool lp_debug_hires_timestamp(void);
2858 bool lp_debug_pid(void);
2859 bool lp_debug_uid(void);
2860 bool lp_debug_class(void);
2861 bool lp_enable_core_files(void);
2862 bool lp_browse_list(void);
2863 bool lp_nis_home_map(void);
2864 bool lp_bind_interfaces_only(void);
2865 bool lp_pam_password_change(void);
2866 bool lp_unix_password_sync(void);
2867 bool lp_passwd_chat_debug(void);
2868 int lp_passwd_chat_timeout(void);
2869 bool lp_nt_pipe_support(void);
2870 bool lp_nt_status_support(void);
2871 bool lp_stat_cache(void);
2872 int lp_max_stat_cache_size(void);
2873 bool lp_allow_trusted_domains(void);
2874 bool lp_map_untrusted_to_domain(void);
2875 int lp_restrict_anonymous(void);
2876 bool lp_lanman_auth(void);
2877 bool lp_ntlm_auth(void);
2878 bool lp_client_plaintext_auth(void);
2879 bool lp_client_lanman_auth(void);
2880 bool lp_client_ntlmv2_auth(void);
2881 bool lp_host_msdfs(void);
2882 bool lp_kernel_oplocks(void);
2883 bool lp_enhanced_browsing(void);
2884 bool lp_use_mmap(void);
2885 bool lp_unix_extensions(void);
2886 bool lp_use_spnego(void);
2887 bool lp_client_use_spnego(void);
2888 bool lp_client_use_spnego_principal(void);
2889 bool lp_send_spnego_principal(void);
2890 bool lp_hostname_lookups(void);
2891 bool lp_change_notify(const struct share_params *p );
2892 bool lp_kernel_change_notify(const struct share_params *p );
2893 char * lp_dedicated_keytab_file(void);
2894 int lp_kerberos_method(void);
2895 bool lp_defer_sharing_violations(void);
2896 bool lp_enable_privileges(void);
2897 bool lp_enable_asu_support(void);
2898 int lp_os_level(void);
2899 int lp_max_ttl(void);
2900 int lp_max_wins_ttl(void);
2901 int lp_min_wins_ttl(void);
2902 int lp_max_log_size(void);
2903 int lp_max_open_files(void);
2904 int lp_open_files_db_hash_size(void);
2905 int lp_maxxmit(void);
2906 int lp_maxmux(void);
2907 int lp_passwordlevel(void);
2908 int lp_usernamelevel(void);
2909 int lp_deadtime(void);
2910 bool lp_getwd_cache(void);
2911 int lp_maxprotocol(void);
2912 int lp_minprotocol(void);
2913 int lp_security(void);
2914 const char **lp_auth_methods(void);
2915 bool lp_paranoid_server_security(void);
2916 int lp_maxdisksize(void);
2917 int lp_lpqcachetime(void);
2918 int lp_max_smbd_processes(void);
2919 bool _lp_disable_spoolss(void);
2920 int lp_syslog(void);
2921 int lp_lm_announce(void);
2922 int lp_lm_interval(void);
2923 int lp_machine_password_timeout(void);
2924 int lp_map_to_guest(void);
2925 int lp_oplock_break_wait_time(void);
2926 int lp_lock_spin_time(void);
2927 int lp_usershare_max_shares(void);
2928 const char *lp_socket_options(void);
2929 int lp_config_backend(void);
2930 int lp_smb2_max_read(void);
2931 int lp_smb2_max_write(void);
2932 int lp_smb2_max_trans(void);
2933 int lp_smb2_max_credits(void);
2934 char *lp_preexec(int );
2935 char *lp_postexec(int );
2936 char *lp_rootpreexec(int );
2937 char *lp_rootpostexec(int );
2938 char *lp_servicename(int );
2939 const char *lp_const_servicename(int );
2940 char *lp_pathname(int );
2941 char *lp_dontdescend(int );
2942 char *lp_username(int );
2943 const char **lp_invalid_users(int );
2944 const char **lp_valid_users(int );
2945 const char **lp_admin_users(int );
2946 const char **lp_svcctl_list(void);
2947 char *lp_cups_options(int );
2948 char *lp_cups_server(void);
2949 int lp_cups_encrypt(void);
2950 char *lp_iprint_server(void);
2951 int lp_cups_connection_timeout(void);
2952 const char *lp_ctdbd_socket(void);
2953 const char **lp_cluster_addresses(void);
2954 bool lp_clustering(void);
2955 int lp_ctdb_timeout(void);
2956 int lp_ctdb_locktime_warn_threshold(void);
2957 char *lp_printcommand(int );
2958 char *lp_lpqcommand(int );
2959 char *lp_lprmcommand(int );
2960 char *lp_lppausecommand(int );
2961 char *lp_lpresumecommand(int );
2962 char *lp_queuepausecommand(int );
2963 char *lp_queueresumecommand(int );
2964 const char *lp_printjob_username(int );
2965 const char **lp_hostsallow(int );
2966 const char **lp_hostsdeny(int );
2967 char *lp_magicscript(int );
2968 char *lp_magicoutput(int );
2969 char *lp_comment(int );
2970 char *lp_force_user(int );
2971 char *lp_force_group(int );
2972 const char **lp_readlist(int );
2973 const char **lp_writelist(int );
2974 const char **lp_printer_admin(int );
2975 char *lp_fstype(int );
2976 const char **lp_vfs_objects(int );
2977 char *lp_msdfs_proxy(int );
2978 char *lp_veto_files(int );
2979 char *lp_hide_files(int );
2980 char *lp_veto_oplocks(int );
2981 bool lp_msdfs_root(int );
2982 char *lp_aio_write_behind(int );
2983 char *lp_dfree_command(int );
2984 bool lp_autoloaded(int );
2985 bool lp_preexec_close(int );
2986 bool lp_rootpreexec_close(int );
2987 int lp_casesensitive(int );
2988 bool lp_preservecase(int );
2989 bool lp_shortpreservecase(int );
2990 bool lp_hide_dot_files(int );
2991 bool lp_hide_special_files(int );
2992 bool lp_hideunreadable(int );
2993 bool lp_hideunwriteable_files(int );
2994 bool lp_browseable(int );
2995 bool lp_access_based_share_enum(int );
2996 bool lp_readonly(int );
2997 bool lp_no_set_dir(int );
2998 bool lp_guest_ok(int );
2999 bool lp_guest_only(int );
3000 bool lp_administrative_share(int );
3001 bool lp_print_ok(int );
3002 bool lp_print_notify_backchannel(int );
3003 bool lp_map_hidden(int );
3004 bool lp_map_archive(int );
3005 bool lp_store_dos_attributes(int );
3006 bool lp_dmapi_support(int );
3007 bool lp_locking(const struct share_params *p );
3008 int lp_strict_locking(const struct share_params *p );
3009 bool lp_posix_locking(const struct share_params *p );
3010 bool lp_share_modes(int );
3011 bool lp_oplocks(int );
3012 bool lp_level2_oplocks(int );
3013 bool lp_onlyuser(int );
3014 bool lp_manglednames(const struct share_params *p );
3015 bool lp_widelinks(int );
3016 bool lp_symlinks(int );
3017 bool lp_syncalways(int );
3018 bool lp_strict_allocate(int );
3019 bool lp_strict_sync(int );
3020 bool lp_map_system(int );
3021 bool lp_delete_readonly(int );
3022 bool lp_fake_oplocks(int );
3023 bool lp_recursive_veto_delete(int );
3024 bool lp_dos_filemode(int );
3025 bool lp_dos_filetimes(int );
3026 bool lp_dos_filetime_resolution(int );
3027 bool lp_fake_dir_create_times(int);
3028 bool lp_async_smb_echo_handler(void);
3029 bool lp_multicast_dns_register(void);
3030 bool lp_blocking_locks(int );
3031 bool lp_inherit_perms(int );
3032 bool lp_inherit_acls(int );
3033 bool lp_inherit_owner(int );
3034 bool lp_use_client_driver(int );
3035 bool lp_default_devmode(int );
3036 bool lp_force_printername(int );
3037 bool lp_nt_acl_support(int );
3038 bool lp_force_unknown_acl_user(int );
3039 bool lp_ea_support(int );
3040 bool _lp_use_sendfile(int );
3041 bool lp_profile_acls(int );
3042 bool lp_map_acl_inherit(int );
3043 bool lp_afs_share(int );
3044 bool lp_acl_check_permissions(int );
3045 bool lp_acl_group_control(int );
3046 bool lp_acl_map_full_control(int );
3047 int lp_create_mask(int );
3048 int lp_force_create_mode(int );
3049 int lp_security_mask(int );
3050 int lp_force_security_mode(int );
3051 int lp_dir_mask(int );
3052 int lp_force_dir_mode(int );
3053 int lp_dir_security_mask(int );
3054 int lp_force_dir_security_mode(int );
3055 int lp_max_connections(int );
3056 int lp_defaultcase(int );
3057 int lp_minprintspace(int );
3058 int lp_printing(int );
3059 int lp_max_reported_jobs(int );
3060 int lp_oplock_contention_limit(int );
3061 int lp_csc_policy(int );
3062 int lp_write_cache_size(int );
3063 int lp_block_size(int );
3064 int lp_dfree_cache_time(int );
3065 int lp_allocation_roundup_size(int );
3066 int lp_aio_read_size(int );
3067 int lp_aio_write_size(int );
3068 int lp_map_readonly(int );
3069 int lp_directory_name_cache_size(int );
3070 int lp_smb_encrypt(int );
3071 char lp_magicchar(const struct share_params *p );
3072 int lp_winbind_cache_time(void);
3073 int lp_winbind_reconnect_delay(void);
3074 int lp_winbind_max_clients(void);
3075 const char **lp_winbind_nss_info(void);
3076 int lp_algorithmic_rid_base(void);
3077 int lp_name_cache_timeout(void);
3078 int lp_client_signing(void);
3079 int lp_server_signing(void);
3080 int lp_client_ldap_sasl_wrapping(void);
3081 char *lp_parm_talloc_string(int snum, const char *type, const char *option, const char *def);
3082 const char *lp_parm_const_string(int snum, const char *type, const char *option, const char *def);
3083 const char **lp_parm_string_list(int snum, const char *type, const char *option, const char **def);
3084 int lp_parm_int(int snum, const char *type, const char *option, int def);
3085 unsigned long lp_parm_ulong(int snum, const char *type, const char *option, unsigned long def);
3086 bool lp_parm_bool(int snum, const char *type, const char *option, bool def);
3087 int lp_parm_enum(int snum, const char *type, const char *option,
3088 const struct enum_list *_enum, int def);
3089 char *canonicalize_servicename(TALLOC_CTX *ctx, const char *src);
3090 bool lp_add_home(const char *pszHomename, int iDefaultService,
3091 const char *user, const char *pszHomedir);
3092 int lp_add_service(const char *pszService, int iDefaultService);
3093 bool lp_add_printer(const char *pszPrintername, int iDefaultService);
3094 bool lp_parameter_is_valid(const char *pszParmName);
3095 bool lp_parameter_is_global(const char *pszParmName);
3096 bool lp_parameter_is_canonical(const char *parm_name);
3097 bool lp_canonicalize_parameter(const char *parm_name, const char **canon_parm,
3099 bool lp_canonicalize_parameter_with_value(const char *parm_name,
3101 const char **canon_parm,
3102 const char **canon_val);
3103 void show_parameter_list(void);
3104 bool lp_string_is_valid_boolean(const char *parm_value);
3105 bool lp_invert_boolean(const char *str, const char **inverse_str);
3106 bool lp_canonicalize_boolean(const char *str, const char**canon_str);
3107 bool service_ok(int iService);
3108 bool process_registry_service(const char *service_name);
3109 bool process_registry_shares(void);
3110 bool lp_config_backend_is_registry(void);
3111 bool lp_config_backend_is_file(void);
3112 bool lp_file_list_changed(void);
3113 bool lp_idmap_uid(uid_t *low, uid_t *high);
3114 bool lp_idmap_gid(gid_t *low, gid_t *high);
3115 const char *lp_ldap_machine_suffix(void);
3116 const char *lp_ldap_user_suffix(void);
3117 const char *lp_ldap_group_suffix(void);
3118 const char *lp_ldap_idmap_suffix(void);
3119 void *lp_local_ptr_by_snum(int snum, void *ptr);
3120 bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue);
3121 bool lp_set_cmdline(const char *pszParmName, const char *pszParmValue);
3122 bool lp_set_option(const char *option);
3123 void init_locals(void);
3124 bool lp_is_default(int snum, struct parm_struct *parm);
3125 bool dump_a_parameter(int snum, char *parm_name, FILE * f, bool isGlobal);
3126 struct parm_struct *lp_get_parameter(const char *param_name);
3127 struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters);
3128 bool lp_snum_ok(int iService);
3129 void lp_add_one_printer(const char *name, const char *comment, void *pdata);
3130 bool lp_loaded(void);
3131 void lp_killunused(bool (*snumused) (int));
3132 void lp_kill_all_services(void);
3133 void lp_killservice(int iServiceIn);
3134 const char* server_role_str(uint32 role);
3135 enum usershare_err parse_usershare_file(TALLOC_CTX *ctx,
3136 SMB_STRUCT_STAT *psbuf,
3137 const char *servicename,
3141 char **pp_sharepath,
3143 char **pp_cp_share_name,
3144 struct security_descriptor **ppsd,
3145 bool *pallow_guest);
3146 int load_usershare_service(const char *servicename);
3147 int load_usershare_shares(void);
3148 void gfree_loadparm(void);
3149 void lp_set_in_client(bool b);
3150 bool lp_is_in_client(void);
3151 bool lp_load(const char *pszFname,
3155 bool initialize_globals);
3156 bool lp_load_initial_only(const char *pszFname);
3157 bool lp_load_with_registry_shares(const char *pszFname,
3161 bool initialize_globals);
3162 int lp_numservices(void);
3163 void lp_dump(FILE *f, bool show_defaults, int maxtoprint);
3164 void lp_dump_one(FILE * f, bool show_defaults, int snum);
3165 int lp_servicenumber(const char *pszServiceName);
3166 bool share_defined(const char *service_name);
3167 struct share_params *get_share_params(TALLOC_CTX *mem_ctx,
3168 const char *sharename);
3169 struct share_iterator *share_list_all(TALLOC_CTX *mem_ctx);
3170 struct share_params *next_share(struct share_iterator *list);
3171 struct share_params *next_printer(struct share_iterator *list);
3172 struct share_params *snum2params_static(int snum);
3173 const char *volume_label(int snum);
3174 bool lp_domain_master(void);
3175 bool lp_domain_master_true_or_auto(void);
3176 bool lp_preferred_master(void);
3177 void lp_remove_service(int snum);
3178 void lp_copy_service(int snum, const char *new_name);
3179 int lp_default_server_announce(void);
3180 int lp_major_announce_version(void);
3181 int lp_minor_announce_version(void);
3182 void lp_set_name_resolve_order(const char *new_order);
3183 const char *lp_printername(int snum);
3184 void lp_set_logfile(const char *name);
3185 int lp_maxprintjobs(int snum);
3186 const char *lp_printcapname(void);
3187 bool lp_disable_spoolss( void );
3188 void lp_set_spoolss_state( uint32 state );
3189 uint32 lp_get_spoolss_state( void );
3190 bool lp_use_sendfile(int snum, struct smb_signing_state *signing_state);
3191 void set_use_sendfile(int snum, bool val);
3192 void set_store_dos_attributes(int snum, bool val);
3193 void lp_set_mangling_method(const char *new_method);
3194 bool lp_posix_pathnames(void);
3195 void lp_set_posix_pathnames(void);
3196 enum brl_flavour lp_posix_cifsu_locktype(files_struct *fsp);
3197 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val);
3198 int lp_min_receive_file_size(void);
3199 char* lp_perfcount_module(void);
3200 void lp_set_passdb_backend(const char *backend);
3201 void widelinks_warning(int snum);
3202 char *lp_ncalrpc_dir(void);
3204 /* The following definitions come from param/loadparm_server_role.c */
3206 int lp_server_role(void);
3207 void set_server_role(void);
3209 /* The following definitions come from param/util.c */
3211 uint32 get_int_param( const char* param );
3212 char* get_string_param( const char* param );
3214 /* The following definitions come from profile/profile.c */
3216 void set_profile_level(int level, struct server_id src);
3217 bool profile_setup(struct messaging_context *msg_ctx, bool rdonly);
3219 /* The following definitions come from librpc/rpc/rpc_common.c */
3221 bool smb_register_ndr_interface(const struct ndr_interface_table *interface);
3222 const struct ndr_interface_table *get_iface_from_syntax(
3223 const struct ndr_syntax_id *syntax);
3224 const char *get_pipe_name_from_syntax(TALLOC_CTX *mem_ctx,
3225 const struct ndr_syntax_id *syntax);
3227 /* The following definitions come from rpc_server/rpc_ncacn_np.c */
3229 struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx,
3230 const struct ndr_syntax_id *syntax,
3231 struct client_address *client_id,
3232 const struct auth_serversupplied_info *session_info,
3233 struct messaging_context *msg_ctx);
3234 NTSTATUS rpcint_binding_handle(TALLOC_CTX *mem_ctx,
3235 const struct ndr_interface_table *ndr_table,
3236 struct client_address *client_id,
3237 const struct auth_serversupplied_info *session_info,
3238 struct messaging_context *msg_ctx,
3239 struct dcerpc_binding_handle **binding_handle);
3240 NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx,
3241 const struct ndr_syntax_id *abstract_syntax,
3242 const struct auth_serversupplied_info *serversupplied_info,
3243 struct client_address *client_id,
3244 struct messaging_context *msg_ctx,
3245 struct rpc_pipe_client **presult);
3246 NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx,
3247 const struct ndr_syntax_id *syntax,
3248 const struct auth_serversupplied_info *session_info,
3249 struct client_address *client_id,
3250 struct messaging_context *msg_ctx,
3251 struct rpc_pipe_client **cli_pipe);
3253 /* The following definitions come from rpc_client/cli_pipe_schannel.c */
3255 NTSTATUS get_schannel_session_key(struct cli_state *cli,
3258 struct rpc_pipe_client **presult);
3260 /* The following definitions come from rpc_client/rpc_transport_np.c */
3262 struct tevent_req *rpc_transport_np_init_send(TALLOC_CTX *mem_ctx,
3263 struct event_context *ev,
3264 struct cli_state *cli,
3265 const struct ndr_syntax_id *abstract_syntax);
3266 NTSTATUS rpc_transport_np_init_recv(struct tevent_req *req,
3267 TALLOC_CTX *mem_ctx,
3268 struct rpc_cli_transport **presult);
3269 NTSTATUS rpc_transport_np_init(TALLOC_CTX *mem_ctx, struct cli_state *cli,
3270 const struct ndr_syntax_id *abstract_syntax,
3271 struct rpc_cli_transport **presult);
3273 /* The following definitions come from rpc_client/rpc_transport_sock.c */
3275 NTSTATUS rpc_transport_sock_init(TALLOC_CTX *mem_ctx, int fd,
3276 struct rpc_cli_transport **presult);
3278 /* The following definitions come from rpc_client/rpc_transport_tstream.c */
3280 NTSTATUS rpc_transport_tstream_init(TALLOC_CTX *mem_ctx,
3281 struct tstream_context **stream,
3282 struct rpc_cli_transport **presult);
3283 struct cli_state *rpc_pipe_np_smb_conn(struct rpc_pipe_client *p);
3285 /* The following definitions come from rpc_server/srv_eventlog_nt.c */
3287 /* The following definitions come from rpc_server/rpc_handles.c */
3289 size_t num_pipe_handles(struct pipes_struct *p);
3290 bool init_pipe_handles(struct pipes_struct *p, const struct ndr_syntax_id *syntax);
3291 bool create_policy_hnd(struct pipes_struct *p, struct policy_handle *hnd, void *data_ptr);
3292 bool find_policy_by_hnd(struct pipes_struct *p, const struct policy_handle *hnd,
3294 bool close_policy_hnd(struct pipes_struct *p, struct policy_handle *hnd);
3295 void close_policy_by_pipe(struct pipes_struct *p);
3296 bool pipe_access_check(struct pipes_struct *p);
3298 void *_policy_handle_create(struct pipes_struct *p, struct policy_handle *hnd,
3299 uint32_t access_granted, size_t data_size,
3300 const char *type, NTSTATUS *pstatus);
3301 #define policy_handle_create(_p, _hnd, _access, _type, _pstatus) \
3302 (_type *)_policy_handle_create((_p), (_hnd), (_access), sizeof(_type), #_type, \
3305 void *_policy_handle_find(struct pipes_struct *p,
3306 const struct policy_handle *hnd,
3307 uint32_t access_required, uint32_t *paccess_granted,
3308 const char *name, const char *location,
3310 #define policy_handle_find(_p, _hnd, _access_required, _access_granted, _type, _pstatus) \
3311 (_type *)_policy_handle_find((_p), (_hnd), (_access_required), \
3312 (_access_granted), #_type, __location__, (_pstatus))
3315 /* The following definitions come from rpc_server/srv_rpc_register.c */
3317 struct rpc_srv_callbacks {
3318 bool (*init)(void *private_data);
3319 bool (*shutdown)(void *private_data);
3323 NTSTATUS rpc_srv_register(int version, const char *clnt,
3325 const struct ndr_interface_table *iface,
3326 const struct api_struct *cmds, int size,
3327 const struct rpc_srv_callbacks *rpc_srv_cb);
3329 NTSTATUS rpc_srv_unregister(const struct ndr_interface_table *iface);
3331 /* The following definitions come from rpc_server/srv_pipe.c */
3333 bool create_next_pdu(struct pipes_struct *p);
3334 bool api_pipe_bind_auth3(struct pipes_struct *p, struct ncacn_packet *pkt);
3335 bool setup_fault_pdu(struct pipes_struct *p, NTSTATUS status);
3336 NTSTATUS rpc_pipe_register_commands(int version, const char *clnt,
3338 const struct ndr_syntax_id *interface,
3339 const struct api_struct *cmds, int size);
3340 bool is_known_pipename(const char *cli_filename, struct ndr_syntax_id *syntax);
3342 /* The following definitions come from rpc_server/srv_pipe_hnd.c */
3344 struct pipes_struct *get_first_internal_pipe(void);
3345 struct pipes_struct *get_next_internal_pipe(struct pipes_struct *p);
3346 bool check_open_pipes(void);
3347 int close_internal_rpc_pipe_hnd(struct pipes_struct *p);
3349 bool fsp_is_np(struct files_struct *fsp);
3350 struct tsocket_address;
3351 NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name,
3352 const struct tsocket_address *local_address,
3353 const struct tsocket_address *remote_address,
3354 struct client_address *client_id,
3355 struct auth_serversupplied_info *session_info,
3356 struct messaging_context *msg_ctx,
3357 struct fake_file_handle **phandle);
3358 bool np_read_in_progress(struct fake_file_handle *handle);
3359 struct tevent_req *np_write_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
3360 struct fake_file_handle *handle,
3361 const uint8_t *data, size_t len);
3362 NTSTATUS np_write_recv(struct tevent_req *req, ssize_t *pnwritten);
3363 struct tevent_req *np_read_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
3364 struct fake_file_handle *handle,
3365 uint8_t *data, size_t len);
3366 NTSTATUS np_read_recv(struct tevent_req *req, ssize_t *nread,
3367 bool *is_data_outstanding);
3369 ssize_t process_incoming_data(struct pipes_struct *p, char *data, size_t n);
3371 /* The following definitions come from rpc_server/srv_spoolss_nt.c */
3372 void srv_spoolss_cleanup(void);
3374 void do_drv_upgrade_printer(struct messaging_context *msg,
3377 struct server_id server_id,
3379 void update_monitored_printq_cache(struct messaging_context *msg_ctx);
3381 /* The following definitions come from rpc_server/srv_srvsvc_nt.c */
3383 char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname);
3385 /* The following definitions come from rpc_server/srv_svcctl_nt.c */
3387 bool init_service_op_table( void );
3388 bool shutdown_service_op_table(void);
3390 /* The following definitions come from rpcclient/cmd_dfs.c */
3393 /* The following definitions come from rpcclient/cmd_dssetup.c */
3396 /* The following definitions come from rpcclient/cmd_echo.c */
3399 /* The following definitions come from rpcclient/cmd_lsarpc.c */
3402 /* The following definitions come from rpcclient/cmd_netlogon.c */
3405 /* The following definitions come from rpcclient/cmd_ntsvcs.c */
3408 /* The following definitions come from rpcclient/cmd_samr.c */
3411 /* The following definitions come from rpcclient/cmd_shutdown.c */
3414 /* The following definitions come from rpcclient/cmd_spoolss.c */
3417 /* The following definitions come from rpcclient/cmd_srvsvc.c */
3420 /* The following definitions come from rpcclient/cmd_test.c */
3423 /* The following definitions come from rpcclient/cmd_wkssvc.c */
3426 /* The following definitions come from rpcclient/rpcclient.c */
3429 /* The following definitions come from services/svc_netlogon.c */
3432 /* The following definitions come from services/svc_rcinit.c */
3435 /* The following definitions come from services/svc_spoolss.c */
3438 /* The following definitions come from services/svc_winreg.c */
3441 /* The following definitions come from services/svc_wins.c */
3444 /* The following definitions come from smbd/aio.c */
3446 NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
3447 struct smb_request *req,
3448 files_struct *fsp, SMB_OFF_T startpos,
3450 NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
3451 struct smb_request *req,
3452 files_struct *fsp, char *data,
3455 NTSTATUS schedule_smb2_aio_read(connection_struct *conn,
3456 struct smb_request *smbreq,
3459 DATA_BLOB *preadbuf,
3462 NTSTATUS schedule_aio_smb2_write(connection_struct *conn,
3463 struct smb_request *smbreq,
3467 bool write_through);
3468 int wait_for_aio_completion(files_struct *fsp);
3469 void cancel_aio_by_fsp(files_struct *fsp);
3470 void smbd_aio_complete_aio_ex(struct aio_extra *aio_ex);
3472 /* The following definitions come from smbd/blocking.c */
3474 void brl_timeout_fn(struct event_context *event_ctx,
3475 struct timed_event *te,
3477 void *private_data);
3478 struct timeval timeval_brl_min(const struct timeval *tv1,
3479 const struct timeval *tv2);
3480 void process_blocking_lock_queue(struct smbd_server_connection *sconn);
3481 bool push_blocking_lock_request( struct byte_range_lock *br_lck,
3482 struct smb_request *req,
3487 enum brl_type lock_type,
3488 enum brl_flavour lock_flav,
3491 uint64_t blocking_smblctx);
3492 void cancel_pending_lock_requests_by_fid(files_struct *fsp,
3493 struct byte_range_lock *br_lck,
3494 enum file_close_type close_type);
3495 void remove_pending_lock_requests_by_mid_smb1(
3496 struct smbd_server_connection *sconn, uint64_t mid);
3497 bool blocking_lock_was_deferred_smb1(
3498 struct smbd_server_connection *sconn, uint64_t mid);
3499 struct blocking_lock_record *blocking_lock_cancel_smb1(files_struct *fsp,
3503 enum brl_flavour lock_flav,
3504 unsigned char locktype,
3507 /* The following definitions come from smbd/close.c */
3509 void set_close_write_time(struct files_struct *fsp, struct timespec ts);
3510 NTSTATUS close_file(struct smb_request *req, files_struct *fsp,
3511 enum file_close_type close_type);
3512 void msg_close_file(struct messaging_context *msg_ctx,
3515 struct server_id server_id,
3517 NTSTATUS delete_all_streams(connection_struct *conn, const char *fname);
3519 /* The following definitions come from smbd/conn.c */
3521 void conn_init(struct smbd_server_connection *sconn);
3522 int conn_num_open(struct smbd_server_connection *sconn);
3523 bool conn_snum_used(int snum);
3524 connection_struct *conn_find(struct smbd_server_connection *sconn,
3526 connection_struct *conn_new(struct smbd_server_connection *sconn);
3527 bool conn_close_all(struct smbd_server_connection *sconn);
3528 bool conn_idle_all(struct smbd_server_connection *sconn, time_t t);
3529 void conn_clear_vuid_caches(struct smbd_server_connection *sconn, uint16 vuid);
3530 void conn_free(connection_struct *conn);
3531 void msg_force_tdis(struct messaging_context *msg,
3534 struct server_id server_id,
3537 /* The following definitions come from smbd/connection.c */
3539 bool yield_connection(connection_struct *conn, const char *name);
3540 int count_current_connections( const char *sharename, bool clear );
3541 bool claim_connection(connection_struct *conn, const char *name);
3543 /* The following definitions come from smbd/dfree.c */
3545 uint64_t sys_disk_free(connection_struct *conn, const char *path, bool small_query,
3546 uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
3547 uint64_t get_dfree_info(connection_struct *conn,
3554 /* The following definitions come from smbd/dir.c */
3556 bool make_dir_struct(TALLOC_CTX *ctx,
3564 bool init_dptrs(struct smbd_server_connection *sconn);
3565 char *dptr_path(struct smbd_server_connection *sconn, int key);
3566 char *dptr_wcard(struct smbd_server_connection *sconn, int key);
3567 uint16 dptr_attr(struct smbd_server_connection *sconn, int key);
3568 void dptr_close(struct smbd_server_connection *sconn, int *key);
3569 void dptr_closecnum(connection_struct *conn);
3570 void dptr_idlecnum(connection_struct *conn);
3571 void dptr_closepath(struct smbd_server_connection *sconn,
3572 char *path,uint16 spid);
3573 NTSTATUS dptr_create(connection_struct *conn, files_struct *fsp,
3574 const char *path, bool old_handle, bool expect_close,uint16 spid,
3575 const char *wcard, bool wcard_has_wild, uint32 attr, struct dptr_struct **dptr_ret);
3576 void dptr_CloseDir(files_struct *fsp);
3577 void dptr_SeekDir(struct dptr_struct *dptr, long offset);
3578 long dptr_TellDir(struct dptr_struct *dptr);
3579 bool dptr_has_wild(struct dptr_struct *dptr);
3580 int dptr_dnum(struct dptr_struct *dptr);
3581 char *dptr_ReadDirName(TALLOC_CTX *ctx,
3582 struct dptr_struct *dptr,
3584 SMB_STRUCT_STAT *pst);
3585 bool dptr_SearchDir(struct dptr_struct *dptr, const char *name, long *poffset, SMB_STRUCT_STAT *pst);
3586 void dptr_DirCacheAdd(struct dptr_struct *dptr, const char *name, long offset);
3587 void dptr_init_search_op(struct dptr_struct *dptr);
3588 bool dptr_fill(struct smbd_server_connection *sconn,
3589 char *buf1,unsigned int key);
3590 struct dptr_struct *dptr_fetch(struct smbd_server_connection *sconn,
3591 char *buf,int *num);
3592 struct dptr_struct *dptr_fetch_lanman2(struct smbd_server_connection *sconn,
3594 bool dir_check_ftype(connection_struct *conn, uint32 mode, uint32 dirtype);
3595 bool get_dir_entry(TALLOC_CTX *ctx,
3596 struct dptr_struct *dirptr,
3599 char **pp_fname_out,
3602 struct timespec *date,
3604 bool ask_sharemode);
3605 bool is_visible_file(connection_struct *conn, const char *dir_path, const char *name, SMB_STRUCT_STAT *pst, bool use_veto);
3606 struct smb_Dir *OpenDir(TALLOC_CTX *mem_ctx, connection_struct *conn,
3607 const char *name, const char *mask, uint32 attr);
3608 const char *ReadDirName(struct smb_Dir *dirp, long *poffset,
3609 SMB_STRUCT_STAT *sbuf, char **talloced);
3610 void RewindDir(struct smb_Dir *dirp, long *poffset);
3611 void SeekDir(struct smb_Dir *dirp, long offset);
3612 long TellDir(struct smb_Dir *dirp);
3613 void DirCacheAdd(struct smb_Dir *dirp, const char *name, long offset);
3614 bool SearchDir(struct smb_Dir *dirp, const char *name, long *poffset);
3615 NTSTATUS can_delete_directory(struct connection_struct *conn,
3616 const char *dirname);
3618 /* The following definitions come from smbd/dmapi.c */
3620 const void *dmapi_get_current_session(void);
3621 bool dmapi_have_session(void);
3622 bool dmapi_new_session(void);
3623 bool dmapi_destroy_session(void);
3624 uint32 dmapi_file_flags(const char * const path);
3626 /* The following definitions come from smbd/dnsregister.c */
3628 bool smbd_setup_mdns_registration(struct tevent_context *ev,
3629 TALLOC_CTX *mem_ctx,
3632 /* The following definitions come from smbd/dosmode.c */
3634 mode_t unix_mode(connection_struct *conn, int dosmode,
3635 const struct smb_filename *smb_fname,
3636 const char *inherit_from_dir);
3637 uint32 dos_mode_msdfs(connection_struct *conn,
3638 const struct smb_filename *smb_fname);
3639 int dos_attributes_to_stat_dos_flags(uint32_t dosmode);
3640 uint32 dos_mode(connection_struct *conn, struct smb_filename *smb_fname);
3641 int file_set_dosmode(connection_struct *conn, struct smb_filename *smb_fname,
3642 uint32 dosmode, const char *parent_dir, bool newfile);
3643 NTSTATUS file_set_sparse(connection_struct *conn,
3644 struct files_struct *fsp,
3646 int file_ntimes(connection_struct *conn, const struct smb_filename *smb_fname,
3647 struct smb_file_time *ft);
3648 bool set_sticky_write_time_path(struct file_id fileid, struct timespec mtime);
3649 bool set_sticky_write_time_fsp(struct files_struct *fsp,
3650 struct timespec mtime);
3652 NTSTATUS set_create_timespec_ea(connection_struct *conn,
3653 const struct smb_filename *smb_fname,
3654 struct timespec create_time);
3656 struct timespec get_create_timespec(connection_struct *conn,
3657 struct files_struct *fsp,
3658 const struct smb_filename *smb_fname);
3660 struct timespec get_change_timespec(connection_struct *conn,
3661 struct files_struct *fsp,
3662 const struct smb_filename *smb_fname);
3664 /* The following definitions come from smbd/error.c */
3666 bool use_nt_status(void);
3667 void error_packet_set(char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatus, int line, const char *file);
3668 int error_packet(char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatus, int line, const char *file);
3669 void reply_nt_error(struct smb_request *req, NTSTATUS ntstatus,
3670 int line, const char *file);
3671 void reply_force_dos_error(struct smb_request *req, uint8 eclass, uint32 ecode,
3672 int line, const char *file);
3673 void reply_both_error(struct smb_request *req, uint8 eclass, uint32 ecode,
3674 NTSTATUS status, int line, const char *file);
3675 void reply_openerror(struct smb_request *req, NTSTATUS status);
3677 /* The following definitions come from smbd/file_access.c */
3679 bool can_access_file_acl(struct connection_struct *conn,
3680 const struct smb_filename *smb_fname,
3681 uint32_t access_mask);
3682 bool can_delete_file_in_directory(connection_struct *conn,
3683 struct smb_filename *smb_fname);
3684 bool can_access_file_data(connection_struct *conn,
3685 const struct smb_filename *smb_fname,
3686 uint32 access_mask);
3687 bool can_write_to_file(connection_struct *conn,
3688 const struct smb_filename *smb_fname);
3689 bool directory_has_default_acl(connection_struct *conn, const char *fname);
3691 /* The following definitions come from smbd/fileio.c */
3693 ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n);
3694 void update_write_time_handler(struct event_context *ctx,
3695 struct timed_event *te,
3697 void *private_data);
3698 void trigger_write_time_update(struct files_struct *fsp);
3699 void trigger_write_time_update_immediate(struct files_struct *fsp);
3700 ssize_t write_file(struct smb_request *req,
3705 void delete_write_cache(files_struct *fsp);
3706 void set_filelen_write_cache(files_struct *fsp, SMB_OFF_T file_size);
3707 ssize_t flush_write_cache(files_struct *fsp, enum flush_reason_enum reason);
3708 NTSTATUS sync_file(connection_struct *conn, files_struct *fsp, bool write_through);
3709 int fsp_stat(files_struct *fsp);
3711 /* The following definitions come from smbd/filename.c */
3713 NTSTATUS unix_convert(TALLOC_CTX *ctx,
3714 connection_struct *conn,
3715 const char *orig_path,
3716 struct smb_filename **smb_fname,
3717 uint32_t ucf_flags);
3718 NTSTATUS check_name(connection_struct *conn, const char *name);
3719 int get_real_filename(connection_struct *conn, const char *path,
3720 const char *name, TALLOC_CTX *mem_ctx,
3722 NTSTATUS filename_convert(TALLOC_CTX *mem_ctx,
3723 connection_struct *conn,
3725 const char *name_in,
3727 bool *ppath_contains_wcard,
3728 struct smb_filename **pp_smb_fname);
3730 /* The following definitions come from smbd/files.c */
3732 NTSTATUS file_new(struct smb_request *req, connection_struct *conn,
3733 files_struct **result);
3734 void file_close_conn(connection_struct *conn);
3735 void file_close_pid(struct smbd_server_connection *sconn, uint16 smbpid,
3737 bool file_init(struct smbd_server_connection *sconn);
3738 void file_close_user(struct smbd_server_connection *sconn, int vuid);
3739 struct files_struct *files_forall(
3740 struct smbd_server_connection *sconn,
3741 struct files_struct *(*fn)(struct files_struct *fsp,
3742 void *private_data),
3743 void *private_data);
3744 files_struct *file_find_fd(struct smbd_server_connection *sconn, int fd);
3745 files_struct *file_find_dif(struct smbd_server_connection *sconn,
3746 struct file_id id, unsigned long gen_id);
3747 files_struct *file_find_di_first(struct smbd_server_connection *sconn,
3749 files_struct *file_find_di_next(files_struct *start_fsp);
3750 bool file_find_subpath(files_struct *dir_fsp);
3751 void file_sync_all(connection_struct *conn);
3752 void file_free(struct smb_request *req, files_struct *fsp);
3753 files_struct *file_fsp(struct smb_request *req, uint16 fid);
3754 NTSTATUS dup_file_fsp(struct smb_request *req, files_struct *from,
3755 uint32 access_mask, uint32 share_access,
3756 uint32 create_options, files_struct *to);
3757 NTSTATUS file_name_hash(connection_struct *conn,
3758 const char *name, uint32_t *p_name_hash);
3759 NTSTATUS fsp_set_smb_fname(struct files_struct *fsp,
3760 const struct smb_filename *smb_fname_in);
3762 /* The following definitions come from smbd/ipc.c */
3764 void send_trans_reply(connection_struct *conn,
3765 struct smb_request *req,
3766 char *rparam, int rparam_len,
3767 char *rdata, int rdata_len,
3768 bool buffer_too_large);
3769 void reply_trans(struct smb_request *req);
3770 void reply_transs(struct smb_request *req);
3772 /* The following definitions come from smbd/lanman.c */
3774 void api_reply(connection_struct *conn, uint16 vuid,
3775 struct smb_request *req,
3776 char *data, char *params,
3777 int tdscnt, int tpscnt,
3778 int mdrcnt, int mprcnt);
3780 /* The following definitions come from smbd/mangle.c */
3782 void mangle_reset_cache(void);
3783 void mangle_change_to_posix(void);
3784 bool mangle_is_mangled(const char *s, const struct share_params *p);
3785 bool mangle_is_8_3(const char *fname, bool check_case,
3786 const struct share_params *p);
3787 bool mangle_is_8_3_wildcards(const char *fname, bool check_case,
3788 const struct share_params *p);
3789 bool mangle_must_mangle(const char *fname,
3790 const struct share_params *p);
3791 bool mangle_lookup_name_from_8_3(TALLOC_CTX *ctx,
3793 char **out, /* talloced on the given context. */
3794 const struct share_params *p);
3795 bool name_to_8_3(const char *in,
3798 const struct share_params *p);
3800 /* The following definitions come from smbd/mangle_hash.c */
3802 const struct mangle_fns *mangle_hash_init(void);
3804 /* The following definitions come from smbd/mangle_hash2.c */
3806 const struct mangle_fns *mangle_hash2_init(void);
3807 const struct mangle_fns *posix_mangle_init(void);
3809 /* The following definitions come from auth/user_util.c */
3811 bool map_username(TALLOC_CTX *ctx, const char *user_in, char **p_user_out);
3813 /* The following definitions come from auth/user_krb5.c */
3814 struct PAC_LOGON_INFO;
3815 NTSTATUS get_user_from_kerberos_info(TALLOC_CTX *mem_ctx,
3816 const char *cli_name,
3817 const char *princ_name,
3818 struct PAC_LOGON_INFO *logon_info,
3820 bool *mapped_to_guest,
3824 struct passwd **_pw);
3825 NTSTATUS make_server_info_krb5(TALLOC_CTX *mem_ctx,
3830 struct PAC_LOGON_INFO *logon_info,
3831 bool mapped_to_guest,
3832 struct auth_serversupplied_info **server_info);
3834 /* The following definitions come from smbd/message.c */
3836 void reply_sends(struct smb_request *req);
3837 void reply_sendstrt(struct smb_request *req);
3838 void reply_sendtxt(struct smb_request *req);
3839 void reply_sendend(struct smb_request *req);
3841 /* The following definitions come from smbd/msdfs.c */
3843 bool is_msdfs_link(connection_struct *conn,
3845 SMB_STRUCT_STAT *sbufp);
3846 struct junction_map;
3847 NTSTATUS get_referred_path(TALLOC_CTX *ctx,
3848 const char *dfs_path,
3849 struct junction_map *jucn,
3851 bool *self_referralp);
3852 int setup_dfs_referral(connection_struct *orig_conn,
3853 const char *dfs_path,
3854 int max_referral_level,
3855 char **ppdata, NTSTATUS *pstatus);
3856 bool create_junction(TALLOC_CTX *ctx,
3857 const char *dfs_path,
3858 struct junction_map *jucn);
3859 bool create_msdfs_link(const struct junction_map *jucn);
3860 bool remove_msdfs_link(const struct junction_map *jucn);
3861 struct junction_map *enum_msdfs_links(TALLOC_CTX *ctx, size_t *p_num_jn);
3862 NTSTATUS resolve_dfspath(TALLOC_CTX *ctx,
3863 connection_struct *conn,
3865 const char *name_in,
3866 char **pp_name_out);
3867 NTSTATUS resolve_dfspath_wcard(TALLOC_CTX *ctx,
3868 connection_struct *conn,
3870 const char *name_in,
3873 bool *ppath_contains_wcard);
3874 NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
3875 connection_struct **pconn,
3878 const struct auth_serversupplied_info *session_info,
3881 /* The following definitions come from smbd/negprot.c */
3883 void reply_negprot(struct smb_request *req);
3885 /* The following definitions come from smbd/notify.c */
3887 void change_notify_reply(struct smb_request *req,
3888 NTSTATUS error_code,
3890 struct notify_change_buf *notify_buf,
3891 void (*reply_fn)(struct smb_request *req,
3892 NTSTATUS error_code,
3893 uint8_t *buf, size_t len));
3894 NTSTATUS change_notify_create(struct files_struct *fsp, uint32 filter,
3896 NTSTATUS change_notify_add_request(struct smb_request *req,
3898 uint32 filter, bool recursive,
3899 struct files_struct *fsp,
3900 void (*reply_fn)(struct smb_request *req,
3901 NTSTATUS error_code,
3902 uint8_t *buf, size_t len));
3903 void remove_pending_change_notify_requests_by_mid(
3904 struct smbd_server_connection *sconn, uint64_t mid);
3905 void remove_pending_change_notify_requests_by_fid(files_struct *fsp,
3907 void notify_fname(connection_struct *conn, uint32 action, uint32 filter,
3909 char *notify_filter_string(TALLOC_CTX *mem_ctx, uint32 filter);
3910 struct sys_notify_context *sys_notify_context_create(connection_struct *conn,
3911 TALLOC_CTX *mem_ctx,
3912 struct event_context *ev);
3913 NTSTATUS sys_notify_watch(struct sys_notify_context *ctx,
3914 struct notify_entry *e,
3915 void (*callback)(struct sys_notify_context *ctx,
3917 struct notify_event *ev),
3918 void *private_data, void *handle);
3920 /* The following definitions come from smbd/notify_inotify.c */
3922 NTSTATUS inotify_watch(struct sys_notify_context *ctx,
3923 struct notify_entry *e,
3924 void (*callback)(struct sys_notify_context *ctx,
3926 struct notify_event *ev),
3930 /* The following definitions come from smbd/notify_internal.c */
3932 struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server,
3933 struct messaging_context *messaging_ctx,
3934 struct event_context *ev,
3935 connection_struct *conn);
3936 bool notify_internal_parent_init(TALLOC_CTX *mem_ctx);
3937 NTSTATUS notify_add(struct notify_context *notify, struct notify_entry *e0,
3938 void (*callback)(void *, const struct notify_event *),
3939 void *private_data);
3940 NTSTATUS notify_remove(struct notify_context *notify, void *private_data);
3941 NTSTATUS notify_remove_onelevel(struct notify_context *notify,
3942 const struct file_id *fid,
3943 void *private_data);
3944 void notify_onelevel(struct notify_context *notify, uint32_t action,
3945 uint32_t filter, struct file_id fid, const char *name);
3946 void notify_trigger(struct notify_context *notify,
3947 uint32_t action, uint32_t filter, const char *path);
3949 /* The following definitions come from smbd/ntquotas.c */
3951 int vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, struct dom_sid *psid, SMB_NTQUOTA_STRUCT *qt);
3952 int vfs_set_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, struct dom_sid *psid, SMB_NTQUOTA_STRUCT *qt);
3953 int vfs_get_user_ntquota_list(files_struct *fsp, SMB_NTQUOTA_LIST **qt_list);
3954 void *init_quota_handle(TALLOC_CTX *mem_ctx);
3956 /* The following definitions come from smbd/nttrans.c */
3958 void send_nt_replies(connection_struct *conn,
3959 struct smb_request *req, NTSTATUS nt_error,
3960 char *params, int paramsize,
3961 char *pdata, int datasize);
3962 void reply_ntcreate_and_X(struct smb_request *req);
3963 NTSTATUS set_sd(files_struct *fsp, uint8_t *data, uint32_t sd_len,
3964 uint32_t security_info_sent);
3965 struct ea_list *read_nttrans_ea_list(TALLOC_CTX *ctx, const char *pdata, size_t data_size);
3966 void reply_ntcancel(struct smb_request *req);
3967 void reply_ntrename(struct smb_request *req);
3968 NTSTATUS smbd_do_query_security_desc(connection_struct *conn,
3969 TALLOC_CTX *mem_ctx,
3971 uint32_t security_info_wanted,
3972 uint32_t max_data_count,
3973 uint8_t **ppmarshalled_sd,
3975 void reply_nttrans(struct smb_request *req);
3976 void reply_nttranss(struct smb_request *req);
3978 /* The following definitions come from smbd/open.c */
3980 NTSTATUS smb1_file_se_access_check(connection_struct *conn,
3981 const struct security_descriptor *sd,
3982 const struct security_token *token,
3983 uint32_t access_desired,
3984 uint32_t *access_granted);
3985 NTSTATUS fd_close(files_struct *fsp);
3986 void change_file_owner_to_parent(connection_struct *conn,
3987 const char *inherit_from_dir,
3989 NTSTATUS change_dir_owner_to_parent(connection_struct *conn,
3990 const char *inherit_from_dir,
3992 SMB_STRUCT_STAT *psbuf);
3993 bool is_executable(const char *fname);
3994 bool is_stat_open(uint32 access_mask);
3995 bool request_timed_out(struct timeval request_time,
3996 struct timeval timeout);
3997 bool open_match_attributes(connection_struct *conn,
3998 uint32 old_dos_attr,
3999 uint32 new_dos_attr,
4000 mode_t existing_unx_mode,
4001 mode_t new_unx_mode,
4002 mode_t *returned_unx_mode);
4003 NTSTATUS fcb_or_dos_open(struct smb_request *req,
4004 connection_struct *conn,
4005 files_struct *fsp_to_dup_into,
4006 const struct smb_filename *smb_fname,
4011 uint32 share_access,
4012 uint32 create_options);
4013 bool map_open_params_to_ntcreate(const struct smb_filename *smb_fname,
4014 int deny_mode, int open_func,
4015 uint32 *paccess_mask,
4016 uint32 *pshare_mode,
4017 uint32 *pcreate_disposition,
4018 uint32 *pcreate_options,
4019 uint32_t *pprivate_flags);
4020 void remove_deferred_open_entry(struct file_id id, uint64_t mid,
4021 struct server_id pid);
4022 NTSTATUS open_file_fchmod(connection_struct *conn,
4023 struct smb_filename *smb_fname,
4024 files_struct **result);
4025 NTSTATUS create_directory(connection_struct *conn, struct smb_request *req,
4026 struct smb_filename *smb_dname);
4027 void msg_file_was_renamed(struct messaging_context *msg,
4030 struct server_id server_id,
4032 NTSTATUS open_streams_for_delete(connection_struct *conn,
4034 NTSTATUS create_file_default(connection_struct *conn,
4035 struct smb_request *req,
4036 uint16_t root_dir_fid,
4037 struct smb_filename * smb_fname,
4038 uint32_t access_mask,
4039 uint32_t share_access,
4040 uint32_t create_disposition,
4041 uint32_t create_options,
4042 uint32_t file_attributes,
4043 uint32_t oplock_request,
4044 uint64_t allocation_size,
4045 uint32_t private_flags,
4046 struct security_descriptor *sd,
4047 struct ea_list *ea_list,
4049 files_struct **result,
4051 NTSTATUS get_relative_fid_filename(connection_struct *conn,
4052 struct smb_request *req,
4053 uint16_t root_dir_fid,
4054 const struct smb_filename *smb_fname,
4055 struct smb_filename **smb_fname_out);
4057 /* The following definitions come from smbd/oplock.c */
4059 int32 get_number_of_exclusive_open_oplocks(void);
4060 void break_kernel_oplock(struct messaging_context *msg_ctx, files_struct *fsp);
4061 bool set_file_oplock(files_struct *fsp, int oplock_type);
4062 void release_file_oplock(files_struct *fsp);
4063 bool remove_oplock(files_struct *fsp);
4064 bool downgrade_oplock(files_struct *fsp);
4065 bool should_notify_deferred_opens(void);
4066 void break_level2_to_none_async(files_struct *fsp);
4067 void reply_to_oplock_break_requests(files_struct *fsp);
4068 void process_oplock_async_level2_break_message(struct messaging_context *msg_ctx,
4071 struct server_id src,
4073 void contend_level2_oplocks_begin(files_struct *fsp,
4074 enum level2_contention_type type);
4075 void contend_level2_oplocks_end(files_struct *fsp,
4076 enum level2_contention_type type);
4077 void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e);
4078 void message_to_share_mode_entry(struct share_mode_entry *e, char *msg);
4079 bool init_oplocks(struct messaging_context *msg_ctx);
4081 /* The following definitions come from smbd/oplock_irix.c */
4083 struct kernel_oplocks *irix_init_kernel_oplocks(TALLOC_CTX *mem_ctx) ;
4085 /* The following definitions come from smbd/oplock_linux.c */
4087 void linux_set_lease_capability(void);
4088 int linux_set_lease_sighandler(int fd);
4089 int linux_setlease(int fd, int leasetype);
4090 struct kernel_oplocks *linux_init_kernel_oplocks(TALLOC_CTX *mem_ctx) ;
4092 /* The following definitions come from smbd/oplock_onefs.c */
4094 struct kernel_oplocks *onefs_init_kernel_oplocks(TALLOC_CTX *mem_ctx);
4096 /* The following definitions come from smbd/password.c */
4098 user_struct *get_valid_user_struct(struct smbd_server_connection *sconn,
4100 bool is_partial_auth_vuid(struct smbd_server_connection *sconn, uint16 vuid);
4101 user_struct *get_partial_auth_user_struct(struct smbd_server_connection *sconn,
4103 void invalidate_vuid(struct smbd_server_connection *sconn, uint16 vuid);
4104 void invalidate_all_vuids(struct smbd_server_connection *sconn);
4105 int register_initial_vuid(struct smbd_server_connection *sconn);
4106 int register_homes_share(const char *username);
4107 int register_existing_vuid(struct smbd_server_connection *sconn,
4109 struct auth_serversupplied_info *session_info,
4110 DATA_BLOB response_blob,
4111 const char *smb_name);
4112 void add_session_user(struct smbd_server_connection *sconn, const char *user);
4113 void add_session_workgroup(struct smbd_server_connection *sconn,
4114 const char *workgroup);
4115 const char *get_session_workgroup(struct smbd_server_connection *sconn);
4116 bool user_in_netgroup(TALLOC_CTX *ctx, const char *user, const char *ngname);
4117 bool user_in_list(TALLOC_CTX *ctx, const char *user,const char **list);
4118 bool authorise_login(struct smbd_server_connection *sconn,
4119 int snum, fstring user, DATA_BLOB password,
4122 /* The following definitions come from smbd/pipes.c */
4124 NTSTATUS open_np_file(struct smb_request *smb_req, const char *name,
4125 struct files_struct **pfsp);
4126 void reply_open_pipe_and_X(connection_struct *conn, struct smb_request *req);
4127 void reply_pipe_write(struct smb_request *req);
4128 void reply_pipe_write_and_X(struct smb_request *req);
4129 void reply_pipe_read_and_X(struct smb_request *req);
4131 /* The following definitions come from smbd/posix_acls.c */
4133 void create_file_sids(const SMB_STRUCT_STAT *psbuf, struct dom_sid *powner_sid, struct dom_sid *pgroup_sid);
4134 bool nt4_compatible_acls(void);
4135 uint32_t map_canon_ace_perms(int snum,
4136 enum security_ace_type *pacl_type,
4138 bool directory_ace);
4139 NTSTATUS unpack_nt_owners(connection_struct *conn, uid_t *puser, gid_t *pgrp, uint32 security_info_sent, const struct security_descriptor *psd);
4140 SMB_ACL_T free_empty_sys_acl(connection_struct *conn, SMB_ACL_T the_acl);
4141 NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info,
4142 struct security_descriptor **ppdesc);
4143 NTSTATUS posix_get_nt_acl(struct connection_struct *conn, const char *name,
4144 uint32_t security_info, struct security_descriptor **ppdesc);
4145 NTSTATUS try_chown(files_struct *fsp, uid_t uid, gid_t gid);
4146 NTSTATUS append_parent_acl(files_struct *fsp,
4147 const struct security_descriptor *pcsd,
4148 struct security_descriptor **pp_new_sd);
4149 NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, const struct security_descriptor *psd);
4150 int get_acl_group_bits( connection_struct *conn, const char *fname, mode_t *mode );
4151 int chmod_acl(connection_struct *conn, const char *name, mode_t mode);
4152 int inherit_access_posix_acl(connection_struct *conn, const char *inherit_from_dir,
4153 const char *name, mode_t mode);
4154 int fchmod_acl(files_struct *fsp, mode_t mode);
4155 bool set_unix_posix_default_acl(connection_struct *conn, const char *fname,
4156 const SMB_STRUCT_STAT *psbuf,
4157 uint16 num_def_acls, const char *pdata);
4158 bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp, const char *fname, uint16 num_acls, const char *pdata);
4159 struct security_descriptor *get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname);
4160 NTSTATUS make_default_filesystem_acl(TALLOC_CTX *ctx,
4162 SMB_STRUCT_STAT *psbuf,
4163 struct security_descriptor **ppdesc);
4165 /* The following definitions come from smbd/process.c */
4167 void smbd_setup_sig_term_handler(void);
4168 void smbd_setup_sig_hup_handler(struct tevent_context *ev,
4169 struct messaging_context *msg_ctx);
4170 bool srv_send_smb(struct smbd_server_connection *sconn, char *buffer,
4171 bool no_signing, uint32_t seqnum,
4173 struct smb_perfcount_data *pcd);
4174 int srv_set_message(char *buf,
4178 void remove_deferred_open_message_smb(uint64_t mid);
4179 void schedule_deferred_open_message_smb(uint64_t mid);
4180 bool open_was_deferred(uint64_t mid);
4181 bool get_deferred_open_message_state(struct smb_request *smbreq,
4182 struct timeval *p_request_time,
4184 bool push_deferred_open_message_smb(struct smb_request *req,
4185 struct timeval request_time,
4186 struct timeval timeout,
4190 struct idle_event *event_add_idle(struct event_context *event_ctx,
4191 TALLOC_CTX *mem_ctx,
4192 struct timeval interval,
4194 bool (*handler)(const struct timeval *now,
4195 void *private_data),
4196 void *private_data);
4197 NTSTATUS allow_new_trans(struct trans_state *list, uint64_t mid);
4198 void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes);
4199 const char *smb_fn_name(int type);
4200 void add_to_common_flags2(uint32 v);
4201 void remove_from_common_flags2(uint32 v);
4202 void construct_reply_common_req(struct smb_request *req, char *outbuf);
4203 size_t req_wct_ofs(struct smb_request *req);
4204 void chain_reply(struct smb_request *req);
4205 bool req_is_in_chain(struct smb_request *req);
4206 void smbd_process(struct smbd_server_connection *sconn);
4208 /* The following definitions come from smbd/quotas.c */
4210 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
4211 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
4212 bool disk_quotas(const char *path,
4216 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
4217 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
4218 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
4219 bool disk_quotas_vxfs(const char *name, char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
4220 bool disk_quotas(const char *path,uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
4221 bool disk_quotas(const char *path,uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
4223 /* The following definitions come from smbd/reply.c */
4225 NTSTATUS check_path_syntax(char *path);
4226 NTSTATUS check_path_syntax_wcard(char *path, bool *p_contains_wcard);
4227 NTSTATUS check_path_syntax_posix(char *path);
4228 size_t srvstr_get_path_wcard(TALLOC_CTX *ctx,
4236 bool *contains_wcard);
4237 size_t srvstr_get_path(TALLOC_CTX *ctx,
4245 size_t srvstr_get_path_req_wcard(TALLOC_CTX *mem_ctx, struct smb_request *req,
4246 char **pp_dest, const char *src, int flags,
4247 NTSTATUS *err, bool *contains_wcard);
4248 size_t srvstr_get_path_req(TALLOC_CTX *mem_ctx, struct smb_request *req,
4249 char **pp_dest, const char *src, int flags,
4251 bool check_fsp_open(connection_struct *conn, struct smb_request *req,
4253 bool check_fsp(connection_struct *conn, struct smb_request *req,
4255 bool check_fsp_ntquota_handle(connection_struct *conn, struct smb_request *req,
4257 void reply_special(struct smbd_server_connection *sconn, char *inbuf, size_t inbuf_len);
4258 void reply_tcon(struct smb_request *req);
4259 void reply_tcon_and_X(struct smb_request *req);
4260 void reply_unknown_new(struct smb_request *req, uint8 type);
4261 void reply_ioctl(struct smb_request *req);
4262 void reply_checkpath(struct smb_request *req);
4263 void reply_getatr(struct smb_request *req);
4264 void reply_setatr(struct smb_request *req);
4265 void reply_dskattr(struct smb_request *req);
4266 void reply_search(struct smb_request *req);
4267 void reply_fclose(struct smb_request *req);
4268 void reply_open(struct smb_request *req);
4269 void reply_open_and_X(struct smb_request *req);
4270 void reply_ulogoffX(struct smb_request *req);
4271 void reply_mknew(struct smb_request *req);
4272 void reply_ctemp(struct smb_request *req);
4273 NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req,
4274 uint32 dirtype, struct smb_filename *smb_fname,
4276 void reply_unlink(struct smb_request *req);
4277 ssize_t fake_sendfile(files_struct *fsp, SMB_OFF_T startpos, size_t nread);
4278 void sendfile_short_send(files_struct *fsp,
4282 void reply_readbraw(struct smb_request *req);
4283 void reply_lockread(struct smb_request *req);
4284 void reply_read(struct smb_request *req);
4285 void reply_read_and_X(struct smb_request *req);
4286 void error_to_writebrawerr(struct smb_request *req);
4287 void reply_writebraw(struct smb_request *req);
4288 void reply_writeunlock(struct smb_request *req);
4289 void reply_write(struct smb_request *req);
4290 bool is_valid_writeX_buffer(struct smbd_server_connection *sconn,
4291 const uint8_t *inbuf);
4292 void reply_write_and_X(struct smb_request *req);
4293 void reply_lseek(struct smb_request *req);
4294 void reply_flush(struct smb_request *req);
4295 void reply_exit(struct smb_request *req);
4296 void reply_close(struct smb_request *req);
4297 void reply_writeclose(struct smb_request *req);
4298 void reply_lock(struct smb_request *req);
4299 void reply_unlock(struct smb_request *req);
4300 void reply_tdis(struct smb_request *req);
4301 void reply_echo(struct smb_request *req);
4302 void reply_printopen(struct smb_request *req);
4303 void reply_printclose(struct smb_request *req);
4304 void reply_printqueue(struct smb_request *req);
4305 void reply_printwrite(struct smb_request *req);
4306 void reply_mkdir(struct smb_request *req);
4307 void reply_rmdir(struct smb_request *req);
4308 NTSTATUS rename_internals_fsp(connection_struct *conn,
4310 const struct smb_filename *smb_fname_dst_in,
4312 bool replace_if_exists);
4313 NTSTATUS rename_internals(TALLOC_CTX *ctx,
4314 connection_struct *conn,
4315 struct smb_request *req,
4316 struct smb_filename *smb_fname_src,
4317 struct smb_filename *smb_fname_dst,
4319 bool replace_if_exists,
4322 uint32_t access_mask);
4323 void reply_mv(struct smb_request *req);
4324 NTSTATUS copy_file(TALLOC_CTX *ctx,
4325 connection_struct *conn,
4326 struct smb_filename *smb_fname_src,
4327 struct smb_filename *smb_fname_dst,
4330 bool target_is_directory);
4331 void reply_copy(struct smb_request *req);
4332 uint64_t get_lock_pid(const uint8_t *data, int data_offset,
4333 bool large_file_format);
4334 uint64_t get_lock_count(const uint8_t *data, int data_offset,
4335 bool large_file_format);
4336 uint64_t get_lock_offset(const uint8_t *data, int data_offset,
4337 bool large_file_format, bool *err);
4338 void reply_lockingX(struct smb_request *req);
4339 void reply_readbmpx(struct smb_request *req);
4340 void reply_readbs(struct smb_request *req);
4341 void reply_setattrE(struct smb_request *req);
4342 void reply_writebmpx(struct smb_request *req);
4343 void reply_writebs(struct smb_request *req);
4344 void reply_getattrE(struct smb_request *req);
4346 /* The following definitions come from smbd/seal.c */
4348 uint16_t srv_enc_ctx(void);
4349 bool is_encrypted_packet(const uint8_t *inbuf);
4350 void srv_free_enc_buffer(char *buf);
4351 NTSTATUS srv_decrypt_buffer(char *buf);
4352 NTSTATUS srv_encrypt_buffer(char *buf, char **buf_out);
4353 NTSTATUS srv_request_encryption_setup(connection_struct *conn,
4354 unsigned char **ppdata,
4355 size_t *p_data_size,
4356 unsigned char **pparam,
4357 size_t *p_param_size);
4358 NTSTATUS srv_encryption_start(connection_struct *conn);
4359 void server_encryption_shutdown(void);
4361 /* The following definitions come from smbd/sec_ctx.c */
4363 bool unix_token_equal(const struct security_unix_token *t1, const struct security_unix_token *t2);
4364 bool push_sec_ctx(void);
4365 void set_sec_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups, struct security_token *token);
4366 void set_root_sec_ctx(void);
4367 bool pop_sec_ctx(void);
4368 void init_sec_ctx(void);
4370 /* The following definitions come from lib/server_contexts.c */
4371 struct tevent_context *server_event_context(void);
4372 void server_event_context_free(void);
4373 struct messaging_context *server_messaging_context(void);
4374 void server_messaging_context_free(void);
4376 /* The following definitions come from smbd/server.c */
4378 struct event_context *smbd_event_context(void);
4379 struct messaging_context *smbd_messaging_context(void);
4380 struct memcache *smbd_memcache(void);
4381 void reload_printers(struct tevent_context *ev,
4382 struct messaging_context *msg_ctx);
4383 bool reload_services(struct messaging_context *msg_ctx, int smb_sock,
4385 void reload_pcap_change_notify(struct tevent_context *ev,
4386 struct messaging_context *msg_ctx);
4387 void exit_server(const char *const explanation);
4388 void exit_server_cleanly(const char *const explanation);
4389 void exit_server_fault(void);
4391 /* The following definitions come from smbd/service.c */
4393 bool set_conn_connectpath(connection_struct *conn, const char *connectpath);
4394 NTSTATUS set_conn_force_user_group(connection_struct *conn, int snum);
4395 bool set_current_service(connection_struct *conn, uint16 flags, bool do_chdir);
4396 void load_registry_shares(void);
4397 int add_home_service(const char *service, const char *username, const char *homedir);
4398 int find_service(TALLOC_CTX *ctx, const char *service, char **p_service_out);
4399 connection_struct *make_connection_snum(struct smbd_server_connection *sconn,
4400 int snum, user_struct *vuser,
4404 connection_struct *make_connection(struct smbd_server_connection *sconn,
4405 const char *service_in, DATA_BLOB password,
4406 const char *pdev, uint16 vuid,
4408 void close_cnum(connection_struct *conn, uint16 vuid);
4410 /* The following definitions come from smbd/session.c */
4412 bool session_init(void);
4413 bool session_claim(struct smbd_server_connection *sconn, user_struct *vuser);
4414 void session_yield(user_struct *vuser);
4415 int list_sessions(TALLOC_CTX *mem_ctx, struct sessionid **session_list);
4417 /* The following definitions come from lib/sessionid_tdb.c */
4419 bool sessionid_init(void);
4420 struct db_record *sessionid_fetch_record(TALLOC_CTX *mem_ctx, const char *key);
4421 int sessionid_traverse(int (*fn)(struct db_record *rec, const char *key,
4422 struct sessionid *session,
4423 void *private_data),
4424 void *private_data);
4425 int sessionid_traverse_read(int (*fn)(const char *key,
4426 struct sessionid *session,
4427 void *private_data),
4428 void *private_data);
4430 /* The following definitions come from smbd/sesssetup.c */
4432 NTSTATUS do_map_to_guest(NTSTATUS status,
4433 struct auth_serversupplied_info **session_info,
4434 const char *user, const char *domain);
4436 NTSTATUS parse_spnego_mechanisms(TALLOC_CTX *ctx,
4438 DATA_BLOB *pblob_out,
4439 char **kerb_mechOID);
4440 void reply_sesssetup_and_X(struct smb_request *req);
4442 /* The following definitions come from smbd/share_access.c */
4444 bool token_contains_name_in_list(const char *username,
4446 const char *sharename,
4447 const struct security_token *token,
4449 bool user_ok_token(const char *username, const char *domain,
4450 const struct security_token *token, int snum);
4451 bool is_share_read_only_for_token(const char *username,
4453 const struct security_token *token,
4454 connection_struct *conn);
4456 /* The following definitions come from smbd/srvstr.c */
4458 size_t srvstr_push_fn(const char *base_ptr, uint16 smb_flags2, void *dest,
4459 const char *src, int dest_len, int flags);
4460 ssize_t message_push_string(uint8 **outbuf, const char *str, int flags);
4462 /* The following definitions come from smbd/statcache.c */
4464 void stat_cache_add( const char *full_orig_name,
4465 char *translated_path,
4466 bool case_sensitive);
4467 bool stat_cache_lookup(connection_struct *conn,
4471 SMB_STRUCT_STAT *pst);
4472 void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
4474 void stat_cache_delete(const char *name);
4475 unsigned int fast_string_hash(TDB_DATA *key);
4476 bool reset_stat_cache( void );
4478 /* The following definitions come from smbd/statvfs.c */
4480 int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf);
4482 /* The following definitions come from smbd/trans2.c */
4484 uint64_t smb_roundup(connection_struct *conn, uint64_t val);
4485 uint64_t get_FileIndex(connection_struct *conn, const SMB_STRUCT_STAT *psbuf);
4486 NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn,
4487 files_struct *fsp, const char *fname,
4488 const char *ea_name, struct ea_struct *pea);
4489 NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn,
4490 files_struct *fsp, const char *fname,
4491 char ***pnames, size_t *pnum_names);
4492 NTSTATUS set_ea(connection_struct *conn, files_struct *fsp,
4493 const struct smb_filename *smb_fname, struct ea_list *ea_list);
4494 struct ea_list *read_ea_list_entry(TALLOC_CTX *ctx, const char *pdata, size_t data_size, size_t *pbytes_used);
4495 void send_trans2_replies(connection_struct *conn,
4496 struct smb_request *req,
4501 int max_data_bytes);
4502 unsigned char *create_volume_objectid(connection_struct *conn, unsigned char objid[16]);
4503 NTSTATUS hardlink_internals(TALLOC_CTX *ctx,
4504 connection_struct *conn,
4505 struct smb_request *req,
4506 bool overwrite_if_exists,
4507 const struct smb_filename *smb_fname_old,
4508 struct smb_filename *smb_fname_new);
4509 NTSTATUS smb_set_file_time(connection_struct *conn,
4511 const struct smb_filename *smb_fname,
4512 struct smb_file_time *ft,
4513 bool setting_write_time);
4514 void reply_findclose(struct smb_request *req);
4515 void reply_findnclose(struct smb_request *req);
4516 void reply_trans2(struct smb_request *req);
4517 void reply_transs2(struct smb_request *req);
4519 /* The following definitions come from smbd/uid.c */
4521 bool change_to_guest(void);
4522 void conn_clear_vuid_cache(connection_struct *conn, uint16_t vuid);
4523 bool change_to_user(connection_struct *conn, uint16 vuid);
4524 bool change_to_root_user(void);
4525 bool become_authenticated_pipe_user(struct pipes_struct *p);
4526 bool unbecome_authenticated_pipe_user(void);
4527 void become_root(void);
4528 void unbecome_root(void);
4529 bool become_user(connection_struct *conn, uint16 vuid);
4530 bool unbecome_user(void);
4531 uid_t get_current_uid(connection_struct *conn);
4532 gid_t get_current_gid(connection_struct *conn);
4533 const struct security_unix_token *get_current_utok(connection_struct *conn);
4534 const struct security_token *get_current_nttok(connection_struct *conn);
4535 uint16_t get_current_vuid(connection_struct *conn);
4537 /* The following definitions come from smbd/utmp.c */
4539 void sys_utmp_claim(const char *username, const char *hostname,
4540 const char *ip_addr_str,
4541 const char *id_str, int id_num);
4542 void sys_utmp_yield(const char *username, const char *hostname,
4543 const char *ip_addr_str,
4544 const char *id_str, int id_num);
4545 void sys_utmp_yield(const char *username, const char *hostname,
4546 const char *ip_addr_str,
4547 const char *id_str, int id_num);
4548 void sys_utmp_claim(const char *username, const char *hostname,
4549 const char *ip_addr_str,
4550 const char *id_str, int id_num);
4552 /* The following definitions come from smbd/vfs.c */
4554 NTSTATUS smb_register_vfs(int version, const char *name,
4555 const struct vfs_fn_pointers *fns);
4556 bool vfs_init_custom(connection_struct *conn, const char *vfs_object);
4557 void *vfs_add_fsp_extension_notype(vfs_handle_struct *handle,
4558 files_struct *fsp, size_t ext_size,
4559 void (*destroy_fn)(void *p_data));
4560 void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
4561 void *vfs_memctx_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
4562 void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
4563 bool smbd_vfs_init(connection_struct *conn);
4564 NTSTATUS vfs_file_exist(connection_struct *conn, struct smb_filename *smb_fname);
4565 ssize_t vfs_read_data(files_struct *fsp, char *buf, size_t byte_count);
4566 ssize_t vfs_pread_data(files_struct *fsp, char *buf,
4567 size_t byte_count, SMB_OFF_T offset);
4568 ssize_t vfs_write_data(struct smb_request *req,
4572 ssize_t vfs_pwrite_data(struct smb_request *req,
4577 int vfs_allocate_file_space(files_struct *fsp, uint64_t len);
4578 int vfs_set_filelen(files_struct *fsp, SMB_OFF_T len);
4579 int vfs_slow_fallocate(files_struct *fsp, SMB_OFF_T offset, SMB_OFF_T len);
4580 int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len);
4581 SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n);
4582 const char *vfs_readdirname(connection_struct *conn, void *p,
4583 SMB_STRUCT_STAT *sbuf, char **talloced);
4584 int vfs_ChDir(connection_struct *conn, const char *path);
4585 char *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn);
4586 NTSTATUS check_reduced_name(connection_struct *conn, const char *fname);
4587 int vfs_stat_smb_fname(struct connection_struct *conn, const char *fname,
4588 SMB_STRUCT_STAT *psbuf);
4589 int vfs_lstat_smb_fname(struct connection_struct *conn, const char *fname,
4590 SMB_STRUCT_STAT *psbuf);
4591 NTSTATUS vfs_stat_fsp(files_struct *fsp);
4592 NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid);
4594 /* The following definitions come from utils/passwd_util.c */
4596 char *stdin_new_passwd( void);
4597 char *get_pass( const char *prompt, bool stdin_get);
4599 /* The following definitions come from winbindd/nss_info.c */
4602 /* The following definitions come from winbindd/nss_info_template.c */
4604 NTSTATUS nss_info_template_init( void );
4606 /* The following definitions come from lib/avahi.c */
4608 struct AvahiPoll *tevent_avahi_poll(TALLOC_CTX *mem_ctx,
4609 struct tevent_context *ev);
4611 /* The following definitions come from smbd/avahi_register.c */
4613 void *avahi_start_register(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
4616 /* The following definitions come from smbd/msg_idmap.c */
4618 void msg_idmap_register_msgs(struct messaging_context *ctx);
4620 /* The following definitions come from lib/fncall.c */
4622 struct fncall_context *fncall_context_init(TALLOC_CTX *mem_ctx,
4624 struct tevent_req *fncall_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
4625 struct fncall_context *ctx,
4626 void (*fn)(void *private_data),
4627 void *private_data);
4628 int fncall_recv(struct tevent_req *req, int *perr);
4630 /* The following definitions come from libsmb/smbsock_connect.c */
4632 struct tevent_req *smbsock_connect_send(TALLOC_CTX *mem_ctx,
4633 struct tevent_context *ev,
4634 const struct sockaddr_storage *addr,
4636 const char *called_name,
4638 const char *calling_name,
4640 NTSTATUS smbsock_connect_recv(struct tevent_req *req, int *sock,
4641 uint16_t *ret_port);
4642 NTSTATUS smbsock_connect(const struct sockaddr_storage *addr, uint16_t port,
4643 const char *called_name, int called_type,
4644 const char *calling_name, int calling_type,
4645 int *pfd, uint16_t *ret_port);
4647 struct tevent_req *smbsock_any_connect_send(TALLOC_CTX *mem_ctx,
4648 struct tevent_context *ev,
4649 const struct sockaddr_storage *addrs,
4650 const char **called_names,
4652 const char **calling_names,
4654 size_t num_addrs, uint16_t port);
4655 NTSTATUS smbsock_any_connect_recv(struct tevent_req *req, int *pfd,
4656 size_t *chosen_index, uint16_t *chosen_port);
4657 NTSTATUS smbsock_any_connect(const struct sockaddr_storage *addrs,
4658 const char **called_names,
4660 const char **calling_names,
4664 int *pfd, size_t *chosen_index,
4665 uint16_t *chosen_port);
4667 /* The following definitions come from rpc_server/srv_samr_nt.c */
4668 NTSTATUS access_check_object( struct security_descriptor *psd, struct security_token *token,
4669 enum sec_privilege needed_priv_1, enum sec_privilege needed_priv_2,
4671 uint32 des_access, uint32 *acc_granted,
4672 const char *debug );
4673 void map_max_allowed_access(const struct security_token *nt_token,
4674 const struct security_unix_token *unix_token,
4675 uint32_t *pacc_requested);
4677 /* The following definitions come from lib/util_wellknown.c */
4679 bool sid_check_is_wellknown_domain(const struct dom_sid *sid, const char **name);
4680 bool sid_check_is_in_wellknown_domain(const struct dom_sid *sid);
4681 bool lookup_wellknown_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
4682 const char **domain, const char **name);
4683 bool lookup_wellknown_name(TALLOC_CTX *mem_ctx, const char *name,
4684 struct dom_sid *sid, const char **domain);
4686 /* The following definitions come from lib/util_unixsids.c */
4688 bool sid_check_is_unix_users(const struct dom_sid *sid);
4689 bool sid_check_is_in_unix_users(const struct dom_sid *sid);
4690 void uid_to_unix_users_sid(uid_t uid, struct dom_sid *sid);
4691 void gid_to_unix_groups_sid(gid_t gid, struct dom_sid *sid);
4692 const char *unix_users_domain_name(void);
4693 bool lookup_unix_user_name(const char *name, struct dom_sid *sid);
4694 bool sid_check_is_unix_groups(const struct dom_sid *sid);
4695 bool sid_check_is_in_unix_groups(const struct dom_sid *sid);
4696 const char *unix_groups_domain_name(void);
4697 bool lookup_unix_group_name(const char *name, struct dom_sid *sid);
4699 /* The following definitions come from lib/filename_util.c */
4701 NTSTATUS get_full_smb_filename(TALLOC_CTX *ctx, const struct smb_filename *smb_fname,
4703 NTSTATUS create_synthetic_smb_fname(TALLOC_CTX *ctx, const char *base_name,
4704 const char *stream_name,
4705 const SMB_STRUCT_STAT *psbuf,
4706 struct smb_filename **smb_fname_out);
4707 NTSTATUS create_synthetic_smb_fname_split(TALLOC_CTX *ctx,
4709 const SMB_STRUCT_STAT *psbuf,
4710 struct smb_filename **smb_fname_out);
4711 const char *smb_fname_str_dbg(const struct smb_filename *smb_fname);
4712 const char *fsp_str_dbg(const struct files_struct *fsp);
4713 NTSTATUS copy_smb_filename(TALLOC_CTX *ctx,
4714 const struct smb_filename *smb_fname_in,
4715 struct smb_filename **smb_fname_out);
4716 bool is_ntfs_stream_smb_fname(const struct smb_filename *smb_fname);
4717 bool is_ntfs_default_stream_smb_fname(const struct smb_filename *smb_fname);
4719 #endif /* _PROTO_H_ */