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) ;
126 NTSTATUS make_server_info_sam(struct auth_serversupplied_info **server_info,
127 struct samu *sampass);
128 NTSTATUS create_local_token(struct auth_serversupplied_info *server_info);
129 NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
131 uid_t *uid, gid_t *gid,
132 char **found_username,
133 struct security_token **token);
134 bool user_in_group_sid(const char *username, const struct dom_sid *group_sid);
135 bool user_in_group(const char *username, const char *groupname);
136 NTSTATUS make_server_info_pw(struct auth_serversupplied_info **server_info,
139 NTSTATUS make_serverinfo_from_username(TALLOC_CTX *mem_ctx,
140 const char *username,
142 struct auth_serversupplied_info **presult);
143 struct auth_serversupplied_info *copy_serverinfo(TALLOC_CTX *mem_ctx,
144 const struct auth_serversupplied_info *src);
145 bool init_guest_info(void);
146 NTSTATUS init_system_info(void);
147 bool session_info_set_session_key(struct auth_serversupplied_info *info,
148 DATA_BLOB session_key);
149 NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx,
150 struct auth_serversupplied_info **server_info);
151 NTSTATUS make_session_info_system(TALLOC_CTX *mem_ctx,
152 struct auth_serversupplied_info **session_info);
153 const struct auth_serversupplied_info *get_session_info_system(void);
154 bool copy_current_user(struct current_user *dst, struct current_user *src);
155 struct passwd *smb_getpwnam( TALLOC_CTX *mem_ctx, const char *domuser,
156 char **p_save_username, bool create );
157 NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
158 const char *sent_nt_username,
160 struct auth_serversupplied_info **server_info,
161 struct netr_SamInfo3 *info3);
162 struct wbcAuthUserInfo;
163 NTSTATUS make_server_info_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
164 const char *sent_nt_username,
166 const struct wbcAuthUserInfo *info,
167 struct auth_serversupplied_info **server_info);
168 void free_user_info(struct auth_usersupplied_info **user_info);
169 bool make_auth_methods(struct auth_context *auth_context, auth_methods **auth_method) ;
170 bool is_trusted_domain(const char* dom_name);
172 /* The following definitions come from auth/user_info.c */
174 NTSTATUS make_user_info(struct auth_usersupplied_info **ret_user_info,
175 const char *smb_name,
176 const char *internal_username,
177 const char *client_domain,
179 const char *workstation_name,
180 const DATA_BLOB *lm_pwd,
181 const DATA_BLOB *nt_pwd,
182 const struct samr_Password *lm_interactive_pwd,
183 const struct samr_Password *nt_interactive_pwd,
184 const char *plaintext_password,
185 enum auth_password_state password_state);
186 void free_user_info(struct auth_usersupplied_info **user_info);
188 /* The following definitions come from auth/auth_winbind.c */
190 NTSTATUS auth_winbind_init(void);
192 /* The following definitions come from auth/server_info.c */
194 struct netr_SamInfo2;
195 struct netr_SamInfo3;
196 struct netr_SamInfo6;
198 struct auth_serversupplied_info *make_server_info(TALLOC_CTX *mem_ctx);
199 NTSTATUS serverinfo_to_SamInfo2(struct auth_serversupplied_info *server_info,
200 uint8_t *pipe_session_key,
201 size_t pipe_session_key_len,
202 struct netr_SamInfo2 *sam2);
203 NTSTATUS serverinfo_to_SamInfo3(const struct auth_serversupplied_info *server_info,
204 uint8_t *pipe_session_key,
205 size_t pipe_session_key_len,
206 struct netr_SamInfo3 *sam3);
207 NTSTATUS serverinfo_to_SamInfo6(struct auth_serversupplied_info *server_info,
208 uint8_t *pipe_session_key,
209 size_t pipe_session_key_len,
210 struct netr_SamInfo6 *sam6);
211 NTSTATUS samu_to_SamInfo3(TALLOC_CTX *mem_ctx,
213 const char *login_server,
214 struct netr_SamInfo3 **_info3,
215 struct extra_auth_info *extra);
216 struct netr_SamInfo3 *copy_netr_SamInfo3(TALLOC_CTX *mem_ctx,
217 struct netr_SamInfo3 *orig);
218 struct netr_SamInfo3 *wbcAuthUserInfo_to_netr_SamInfo3(TALLOC_CTX *mem_ctx,
219 const struct wbcAuthUserInfo *info);
221 /* The following definitions come from auth/auth_wbc.c */
223 NTSTATUS auth_wbc_init(void);
225 /* The following definitions come from auth/pampass.c */
227 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
228 bool smb_pam_close_session(char *user, char *tty, char *rhost);
229 NTSTATUS smb_pam_accountcheck(const char *user, const char *rhost);
230 NTSTATUS smb_pam_passcheck(const char * user, const char * rhost,
231 const char * password);
232 bool smb_pam_passchange(const char *user, const char *rhost,
233 const char *oldpassword, const char *newpassword);
234 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
235 bool smb_pam_close_session(char *in_user, char *tty, char *rhost);
237 /* The following definitions come from auth/pass_check.c */
239 void dfs_unlogin(void);
240 NTSTATUS pass_check(const struct passwd *pass,
243 const char *password,
246 /* The following definitions come from auth/token_util.c */
248 bool nt_token_check_sid ( const struct dom_sid *sid, const struct security_token *token );
249 bool nt_token_check_domain_rid( struct security_token *token, uint32 rid );
250 struct security_token *get_root_nt_token( void );
251 NTSTATUS add_aliases(const struct dom_sid *domain_sid,
252 struct security_token *token);
253 struct security_token *create_local_nt_token(TALLOC_CTX *mem_ctx,
254 const struct dom_sid *user_sid,
257 const struct dom_sid *groupsids);
258 NTSTATUS create_local_nt_token_from_info3(TALLOC_CTX *mem_ctx,
260 struct netr_SamInfo3 *info3,
261 struct extra_auth_info *extra,
262 struct security_token **ntok);
263 void debug_unix_user_token(int dbg_class, int dbg_lev, uid_t uid, gid_t gid,
264 int n_groups, gid_t *groups);
266 /* The following definitions come from intl/lang_tdb.c */
268 bool lang_tdb_init(const char *lang);
269 const char *lang_msg(const char *msgid);
270 void lang_msg_free(const char *msgstr);
271 char *lang_tdb_current(void);
273 /* The following definitions come from lib/access.c */
275 bool client_match(const char *tok, const void *item);
276 bool list_match(const char **list,const void *item,
277 bool (*match_fn)(const char *, const void *));
278 bool allow_access(const char **deny_list,
279 const char **allow_list,
283 /* The following definitions come from lib/adt_tree.c */
286 /* The following definitions come from lib/afs.c */
288 char *afs_createtoken_str(const char *username, const char *cell);
289 bool afs_login(connection_struct *conn);
290 bool afs_login(connection_struct *conn);
291 char *afs_createtoken_str(const char *username, const char *cell);
293 /* The following definitions come from lib/afs_settoken.c */
295 int afs_syscall( int subcall,
300 bool afs_settoken_str(const char *token_string);
301 bool afs_settoken_str(const char *token_string);
303 /* The following definitions come from lib/audit.c */
305 const char *audit_category_str(uint32 category);
306 const char *audit_param_str(uint32 category);
307 const char *audit_description_str(uint32 category);
308 bool get_audit_category_from_param(const char *param, uint32 *audit_category);
309 const char *audit_policy_str(TALLOC_CTX *mem_ctx, uint32 policy);
311 /* The following definitions come from lib/bitmap.c */
313 struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n);
314 int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src);
315 bool bitmap_set(struct bitmap *bm, unsigned i);
316 bool bitmap_clear(struct bitmap *bm, unsigned i);
317 bool bitmap_query(struct bitmap *bm, unsigned i);
318 int bitmap_find(struct bitmap *bm, unsigned ofs);
320 /* The following definitions come from lib/charcnv.c */
322 void lazy_initialize_conv(void);
323 void gfree_charcnv(void);
324 void init_iconv(void);
325 size_t convert_string(charset_t from, charset_t to,
326 void const *src, size_t srclen,
327 void *dest, size_t destlen);
328 size_t convert_string_error(charset_t from, charset_t to,
329 void const *src, size_t srclen,
330 void *dest, size_t destlen,
331 size_t *converted_size);
332 size_t unix_strupper(const char *src, size_t srclen, char *dest, size_t destlen);
333 char *talloc_strdup_upper(TALLOC_CTX *ctx, const char *s);
334 char *strupper_talloc(TALLOC_CTX *ctx, const char *s);
335 size_t unix_strlower(const char *src, size_t srclen, char *dest, size_t destlen);
336 char *talloc_strdup_lower(TALLOC_CTX *ctx, const char *s);
337 char *strlower_talloc(TALLOC_CTX *ctx, const char *s);
338 size_t ucs2_align(const void *base_ptr, const void *p, int flags);
339 size_t push_ascii(void *dest, const char *src, size_t dest_len, int flags);
340 size_t push_ascii_fstring(void *dest, const char *src);
341 size_t push_ascii_nstring(void *dest, const char *src);
342 size_t pull_ascii(char *dest, const void *src, size_t dest_len, size_t src_len, int flags);
343 size_t pull_ascii_fstring(char *dest, const void *src);
344 size_t pull_ascii_nstring(char *dest, size_t dest_len, const void *src);
345 size_t push_ucs2(const void *base_ptr, void *dest, const char *src, size_t dest_len, int flags);
346 size_t push_utf8_fstring(void *dest, const char *src);
347 bool push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
348 size_t *converted_size);
349 size_t pull_ucs2(const void *base_ptr, char *dest, const void *src, size_t dest_len, size_t src_len, int flags);
350 size_t pull_ucs2_fstring(char *dest, const void *src);
351 bool push_ucs2_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src,
352 size_t *converted_size);
353 bool pull_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
354 size_t *converted_size);
355 bool pull_ucs2_talloc(TALLOC_CTX *ctx, char **dest, const smb_ucs2_t *src,
356 size_t *converted_size);
357 bool pull_ascii_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
358 size_t *converted_size);
359 size_t push_string_check_fn(void *dest, const char *src,
360 size_t dest_len, int flags);
361 size_t push_string_base(const char *base, uint16 flags2,
362 void *dest, const char *src,
363 size_t dest_len, int flags);
364 size_t pull_string_fn(const void *base_ptr,
371 size_t pull_string_talloc(TALLOC_CTX *ctx,
372 const void *base_ptr,
378 size_t align_string(const void *base_ptr, const char *p, int flags);
380 /* The following definitions come from lib/conn_tdb.c */
382 struct db_record *connections_fetch_entry(TALLOC_CTX *mem_ctx,
383 connection_struct *conn,
385 int connections_traverse(int (*fn)(struct db_record *rec,
388 int connections_forall(int (*fn)(struct db_record *rec,
389 const struct connections_key *key,
390 const struct connections_data *data,
393 int connections_forall_read(int (*fn)(const struct connections_key *key,
394 const struct connections_data *data,
397 bool connections_init(bool rw);
399 /* The following definitions come from lib/dmallocmsg.c */
401 void register_dmalloc_msgs(struct messaging_context *msg_ctx);
403 /* The following definitions come from lib/dprintf.c */
405 void display_set_stderr(void);
407 /* The following definitions come from lib/errmap_unix.c */
409 NTSTATUS map_nt_error_from_unix(int unix_error);
410 int map_errno_from_nt_status(NTSTATUS status);
412 /* The following definitions come from lib/file_id.c */
414 struct file_id vfs_file_id_from_sbuf(connection_struct *conn, const SMB_STRUCT_STAT *sbuf);
415 bool file_id_equal(const struct file_id *id1, const struct file_id *id2);
416 const char *file_id_string_tos(const struct file_id *id);
417 void push_file_id_16(char *buf, const struct file_id *id);
418 void push_file_id_24(char *buf, const struct file_id *id);
419 void pull_file_id_24(char *buf, struct file_id *id);
421 /* The following definitions come from lib/gencache.c */
423 bool gencache_set(const char *keystr, const char *value, time_t timeout);
424 bool gencache_del(const char *keystr);
425 bool gencache_get(const char *keystr, char **valstr, time_t *timeout);
426 bool gencache_parse(const char *keystr,
427 void (*parser)(time_t timeout, DATA_BLOB blob,
430 bool gencache_get_data_blob(const char *keystr, DATA_BLOB *blob,
431 time_t *timeout, bool *was_expired);
432 bool gencache_stabilize(void);
433 bool gencache_set_data_blob(const char *keystr, const DATA_BLOB *blob, time_t timeout);
434 void gencache_iterate_blobs(void (*fn)(const char *key, DATA_BLOB value,
435 time_t timeout, void *private_data),
436 void *private_data, const char *pattern);
437 void gencache_iterate(void (*fn)(const char* key, const char *value, time_t timeout, void* dptr),
438 void* data, const char* keystr_pattern);
440 /* The following definitions come from lib/interface.c */
442 bool ismyaddr(const struct sockaddr *ip);
443 bool ismyip_v4(struct in_addr ip);
444 bool is_local_net(const struct sockaddr *from);
445 void setup_linklocal_scope_id(struct sockaddr *pss);
446 bool is_local_net_v4(struct in_addr from);
447 int iface_count(void);
448 int iface_count_v4_nl(void);
449 const struct in_addr *first_ipv4_iface(void);
450 struct interface *get_interface(int n);
451 const struct sockaddr_storage *iface_n_sockaddr_storage(int n);
452 const struct in_addr *iface_n_ip_v4(int n);
453 const struct in_addr *iface_n_bcast_v4(int n);
454 const struct sockaddr_storage *iface_n_bcast(int n);
455 const struct sockaddr_storage *iface_ip(const struct sockaddr *ip);
456 bool iface_local(const struct sockaddr *ip);
457 void load_interfaces(void);
458 void gfree_interfaces(void);
459 bool interfaces_changed(void);
461 /* The following definitions come from lib/ldap_debug_handler.c */
463 void init_ldap_debugging(void);
465 /* The following definitions come from lib/ldap_escape.c */
467 char *escape_ldap_string(TALLOC_CTX *mem_ctx, const char *s);
468 char *escape_rdn_val_string_alloc(const char *s);
470 /* The following definitions come from lib/module.c */
472 NTSTATUS smb_load_module(const char *module_name);
473 int smb_load_modules(const char **modules);
474 NTSTATUS smb_probe_module(const char *subsystem, const char *module);
475 NTSTATUS smb_load_module(const char *module_name);
476 int smb_load_modules(const char **modules);
477 NTSTATUS smb_probe_module(const char *subsystem, const char *module);
478 void init_modules(void);
480 /* The following definitions come from lib/ms_fnmatch.c */
482 int ms_fnmatch(const char *pattern, const char *string, bool translate_pattern,
483 bool is_case_sensitive);
484 int gen_fnmatch(const char *pattern, const char *string);
486 /* The following definitions come from lib/pidfile.c */
488 pid_t pidfile_pid(const char *name);
489 void pidfile_create(const char *program_name);
490 void pidfile_unlink(void);
492 /* The following definitions come from lib/privileges.c */
494 bool get_privileges_for_sids(uint64_t *privileges, struct dom_sid *slist, int scount);
495 NTSTATUS get_privileges_for_sid_as_set(TALLOC_CTX *mem_ctx, PRIVILEGE_SET **privileges, struct dom_sid *sid);
496 NTSTATUS privilege_enumerate_accounts(struct dom_sid **sids, int *num_sids);
497 NTSTATUS privilege_enum_sids(enum sec_privilege privilege, TALLOC_CTX *mem_ctx,
498 struct dom_sid **sids, int *num_sids);
499 bool grant_privilege_set(const struct dom_sid *sid, struct lsa_PrivilegeSet *set);
500 bool grant_privilege_by_name( const struct dom_sid *sid, const char *name);
501 bool revoke_all_privileges( const struct dom_sid *sid );
502 bool revoke_privilege_set(const struct dom_sid *sid, struct lsa_PrivilegeSet *set);
503 bool revoke_privilege_by_name(const struct dom_sid *sid, const char *name);
504 NTSTATUS privilege_create_account(const struct dom_sid *sid );
505 NTSTATUS privilege_delete_account(const struct dom_sid *sid);
506 bool is_privileged_sid( const struct dom_sid *sid );
507 bool grant_all_privileges( const struct dom_sid *sid );
509 /* The following definitions come from lib/recvfile.c */
511 ssize_t sys_recvfile(int fromfd,
515 ssize_t sys_recvfile(int fromfd,
519 ssize_t drain_socket(int sockfd, size_t count);
521 /* The following definitions come from lib/secdesc.c */
523 uint32_t get_sec_info(const struct security_descriptor *sd);
524 struct security_descriptor *sec_desc_merge(TALLOC_CTX *ctx, struct security_descriptor *new_sdb, struct security_descriptor *old_sdb);
525 struct sec_desc_buf *sec_desc_merge_buf(TALLOC_CTX *ctx, struct sec_desc_buf *new_sdb, struct sec_desc_buf *old_sdb);
526 struct security_descriptor *make_sec_desc(TALLOC_CTX *ctx,
527 enum security_descriptor_revision revision,
529 const struct dom_sid *owner_sid, const struct dom_sid *grp_sid,
530 struct security_acl *sacl, struct security_acl *dacl, size_t *sd_size);
531 struct security_descriptor *dup_sec_desc(TALLOC_CTX *ctx, const struct security_descriptor *src);
532 NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx,
533 struct security_descriptor *secdesc,
534 uint8 **data, size_t *len);
535 NTSTATUS marshall_sec_desc_buf(TALLOC_CTX *mem_ctx,
536 struct sec_desc_buf *secdesc_buf,
537 uint8_t **data, size_t *len);
538 NTSTATUS unmarshall_sec_desc(TALLOC_CTX *mem_ctx, uint8 *data, size_t len,
539 struct security_descriptor **psecdesc);
540 NTSTATUS unmarshall_sec_desc_buf(TALLOC_CTX *mem_ctx, uint8_t *data, size_t len,
541 struct sec_desc_buf **psecdesc_buf);
542 struct security_descriptor *make_standard_sec_desc(TALLOC_CTX *ctx, const struct dom_sid *owner_sid, const struct dom_sid *grp_sid,
543 struct security_acl *dacl, size_t *sd_size);
544 struct sec_desc_buf *make_sec_desc_buf(TALLOC_CTX *ctx, size_t len, struct security_descriptor *sec_desc);
545 struct sec_desc_buf *dup_sec_desc_buf(TALLOC_CTX *ctx, struct sec_desc_buf *src);
546 NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, struct security_descriptor **psd, const struct dom_sid *sid, uint32 mask, size_t *sd_size);
547 NTSTATUS sec_desc_mod_sid(struct security_descriptor *sd, struct dom_sid *sid, uint32 mask);
548 NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, struct security_descriptor **psd, struct dom_sid *sid, size_t *sd_size);
549 bool sd_has_inheritable_components(const struct security_descriptor *parent_ctr, bool container);
550 NTSTATUS se_create_child_secdesc(TALLOC_CTX *ctx,
551 struct security_descriptor **ppsd,
553 const struct security_descriptor *parent_ctr,
554 const struct dom_sid *owner_sid,
555 const struct dom_sid *group_sid,
557 NTSTATUS se_create_child_secdesc_buf(TALLOC_CTX *ctx,
558 struct sec_desc_buf **ppsdb,
559 const struct security_descriptor *parent_ctr,
562 /* The following definitions come from lib/sendfile.c */
564 ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
566 /* The following definitions come from lib/server_mutex.c */
568 struct named_mutex *grab_named_mutex(TALLOC_CTX *mem_ctx, const char *name,
571 /* The following definitions come from lib/sharesec.c */
573 bool share_info_db_init(void);
574 struct security_descriptor *get_share_security_default( TALLOC_CTX *ctx, size_t *psize, uint32 def_access);
575 struct security_descriptor *get_share_security( TALLOC_CTX *ctx, const char *servicename,
577 bool set_share_security(const char *share_name, struct security_descriptor *psd);
578 bool delete_share_security(const char *servicename);
579 bool share_access_check(const struct security_token *token, const char *sharename,
580 uint32 desired_access);
581 bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, struct security_descriptor **ppsd);
583 /* The following definitions come from lib/smbrun.c */
585 int smbrun_no_sanitize(const char *cmd, int *outfd);
586 int smbrun(const char *cmd, int *outfd);
587 int smbrunsecret(const char *cmd, const char *secret);
589 /* The following definitions come from lib/sock_exec.c */
591 int sock_exec(const char *prog);
593 /* The following definitions come from lib/substitute.c */
595 void free_local_machine_name(void);
596 bool set_local_machine_name(const char *local_name, bool perm);
597 const char *get_local_machine_name(void);
598 bool set_remote_machine_name(const char *remote_name, bool perm);
599 const char *get_remote_machine_name(void);
600 void sub_set_smb_name(const char *name);
601 void set_current_user_info(const char *smb_name, const char *unix_name,
603 void sub_set_socket_ids(const char *peeraddr, const char *peername,
604 const char *sockaddr);
605 const char *get_current_username(void);
606 void standard_sub_basic(const char *smb_name, const char *domain_name,
607 char *str, size_t len);
608 char *talloc_sub_basic(TALLOC_CTX *mem_ctx, const char *smb_name,
609 const char *domain_name, const char *str);
610 char *talloc_sub_specified(TALLOC_CTX *mem_ctx,
611 const char *input_string,
612 const char *username,
616 char *talloc_sub_advanced(TALLOC_CTX *mem_ctx,
617 const char *servicename, const char *user,
618 const char *connectpath, gid_t gid,
619 const char *smb_name, const char *domain_name,
621 void standard_sub_advanced(const char *servicename, const char *user,
622 const char *connectpath, gid_t gid,
623 const char *smb_name, const char *domain_name,
624 char *str, size_t len);
625 char *standard_sub_conn(TALLOC_CTX *ctx, connection_struct *conn, const char *str);
627 /* The following definitions come from lib/sysacls.c */
629 int sys_acl_get_entry(SMB_ACL_T acl_d, int entry_id, SMB_ACL_ENTRY_T *entry_p);
630 int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *type_p);
631 int sys_acl_get_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
632 void *sys_acl_get_qualifier(SMB_ACL_ENTRY_T entry_d);
633 int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset_d);
634 int sys_acl_add_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
635 int sys_acl_get_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
636 char *sys_acl_to_text(SMB_ACL_T acl_d, ssize_t *len_p);
637 SMB_ACL_T sys_acl_init(int count);
638 int sys_acl_create_entry(SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p);
639 int sys_acl_set_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type);
640 int sys_acl_set_qualifier(SMB_ACL_ENTRY_T entry_d, void *qual_p);
641 int sys_acl_set_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d);
642 int sys_acl_free_text(char *text);
643 int sys_acl_free_acl(SMB_ACL_T acl_d) ;
644 int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype);
645 int sys_acl_valid(SMB_ACL_T acl_d);
646 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
647 const char *path_p, SMB_ACL_TYPE_T type);
648 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
649 int sys_acl_set_file(vfs_handle_struct *handle,
650 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
651 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
653 int sys_acl_delete_def_file(vfs_handle_struct *handle,
655 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
656 const char *path_p, SMB_ACL_TYPE_T type);
657 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
658 int sys_acl_set_file(vfs_handle_struct *handle,
659 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
660 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
662 int sys_acl_delete_def_file(vfs_handle_struct *handle,
664 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
665 const char *path_p, SMB_ACL_TYPE_T type);
666 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
667 int sys_acl_set_file(vfs_handle_struct *handle,
668 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
669 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
671 int sys_acl_delete_def_file(vfs_handle_struct *handle,
673 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
674 const char *path_p, SMB_ACL_TYPE_T type);
675 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
676 int sys_acl_set_file(vfs_handle_struct *handle,
677 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
678 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
680 int sys_acl_delete_def_file(vfs_handle_struct *handle,
682 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
683 const char *path_p, SMB_ACL_TYPE_T type);
684 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
685 int sys_acl_set_file(vfs_handle_struct *handle,
686 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
687 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
689 int sys_acl_delete_def_file(vfs_handle_struct *handle,
691 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
692 const char *path_p, SMB_ACL_TYPE_T type);
693 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
694 int sys_acl_set_file(vfs_handle_struct *handle,
695 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
696 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
698 int sys_acl_delete_def_file(vfs_handle_struct *handle,
700 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
701 const char *path_p, SMB_ACL_TYPE_T type);
702 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
703 int sys_acl_set_file(vfs_handle_struct *handle,
704 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
705 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
707 int sys_acl_delete_def_file(vfs_handle_struct *handle,
709 int no_acl_syscall_error(int err);
711 /* The following definitions come from lib/sysquotas.c */
713 int sys_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
714 int sys_set_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
716 /* The following definitions come from lib/sysquotas_*.c */
718 int sys_get_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
719 int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
721 int sys_get_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
722 int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
724 int sys_get_nfs_quota(const char *path, const char *bdev,
725 enum SMB_QUOTA_TYPE qtype,
726 unid_t id, SMB_DISK_QUOTA *dp);
727 int sys_set_nfs_quota(const char *path, const char *bdev,
728 enum SMB_QUOTA_TYPE qtype,
729 unid_t id, SMB_DISK_QUOTA *dp);
731 /* The following definitions come from lib/system.c */
733 void *sys_memalign( size_t align, size_t size );
734 int sys_usleep(long usecs);
735 ssize_t sys_read(int fd, void *buf, size_t count);
736 ssize_t sys_write(int fd, const void *buf, size_t count);
737 ssize_t sys_writev(int fd, const struct iovec *iov, int iovcnt);
738 ssize_t sys_pread(int fd, void *buf, size_t count, SMB_OFF_T off);
739 ssize_t sys_pwrite(int fd, const void *buf, size_t count, SMB_OFF_T off);
740 ssize_t sys_send(int s, const void *msg, size_t len, int flags);
741 ssize_t sys_sendto(int s, const void *msg, size_t len, int flags, const struct sockaddr *to, socklen_t tolen);
742 ssize_t sys_recv(int fd, void *buf, size_t count, int flags);
743 ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen);
744 int sys_fcntl_ptr(int fd, int cmd, void *arg);
745 int sys_fcntl_long(int fd, int cmd, long arg);
746 void update_stat_ex_mtime(struct stat_ex *dst, struct timespec write_ts);
747 void update_stat_ex_create_time(struct stat_ex *dst, struct timespec create_time);
748 int sys_stat(const char *fname, SMB_STRUCT_STAT *sbuf,
749 bool fake_dir_create_times);
750 int sys_fstat(int fd, SMB_STRUCT_STAT *sbuf,
751 bool fake_dir_create_times);
752 int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf,
753 bool fake_dir_create_times);
754 int sys_ftruncate(int fd, SMB_OFF_T offset);
755 int sys_posix_fallocate(int fd, SMB_OFF_T offset, SMB_OFF_T len);
756 int sys_fallocate(int fd, enum vfs_fallocate_mode mode, SMB_OFF_T offset, SMB_OFF_T len);
757 SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence);
758 int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence);
759 SMB_OFF_T sys_ftell(FILE *fp);
760 int sys_creat(const char *path, mode_t mode);
761 int sys_open(const char *path, int oflag, mode_t mode);
762 FILE *sys_fopen(const char *path, const char *type);
763 void kernel_flock(int fd, uint32 share_mode, uint32 access_mask);
764 SMB_STRUCT_DIR *sys_opendir(const char *name);
765 SMB_STRUCT_DIR *sys_fdopendir(int fd);
766 SMB_STRUCT_DIRENT *sys_readdir(SMB_STRUCT_DIR *dirp);
767 void sys_seekdir(SMB_STRUCT_DIR *dirp, long offset);
768 long sys_telldir(SMB_STRUCT_DIR *dirp);
769 void sys_rewinddir(SMB_STRUCT_DIR *dirp);
770 int sys_closedir(SMB_STRUCT_DIR *dirp);
771 int sys_mknod(const char *path, mode_t mode, SMB_DEV_T dev);
772 int sys_waitpid(pid_t pid,int *status,int options);
773 char *sys_getwd(char *s);
774 void set_effective_capability(enum smbd_capability capability);
775 void drop_effective_capability(enum smbd_capability capability);
776 long sys_random(void);
777 void sys_srandom(unsigned int seed);
778 int groups_max(void);
779 int sys_getgroups(int setlen, gid_t *gidset);
780 int sys_setgroups(gid_t UNUSED(primary_gid), int setlen, gid_t *gidset);
781 int sys_popen(const char *command);
782 int sys_pclose(int fd);
783 ssize_t sys_getxattr (const char *path, const char *name, void *value, size_t size);
784 ssize_t sys_lgetxattr (const char *path, const char *name, void *value, size_t size);
785 ssize_t sys_fgetxattr (int filedes, const char *name, void *value, size_t size);
786 ssize_t sys_listxattr (const char *path, char *list, size_t size);
787 ssize_t sys_llistxattr (const char *path, char *list, size_t size);
788 ssize_t sys_flistxattr (int filedes, char *list, size_t size);
789 int sys_removexattr (const char *path, const char *name);
790 int sys_lremovexattr (const char *path, const char *name);
791 int sys_fremovexattr (int filedes, const char *name);
792 int sys_setxattr (const char *path, const char *name, const void *value, size_t size, int flags);
793 int sys_lsetxattr (const char *path, const char *name, const void *value, size_t size, int flags);
794 int sys_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags);
795 uint32 unix_dev_major(SMB_DEV_T dev);
796 uint32 unix_dev_minor(SMB_DEV_T dev);
797 int sys_aio_read(SMB_STRUCT_AIOCB *aiocb);
798 int sys_aio_write(SMB_STRUCT_AIOCB *aiocb);
799 ssize_t sys_aio_return(SMB_STRUCT_AIOCB *aiocb);
800 int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb);
801 int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb);
802 int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb);
803 int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout);
804 int sys_aio_read(SMB_STRUCT_AIOCB *aiocb);
805 int sys_aio_write(SMB_STRUCT_AIOCB *aiocb);
806 ssize_t sys_aio_return(SMB_STRUCT_AIOCB *aiocb);
807 int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb);
808 int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb);
809 int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb);
810 int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout);
811 int sys_getpeereid( int s, uid_t *uid);
812 int sys_getnameinfo(const struct sockaddr *psa,
819 int sys_connect(int fd, const struct sockaddr * addr);
821 /* The following definitions come from lib/system_smbd.c */
823 bool getgroups_unix_user(TALLOC_CTX *mem_ctx, const char *user,
825 gid_t **ret_groups, uint32_t *p_ngroups);
827 /* The following definitions come from lib/tallocmsg.c */
829 void register_msg_pool_usage(struct messaging_context *msg_ctx);
831 /* The following definitions come from lib/time.c */
833 void push_dos_date(uint8_t *buf, int offset, time_t unixdate, int zone_offset);
834 void push_dos_date2(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
835 void push_dos_date3(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
836 uint32_t convert_time_t_to_uint32_t(time_t t);
837 time_t convert_uint32_t_to_time_t(uint32_t u);
838 bool nt_time_is_zero(const NTTIME *nt);
839 time_t generalized_to_unix_time(const char *str);
840 int get_server_zone_offset(void);
841 int set_server_zone_offset(time_t t);
842 char *timeval_string(TALLOC_CTX *ctx, const struct timeval *tp, bool hires);
843 char *current_timestring(TALLOC_CTX *ctx, bool hires);
844 void srv_put_dos_date(char *buf,int offset,time_t unixdate);
845 void srv_put_dos_date2(char *buf,int offset, time_t unixdate);
846 void srv_put_dos_date3(char *buf,int offset,time_t unixdate);
847 void round_timespec(enum timestamp_set_resolution res, struct timespec *ts);
848 void put_long_date_timespec(enum timestamp_set_resolution res, char *p, struct timespec ts);
849 void put_long_date(char *p, time_t t);
850 void dos_filetime_timespec(struct timespec *tsp);
851 time_t make_unix_date(const void *date_ptr, int zone_offset);
852 time_t make_unix_date2(const void *date_ptr, int zone_offset);
853 time_t make_unix_date3(const void *date_ptr, int zone_offset);
854 time_t srv_make_unix_date(const void *date_ptr);
855 time_t srv_make_unix_date2(const void *date_ptr);
856 time_t srv_make_unix_date3(const void *date_ptr);
857 struct timespec convert_time_t_to_timespec(time_t t);
858 struct timespec convert_timeval_to_timespec(const struct timeval tv);
859 struct timeval convert_timespec_to_timeval(const struct timespec ts);
860 struct timespec timespec_current(void);
861 struct timespec timespec_min(const struct timespec *ts1,
862 const struct timespec *ts2);
863 int timespec_compare(const struct timespec *ts1, const struct timespec *ts2);
864 void round_timespec_to_sec(struct timespec *ts);
865 void round_timespec_to_usec(struct timespec *ts);
866 struct timespec interpret_long_date(const char *p);
868 void get_process_uptime(struct timeval *ret_time);
869 void get_startup_time(struct timeval *ret_time);
870 time_t nt_time_to_unix_abs(const NTTIME *nt);
871 time_t uint64s_nt_time_to_unix_abs(const uint64_t *src);
872 void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts);
873 void unix_to_nt_time_abs(NTTIME *nt, time_t t);
874 const char *time_to_asc(const time_t t);
875 const char *display_time(NTTIME nttime);
876 bool nt_time_is_set(const NTTIME *nt);
878 /* The following definitions come from lib/username.c */
880 void flush_pwnam_cache(void);
881 char *get_user_home_dir(TALLOC_CTX *mem_ctx, const char *user);
882 struct passwd *Get_Pwnam_alloc(TALLOC_CTX *mem_ctx, const char *user);
884 /* The following definitions come from lib/util_names.c */
885 void gfree_netbios_names(void);
886 bool set_global_myname(const char *myname);
887 const char *global_myname(void);
888 bool set_global_myworkgroup(const char *myworkgroup);
889 const char *lp_workgroup(void);
890 const char *get_global_sam_name(void);
892 /* The following definitions come from lib/util.c */
894 enum protocol_types get_Protocol(void);
895 void set_Protocol(enum protocol_types p);
896 bool all_zero(const uint8_t *ptr, size_t size);
897 bool set_global_scope(const char *scope);
898 const char *global_scope(void);
899 void gfree_names(void);
900 void gfree_all( void );
901 const char *my_netbios_names(int i);
902 bool set_netbios_aliases(const char **str_array);
903 bool init_names(void);
904 struct user_auth_info *user_auth_info_init(TALLOC_CTX *mem_ctx);
905 const char *get_cmdline_auth_info_username(const struct user_auth_info *auth_info);
906 void set_cmdline_auth_info_username(struct user_auth_info *auth_info,
907 const char *username);
908 const char *get_cmdline_auth_info_domain(const struct user_auth_info *auth_info);
909 void set_cmdline_auth_info_domain(struct user_auth_info *auth_info,
911 void set_cmdline_auth_info_password(struct user_auth_info *auth_info,
912 const char *password);
913 const char *get_cmdline_auth_info_password(const struct user_auth_info *auth_info);
914 bool set_cmdline_auth_info_signing_state(struct user_auth_info *auth_info,
916 int get_cmdline_auth_info_signing_state(const struct user_auth_info *auth_info);
917 void set_cmdline_auth_info_use_ccache(struct user_auth_info *auth_info,
919 bool get_cmdline_auth_info_use_ccache(const struct user_auth_info *auth_info);
920 void set_cmdline_auth_info_use_kerberos(struct user_auth_info *auth_info,
922 bool get_cmdline_auth_info_use_kerberos(const struct user_auth_info *auth_info);
923 void set_cmdline_auth_info_fallback_after_kerberos(struct user_auth_info *auth_info,
925 bool get_cmdline_auth_info_fallback_after_kerberos(const struct user_auth_info *auth_info);
926 void set_cmdline_auth_info_use_krb5_ticket(struct user_auth_info *auth_info);
927 void set_cmdline_auth_info_smb_encrypt(struct user_auth_info *auth_info);
928 void set_cmdline_auth_info_use_machine_account(struct user_auth_info *auth_info);
929 bool get_cmdline_auth_info_got_pass(const struct user_auth_info *auth_info);
930 bool get_cmdline_auth_info_smb_encrypt(const struct user_auth_info *auth_info);
931 bool get_cmdline_auth_info_use_machine_account(const struct user_auth_info *auth_info);
932 struct user_auth_info *get_cmdline_auth_info_copy(TALLOC_CTX *mem_ctx,
933 const struct user_auth_info *info);
934 bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_info);
935 void set_cmdline_auth_info_getpass(struct user_auth_info *auth_info);
936 bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf,
937 bool fake_dir_create_times);
938 bool socket_exist(const char *fname);
939 uint64_t get_file_size_stat(const SMB_STRUCT_STAT *sbuf);
940 SMB_OFF_T get_file_size(char *file_name);
941 char *attrib_string(uint16 mode);
942 void show_msg(char *buf);
943 void smb_set_enclen(char *buf,int len,uint16 enc_ctx_num);
944 void smb_setlen(char *buf,int len);
945 int set_message_bcc(char *buf,int num_bytes);
946 ssize_t message_push_blob(uint8 **outbuf, DATA_BLOB blob);
947 char *unix_clean_name(TALLOC_CTX *ctx, const char *s);
948 char *clean_name(TALLOC_CTX *ctx, const char *s);
949 ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, SMB_OFF_T pos);
950 int set_blocking(int fd, bool set);
951 NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
952 struct event_context *ev_ctx,
954 bool parent_longlived);
955 void *malloc_(size_t size);
956 void *memalign_array(size_t el_size, size_t align, unsigned int count);
957 void *calloc_array(size_t size, size_t nmemb);
958 void *Realloc(void *p, size_t size, bool free_old_on_error);
959 void add_to_large_array(TALLOC_CTX *mem_ctx, size_t element_size,
960 void *element, void *_array, uint32 *num_elements,
961 ssize_t *array_size);
962 char *get_myname(TALLOC_CTX *ctx);
963 char *get_mydnsdomname(TALLOC_CTX *ctx);
964 int interpret_protocol(const char *str,int def);
965 char *automount_lookup(TALLOC_CTX *ctx, const char *user_name);
966 char *automount_lookup(TALLOC_CTX *ctx, const char *user_name);
967 bool process_exists(const struct server_id pid);
968 const char *uidtoname(uid_t uid);
969 char *gidtoname(gid_t gid);
970 uid_t nametouid(const char *name);
971 gid_t nametogid(const char *name);
972 void smb_panic_s3(const char *why);
973 void log_stack_trace(void);
974 const char *readdirname(SMB_STRUCT_DIR *p);
975 bool is_in_path(const char *name, name_compare_entry *namelist, bool case_sensitive);
976 void set_namearray(name_compare_entry **ppname_array, const char *namelist);
977 void free_namearray(name_compare_entry *name_array);
978 bool fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
979 bool fcntl_getlock(int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid);
980 bool is_myname(const char *s);
981 bool is_myworkgroup(const char *s);
982 void ra_lanman_string( const char *native_lanman );
983 const char *get_remote_arch_str(void);
984 void set_remote_arch(enum remote_arch_types type);
985 enum remote_arch_types get_remote_arch(void);
986 const char *tab_depth(int level, int depth);
987 int str_checksum(const char *s);
988 void zero_free(void *p, size_t size);
989 int set_maxfiles(int requested_max);
990 int smb_mkstemp(char *name_template);
991 void *smb_xmalloc_array(size_t size, unsigned int count);
992 char *myhostname(void);
993 char *lock_path(const char *name);
994 char *pid_path(const char *name);
995 char *lib_path(const char *name);
996 char *modules_path(const char *name);
997 char *data_path(const char *name);
998 char *state_path(const char *name);
999 char *cache_path(const char *name);
1000 const char *shlib_ext(void);
1001 bool parent_dirname(TALLOC_CTX *mem_ctx, const char *dir, char **parent,
1003 bool ms_has_wild(const char *s);
1004 bool ms_has_wild_w(const smb_ucs2_t *s);
1005 bool mask_match(const char *string, const char *pattern, bool is_case_sensitive);
1006 bool mask_match_search(const char *string, const char *pattern, bool is_case_sensitive);
1007 bool mask_match_list(const char *string, char **list, int listLen, bool is_case_sensitive);
1008 bool unix_wild_match(const char *pattern, const char *string);
1009 bool name_to_fqdn(fstring fqdn, const char *name);
1010 void *talloc_append_blob(TALLOC_CTX *mem_ctx, void *buf, DATA_BLOB blob);
1011 uint32 map_share_mode_to_deny_mode(uint32 share_access, uint32 private_options);
1012 pid_t procid_to_pid(const struct server_id *proc);
1013 void set_my_vnn(uint32 vnn);
1014 uint32 get_my_vnn(void);
1015 void set_my_unique_id(uint64_t unique_id);
1016 struct server_id pid_to_procid(pid_t pid);
1017 struct server_id procid_self(void);
1018 bool procid_equal(const struct server_id *p1, const struct server_id *p2);
1019 bool cluster_id_equal(const struct server_id *id1,
1020 const struct server_id *id2);
1021 bool procid_is_me(const struct server_id *pid);
1022 struct server_id interpret_pid(const char *pid_string);
1023 char *procid_str(TALLOC_CTX *mem_ctx, const struct server_id *pid);
1024 char *procid_str_static(const struct server_id *pid);
1025 bool procid_valid(const struct server_id *pid);
1026 bool procid_is_local(const struct server_id *pid);
1027 bool trans_oob(uint32_t bufsize, uint32_t offset, uint32_t length);
1028 bool is_offset_safe(const char *buf_base, size_t buf_len, char *ptr, size_t off);
1029 char *get_safe_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
1030 char *get_safe_str_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
1031 int get_safe_SVAL(const char *buf_base, size_t buf_len, char *ptr, size_t off, int failval);
1032 int get_safe_IVAL(const char *buf_base, size_t buf_len, char *ptr, size_t off, int failval);
1033 void split_domain_user(TALLOC_CTX *mem_ctx,
1034 const char *full_name,
1037 void *_talloc_zero_zeronull(const void *ctx, size_t size, const char *name);
1038 void *_talloc_memdup_zeronull(const void *t, const void *p, size_t size, const char *name);
1039 void *_talloc_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
1040 void *_talloc_zero_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
1041 void *talloc_zeronull(const void *context, size_t size, const char *name);
1042 const char *strip_hostname(const char *s);
1043 bool tevent_req_poll_ntstatus(struct tevent_req *req,
1044 struct tevent_context *ev,
1046 bool any_nt_status_not_ok(NTSTATUS err1, NTSTATUS err2, NTSTATUS *result);
1047 int timeval_to_msec(struct timeval t);
1049 /* The following definitions come from lib/util_builtin.c */
1051 bool lookup_builtin_rid(TALLOC_CTX *mem_ctx, uint32 rid, const char **name);
1052 bool lookup_builtin_name(const char *name, uint32 *rid);
1053 const char *builtin_domain_name(void);
1054 bool sid_check_is_builtin(const struct dom_sid *sid);
1055 bool sid_check_is_in_builtin(const struct dom_sid *sid);
1057 /* The following definitions come from lib/util_file.c */
1059 char **file_lines_pload(const char *syscmd, int *numlines);
1060 void file_lines_free(char **lines);
1062 /* The following definitions come from lib/util_nscd.c */
1064 void smb_nscd_flush_user_cache(void);
1065 void smb_nscd_flush_group_cache(void);
1067 /* The following definitions come from lib/util_nttoken.c */
1069 struct security_token *dup_nt_token(TALLOC_CTX *mem_ctx, const struct security_token *ptoken);
1070 NTSTATUS merge_nt_token(TALLOC_CTX *mem_ctx,
1071 const struct security_token *token_1,
1072 const struct security_token *token_2,
1073 struct security_token **token_out);
1074 bool token_sid_in_ace(const struct security_token *token, const struct security_ace *ace);
1076 /* The following definitions come from lib/util_sec.c */
1078 void sec_init(void);
1079 uid_t sec_initial_uid(void);
1080 gid_t sec_initial_gid(void);
1081 bool non_root_mode(void);
1082 void gain_root_privilege(void);
1083 void gain_root_group_privilege(void);
1084 void set_effective_uid(uid_t uid);
1085 void set_effective_gid(gid_t gid);
1086 void save_re_uid(void);
1087 void restore_re_uid_fromroot(void);
1088 void restore_re_uid(void);
1089 void save_re_gid(void);
1090 void restore_re_gid(void);
1091 int set_re_uid(void);
1092 void become_user_permanently(uid_t uid, gid_t gid);
1093 bool is_setuid_root(void) ;
1095 /* The following definitions come from lib/util_sid.c */
1097 char *sid_to_fstring(fstring sidstr_out, const struct dom_sid *sid);
1098 char *sid_string_talloc(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
1099 char *sid_string_dbg(const struct dom_sid *sid);
1100 char *sid_string_tos(const struct dom_sid *sid);
1101 bool sid_linearize(char *outbuf, size_t len, const struct dom_sid *sid);
1102 bool non_mappable_sid(struct dom_sid *sid);
1103 char *sid_binstring_hex(const struct dom_sid *sid);
1104 NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx,
1105 const struct netr_SamInfo3 *info3,
1106 struct dom_sid **user_sids,
1107 uint32_t *num_user_sids,
1108 bool include_user_group_rid,
1109 bool skip_ressource_groups);
1111 /* The following definitions come from lib/util_sock.c */
1113 bool is_broadcast_addr(const struct sockaddr *pss);
1114 bool is_loopback_ip_v4(struct in_addr ip);
1115 bool is_loopback_addr(const struct sockaddr *pss);
1116 bool is_zero_addr(const struct sockaddr_storage *pss);
1117 void zero_ip_v4(struct in_addr *ip);
1118 void in_addr_to_sockaddr_storage(struct sockaddr_storage *ss,
1120 bool same_net(const struct sockaddr *ip1,
1121 const struct sockaddr *ip2,
1122 const struct sockaddr *mask);
1123 bool sockaddr_equal(const struct sockaddr *ip1,
1124 const struct sockaddr *ip2);
1125 bool is_address_any(const struct sockaddr *psa);
1126 uint16_t get_sockaddr_port(const struct sockaddr_storage *pss);
1127 char *print_sockaddr(char *dest,
1129 const struct sockaddr_storage *psa);
1130 char *print_canonical_sockaddr(TALLOC_CTX *ctx,
1131 const struct sockaddr_storage *pss);
1132 const char *client_name(int fd);
1133 int get_socket_port(int fd);
1134 const char *client_addr(int fd, char *addr, size_t addrlen);
1135 const char *client_socket_addr(int fd, char *addr, size_t addr_len);
1136 int client_socket_port(int fd);
1137 void set_smb_read_error(enum smb_read_errors *pre,
1138 enum smb_read_errors newerr);
1139 void cond_set_smb_read_error(enum smb_read_errors *pre,
1140 enum smb_read_errors newerr);
1141 bool is_a_socket(int fd);
1142 void set_socket_options(int fd, const char *options);
1143 ssize_t read_udp_v4_socket(int fd,
1146 struct sockaddr_storage *psa);
1147 NTSTATUS read_fd_with_timeout(int fd, char *buf,
1148 size_t mincnt, size_t maxcnt,
1149 unsigned int time_out,
1151 NTSTATUS read_data(int fd, char *buffer, size_t N);
1152 ssize_t write_data(int fd, const char *buffer, size_t N);
1153 ssize_t write_data_iov(int fd, const struct iovec *orig_iov, int iovcnt);
1154 bool send_keepalive(int client);
1155 NTSTATUS read_smb_length_return_keepalive(int fd, char *inbuf,
1156 unsigned int timeout,
1158 NTSTATUS receive_smb_raw(int fd,
1161 unsigned int timeout,
1164 int open_socket_in(int type,
1167 const struct sockaddr_storage *psock,
1169 NTSTATUS open_socket_out(const struct sockaddr_storage *pss, uint16_t port,
1170 int timeout, int *pfd);
1171 struct tevent_req *open_socket_out_send(TALLOC_CTX *mem_ctx,
1172 struct event_context *ev,
1173 const struct sockaddr_storage *pss,
1176 NTSTATUS open_socket_out_recv(struct tevent_req *req, int *pfd);
1177 struct tevent_req *open_socket_out_defer_send(TALLOC_CTX *mem_ctx,
1178 struct event_context *ev,
1179 struct timeval wait_time,
1180 const struct sockaddr_storage *pss,
1183 NTSTATUS open_socket_out_defer_recv(struct tevent_req *req, int *pfd);
1184 int open_udp_socket(const char *host, int port);
1185 const char *get_peer_name(int fd, bool force_lookup);
1186 const char *get_peer_addr(int fd, char *addr, size_t addr_len);
1187 int create_pipe_sock(const char *socket_dir,
1188 const char *socket_name,
1190 const char *get_mydnsfullname(void);
1191 bool is_myname_or_ipaddr(const char *s);
1192 struct tevent_req *getaddrinfo_send(TALLOC_CTX *mem_ctx,
1193 struct tevent_context *ev,
1194 struct fncall_context *ctx,
1196 const char *service,
1197 const struct addrinfo *hints);
1198 int getaddrinfo_recv(struct tevent_req *req, struct addrinfo **res);
1199 int poll_one_fd(int fd, int events, int timeout, int *revents);
1200 int poll_intr_one_fd(int fd, int events, int timeout, int *revents);
1201 struct tevent_req *tstream_read_packet_send(TALLOC_CTX *mem_ctx,
1202 struct tevent_context *ev,
1203 struct tstream_context *stream,
1205 ssize_t (*more)(uint8_t *buf,
1207 void *private_data),
1208 void *private_data);
1209 ssize_t tstream_read_packet_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1210 uint8_t **pbuf, int *perrno);
1212 /* The following definitions come from lib/util_str.c */
1214 bool next_token(const char **ptr, char *buff, const char *sep, size_t bufsize);
1215 int StrCaseCmp(const char *s, const char *t);
1216 int StrnCaseCmp(const char *s, const char *t, size_t len);
1217 bool strnequal(const char *s1,const char *s2,size_t n);
1218 bool strcsequal(const char *s1,const char *s2);
1219 void strnorm(char *s, int case_default);
1220 bool strisnormal(const char *s, int case_default);
1221 char *push_skip_string(char *buf);
1222 char *skip_string(const char *base, size_t len, char *buf);
1223 size_t str_charnum(const char *s);
1224 size_t str_ascii_charnum(const char *s);
1225 bool trim_char(char *s,char cfront,char cback);
1226 bool strhasupper(const char *s);
1227 bool strhaslower(const char *s);
1228 char *safe_strcpy_fn(char *dest,
1231 char *safe_strcat_fn(char *dest,
1234 char *alpha_strcpy(char *dest,
1236 const char *other_safe_chars,
1238 char *StrnCpy(char *dest,const char *src,size_t n);
1239 bool in_list(const char *s, const char *list, bool casesensitive);
1240 void string_free(char **s);
1241 bool string_set(char **dest,const char *src);
1242 void string_sub2(char *s,const char *pattern, const char *insert, size_t len,
1243 bool remove_unsafe_characters, bool replace_once,
1244 bool allow_trailing_dollar);
1245 void string_sub_once(char *s, const char *pattern,
1246 const char *insert, size_t len);
1247 void string_sub(char *s,const char *pattern, const char *insert, size_t len);
1248 void fstring_sub(char *s,const char *pattern,const char *insert);
1249 char *realloc_string_sub2(char *string,
1250 const char *pattern,
1252 bool remove_unsafe_characters,
1253 bool allow_trailing_dollar);
1254 char *realloc_string_sub(char *string,
1255 const char *pattern,
1256 const char *insert);
1257 char *talloc_string_sub2(TALLOC_CTX *mem_ctx, const char *src,
1258 const char *pattern,
1260 bool remove_unsafe_characters,
1262 bool allow_trailing_dollar);
1263 char *talloc_string_sub(TALLOC_CTX *mem_ctx,
1265 const char *pattern,
1266 const char *insert);
1267 void all_string_sub(char *s,const char *pattern,const char *insert, size_t len);
1268 char *talloc_all_string_sub(TALLOC_CTX *ctx,
1270 const char *pattern,
1271 const char *insert);
1272 char *octal_string(int i);
1273 char *string_truncate(char *s, unsigned int length);
1274 char *strchr_m(const char *src, char c);
1275 char *strrchr_m(const char *s, char c);
1276 char *strnrchr_m(const char *s, char c, unsigned int n);
1277 char *strstr_m(const char *src, const char *findstr);
1278 void strlower_m(char *s);
1279 void strupper_m(char *s);
1280 size_t strlen_m(const char *s);
1281 size_t strlen_m_term(const char *s);
1282 size_t strlen_m_term_null(const char *s);
1283 int fstr_sprintf(fstring s, const char *fmt, ...);
1284 bool str_list_sub_basic( char **list, const char *smb_name,
1285 const char *domain_name );
1286 bool str_list_substitute(char **list, const char *pattern, const char *insert);
1288 char *ipstr_list_make(char **ipstr_list,
1289 const struct ip_service *ip_list,
1291 int ipstr_list_parse(const char *ipstr_list, struct ip_service **ip_list);
1292 void ipstr_list_free(char* ipstr_list);
1293 DATA_BLOB base64_decode_data_blob(const char *s);
1294 void base64_decode_inplace(char *s);
1295 char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data);
1296 uint64_t STR_TO_SMB_BIG_UINT(const char *nptr, const char **entptr);
1297 SMB_OFF_T conv_str_size(const char * str);
1298 void string_append(char **left, const char *right);
1299 bool add_string_to_array(TALLOC_CTX *mem_ctx,
1300 const char *str, const char ***strings,
1302 void sprintf_append(TALLOC_CTX *mem_ctx, char **string, ssize_t *len,
1303 size_t *bufsize, const char *fmt, ...);
1304 int asprintf_strupper_m(char **strp, const char *fmt, ...);
1305 char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...);
1306 char *talloc_asprintf_strlower_m(TALLOC_CTX *t, const char *fmt, ...);
1307 char *sstring_sub(const char *src, char front, char back);
1308 bool validate_net_name( const char *name,
1309 const char *invalid_chars,
1311 char *escape_shell_string(const char *src);
1312 char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep);
1313 char *sanitize_username(TALLOC_CTX *mem_ctx, const char *username);
1315 /* The following definitions come from lib/util_unistr.c */
1317 void gfree_case_tables(void);
1318 void load_case_tables(void);
1319 size_t dos_PutUniCode(char *dst,const char *src, size_t len, bool null_terminate);
1320 char *skip_unibuf(char *src, size_t len);
1321 int rpcstr_push(void *dest, const char *src, size_t dest_len, int flags);
1322 int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src);
1323 bool isvalid83_w(smb_ucs2_t c);
1324 size_t strlen_w(const smb_ucs2_t *src);
1325 size_t strnlen_w(const smb_ucs2_t *src, size_t max);
1326 smb_ucs2_t *strchr_w(const smb_ucs2_t *s, smb_ucs2_t c);
1327 smb_ucs2_t *strchr_wa(const smb_ucs2_t *s, char c);
1328 smb_ucs2_t *strrchr_w(const smb_ucs2_t *s, smb_ucs2_t c);
1329 smb_ucs2_t *strnrchr_w(const smb_ucs2_t *s, smb_ucs2_t c, unsigned int n);
1330 smb_ucs2_t *strstr_w(const smb_ucs2_t *s, const smb_ucs2_t *ins);
1331 bool strlower_w(smb_ucs2_t *s);
1332 bool strupper_w(smb_ucs2_t *s);
1333 void strnorm_w(smb_ucs2_t *s, int case_default);
1334 int strcmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b);
1335 int strncmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len);
1336 int strcasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b);
1337 int strncasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len);
1338 bool strequal_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2);
1339 bool strnequal_w(const smb_ucs2_t *s1,const smb_ucs2_t *s2,size_t n);
1340 smb_ucs2_t *strdup_w(const smb_ucs2_t *src);
1341 smb_ucs2_t *strndup_w(const smb_ucs2_t *src, size_t len);
1342 smb_ucs2_t *strncpy_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const size_t max);
1343 smb_ucs2_t *strncat_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const size_t max);
1344 smb_ucs2_t *strcat_w(smb_ucs2_t *dest, const smb_ucs2_t *src);
1345 void string_replace_w(smb_ucs2_t *s, smb_ucs2_t oldc, smb_ucs2_t newc);
1346 bool trim_string_w(smb_ucs2_t *s, const smb_ucs2_t *front,
1347 const smb_ucs2_t *back);
1348 int strcmp_wa(const smb_ucs2_t *a, const char *b);
1349 int strncmp_wa(const smb_ucs2_t *a, const char *b, size_t len);
1350 smb_ucs2_t *strpbrk_wa(const smb_ucs2_t *s, const char *p);
1351 smb_ucs2_t *strstr_wa(const smb_ucs2_t *s, const char *ins);
1352 int toupper_ascii(int c);
1353 int tolower_ascii(int c);
1354 int isupper_ascii(int c);
1355 int islower_ascii(int c);
1357 /* The following definitions come from lib/version.c */
1359 const char *samba_version_string(void);
1361 /* The following definitions come from lib/wins_srv.c */
1363 bool wins_srv_is_dead(struct in_addr wins_ip, struct in_addr src_ip);
1364 void wins_srv_alive(struct in_addr wins_ip, struct in_addr src_ip);
1365 void wins_srv_died(struct in_addr wins_ip, struct in_addr src_ip);
1366 unsigned wins_srv_count(void);
1367 char **wins_srv_tags(void);
1368 void wins_srv_tags_free(char **list);
1369 struct in_addr wins_srv_ip_tag(const char *tag, struct in_addr src_ip);
1370 unsigned wins_srv_count_tag(const char *tag);
1372 /* The following definitions come from libsmb/cliconnect.c */
1374 ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
1375 const char *pass, const char *user_domain,
1376 const char * dest_realm);
1378 NTSTATUS cli_session_setup(struct cli_state *cli,
1380 const char *pass, int passlen,
1381 const char *ntpass, int ntpasslen,
1382 const char *workgroup);
1383 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
1384 struct event_context *ev,
1385 struct cli_state *cli,
1386 struct tevent_req **psmbreq);
1387 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
1388 struct event_context *ev,
1389 struct cli_state *cli);
1390 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
1391 struct tevent_req *cli_ulogoff_send(TALLOC_CTX *mem_ctx,
1392 struct tevent_context *ev,
1393 struct cli_state *cli);
1394 NTSTATUS cli_ulogoff_recv(struct tevent_req *req);
1395 NTSTATUS cli_ulogoff(struct cli_state *cli);
1396 struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
1397 struct event_context *ev,
1398 struct cli_state *cli,
1399 const char *share, const char *dev,
1400 const char *pass, int passlen,
1401 struct tevent_req **psmbreq);
1402 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
1403 struct event_context *ev,
1404 struct cli_state *cli,
1405 const char *share, const char *dev,
1406 const char *pass, int passlen);
1407 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
1408 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
1409 const char *dev, const char *pass, int passlen);
1410 struct tevent_req *cli_tdis_send(TALLOC_CTX *mem_ctx,
1411 struct tevent_context *ev,
1412 struct cli_state *cli);
1413 NTSTATUS cli_tdis_recv(struct tevent_req *req);
1414 NTSTATUS cli_tdis(struct cli_state *cli);
1415 NTSTATUS cli_negprot(struct cli_state *cli);
1416 struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
1417 struct event_context *ev,
1418 struct cli_state *cli);
1419 NTSTATUS cli_negprot_recv(struct tevent_req *req);
1420 bool cli_session_request(struct cli_state *cli,
1421 struct nmb_name *calling, struct nmb_name *called);
1422 NTSTATUS cli_connect(struct cli_state *cli,
1424 struct sockaddr_storage *dest_ss);
1425 NTSTATUS cli_start_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 int signing_state, int flags);
1430 NTSTATUS cli_full_connection(struct cli_state **output_cli,
1431 const char *my_name,
1432 const char *dest_host,
1433 struct sockaddr_storage *dest_ss, int port,
1434 const char *service, const char *service_type,
1435 const char *user, const char *domain,
1436 const char *password, int flags,
1438 bool attempt_netbios_session_request(struct cli_state **ppcli, const char *srchost, const char *desthost,
1439 struct sockaddr_storage *pdest_ss);
1440 NTSTATUS cli_raw_tcon(struct cli_state *cli,
1441 const char *service, const char *pass, const char *dev,
1442 uint16 *max_xmit, uint16 *tid);
1443 struct cli_state *get_ipc_connect(char *server,
1444 struct sockaddr_storage *server_ss,
1445 const struct user_auth_info *user_info);
1446 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
1447 struct ip_service *mb_ip,
1448 const struct user_auth_info *user_info,
1449 char **pp_workgroup_out);
1450 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
1451 const struct user_auth_info *user_info,
1452 char **pp_workgroup_out);
1454 /* The following definitions come from libsmb/clidfs.c */
1456 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
1457 const char *username,
1458 const char *password,
1460 const char *sharename);
1461 struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
1462 struct cli_state *referring_cli,
1465 const struct user_auth_info *auth_info,
1471 void cli_cm_display(const struct cli_state *c);
1472 struct client_dfs_referral;
1473 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
1474 struct cli_state *cli,
1476 struct client_dfs_referral **refs,
1479 bool cli_resolve_path(TALLOC_CTX *ctx,
1480 const char *mountpt,
1481 const struct user_auth_info *dfs_auth_info,
1482 struct cli_state *rootcli,
1484 struct cli_state **targetcli,
1485 char **pp_targetpath);
1487 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
1488 struct cli_state *cli,
1489 const char *sharename,
1490 char **pp_newserver,
1493 const char *username,
1494 const char *password,
1495 const char *domain);
1497 /* The following definitions come from libsmb/clientgen.c */
1499 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
1500 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
1501 void cli_set_port(struct cli_state *cli, int port);
1502 bool cli_state_seqnum_persistent(struct cli_state *cli,
1504 bool cli_state_seqnum_remove(struct cli_state *cli,
1506 bool cli_receive_smb(struct cli_state *cli);
1507 bool cli_send_smb(struct cli_state *cli);
1508 bool cli_send_smb_direct_writeX(struct cli_state *cli,
1511 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
1512 void cli_setup_packet(struct cli_state *cli);
1513 void cli_setup_bcc(struct cli_state *cli, void *p);
1514 NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
1515 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);
1516 NTSTATUS cli_set_password(struct cli_state *cli, const char *password);
1517 NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password);
1518 struct cli_state *cli_initialise(void);
1519 struct cli_state *cli_initialise_ex(int signing_state);
1520 void cli_nt_pipes_close(struct cli_state *cli);
1521 void cli_shutdown(struct cli_state *cli);
1522 void cli_sockopt(struct cli_state *cli, const char *options);
1523 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
1524 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
1525 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
1526 struct cli_state *cli, uint16_t num_echos,
1528 NTSTATUS cli_echo_recv(struct tevent_req *req);
1529 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
1530 bool cli_ucs2(struct cli_state *cli);
1531 bool is_andx_req(uint8_t cmd);
1532 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
1533 uint8_t smb_command, uint8_t additional_flags,
1534 uint8_t wct, uint16_t *vwv,
1535 uint32_t num_bytes, const uint8_t *bytes,
1536 struct tevent_req **result_parent,
1537 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
1538 uint32_t *pnum_bytes, uint8_t **pbytes);
1540 /* The following definitions come from libsmb/clierror.c */
1542 const char *cli_errstr(struct cli_state *cli);
1543 NTSTATUS cli_nt_error(struct cli_state *cli);
1544 void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode);
1545 int cli_errno(struct cli_state *cli);
1546 bool cli_is_error(struct cli_state *cli);
1547 bool cli_is_nt_error(struct cli_state *cli);
1548 bool cli_is_dos_error(struct cli_state *cli);
1549 NTSTATUS cli_get_nt_error(struct cli_state *cli);
1550 void cli_set_nt_error(struct cli_state *cli, NTSTATUS status);
1551 void cli_reset_error(struct cli_state *cli);
1552 bool cli_state_is_connected(struct cli_state *cli);
1554 /* The following definitions come from libsmb/clifile.c */
1556 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
1557 struct tevent_context *ev,
1558 struct cli_state *cli,
1563 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
1564 NTSTATUS cli_setpathinfo(struct cli_state *cli,
1570 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
1571 struct event_context *ev,
1572 struct cli_state *cli,
1573 const char *oldname,
1574 const char *newname);
1575 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
1576 NTSTATUS cli_posix_symlink(struct cli_state *cli,
1577 const char *oldname,
1578 const char *newname);
1579 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
1580 struct event_context *ev,
1581 struct cli_state *cli,
1584 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
1585 char *retpath, size_t len);
1586 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
1587 char *linkpath, size_t len);
1588 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
1589 struct event_context *ev,
1590 struct cli_state *cli,
1591 const char *oldname,
1592 const char *newname);
1593 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
1594 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
1595 const char *oldname,
1596 const char *newname);
1597 uint32_t unix_perms_to_wire(mode_t perms);
1598 mode_t wire_perms_to_unix(uint32_t perms);
1599 struct tevent_req *cli_posix_getfacl_send(TALLOC_CTX *mem_ctx,
1600 struct event_context *ev,
1601 struct cli_state *cli,
1603 NTSTATUS cli_posix_getfacl_recv(struct tevent_req *req,
1604 TALLOC_CTX *mem_ctx,
1607 NTSTATUS cli_posix_getfacl(struct cli_state *cli,
1609 TALLOC_CTX *mem_ctx,
1612 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
1613 struct event_context *ev,
1614 struct cli_state *cli,
1616 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
1617 SMB_STRUCT_STAT *sbuf);
1618 NTSTATUS cli_posix_stat(struct cli_state *cli,
1620 SMB_STRUCT_STAT *sbuf);
1621 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
1622 struct event_context *ev,
1623 struct cli_state *cli,
1626 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
1627 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
1628 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
1629 struct event_context *ev,
1630 struct cli_state *cli,
1634 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
1635 NTSTATUS cli_posix_chown(struct cli_state *cli,
1639 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
1640 struct event_context *ev,
1641 struct cli_state *cli,
1642 const char *fname_src,
1643 const char *fname_dst);
1644 NTSTATUS cli_rename_recv(struct tevent_req *req);
1645 NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
1646 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
1647 struct event_context *ev,
1648 struct cli_state *cli,
1649 const char *fname_src,
1650 const char *fname_dst);
1651 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
1652 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
1654 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
1655 struct event_context *ev,
1656 struct cli_state *cli,
1657 const char *fname_src,
1658 const char *fname_dst);
1659 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
1660 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
1662 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
1663 struct event_context *ev,
1664 struct cli_state *cli,
1666 uint16_t mayhave_attrs);
1667 NTSTATUS cli_unlink_recv(struct tevent_req *req);
1668 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
1670 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
1671 struct event_context *ev,
1672 struct cli_state *cli,
1674 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
1675 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
1676 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
1677 struct event_context *ev,
1678 struct cli_state *cli,
1680 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
1681 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
1682 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
1683 struct event_context *ev,
1684 struct cli_state *cli,
1687 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
1688 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
1689 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
1690 struct event_context *ev,
1691 struct cli_state *cli,
1693 uint32_t CreatFlags,
1694 uint32_t DesiredAccess,
1695 uint32_t FileAttributes,
1696 uint32_t ShareAccess,
1697 uint32_t CreateDisposition,
1698 uint32_t CreateOptions,
1699 uint8_t SecurityFlags);
1700 NTSTATUS cli_ntcreate_recv(struct tevent_req *req, uint16_t *pfnum);
1701 NTSTATUS cli_ntcreate(struct cli_state *cli,
1703 uint32_t CreatFlags,
1704 uint32_t DesiredAccess,
1705 uint32_t FileAttributes,
1706 uint32_t ShareAccess,
1707 uint32_t CreateDisposition,
1708 uint32_t CreateOptions,
1709 uint8_t SecurityFlags,
1711 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
1712 size_t str_len, size_t *pconverted_size);
1713 uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
1714 const uint8_t *bytes, size_t num_bytes);
1715 struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx,
1716 struct event_context *ev,
1717 struct cli_state *cli, const char *fname,
1718 int flags, int share_mode,
1719 struct tevent_req **psmbreq);
1720 struct tevent_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
1721 struct cli_state *cli, const char *fname,
1722 int flags, int share_mode);
1723 NTSTATUS cli_open_recv(struct tevent_req *req, uint16_t *fnum);
1724 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
1725 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
1726 struct event_context *ev,
1727 struct cli_state *cli, uint16_t fnum,
1728 struct tevent_req **psubreq);
1729 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
1730 struct event_context *ev,
1731 struct cli_state *cli, uint16_t fnum);
1732 NTSTATUS cli_close_recv(struct tevent_req *req);
1733 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
1734 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
1735 struct event_context *ev,
1736 struct cli_state *cli,
1739 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
1740 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
1741 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
1742 uint32_t offset, uint32_t len,
1743 int timeout, unsigned char locktype);
1744 bool cli_lock(struct cli_state *cli, uint16_t fnum,
1745 uint32_t offset, uint32_t len, int timeout, enum brl_type lock_type);
1746 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
1747 struct event_context *ev,
1748 struct cli_state *cli,
1752 NTSTATUS cli_unlock_recv(struct tevent_req *req);
1753 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
1754 bool cli_lock64(struct cli_state *cli, uint16_t fnum,
1755 uint64_t offset, uint64_t len, int timeout, enum brl_type lock_type);
1756 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
1757 struct event_context *ev,
1758 struct cli_state *cli,
1762 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
1763 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
1764 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
1765 struct event_context *ev,
1766 struct cli_state *cli,
1771 enum brl_type lock_type);
1772 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
1773 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
1774 uint64_t offset, uint64_t len,
1775 bool wait_lock, enum brl_type lock_type);
1776 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
1777 struct event_context *ev,
1778 struct cli_state *cli,
1782 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
1783 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
1784 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
1785 struct event_context *ev,
1786 struct cli_state *cli,
1788 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
1791 time_t *change_time,
1792 time_t *access_time,
1793 time_t *write_time);
1794 NTSTATUS cli_getattrE(struct cli_state *cli,
1798 time_t *change_time,
1799 time_t *access_time,
1800 time_t *write_time);
1801 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
1802 struct event_context *ev,
1803 struct cli_state *cli,
1808 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
1809 NTSTATUS cli_setattrE(struct cli_state *cli,
1814 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
1815 struct event_context *ev,
1816 struct cli_state *cli,
1818 NTSTATUS cli_getatr_recv(struct tevent_req *req,
1821 time_t *write_time);
1822 NTSTATUS cli_getatr(struct cli_state *cli,
1826 time_t *write_time);
1827 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
1828 struct event_context *ev,
1829 struct cli_state *cli,
1833 NTSTATUS cli_setatr_recv(struct tevent_req *req);
1834 NTSTATUS cli_setatr(struct cli_state *cli,
1838 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
1839 struct event_context *ev,
1840 struct cli_state *cli,
1842 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
1843 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
1844 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
1845 struct event_context *ev,
1846 struct cli_state *cli);
1847 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
1849 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
1850 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
1851 struct event_context *ev,
1852 struct cli_state *cli,
1854 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
1858 NTSTATUS cli_ctemp(struct cli_state *cli,
1863 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
1864 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
1865 const char *ea_name, const char *ea_val,
1867 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
1868 const char *ea_name, const char *ea_val,
1870 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
1871 struct tevent_context *ev,
1872 struct cli_state *cli,
1874 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1875 size_t *pnum_eas, struct ea_struct **peas);
1876 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
1879 struct ea_struct **pea_list);
1880 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
1881 struct event_context *ev,
1882 struct cli_state *cli,
1886 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
1887 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
1888 int flags, mode_t mode, uint16_t *fnum);
1889 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
1890 struct event_context *ev,
1891 struct cli_state *cli,
1894 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
1895 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
1897 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
1898 struct event_context *ev,
1899 struct cli_state *cli,
1901 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
1902 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
1904 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
1905 struct event_context *ev,
1906 struct cli_state *cli,
1908 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1909 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
1910 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
1911 struct tevent_context *ev,
1912 struct cli_state *cli, uint16_t fnum,
1913 uint32_t buffer_size,
1914 uint32_t completion_filter, bool recursive);
1915 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1916 uint32_t *pnum_changes,
1917 struct notify_change **pchanges);
1919 /* The following definitions come from libsmb/clifsinfo.c */
1921 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
1922 struct tevent_context *ev,
1923 struct cli_state *cli);
1924 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
1925 uint16_t *pmajor, uint16_t *pminor,
1927 uint32_t *pcaphigh);
1928 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor,
1929 uint16 *pminor, uint32 *pcaplow,
1931 struct tevent_req *cli_set_unix_extensions_capabilities_send(
1932 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
1933 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
1934 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
1935 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
1936 uint16 major, uint16 minor,
1937 uint32 caplow, uint32 caphigh);
1938 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
1939 struct tevent_context *ev,
1940 struct cli_state *cli);
1941 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
1942 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
1943 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name,
1944 uint32 *pserial_number, time_t *pdate);
1945 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
1946 uint64_t *total_allocation_units,
1947 uint64_t *caller_allocation_units,
1948 uint64_t *actual_allocation_units,
1949 uint64_t *sectors_per_allocation_unit,
1950 uint64_t *bytes_per_sector);
1951 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
1952 uint32 *optimal_transfer_size,
1954 uint64_t *total_blocks,
1955 uint64_t *blocks_available,
1956 uint64_t *user_blocks_available,
1957 uint64_t *total_file_nodes,
1958 uint64_t *free_file_nodes,
1959 uint64_t *fs_identifier);
1960 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
1963 const char *domain);
1964 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
1965 NTSTATUS cli_force_encryption(struct cli_state *c,
1966 const char *username,
1967 const char *password,
1968 const char *domain);
1970 /* The following definitions come from libsmb/clikrb5.c */
1972 bool unwrap_edata_ntstatus(TALLOC_CTX *mem_ctx,
1974 DATA_BLOB *edata_out);
1975 bool unwrap_pac(TALLOC_CTX *mem_ctx, DATA_BLOB *auth_data, DATA_BLOB *unwrapped_pac_data);
1977 /* The following definitions come from libsmb/clilist.c */
1979 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
1980 NTSTATUS (*fn)(const char *, struct file_info *,
1981 const char *, void *), void *state);
1982 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
1983 uint16_t attribute, int info_level,
1984 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
1985 const char *mask, void *private_data),
1986 void *private_data);
1987 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
1988 struct tevent_context *ev,
1989 struct cli_state *cli,
1992 uint16_t info_level);
1993 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1994 struct file_info **finfo, size_t *num_finfo);
1995 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
1996 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
1997 void *), void *state);
1999 /* The following definitions come from libsmb/climessage.c */
2001 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
2002 struct tevent_context *ev,
2003 struct cli_state *cli,
2004 const char *host, const char *username,
2005 const char *message);
2006 NTSTATUS cli_message_recv(struct tevent_req *req);
2007 NTSTATUS cli_message(struct cli_state *cli, const char *host,
2008 const char *username, const char *message);
2010 /* The following definitions come from libsmb/clioplock.c */
2012 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
2013 struct tevent_context *ev,
2014 struct cli_state *cli,
2015 uint16_t fnum, uint8_t level);
2016 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
2017 NTSTATUS cli_oplock_ack(struct cli_state *cli, uint16_t fnum, unsigned char level);
2018 void cli_oplock_handler(struct cli_state *cli,
2019 NTSTATUS (*handler)(struct cli_state *, uint16_t, unsigned char));
2021 /* The following definitions come from libsmb/cliprint.c */
2023 int cli_print_queue(struct cli_state *cli,
2024 void (*fn)(struct print_job_info *));
2025 int cli_printjob_del(struct cli_state *cli, int job);
2027 /* The following definitions come from libsmb/cliquota.c */
2029 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
2030 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
2031 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
2032 SMB_NTQUOTA_STRUCT *pqt);
2033 NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
2034 SMB_NTQUOTA_STRUCT *pqt);
2035 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
2036 SMB_NTQUOTA_LIST **pqt_list);
2037 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
2038 SMB_NTQUOTA_STRUCT *pqt);
2039 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
2040 SMB_NTQUOTA_STRUCT *pqt);
2042 /* The following definitions come from libsmb/clireadwrite.c */
2044 struct tevent_req *cli_read_andx_create(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 struct tevent_req **psmbreq);
2049 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
2050 struct event_context *ev,
2051 struct cli_state *cli, uint16_t fnum,
2052 off_t offset, size_t size);
2053 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
2055 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
2056 struct event_context *ev,
2057 struct cli_state *cli,
2058 uint16_t fnum, off_t start_offset,
2059 SMB_OFF_T size, size_t window_size,
2060 NTSTATUS (*sink)(char *buf, size_t n,
2063 NTSTATUS cli_pull_recv(struct tevent_req *req, SMB_OFF_T *received);
2064 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
2065 off_t start_offset, SMB_OFF_T size, size_t window_size,
2066 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
2067 void *priv, SMB_OFF_T *received);
2068 ssize_t cli_read(struct cli_state *cli, uint16_t fnum, char *buf,
2069 off_t offset, size_t size);
2070 ssize_t cli_write(struct cli_state *cli,
2071 uint16_t fnum, uint16 write_mode,
2072 const char *buf, off_t offset, size_t size);
2073 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
2074 off_t offset, size_t size1, size_t *ptotal);
2075 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
2076 struct event_context *ev,
2077 struct cli_state *cli, uint16_t fnum,
2078 uint16_t mode, const uint8_t *buf,
2079 off_t offset, size_t size,
2080 struct tevent_req **reqs_before,
2081 int num_reqs_before,
2082 struct tevent_req **psmbreq);
2083 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
2084 struct event_context *ev,
2085 struct cli_state *cli, uint16_t fnum,
2086 uint16_t mode, const uint8_t *buf,
2087 off_t offset, size_t size);
2088 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
2090 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
2091 struct cli_state *cli,
2092 uint16_t fnum, uint16_t mode,
2093 off_t start_offset, size_t window_size,
2094 size_t (*source)(uint8_t *buf, size_t n,
2097 NTSTATUS cli_push_recv(struct tevent_req *req);
2098 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
2099 off_t start_offset, size_t window_size,
2100 size_t (*source)(uint8_t *buf, size_t n, void *priv),
2103 /* The following definitions come from libsmb/clisecdesc.c */
2105 struct security_descriptor *cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
2106 TALLOC_CTX *mem_ctx);
2107 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
2108 struct security_descriptor *sd);
2110 /* The following definitions come from libsmb/clispnego.c */
2112 DATA_BLOB spnego_gen_negTokenInit(TALLOC_CTX *ctx,
2114 DATA_BLOB *psecblob,
2115 const char *principal);
2117 #ifndef ASN1_MAX_OIDS
2118 #define ASN1_MAX_OIDS 20
2120 bool spnego_parse_negTokenInit(TALLOC_CTX *ctx,
2122 char *OIDs[ASN1_MAX_OIDS],
2124 DATA_BLOB *secblob);
2125 DATA_BLOB spnego_gen_krb5_wrap(TALLOC_CTX *ctx, const DATA_BLOB ticket, const uint8 tok_id[2]);
2126 bool spnego_parse_krb5_wrap(TALLOC_CTX *ctx, DATA_BLOB blob, DATA_BLOB *ticket, uint8 tok_id[2]);
2127 int spnego_gen_krb5_negTokenInit(TALLOC_CTX *ctx,
2128 const char *principal, int time_offset,
2130 DATA_BLOB *session_key_krb5, uint32 extra_ap_opts,
2131 time_t *expire_time);
2132 bool spnego_parse_challenge(TALLOC_CTX *ctx, const DATA_BLOB blob,
2133 DATA_BLOB *chal1, DATA_BLOB *chal2);
2134 DATA_BLOB spnego_gen_auth(TALLOC_CTX *ctx, DATA_BLOB blob);
2135 bool spnego_parse_auth(TALLOC_CTX *ctx, DATA_BLOB blob, DATA_BLOB *auth);
2136 DATA_BLOB spnego_gen_auth_response(TALLOC_CTX *ctx, DATA_BLOB *reply, NTSTATUS nt_status,
2137 const char *mechOID);
2138 bool spnego_parse_auth_response(TALLOC_CTX *ctx,
2139 DATA_BLOB blob, NTSTATUS nt_status,
2140 const char *mechOID,
2143 bool spnego_parse_auth_and_mic(TALLOC_CTX *ctx, DATA_BLOB blob,
2144 DATA_BLOB *auth, DATA_BLOB *signature);
2145 DATA_BLOB spnego_gen_auth_response_and_mic(TALLOC_CTX *ctx,
2147 const char *mechOID,
2149 DATA_BLOB *mechlistMIC);
2150 bool spnego_mech_list_blob(TALLOC_CTX *mem_ctx,
2151 char **oid_list, DATA_BLOB *data);
2153 /* The following definitions come from libsmb/clistr.c */
2155 size_t clistr_push_fn(struct cli_state *cli,
2160 size_t clistr_pull_fn(const char *inbuf,
2166 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
2173 size_t clistr_align_out(struct cli_state *cli, const void *p, int flags);
2175 /* The following definitions come from libsmb/clitrans.c */
2177 struct tevent_req *cli_trans_send(
2178 TALLOC_CTX *mem_ctx, struct event_context *ev,
2179 struct cli_state *cli, uint8_t cmd,
2180 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
2181 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
2182 uint8_t *param, uint32_t num_param, uint32_t max_param,
2183 uint8_t *data, uint32_t num_data, uint32_t max_data);
2184 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
2185 uint16_t *recv_flags2,
2186 uint16_t **setup, uint8_t min_setup,
2188 uint8_t **param, uint32_t min_param,
2189 uint32_t *num_param,
2190 uint8_t **data, uint32_t min_data,
2191 uint32_t *num_data);
2192 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
2194 const char *pipe_name, uint16_t fid, uint16_t function,
2196 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
2197 uint8_t *param, uint32_t num_param, uint32_t max_param,
2198 uint8_t *data, uint32_t num_data, uint32_t max_data,
2199 uint16_t *recv_flags2,
2200 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
2201 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
2202 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
2204 /* The following definitions come from libsmb/conncache.c */
2206 NTSTATUS check_negative_conn_cache( const char *domain, const char *server);
2207 void add_failed_connection_entry(const char *domain, const char *server, NTSTATUS result) ;
2208 void flush_negative_conn_cache_for_domain(const char *domain);
2210 /* The following definitions come from libsmb/dsgetdcname.c */
2212 struct netr_DsRGetDCNameInfo;
2214 void debug_dsdcinfo_flags(int lvl, uint32_t flags);
2215 NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx,
2216 struct messaging_context *msg_ctx,
2217 const char *domain_name,
2218 const struct GUID *domain_guid,
2219 const char *site_name,
2221 struct netr_DsRGetDCNameInfo **info);
2223 /* The following definitions come from libsmb/errormap.c */
2225 NTSTATUS dos_to_ntstatus(uint8 eclass, uint32 ecode);
2226 void ntstatus_to_dos(NTSTATUS ntstatus, uint8 *eclass, uint32 *ecode);
2227 NTSTATUS werror_to_ntstatus(WERROR error);
2228 WERROR ntstatus_to_werror(NTSTATUS error);
2229 NTSTATUS map_nt_error_from_gss(uint32 gss_maj, uint32 minor);
2231 /* The following definitions come from libsmb/namecache.c */
2233 bool namecache_store(const char *name,
2236 struct ip_service *ip_list);
2237 bool namecache_fetch(const char *name,
2239 struct ip_service **ip_list,
2241 bool namecache_delete(const char *name, int name_type);
2242 void namecache_flush(void);
2243 bool namecache_status_store(const char *keyname, int keyname_type,
2244 int name_type, const struct sockaddr_storage *keyip,
2245 const char *srvname);
2246 bool namecache_status_fetch(const char *keyname,
2249 const struct sockaddr_storage *keyip,
2252 /* The following definitions come from libsmb/namequery.c */
2254 bool saf_store( const char *domain, const char *servername );
2255 bool saf_join_store( const char *domain, const char *servername );
2256 bool saf_delete( const char *domain );
2257 char *saf_fetch( const char *domain );
2258 struct tevent_req *node_status_query_send(TALLOC_CTX *mem_ctx,
2259 struct tevent_context *ev,
2260 struct nmb_name *name,
2261 const struct sockaddr_storage *addr);
2262 NTSTATUS node_status_query_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
2263 struct node_status **pnode_status,
2265 struct node_status_extra *extra);
2266 NTSTATUS node_status_query(TALLOC_CTX *mem_ctx, struct nmb_name *name,
2267 const struct sockaddr_storage *addr,
2268 struct node_status **pnode_status,
2270 struct node_status_extra *extra);
2271 bool name_status_find(const char *q_name,
2274 const struct sockaddr_storage *to_ss,
2276 int ip_service_compare(struct ip_service *ss1, struct ip_service *ss2);
2277 struct tevent_req *name_query_send(TALLOC_CTX *mem_ctx,
2278 struct tevent_context *ev,
2279 const char *name, int name_type,
2280 bool bcast, bool recurse,
2281 const struct sockaddr_storage *addr);
2282 NTSTATUS name_query_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
2283 struct sockaddr_storage **addrs, int *num_addrs,
2285 NTSTATUS name_query(const char *name, int name_type,
2286 bool bcast, bool recurse,
2287 const struct sockaddr_storage *to_ss,
2288 TALLOC_CTX *mem_ctx,
2289 struct sockaddr_storage **addrs,
2290 int *num_addrs, uint8_t *flags);
2291 NTSTATUS name_resolve_bcast(const char *name,
2293 struct ip_service **return_iplist,
2295 NTSTATUS resolve_wins(const char *name,
2297 struct ip_service **return_iplist,
2299 NTSTATUS internal_resolve_name(const char *name,
2301 const char *sitename,
2302 struct ip_service **return_iplist,
2304 const char *resolve_order);
2305 bool resolve_name(const char *name,
2306 struct sockaddr_storage *return_ss,
2309 NTSTATUS resolve_name_list(TALLOC_CTX *ctx,
2312 struct sockaddr_storage **return_ss_arr,
2313 unsigned int *p_num_entries);
2314 bool find_master_ip(const char *group, struct sockaddr_storage *master_ss);
2315 bool get_pdc_ip(const char *domain, struct sockaddr_storage *pss);
2316 NTSTATUS get_sorted_dc_list( const char *domain,
2317 const char *sitename,
2318 struct ip_service **ip_list,
2321 NTSTATUS get_kdc_list( const char *realm,
2322 const char *sitename,
2323 struct ip_service **ip_list,
2326 /* The following definitions come from libsmb/namequery_dc.c */
2328 bool get_dc_name(const char *domain,
2331 struct sockaddr_storage *ss_out);
2333 /* The following definitions come from libsmb/nmblib.c */
2335 void debug_nmb_packet(struct packet_struct *p);
2336 void put_name(char *dest, const char *name, int pad, unsigned int name_type);
2337 char *nmb_namestr(const struct nmb_name *n);
2338 struct packet_struct *copy_packet(struct packet_struct *packet);
2339 void free_packet(struct packet_struct *packet);
2340 int packet_trn_id(struct packet_struct *p);
2341 struct packet_struct *parse_packet(char *buf,int length,
2342 enum packet_type packet_type,
2345 struct packet_struct *read_packet(int fd,enum packet_type packet_type);
2346 void make_nmb_name( struct nmb_name *n, const char *name, int type);
2347 bool nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2);
2348 int build_packet(char *buf, size_t buflen, struct packet_struct *p);
2349 bool send_packet(struct packet_struct *p);
2350 bool match_mailslot_name(struct packet_struct *p, const char *mailslot_name);
2351 int matching_len_bits(unsigned char *p1, unsigned char *p2, size_t len);
2352 void sort_query_replies(char *data, int n, struct in_addr ip);
2353 char *name_mangle(TALLOC_CTX *mem_ctx, const char *In, char name_type);
2354 int name_extract(unsigned char *buf,size_t buf_len, unsigned int ofs, fstring name);
2355 int name_len(unsigned char *s1, size_t buf_len);
2357 /* The following definitions come from libsmb/nterr.c */
2359 const char *nt_errstr(NTSTATUS nt_code);
2360 const char *get_friendly_nt_error_msg(NTSTATUS nt_code);
2361 const char *get_nt_error_c_code(NTSTATUS nt_code);
2362 NTSTATUS nt_status_string_to_code(const char *nt_status_str);
2363 NTSTATUS nt_status_squash(NTSTATUS nt_status);
2365 /* The following definitions come from libsmb/ntlmssp.c */
2366 struct ntlmssp_state;
2367 NTSTATUS ntlmssp_set_username(struct ntlmssp_state *ntlmssp_state, const char *user) ;
2368 NTSTATUS ntlmssp_set_hashes(struct ntlmssp_state *ntlmssp_state,
2369 const uint8_t lm_hash[16],
2370 const uint8_t nt_hash[16]) ;
2371 NTSTATUS ntlmssp_set_password(struct ntlmssp_state *ntlmssp_state, const char *password) ;
2372 NTSTATUS ntlmssp_set_domain(struct ntlmssp_state *ntlmssp_state, const char *domain) ;
2373 void ntlmssp_want_feature_list(struct ntlmssp_state *ntlmssp_state, char *feature_list);
2374 void ntlmssp_want_feature(struct ntlmssp_state *ntlmssp_state, uint32_t feature);
2375 NTSTATUS ntlmssp_update(struct ntlmssp_state *ntlmssp_state,
2376 const DATA_BLOB in, DATA_BLOB *out) ;
2377 NTSTATUS ntlmssp_server_start(TALLOC_CTX *mem_ctx,
2379 const char *netbios_name,
2380 const char *netbios_domain,
2381 const char *dns_name,
2382 const char *dns_domain,
2383 struct ntlmssp_state **ntlmssp_state);
2384 NTSTATUS ntlmssp_client_start(TALLOC_CTX *mem_ctx,
2385 const char *netbios_name,
2386 const char *netbios_domain,
2388 struct ntlmssp_state **_ntlmssp_state);
2390 /* The following definitions come from libsmb/passchange.c */
2392 NTSTATUS remote_password_change(const char *remote_machine, const char *user_name,
2393 const char *old_passwd, const char *new_passwd,
2396 /* The following definitions come from libsmb/samlogon_cache.c */
2398 bool netsamlogon_cache_init(void);
2399 bool netsamlogon_cache_shutdown(void);
2400 void netsamlogon_clear_cached_user(const struct dom_sid *user_sid);
2401 bool netsamlogon_cache_store(const char *username, struct netr_SamInfo3 *info3);
2402 struct netr_SamInfo3 *netsamlogon_cache_get(TALLOC_CTX *mem_ctx, const struct dom_sid *user_sid);
2403 bool netsamlogon_cache_have(const struct dom_sid *user_sid);
2405 /* The following definitions come from libsmb/smb_seal.c */
2407 NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16 *p_enc_ctx_num);
2408 bool common_encryption_on(struct smb_trans_enc_state *es);
2409 NTSTATUS common_ntlm_decrypt_buffer(struct ntlmssp_state *ntlmssp_state, char *buf);
2410 NTSTATUS common_ntlm_encrypt_buffer(struct ntlmssp_state *ntlmssp_state,
2414 NTSTATUS common_encrypt_buffer(struct smb_trans_enc_state *es, char *buffer, char **buf_out);
2415 NTSTATUS common_decrypt_buffer(struct smb_trans_enc_state *es, char *buf);
2416 void common_free_encryption_state(struct smb_trans_enc_state **pp_es);
2417 void common_free_enc_buffer(struct smb_trans_enc_state *es, char *buf);
2418 bool cli_encryption_on(struct cli_state *cli);
2419 void cli_free_encryption_context(struct cli_state *cli);
2420 void cli_free_enc_buffer(struct cli_state *cli, char *buf);
2421 NTSTATUS cli_decrypt_message(struct cli_state *cli);
2422 NTSTATUS cli_encrypt_message(struct cli_state *cli, char *buf, char **buf_out);
2424 /* The following definitions come from libsmb/clisigning.c */
2426 bool cli_simple_set_signing(struct cli_state *cli,
2427 const DATA_BLOB user_session_key,
2428 const DATA_BLOB response);
2429 bool cli_temp_set_signing(struct cli_state *cli);
2430 void cli_calculate_sign_mac(struct cli_state *cli, char *buf, uint32_t *seqnum);
2431 bool cli_check_sign_mac(struct cli_state *cli, const char *buf, uint32_t seqnum);
2432 bool client_is_signing_on(struct cli_state *cli);
2433 bool client_is_signing_allowed(struct cli_state *cli);
2434 bool client_is_signing_mandatory(struct cli_state *cli);
2435 void cli_set_signing_negotiated(struct cli_state *cli);
2437 /* The following definitions come from smbd/signing.c */
2439 struct smbd_server_connection;
2440 bool srv_check_sign_mac(struct smbd_server_connection *conn,
2441 const char *inbuf, uint32_t *seqnum, bool trusted_channel);
2442 void srv_calculate_sign_mac(struct smbd_server_connection *conn,
2443 char *outbuf, uint32_t seqnum);
2444 void srv_cancel_sign_response(struct smbd_server_connection *conn);
2445 bool srv_init_signing(struct smbd_server_connection *conn);
2446 void srv_set_signing_negotiated(struct smbd_server_connection *conn);
2447 bool srv_is_signing_active(struct smbd_server_connection *conn);
2448 bool srv_is_signing_negotiated(struct smbd_server_connection *conn);
2449 void srv_set_signing(struct smbd_server_connection *conn,
2450 const DATA_BLOB user_session_key,
2451 const DATA_BLOB response);
2453 /* The following definitions come from libsmb/smberr.c */
2455 const char *smb_dos_err_name(uint8 e_class, uint16 num);
2456 const char *get_dos_error_msg(WERROR result);
2457 const char *smb_dos_err_class(uint8 e_class);
2458 char *smb_dos_errstr(char *inbuf);
2459 WERROR map_werror_from_unix(int error);
2461 /* The following definitions come from libsmb/trustdom_cache.c */
2463 bool trustdom_cache_enable(void);
2464 bool trustdom_cache_shutdown(void);
2465 bool trustdom_cache_store(char* name, char* alt_name, const struct dom_sid *sid,
2467 bool trustdom_cache_fetch(const char* name, struct dom_sid* sid);
2468 uint32 trustdom_cache_fetch_timestamp( void );
2469 bool trustdom_cache_store_timestamp( uint32 t, time_t timeout );
2470 void trustdom_cache_flush(void);
2471 void update_trustdom_cache( void );
2473 /* The following definitions come from libsmb/trusts_util.c */
2475 NTSTATUS trust_pw_change_and_store_it(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
2477 const char *account_name,
2478 unsigned char orig_trust_passwd_hash[16],
2479 enum netr_SchannelType sec_channel_type);
2480 NTSTATUS trust_pw_find_change_and_store_it(struct rpc_pipe_client *cli,
2481 TALLOC_CTX *mem_ctx,
2482 const char *domain) ;
2483 bool enumerate_domain_trusts( TALLOC_CTX *mem_ctx, const char *domain,
2484 char ***domain_names, uint32 *num_domains,
2485 struct dom_sid **sids );
2486 NTSTATUS change_trust_account_password( const char *domain, const char *remote_machine);
2488 /* The following definitions come from libsmb/unexpected.c */
2490 struct nb_packet_server;
2491 struct nb_packet_reader;
2493 NTSTATUS nb_packet_server_create(TALLOC_CTX *mem_ctx,
2494 struct tevent_context *ev,
2496 struct nb_packet_server **presult);
2497 void nb_packet_dispatch(struct nb_packet_server *server,
2498 struct packet_struct *p);
2499 struct tevent_req *nb_packet_reader_send(TALLOC_CTX *mem_ctx,
2500 struct tevent_context *ev,
2501 enum packet_type type,
2503 const char *mailslot_name);
2504 NTSTATUS nb_packet_reader_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
2505 struct nb_packet_reader **preader);
2506 struct tevent_req *nb_packet_read_send(TALLOC_CTX *mem_ctx,
2507 struct tevent_context *ev,
2508 struct nb_packet_reader *reader);
2509 NTSTATUS nb_packet_read_recv(struct tevent_req *req,
2510 struct packet_struct **ppacket);
2512 /* The following definitions come from locking/brlock.c */
2514 bool brl_same_context(const struct lock_context *ctx1,
2515 const struct lock_context *ctx2);
2516 NTSTATUS brl_lock_failed(files_struct *fsp, const struct lock_struct *lock, bool blocking_lock);
2517 void brl_init(bool read_only);
2518 void brl_shutdown(void);
2520 NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck,
2521 struct lock_struct *plock,
2522 bool blocking_lock);
2524 NTSTATUS brl_lock(struct messaging_context *msg_ctx,
2525 struct byte_range_lock *br_lck,
2527 struct server_id pid,
2530 enum brl_type lock_type,
2531 enum brl_flavour lock_flav,
2534 struct blocking_lock_record *blr);
2535 bool brl_unlock(struct messaging_context *msg_ctx,
2536 struct byte_range_lock *br_lck,
2538 struct server_id pid,
2541 enum brl_flavour lock_flav);
2542 bool brl_unlock_windows_default(struct messaging_context *msg_ctx,
2543 struct byte_range_lock *br_lck,
2544 const struct lock_struct *plock);
2545 bool brl_locktest(struct byte_range_lock *br_lck,
2547 struct server_id pid,
2550 enum brl_type lock_type,
2551 enum brl_flavour lock_flav);
2552 NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
2554 struct server_id pid,
2557 enum brl_type *plock_type,
2558 enum brl_flavour lock_flav);
2559 bool brl_lock_cancel(struct byte_range_lock *br_lck,
2561 struct server_id pid,
2564 enum brl_flavour lock_flav,
2565 struct blocking_lock_record *blr);
2566 bool brl_lock_cancel_default(struct byte_range_lock *br_lck,
2567 struct lock_struct *plock);
2568 void brl_close_fnum(struct messaging_context *msg_ctx,
2569 struct byte_range_lock *br_lck);
2570 int brl_forall(void (*fn)(struct file_id id, struct server_id pid,
2571 enum brl_type lock_type,
2572 enum brl_flavour lock_flav,
2573 br_off start, br_off size,
2574 void *private_data),
2575 void *private_data);
2576 struct byte_range_lock *brl_get_locks(TALLOC_CTX *mem_ctx,
2578 struct byte_range_lock *brl_get_locks_readonly(files_struct *fsp);
2579 void brl_register_msgs(struct messaging_context *msg_ctx);
2581 /* The following definitions come from locking/locking.c */
2583 const char *lock_type_name(enum brl_type lock_type);
2584 const char *lock_flav_name(enum brl_flavour lock_flav);
2585 void init_strict_lock_struct(files_struct *fsp,
2589 enum brl_type lock_type,
2590 struct lock_struct *plock);
2591 bool strict_lock_default(files_struct *fsp,
2592 struct lock_struct *plock);
2593 void strict_unlock_default(files_struct *fsp,
2594 struct lock_struct *plock);
2595 NTSTATUS query_lock(files_struct *fsp,
2599 enum brl_type *plock_type,
2600 enum brl_flavour lock_flav);
2601 struct byte_range_lock *do_lock(struct messaging_context *msg_ctx,
2606 enum brl_type lock_type,
2607 enum brl_flavour lock_flav,
2611 struct blocking_lock_record *blr);
2612 NTSTATUS do_unlock(struct messaging_context *msg_ctx,
2617 enum brl_flavour lock_flav);
2618 NTSTATUS do_lock_cancel(files_struct *fsp,
2622 enum brl_flavour lock_flav,
2623 struct blocking_lock_record *blr);
2624 void locking_close_file(struct messaging_context *msg_ctx,
2626 enum file_close_type close_type);
2627 bool locking_init(void);
2628 bool locking_init_readonly(void);
2629 bool locking_end(void);
2630 char *share_mode_str(TALLOC_CTX *ctx, int num, const struct share_mode_entry *e);
2631 struct share_mode_lock *get_share_mode_lock(TALLOC_CTX *mem_ctx,
2632 const struct file_id id,
2633 const char *servicepath,
2634 const struct smb_filename *smb_fname,
2635 const struct timespec *old_write_time);
2636 struct share_mode_lock *fetch_share_mode_unlocked(TALLOC_CTX *mem_ctx,
2637 const struct file_id id);
2638 bool rename_share_filename(struct messaging_context *msg_ctx,
2639 struct share_mode_lock *lck,
2640 const char *servicepath,
2641 uint32_t orig_name_hash,
2642 uint32_t new_name_hash,
2643 const struct smb_filename *smb_fname);
2644 void get_file_infos(struct file_id id,
2646 bool *delete_on_close,
2647 struct timespec *write_time);
2648 bool is_valid_share_mode_entry(const struct share_mode_entry *e);
2649 bool is_deferred_open_entry(const struct share_mode_entry *e);
2650 bool is_unused_share_mode_entry(const struct share_mode_entry *e);
2651 void set_share_mode(struct share_mode_lock *lck, files_struct *fsp,
2652 uid_t uid, uint64_t mid, uint16 op_type);
2653 void add_deferred_open(struct share_mode_lock *lck, uint64_t mid,
2654 struct timeval request_time,
2655 struct server_id pid, struct file_id id);
2656 bool del_share_mode(struct share_mode_lock *lck, files_struct *fsp);
2657 void del_deferred_open_entry(struct share_mode_lock *lck, uint64_t mid,
2658 struct server_id pid);
2659 bool remove_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
2660 bool downgrade_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
2661 NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32 dosmode);
2662 const struct security_unix_token *get_delete_on_close_token(struct share_mode_lock *lck, uint32_t name_hash);
2663 void set_delete_on_close_lck(files_struct *fsp,
2664 struct share_mode_lock *lck,
2665 bool delete_on_close,
2666 const struct security_unix_token *tok);
2667 bool set_delete_on_close(files_struct *fsp, bool delete_on_close, const struct security_unix_token *tok);
2668 bool is_delete_on_close_set(struct share_mode_lock *lck, uint32_t name_hash);
2669 bool set_sticky_write_time(struct file_id fileid, struct timespec write_time);
2670 bool set_write_time(struct file_id fileid, struct timespec write_time);
2671 int share_mode_forall(void (*fn)(const struct share_mode_entry *, const char *,
2672 const char *, void *),
2673 void *private_data);
2675 /* The following definitions come from locking/posix.c */
2677 bool is_posix_locked(files_struct *fsp,
2678 uint64_t *pu_offset,
2680 enum brl_type *plock_type,
2681 enum brl_flavour lock_flav);
2682 bool posix_locking_init(bool read_only);
2683 bool posix_locking_end(void);
2684 void reduce_windows_lock_ref_count(files_struct *fsp, unsigned int dcount);
2685 int fd_close_posix(struct files_struct *fsp);
2686 bool set_posix_lock_windows_flavour(files_struct *fsp,
2689 enum brl_type lock_type,
2690 const struct lock_context *lock_ctx,
2691 const struct lock_struct *plocks,
2694 bool release_posix_lock_windows_flavour(files_struct *fsp,
2697 enum brl_type deleted_lock_type,
2698 const struct lock_context *lock_ctx,
2699 const struct lock_struct *plocks,
2701 bool set_posix_lock_posix_flavour(files_struct *fsp,
2704 enum brl_type lock_type,
2706 bool release_posix_lock_posix_flavour(files_struct *fsp,
2709 const struct lock_context *lock_ctx,
2710 const struct lock_struct *plocks,
2713 /* The following definitions come from modules/vfs_default.c */
2715 ssize_t vfswrap_llistxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size);
2716 ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size);
2717 NTSTATUS vfs_default_init(void);
2719 /* The following definitions come from param/loadparm.c */
2721 char *lp_smb_ports(void);
2722 char *lp_dos_charset(void);
2723 char *lp_unix_charset(void);
2724 char *lp_display_charset(void);
2725 char *lp_logfile(void);
2726 char *lp_configfile(void);
2727 char *lp_smb_passwd_file(void);
2728 char *lp_private_dir(void);
2729 char *lp_serverstring(void);
2730 int lp_printcap_cache_time(void);
2731 char *lp_addport_cmd(void);
2732 char *lp_enumports_cmd(void);
2733 char *lp_addprinter_cmd(void);
2734 char *lp_deleteprinter_cmd(void);
2735 char *lp_os2_driver_map(void);
2736 char *lp_lockdir(void);
2737 char *lp_statedir(void);
2738 char *lp_cachedir(void);
2739 char *lp_piddir(void);
2740 char *lp_mangling_method(void);
2741 int lp_mangle_prefix(void);
2742 char *lp_utmpdir(void);
2743 char *lp_wtmpdir(void);
2745 char *lp_rootdir(void);
2746 char *lp_defaultservice(void);
2747 char *lp_msg_command(void);
2748 char *lp_get_quota_command(void);
2749 char *lp_set_quota_command(void);
2750 char *lp_auto_services(void);
2751 char *lp_passwd_program(void);
2752 char *lp_passwd_chat(void);
2753 char *lp_passwordserver(void);
2754 char *lp_name_resolve_order(void);
2755 char *lp_realm(void);
2756 const char *lp_afs_username_map(void);
2757 int lp_afs_token_lifetime(void);
2758 char *lp_log_nt_token_command(void);
2759 char *lp_username_map(void);
2760 const char *lp_logon_script(void);
2761 const char *lp_logon_path(void);
2762 const char *lp_logon_drive(void);
2763 const char *lp_logon_home(void);
2764 char *lp_remote_announce(void);
2765 char *lp_remote_browse_sync(void);
2766 bool lp_nmbd_bind_explicit_broadcast(void);
2767 const char **lp_wins_server_list(void);
2768 const char **lp_interfaces(void);
2769 const char *lp_socket_address(void);
2770 char *lp_nis_home_map_name(void);
2771 const char **lp_netbios_aliases(void);
2772 const char *lp_passdb_backend(void);
2773 const char **lp_preload_modules(void);
2774 char *lp_panic_action(void);
2775 char *lp_adduser_script(void);
2776 char *lp_renameuser_script(void);
2777 char *lp_deluser_script(void);
2778 const char *lp_guestaccount(void);
2779 char *lp_addgroup_script(void);
2780 char *lp_delgroup_script(void);
2781 char *lp_addusertogroup_script(void);
2782 char *lp_deluserfromgroup_script(void);
2783 char *lp_setprimarygroup_script(void);
2784 char *lp_addmachine_script(void);
2785 char *lp_shutdown_script(void);
2786 char *lp_abort_shutdown_script(void);
2787 char *lp_username_map_script(void);
2788 int lp_username_map_cache_time(void);
2789 char *lp_check_password_script(void);
2790 char *lp_wins_hook(void);
2791 const char *lp_template_homedir(void);
2792 const char *lp_template_shell(void);
2793 const char *lp_winbind_separator(void);
2794 int lp_acl_compatibility(void);
2795 bool lp_winbind_enum_users(void);
2796 bool lp_winbind_enum_groups(void);
2797 bool lp_winbind_use_default_domain(void);
2798 bool lp_winbind_trusted_domains_only(void);
2799 bool lp_winbind_nested_groups(void);
2800 int lp_winbind_expand_groups(void);
2801 bool lp_winbind_refresh_tickets(void);
2802 bool lp_winbind_offline_logon(void);
2803 bool lp_winbind_normalize_names(void);
2804 bool lp_winbind_rpc_only(void);
2805 bool lp_create_krb5_conf(void);
2806 int lp_winbind_max_domain_connections(void);
2807 const char *lp_idmap_backend(void);
2808 int lp_idmap_cache_time(void);
2809 int lp_idmap_negative_cache_time(void);
2810 int lp_keepalive(void);
2811 bool lp_passdb_expand_explicit(void);
2812 char *lp_ldap_suffix(void);
2813 char *lp_ldap_admin_dn(void);
2814 int lp_ldap_ssl(void);
2815 bool lp_ldap_ssl_ads(void);
2816 int lp_ldap_deref(void);
2817 int lp_ldap_follow_referral(void);
2818 int lp_ldap_passwd_sync(void);
2819 bool lp_ldap_delete_dn(void);
2820 int lp_ldap_replication_sleep(void);
2821 int lp_ldap_timeout(void);
2822 int lp_ldap_connection_timeout(void);
2823 int lp_ldap_page_size(void);
2824 int lp_ldap_debug_level(void);
2825 int lp_ldap_debug_threshold(void);
2826 char *lp_add_share_cmd(void);
2827 char *lp_change_share_cmd(void);
2828 char *lp_delete_share_cmd(void);
2829 char *lp_usershare_path(void);
2830 const char **lp_usershare_prefix_allow_list(void);
2831 const char **lp_usershare_prefix_deny_list(void);
2832 const char **lp_eventlog_list(void);
2833 bool lp_registry_shares(void);
2834 bool lp_usershare_allow_guests(void);
2835 bool lp_usershare_owner_only(void);
2836 bool lp_disable_netbios(void);
2837 bool lp_reset_on_zero_vc(void);
2838 bool lp_log_writeable_files_on_exit(void);
2839 bool lp_ms_add_printer_wizard(void);
2840 bool lp_dns_proxy(void);
2841 bool lp_wins_support(void);
2842 bool lp_we_are_a_wins_server(void);
2843 bool lp_wins_proxy(void);
2844 bool lp_local_master(void);
2845 bool lp_domain_logons(void);
2846 const char **lp_init_logon_delayed_hosts(void);
2847 int lp_init_logon_delay(void);
2848 bool lp_load_printers(void);
2849 bool lp_readraw(void);
2850 bool _lp_readraw(void);
2851 bool lp_large_readwrite(void);
2852 bool lp_writeraw(void);
2853 bool _lp_writeraw(void);
2854 bool lp_null_passwords(void);
2855 bool lp_obey_pam_restrictions(void);
2856 bool lp_encrypted_passwords(void);
2857 int lp_client_schannel(void);
2858 int lp_server_schannel(void);
2859 bool lp_syslog_only(void);
2860 bool lp_timestamp_logs(void);
2861 bool lp_debug_prefix_timestamp(void);
2862 bool lp_debug_hires_timestamp(void);
2863 bool lp_debug_pid(void);
2864 bool lp_debug_uid(void);
2865 bool lp_debug_class(void);
2866 bool lp_enable_core_files(void);
2867 bool lp_browse_list(void);
2868 bool lp_nis_home_map(void);
2869 bool lp_bind_interfaces_only(void);
2870 bool lp_pam_password_change(void);
2871 bool lp_unix_password_sync(void);
2872 bool lp_passwd_chat_debug(void);
2873 int lp_passwd_chat_timeout(void);
2874 bool lp_nt_pipe_support(void);
2875 bool lp_nt_status_support(void);
2876 bool lp_stat_cache(void);
2877 int lp_max_stat_cache_size(void);
2878 bool lp_allow_trusted_domains(void);
2879 bool lp_map_untrusted_to_domain(void);
2880 int lp_restrict_anonymous(void);
2881 bool lp_lanman_auth(void);
2882 bool lp_ntlm_auth(void);
2883 bool lp_client_plaintext_auth(void);
2884 bool lp_client_lanman_auth(void);
2885 bool lp_client_ntlmv2_auth(void);
2886 bool lp_host_msdfs(void);
2887 bool lp_kernel_oplocks(void);
2888 bool lp_enhanced_browsing(void);
2889 bool lp_use_mmap(void);
2890 bool lp_unix_extensions(void);
2891 bool lp_use_spnego(void);
2892 bool lp_client_use_spnego(void);
2893 bool lp_client_use_spnego_principal(void);
2894 bool lp_send_spnego_principal(void);
2895 bool lp_hostname_lookups(void);
2896 bool lp_change_notify(const struct share_params *p );
2897 bool lp_kernel_change_notify(const struct share_params *p );
2898 char * lp_dedicated_keytab_file(void);
2899 int lp_kerberos_method(void);
2900 bool lp_defer_sharing_violations(void);
2901 bool lp_enable_privileges(void);
2902 bool lp_enable_asu_support(void);
2903 int lp_os_level(void);
2904 int lp_max_ttl(void);
2905 int lp_max_wins_ttl(void);
2906 int lp_min_wins_ttl(void);
2907 int lp_max_log_size(void);
2908 int lp_max_open_files(void);
2909 int lp_open_files_db_hash_size(void);
2910 int lp_maxxmit(void);
2911 int lp_maxmux(void);
2912 int lp_passwordlevel(void);
2913 int lp_usernamelevel(void);
2914 int lp_deadtime(void);
2915 bool lp_getwd_cache(void);
2916 int lp_maxprotocol(void);
2917 int lp_minprotocol(void);
2918 int lp_security(void);
2919 const char **lp_auth_methods(void);
2920 bool lp_paranoid_server_security(void);
2921 int lp_maxdisksize(void);
2922 int lp_lpqcachetime(void);
2923 int lp_max_smbd_processes(void);
2924 bool _lp_disable_spoolss(void);
2925 int lp_syslog(void);
2926 int lp_lm_announce(void);
2927 int lp_lm_interval(void);
2928 int lp_machine_password_timeout(void);
2929 int lp_map_to_guest(void);
2930 int lp_oplock_break_wait_time(void);
2931 int lp_lock_spin_time(void);
2932 int lp_usershare_max_shares(void);
2933 const char *lp_socket_options(void);
2934 int lp_config_backend(void);
2935 int lp_smb2_max_read(void);
2936 int lp_smb2_max_write(void);
2937 int lp_smb2_max_trans(void);
2938 int lp_smb2_max_credits(void);
2939 char *lp_preexec(int );
2940 char *lp_postexec(int );
2941 char *lp_rootpreexec(int );
2942 char *lp_rootpostexec(int );
2943 char *lp_servicename(int );
2944 const char *lp_const_servicename(int );
2945 char *lp_pathname(int );
2946 char *lp_dontdescend(int );
2947 char *lp_username(int );
2948 const char **lp_invalid_users(int );
2949 const char **lp_valid_users(int );
2950 const char **lp_admin_users(int );
2951 const char **lp_svcctl_list(void);
2952 char *lp_cups_options(int );
2953 char *lp_cups_server(void);
2954 int lp_cups_encrypt(void);
2955 char *lp_iprint_server(void);
2956 int lp_cups_connection_timeout(void);
2957 const char *lp_ctdbd_socket(void);
2958 const char **lp_cluster_addresses(void);
2959 bool lp_clustering(void);
2960 int lp_ctdb_timeout(void);
2961 int lp_ctdb_locktime_warn_threshold(void);
2962 char *lp_printcommand(int );
2963 char *lp_lpqcommand(int );
2964 char *lp_lprmcommand(int );
2965 char *lp_lppausecommand(int );
2966 char *lp_lpresumecommand(int );
2967 char *lp_queuepausecommand(int );
2968 char *lp_queueresumecommand(int );
2969 const char *lp_printjob_username(int );
2970 const char **lp_hostsallow(int );
2971 const char **lp_hostsdeny(int );
2972 char *lp_magicscript(int );
2973 char *lp_magicoutput(int );
2974 char *lp_comment(int );
2975 char *lp_force_user(int );
2976 char *lp_force_group(int );
2977 const char **lp_readlist(int );
2978 const char **lp_writelist(int );
2979 const char **lp_printer_admin(int );
2980 char *lp_fstype(int );
2981 const char **lp_vfs_objects(int );
2982 char *lp_msdfs_proxy(int );
2983 char *lp_veto_files(int );
2984 char *lp_hide_files(int );
2985 char *lp_veto_oplocks(int );
2986 bool lp_msdfs_root(int );
2987 char *lp_aio_write_behind(int );
2988 char *lp_dfree_command(int );
2989 bool lp_autoloaded(int );
2990 bool lp_preexec_close(int );
2991 bool lp_rootpreexec_close(int );
2992 int lp_casesensitive(int );
2993 bool lp_preservecase(int );
2994 bool lp_shortpreservecase(int );
2995 bool lp_hide_dot_files(int );
2996 bool lp_hide_special_files(int );
2997 bool lp_hideunreadable(int );
2998 bool lp_hideunwriteable_files(int );
2999 bool lp_browseable(int );
3000 bool lp_access_based_share_enum(int );
3001 bool lp_readonly(int );
3002 bool lp_no_set_dir(int );
3003 bool lp_guest_ok(int );
3004 bool lp_guest_only(int );
3005 bool lp_administrative_share(int );
3006 bool lp_print_ok(int );
3007 bool lp_print_notify_backchannel(int );
3008 bool lp_map_hidden(int );
3009 bool lp_map_archive(int );
3010 bool lp_store_dos_attributes(int );
3011 bool lp_dmapi_support(int );
3012 bool lp_locking(const struct share_params *p );
3013 int lp_strict_locking(const struct share_params *p );
3014 bool lp_posix_locking(const struct share_params *p );
3015 bool lp_share_modes(int );
3016 bool lp_oplocks(int );
3017 bool lp_level2_oplocks(int );
3018 bool lp_onlyuser(int );
3019 bool lp_manglednames(const struct share_params *p );
3020 bool lp_widelinks(int );
3021 bool lp_symlinks(int );
3022 bool lp_syncalways(int );
3023 bool lp_strict_allocate(int );
3024 bool lp_strict_sync(int );
3025 bool lp_map_system(int );
3026 bool lp_delete_readonly(int );
3027 bool lp_fake_oplocks(int );
3028 bool lp_recursive_veto_delete(int );
3029 bool lp_dos_filemode(int );
3030 bool lp_dos_filetimes(int );
3031 bool lp_dos_filetime_resolution(int );
3032 bool lp_fake_dir_create_times(int);
3033 bool lp_async_smb_echo_handler(void);
3034 bool lp_multicast_dns_register(void);
3035 bool lp_blocking_locks(int );
3036 bool lp_inherit_perms(int );
3037 bool lp_inherit_acls(int );
3038 bool lp_inherit_owner(int );
3039 bool lp_use_client_driver(int );
3040 bool lp_default_devmode(int );
3041 bool lp_force_printername(int );
3042 bool lp_nt_acl_support(int );
3043 bool lp_force_unknown_acl_user(int );
3044 bool lp_ea_support(int );
3045 bool _lp_use_sendfile(int );
3046 bool lp_profile_acls(int );
3047 bool lp_map_acl_inherit(int );
3048 bool lp_afs_share(int );
3049 bool lp_acl_check_permissions(int );
3050 bool lp_acl_group_control(int );
3051 bool lp_acl_map_full_control(int );
3052 int lp_create_mask(int );
3053 int lp_force_create_mode(int );
3054 int lp_security_mask(int );
3055 int lp_force_security_mode(int );
3056 int lp_dir_mask(int );
3057 int lp_force_dir_mode(int );
3058 int lp_dir_security_mask(int );
3059 int lp_force_dir_security_mode(int );
3060 int lp_max_connections(int );
3061 int lp_defaultcase(int );
3062 int lp_minprintspace(int );
3063 int lp_printing(int );
3064 int lp_max_reported_jobs(int );
3065 int lp_oplock_contention_limit(int );
3066 int lp_csc_policy(int );
3067 int lp_write_cache_size(int );
3068 int lp_block_size(int );
3069 int lp_dfree_cache_time(int );
3070 int lp_allocation_roundup_size(int );
3071 int lp_aio_read_size(int );
3072 int lp_aio_write_size(int );
3073 int lp_map_readonly(int );
3074 int lp_directory_name_cache_size(int );
3075 int lp_smb_encrypt(int );
3076 char lp_magicchar(const struct share_params *p );
3077 int lp_winbind_cache_time(void);
3078 int lp_winbind_reconnect_delay(void);
3079 int lp_winbind_max_clients(void);
3080 const char **lp_winbind_nss_info(void);
3081 int lp_algorithmic_rid_base(void);
3082 int lp_name_cache_timeout(void);
3083 int lp_client_signing(void);
3084 int lp_server_signing(void);
3085 int lp_client_ldap_sasl_wrapping(void);
3086 char *lp_parm_talloc_string(int snum, const char *type, const char *option, const char *def);
3087 const char *lp_parm_const_string(int snum, const char *type, const char *option, const char *def);
3088 const char **lp_parm_string_list(int snum, const char *type, const char *option, const char **def);
3089 int lp_parm_int(int snum, const char *type, const char *option, int def);
3090 unsigned long lp_parm_ulong(int snum, const char *type, const char *option, unsigned long def);
3091 bool lp_parm_bool(int snum, const char *type, const char *option, bool def);
3092 int lp_parm_enum(int snum, const char *type, const char *option,
3093 const struct enum_list *_enum, int def);
3094 char *canonicalize_servicename(TALLOC_CTX *ctx, const char *src);
3095 bool lp_add_home(const char *pszHomename, int iDefaultService,
3096 const char *user, const char *pszHomedir);
3097 int lp_add_service(const char *pszService, int iDefaultService);
3098 bool lp_add_printer(const char *pszPrintername, int iDefaultService);
3099 bool lp_parameter_is_valid(const char *pszParmName);
3100 bool lp_parameter_is_global(const char *pszParmName);
3101 bool lp_parameter_is_canonical(const char *parm_name);
3102 bool lp_canonicalize_parameter(const char *parm_name, const char **canon_parm,
3104 bool lp_canonicalize_parameter_with_value(const char *parm_name,
3106 const char **canon_parm,
3107 const char **canon_val);
3108 void show_parameter_list(void);
3109 bool lp_string_is_valid_boolean(const char *parm_value);
3110 bool lp_invert_boolean(const char *str, const char **inverse_str);
3111 bool lp_canonicalize_boolean(const char *str, const char**canon_str);
3112 bool service_ok(int iService);
3113 bool process_registry_service(const char *service_name);
3114 bool process_registry_shares(void);
3115 bool lp_config_backend_is_registry(void);
3116 bool lp_config_backend_is_file(void);
3117 bool lp_file_list_changed(void);
3118 bool lp_idmap_uid(uid_t *low, uid_t *high);
3119 bool lp_idmap_gid(gid_t *low, gid_t *high);
3120 const char *lp_ldap_machine_suffix(void);
3121 const char *lp_ldap_user_suffix(void);
3122 const char *lp_ldap_group_suffix(void);
3123 const char *lp_ldap_idmap_suffix(void);
3124 void *lp_local_ptr_by_snum(int snum, void *ptr);
3125 bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue);
3126 bool lp_set_cmdline(const char *pszParmName, const char *pszParmValue);
3127 bool lp_set_option(const char *option);
3128 void init_locals(void);
3129 bool lp_is_default(int snum, struct parm_struct *parm);
3130 bool dump_a_parameter(int snum, char *parm_name, FILE * f, bool isGlobal);
3131 struct parm_struct *lp_get_parameter(const char *param_name);
3132 struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters);
3133 bool lp_snum_ok(int iService);
3134 void lp_add_one_printer(const char *name, const char *comment, void *pdata);
3135 bool lp_loaded(void);
3136 void lp_killunused(bool (*snumused) (int));
3137 void lp_kill_all_services(void);
3138 void lp_killservice(int iServiceIn);
3139 const char* server_role_str(uint32 role);
3140 enum usershare_err parse_usershare_file(TALLOC_CTX *ctx,
3141 SMB_STRUCT_STAT *psbuf,
3142 const char *servicename,
3146 char **pp_sharepath,
3148 char **pp_cp_share_name,
3149 struct security_descriptor **ppsd,
3150 bool *pallow_guest);
3151 int load_usershare_service(const char *servicename);
3152 int load_usershare_shares(void);
3153 void gfree_loadparm(void);
3154 void lp_set_in_client(bool b);
3155 bool lp_is_in_client(void);
3156 bool lp_load(const char *pszFname,
3160 bool initialize_globals);
3161 bool lp_load_initial_only(const char *pszFname);
3162 bool lp_load_with_registry_shares(const char *pszFname,
3166 bool initialize_globals);
3167 int lp_numservices(void);
3168 void lp_dump(FILE *f, bool show_defaults, int maxtoprint);
3169 void lp_dump_one(FILE * f, bool show_defaults, int snum);
3170 int lp_servicenumber(const char *pszServiceName);
3171 bool share_defined(const char *service_name);
3172 struct share_params *get_share_params(TALLOC_CTX *mem_ctx,
3173 const char *sharename);
3174 struct share_iterator *share_list_all(TALLOC_CTX *mem_ctx);
3175 struct share_params *next_share(struct share_iterator *list);
3176 struct share_params *next_printer(struct share_iterator *list);
3177 struct share_params *snum2params_static(int snum);
3178 const char *volume_label(int snum);
3179 bool lp_domain_master(void);
3180 bool lp_domain_master_true_or_auto(void);
3181 bool lp_preferred_master(void);
3182 void lp_remove_service(int snum);
3183 void lp_copy_service(int snum, const char *new_name);
3184 int lp_default_server_announce(void);
3185 int lp_major_announce_version(void);
3186 int lp_minor_announce_version(void);
3187 void lp_set_name_resolve_order(const char *new_order);
3188 const char *lp_printername(int snum);
3189 void lp_set_logfile(const char *name);
3190 int lp_maxprintjobs(int snum);
3191 const char *lp_printcapname(void);
3192 bool lp_disable_spoolss( void );
3193 void lp_set_spoolss_state( uint32 state );
3194 uint32 lp_get_spoolss_state( void );
3195 bool lp_use_sendfile(int snum, struct smb_signing_state *signing_state);
3196 void set_use_sendfile(int snum, bool val);
3197 void set_store_dos_attributes(int snum, bool val);
3198 void lp_set_mangling_method(const char *new_method);
3199 bool lp_posix_pathnames(void);
3200 void lp_set_posix_pathnames(void);
3201 enum brl_flavour lp_posix_cifsu_locktype(files_struct *fsp);
3202 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val);
3203 int lp_min_receive_file_size(void);
3204 char* lp_perfcount_module(void);
3205 void lp_set_passdb_backend(const char *backend);
3206 void widelinks_warning(int snum);
3207 char *lp_ncalrpc_dir(void);
3209 /* The following definitions come from param/loadparm_server_role.c */
3211 int lp_server_role(void);
3212 void set_server_role(void);
3214 /* The following definitions come from param/util.c */
3216 uint32 get_int_param( const char* param );
3217 char* get_string_param( const char* param );
3219 /* The following definitions come from profile/profile.c */
3221 void set_profile_level(int level, struct server_id src);
3222 bool profile_setup(struct messaging_context *msg_ctx, bool rdonly);
3224 /* The following definitions come from librpc/rpc/rpc_common.c */
3226 bool smb_register_ndr_interface(const struct ndr_interface_table *interface);
3227 const struct ndr_interface_table *get_iface_from_syntax(
3228 const struct ndr_syntax_id *syntax);
3229 const char *get_pipe_name_from_syntax(TALLOC_CTX *mem_ctx,
3230 const struct ndr_syntax_id *syntax);
3232 /* The following definitions come from rpc_server/rpc_ncacn_np.c */
3234 struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx,
3235 const struct ndr_syntax_id *syntax,
3236 struct client_address *client_id,
3237 const struct auth_serversupplied_info *session_info,
3238 struct messaging_context *msg_ctx);
3239 NTSTATUS rpcint_binding_handle(TALLOC_CTX *mem_ctx,
3240 const struct ndr_interface_table *ndr_table,
3241 struct client_address *client_id,
3242 const struct auth_serversupplied_info *session_info,
3243 struct messaging_context *msg_ctx,
3244 struct dcerpc_binding_handle **binding_handle);
3245 NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx,
3246 const struct ndr_syntax_id *abstract_syntax,
3247 const struct auth_serversupplied_info *serversupplied_info,
3248 struct client_address *client_id,
3249 struct messaging_context *msg_ctx,
3250 struct rpc_pipe_client **presult);
3251 NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx,
3252 const struct ndr_syntax_id *syntax,
3253 const struct auth_serversupplied_info *session_info,
3254 struct client_address *client_id,
3255 struct messaging_context *msg_ctx,
3256 struct rpc_pipe_client **cli_pipe);
3258 /* The following definitions come from rpc_client/cli_pipe_schannel.c */
3260 NTSTATUS get_schannel_session_key(struct cli_state *cli,
3263 struct rpc_pipe_client **presult);
3265 /* The following definitions come from rpc_client/rpc_transport_np.c */
3267 struct tevent_req *rpc_transport_np_init_send(TALLOC_CTX *mem_ctx,
3268 struct event_context *ev,
3269 struct cli_state *cli,
3270 const struct ndr_syntax_id *abstract_syntax);
3271 NTSTATUS rpc_transport_np_init_recv(struct tevent_req *req,
3272 TALLOC_CTX *mem_ctx,
3273 struct rpc_cli_transport **presult);
3274 NTSTATUS rpc_transport_np_init(TALLOC_CTX *mem_ctx, struct cli_state *cli,
3275 const struct ndr_syntax_id *abstract_syntax,
3276 struct rpc_cli_transport **presult);
3278 /* The following definitions come from rpc_client/rpc_transport_sock.c */
3280 NTSTATUS rpc_transport_sock_init(TALLOC_CTX *mem_ctx, int fd,
3281 struct rpc_cli_transport **presult);
3283 /* The following definitions come from rpc_client/rpc_transport_tstream.c */
3285 NTSTATUS rpc_transport_tstream_init(TALLOC_CTX *mem_ctx,
3286 struct tstream_context **stream,
3287 struct rpc_cli_transport **presult);
3288 struct cli_state *rpc_pipe_np_smb_conn(struct rpc_pipe_client *p);
3290 /* The following definitions come from rpc_server/srv_eventlog_nt.c */
3292 /* The following definitions come from rpc_server/rpc_handles.c */
3294 size_t num_pipe_handles(struct pipes_struct *p);
3295 bool init_pipe_handles(struct pipes_struct *p, const struct ndr_syntax_id *syntax);
3296 bool create_policy_hnd(struct pipes_struct *p, struct policy_handle *hnd, void *data_ptr);
3297 bool find_policy_by_hnd(struct pipes_struct *p, const struct policy_handle *hnd,
3299 bool close_policy_hnd(struct pipes_struct *p, struct policy_handle *hnd);
3300 void close_policy_by_pipe(struct pipes_struct *p);
3301 bool pipe_access_check(struct pipes_struct *p);
3303 void *_policy_handle_create(struct pipes_struct *p, struct policy_handle *hnd,
3304 uint32_t access_granted, size_t data_size,
3305 const char *type, NTSTATUS *pstatus);
3306 #define policy_handle_create(_p, _hnd, _access, _type, _pstatus) \
3307 (_type *)_policy_handle_create((_p), (_hnd), (_access), sizeof(_type), #_type, \
3310 void *_policy_handle_find(struct pipes_struct *p,
3311 const struct policy_handle *hnd,
3312 uint32_t access_required, uint32_t *paccess_granted,
3313 const char *name, const char *location,
3315 #define policy_handle_find(_p, _hnd, _access_required, _access_granted, _type, _pstatus) \
3316 (_type *)_policy_handle_find((_p), (_hnd), (_access_required), \
3317 (_access_granted), #_type, __location__, (_pstatus))
3320 /* The following definitions come from rpc_server/srv_rpc_register.c */
3322 struct rpc_srv_callbacks {
3323 bool (*init)(void *private_data);
3324 bool (*shutdown)(void *private_data);
3328 NTSTATUS rpc_srv_register(int version, const char *clnt,
3330 const struct ndr_interface_table *iface,
3331 const struct api_struct *cmds, int size,
3332 const struct rpc_srv_callbacks *rpc_srv_cb);
3334 NTSTATUS rpc_srv_unregister(const struct ndr_interface_table *iface);
3336 /* The following definitions come from rpc_server/srv_pipe.c */
3338 bool create_next_pdu(struct pipes_struct *p);
3339 bool api_pipe_bind_auth3(struct pipes_struct *p, struct ncacn_packet *pkt);
3340 bool setup_fault_pdu(struct pipes_struct *p, NTSTATUS status);
3341 NTSTATUS rpc_pipe_register_commands(int version, const char *clnt,
3343 const struct ndr_syntax_id *interface,
3344 const struct api_struct *cmds, int size);
3345 bool is_known_pipename(const char *cli_filename, struct ndr_syntax_id *syntax);
3347 /* The following definitions come from rpc_server/srv_pipe_hnd.c */
3349 struct pipes_struct *get_first_internal_pipe(void);
3350 struct pipes_struct *get_next_internal_pipe(struct pipes_struct *p);
3351 bool check_open_pipes(void);
3352 int close_internal_rpc_pipe_hnd(struct pipes_struct *p);
3354 bool fsp_is_np(struct files_struct *fsp);
3355 struct tsocket_address;
3356 NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name,
3357 const struct tsocket_address *local_address,
3358 const struct tsocket_address *remote_address,
3359 struct client_address *client_id,
3360 struct auth_serversupplied_info *session_info,
3361 struct messaging_context *msg_ctx,
3362 struct fake_file_handle **phandle);
3363 bool np_read_in_progress(struct fake_file_handle *handle);
3364 struct tevent_req *np_write_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
3365 struct fake_file_handle *handle,
3366 const uint8_t *data, size_t len);
3367 NTSTATUS np_write_recv(struct tevent_req *req, ssize_t *pnwritten);
3368 struct tevent_req *np_read_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
3369 struct fake_file_handle *handle,
3370 uint8_t *data, size_t len);
3371 NTSTATUS np_read_recv(struct tevent_req *req, ssize_t *nread,
3372 bool *is_data_outstanding);
3374 ssize_t process_incoming_data(struct pipes_struct *p, char *data, size_t n);
3376 /* The following definitions come from rpc_server/srv_spoolss_nt.c */
3377 void srv_spoolss_cleanup(void);
3379 void do_drv_upgrade_printer(struct messaging_context *msg,
3382 struct server_id server_id,
3384 void update_monitored_printq_cache(struct messaging_context *msg_ctx);
3386 /* The following definitions come from rpc_server/srv_srvsvc_nt.c */
3388 char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname);
3390 /* The following definitions come from rpc_server/srv_svcctl_nt.c */
3392 bool init_service_op_table( void );
3393 bool shutdown_service_op_table(void);
3395 /* The following definitions come from rpcclient/cmd_dfs.c */
3398 /* The following definitions come from rpcclient/cmd_dssetup.c */
3401 /* The following definitions come from rpcclient/cmd_echo.c */
3404 /* The following definitions come from rpcclient/cmd_lsarpc.c */
3407 /* The following definitions come from rpcclient/cmd_netlogon.c */
3410 /* The following definitions come from rpcclient/cmd_ntsvcs.c */
3413 /* The following definitions come from rpcclient/cmd_samr.c */
3416 /* The following definitions come from rpcclient/cmd_shutdown.c */
3419 /* The following definitions come from rpcclient/cmd_spoolss.c */
3422 /* The following definitions come from rpcclient/cmd_srvsvc.c */
3425 /* The following definitions come from rpcclient/cmd_test.c */
3428 /* The following definitions come from rpcclient/cmd_wkssvc.c */
3431 /* The following definitions come from rpcclient/rpcclient.c */
3434 /* The following definitions come from services/svc_netlogon.c */
3437 /* The following definitions come from services/svc_rcinit.c */
3440 /* The following definitions come from services/svc_spoolss.c */
3443 /* The following definitions come from services/svc_winreg.c */
3446 /* The following definitions come from services/svc_wins.c */
3449 /* The following definitions come from smbd/aio.c */
3451 NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
3452 struct smb_request *req,
3453 files_struct *fsp, SMB_OFF_T startpos,
3455 NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
3456 struct smb_request *req,
3457 files_struct *fsp, char *data,
3460 NTSTATUS schedule_smb2_aio_read(connection_struct *conn,
3461 struct smb_request *smbreq,
3464 DATA_BLOB *preadbuf,
3467 NTSTATUS schedule_aio_smb2_write(connection_struct *conn,
3468 struct smb_request *smbreq,
3472 bool write_through);
3473 int wait_for_aio_completion(files_struct *fsp);
3474 void cancel_aio_by_fsp(files_struct *fsp);
3475 void smbd_aio_complete_aio_ex(struct aio_extra *aio_ex);
3477 /* The following definitions come from smbd/blocking.c */
3479 void brl_timeout_fn(struct event_context *event_ctx,
3480 struct timed_event *te,
3482 void *private_data);
3483 struct timeval timeval_brl_min(const struct timeval *tv1,
3484 const struct timeval *tv2);
3485 void process_blocking_lock_queue(struct smbd_server_connection *sconn);
3486 bool push_blocking_lock_request( struct byte_range_lock *br_lck,
3487 struct smb_request *req,
3492 enum brl_type lock_type,
3493 enum brl_flavour lock_flav,
3496 uint64_t blocking_smblctx);
3497 void cancel_pending_lock_requests_by_fid(files_struct *fsp,
3498 struct byte_range_lock *br_lck,
3499 enum file_close_type close_type);
3500 void remove_pending_lock_requests_by_mid_smb1(
3501 struct smbd_server_connection *sconn, uint64_t mid);
3502 bool blocking_lock_was_deferred_smb1(
3503 struct smbd_server_connection *sconn, uint64_t mid);
3504 struct blocking_lock_record *blocking_lock_cancel_smb1(files_struct *fsp,
3508 enum brl_flavour lock_flav,
3509 unsigned char locktype,
3512 /* The following definitions come from smbd/close.c */
3514 void set_close_write_time(struct files_struct *fsp, struct timespec ts);
3515 NTSTATUS close_file(struct smb_request *req, files_struct *fsp,
3516 enum file_close_type close_type);
3517 void msg_close_file(struct messaging_context *msg_ctx,
3520 struct server_id server_id,
3522 NTSTATUS delete_all_streams(connection_struct *conn, const char *fname);
3524 /* The following definitions come from smbd/conn.c */
3526 void conn_init(struct smbd_server_connection *sconn);
3527 int conn_num_open(struct smbd_server_connection *sconn);
3528 bool conn_snum_used(int snum);
3529 connection_struct *conn_find(struct smbd_server_connection *sconn,
3531 connection_struct *conn_new(struct smbd_server_connection *sconn);
3532 bool conn_close_all(struct smbd_server_connection *sconn);
3533 bool conn_idle_all(struct smbd_server_connection *sconn, time_t t);
3534 void conn_clear_vuid_caches(struct smbd_server_connection *sconn, uint16 vuid);
3535 void conn_free(connection_struct *conn);
3536 void msg_force_tdis(struct messaging_context *msg,
3539 struct server_id server_id,
3542 /* The following definitions come from smbd/connection.c */
3544 bool yield_connection(connection_struct *conn, const char *name);
3545 int count_current_connections( const char *sharename, bool clear );
3546 bool claim_connection(connection_struct *conn, const char *name);
3548 /* The following definitions come from smbd/dfree.c */
3550 uint64_t sys_disk_free(connection_struct *conn, const char *path, bool small_query,
3551 uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
3552 uint64_t get_dfree_info(connection_struct *conn,
3559 /* The following definitions come from smbd/dir.c */
3561 bool make_dir_struct(TALLOC_CTX *ctx,
3569 bool init_dptrs(struct smbd_server_connection *sconn);
3570 char *dptr_path(struct smbd_server_connection *sconn, int key);
3571 char *dptr_wcard(struct smbd_server_connection *sconn, int key);
3572 uint16 dptr_attr(struct smbd_server_connection *sconn, int key);
3573 void dptr_close(struct smbd_server_connection *sconn, int *key);
3574 void dptr_closecnum(connection_struct *conn);
3575 void dptr_idlecnum(connection_struct *conn);
3576 void dptr_closepath(struct smbd_server_connection *sconn,
3577 char *path,uint16 spid);
3578 NTSTATUS dptr_create(connection_struct *conn, files_struct *fsp,
3579 const char *path, bool old_handle, bool expect_close,uint16 spid,
3580 const char *wcard, bool wcard_has_wild, uint32 attr, struct dptr_struct **dptr_ret);
3581 void dptr_CloseDir(files_struct *fsp);
3582 void dptr_SeekDir(struct dptr_struct *dptr, long offset);
3583 long dptr_TellDir(struct dptr_struct *dptr);
3584 bool dptr_has_wild(struct dptr_struct *dptr);
3585 int dptr_dnum(struct dptr_struct *dptr);
3586 char *dptr_ReadDirName(TALLOC_CTX *ctx,
3587 struct dptr_struct *dptr,
3589 SMB_STRUCT_STAT *pst);
3590 bool dptr_SearchDir(struct dptr_struct *dptr, const char *name, long *poffset, SMB_STRUCT_STAT *pst);
3591 void dptr_DirCacheAdd(struct dptr_struct *dptr, const char *name, long offset);
3592 void dptr_init_search_op(struct dptr_struct *dptr);
3593 bool dptr_fill(struct smbd_server_connection *sconn,
3594 char *buf1,unsigned int key);
3595 struct dptr_struct *dptr_fetch(struct smbd_server_connection *sconn,
3596 char *buf,int *num);
3597 struct dptr_struct *dptr_fetch_lanman2(struct smbd_server_connection *sconn,
3599 bool dir_check_ftype(connection_struct *conn, uint32 mode, uint32 dirtype);
3600 bool get_dir_entry(TALLOC_CTX *ctx,
3601 struct dptr_struct *dirptr,
3604 char **pp_fname_out,
3607 struct timespec *date,
3609 bool ask_sharemode);
3610 bool is_visible_file(connection_struct *conn, const char *dir_path, const char *name, SMB_STRUCT_STAT *pst, bool use_veto);
3611 struct smb_Dir *OpenDir(TALLOC_CTX *mem_ctx, connection_struct *conn,
3612 const char *name, const char *mask, uint32 attr);
3613 const char *ReadDirName(struct smb_Dir *dirp, long *poffset,
3614 SMB_STRUCT_STAT *sbuf, char **talloced);
3615 void RewindDir(struct smb_Dir *dirp, long *poffset);
3616 void SeekDir(struct smb_Dir *dirp, long offset);
3617 long TellDir(struct smb_Dir *dirp);
3618 void DirCacheAdd(struct smb_Dir *dirp, const char *name, long offset);
3619 bool SearchDir(struct smb_Dir *dirp, const char *name, long *poffset);
3620 NTSTATUS can_delete_directory(struct connection_struct *conn,
3621 const char *dirname);
3623 /* The following definitions come from smbd/dmapi.c */
3625 const void *dmapi_get_current_session(void);
3626 bool dmapi_have_session(void);
3627 bool dmapi_new_session(void);
3628 bool dmapi_destroy_session(void);
3629 uint32 dmapi_file_flags(const char * const path);
3631 /* The following definitions come from smbd/dnsregister.c */
3633 bool smbd_setup_mdns_registration(struct tevent_context *ev,
3634 TALLOC_CTX *mem_ctx,
3637 /* The following definitions come from smbd/dosmode.c */
3639 mode_t unix_mode(connection_struct *conn, int dosmode,
3640 const struct smb_filename *smb_fname,
3641 const char *inherit_from_dir);
3642 uint32 dos_mode_msdfs(connection_struct *conn,
3643 const struct smb_filename *smb_fname);
3644 int dos_attributes_to_stat_dos_flags(uint32_t dosmode);
3645 uint32 dos_mode(connection_struct *conn, struct smb_filename *smb_fname);
3646 int file_set_dosmode(connection_struct *conn, struct smb_filename *smb_fname,
3647 uint32 dosmode, const char *parent_dir, bool newfile);
3648 NTSTATUS file_set_sparse(connection_struct *conn,
3649 struct files_struct *fsp,
3651 int file_ntimes(connection_struct *conn, const struct smb_filename *smb_fname,
3652 struct smb_file_time *ft);
3653 bool set_sticky_write_time_path(struct file_id fileid, struct timespec mtime);
3654 bool set_sticky_write_time_fsp(struct files_struct *fsp,
3655 struct timespec mtime);
3657 NTSTATUS set_create_timespec_ea(connection_struct *conn,
3658 const struct smb_filename *smb_fname,
3659 struct timespec create_time);
3661 struct timespec get_create_timespec(connection_struct *conn,
3662 struct files_struct *fsp,
3663 const struct smb_filename *smb_fname);
3665 struct timespec get_change_timespec(connection_struct *conn,
3666 struct files_struct *fsp,
3667 const struct smb_filename *smb_fname);
3669 /* The following definitions come from smbd/error.c */
3671 bool use_nt_status(void);
3672 void error_packet_set(char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatus, int line, const char *file);
3673 int error_packet(char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatus, int line, const char *file);
3674 void reply_nt_error(struct smb_request *req, NTSTATUS ntstatus,
3675 int line, const char *file);
3676 void reply_force_dos_error(struct smb_request *req, uint8 eclass, uint32 ecode,
3677 int line, const char *file);
3678 void reply_both_error(struct smb_request *req, uint8 eclass, uint32 ecode,
3679 NTSTATUS status, int line, const char *file);
3680 void reply_openerror(struct smb_request *req, NTSTATUS status);
3682 /* The following definitions come from smbd/file_access.c */
3684 bool can_access_file_acl(struct connection_struct *conn,
3685 const struct smb_filename *smb_fname,
3686 uint32_t access_mask);
3687 bool can_delete_file_in_directory(connection_struct *conn,
3688 struct smb_filename *smb_fname);
3689 bool can_access_file_data(connection_struct *conn,
3690 const struct smb_filename *smb_fname,
3691 uint32 access_mask);
3692 bool can_write_to_file(connection_struct *conn,
3693 const struct smb_filename *smb_fname);
3694 bool directory_has_default_acl(connection_struct *conn, const char *fname);
3696 /* The following definitions come from smbd/fileio.c */
3698 ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n);
3699 void update_write_time_handler(struct event_context *ctx,
3700 struct timed_event *te,
3702 void *private_data);
3703 void trigger_write_time_update(struct files_struct *fsp);
3704 void trigger_write_time_update_immediate(struct files_struct *fsp);
3705 ssize_t write_file(struct smb_request *req,
3710 void delete_write_cache(files_struct *fsp);
3711 void set_filelen_write_cache(files_struct *fsp, SMB_OFF_T file_size);
3712 ssize_t flush_write_cache(files_struct *fsp, enum flush_reason_enum reason);
3713 NTSTATUS sync_file(connection_struct *conn, files_struct *fsp, bool write_through);
3714 int fsp_stat(files_struct *fsp);
3716 /* The following definitions come from smbd/filename.c */
3718 NTSTATUS unix_convert(TALLOC_CTX *ctx,
3719 connection_struct *conn,
3720 const char *orig_path,
3721 struct smb_filename **smb_fname,
3722 uint32_t ucf_flags);
3723 NTSTATUS check_name(connection_struct *conn, const char *name);
3724 int get_real_filename(connection_struct *conn, const char *path,
3725 const char *name, TALLOC_CTX *mem_ctx,
3727 NTSTATUS filename_convert(TALLOC_CTX *mem_ctx,
3728 connection_struct *conn,
3730 const char *name_in,
3732 bool *ppath_contains_wcard,
3733 struct smb_filename **pp_smb_fname);
3735 /* The following definitions come from smbd/filename_utils.c */
3737 NTSTATUS get_full_smb_filename(TALLOC_CTX *ctx, const struct smb_filename *smb_fname,
3739 NTSTATUS create_synthetic_smb_fname(TALLOC_CTX *ctx, const char *base_name,
3740 const char *stream_name,
3741 const SMB_STRUCT_STAT *psbuf,
3742 struct smb_filename **smb_fname_out);
3743 NTSTATUS create_synthetic_smb_fname_split(TALLOC_CTX *ctx,
3745 const SMB_STRUCT_STAT *psbuf,
3746 struct smb_filename **smb_fname_out);
3747 const char *smb_fname_str_dbg(const struct smb_filename *smb_fname);
3748 const char *fsp_str_dbg(const struct files_struct *fsp);
3749 NTSTATUS copy_smb_filename(TALLOC_CTX *ctx,
3750 const struct smb_filename *smb_fname_in,
3751 struct smb_filename **smb_fname_out);
3752 bool is_ntfs_stream_smb_fname(const struct smb_filename *smb_fname);
3753 bool is_ntfs_default_stream_smb_fname(const struct smb_filename *smb_fname);
3755 /* The following definitions come from smbd/files.c */
3757 NTSTATUS file_new(struct smb_request *req, connection_struct *conn,
3758 files_struct **result);
3759 void file_close_conn(connection_struct *conn);
3760 void file_close_pid(struct smbd_server_connection *sconn, uint16 smbpid,
3762 bool file_init(struct smbd_server_connection *sconn);
3763 void file_close_user(struct smbd_server_connection *sconn, int vuid);
3764 struct files_struct *files_forall(
3765 struct smbd_server_connection *sconn,
3766 struct files_struct *(*fn)(struct files_struct *fsp,
3767 void *private_data),
3768 void *private_data);
3769 files_struct *file_find_fd(struct smbd_server_connection *sconn, int fd);
3770 files_struct *file_find_dif(struct smbd_server_connection *sconn,
3771 struct file_id id, unsigned long gen_id);
3772 files_struct *file_find_di_first(struct smbd_server_connection *sconn,
3774 files_struct *file_find_di_next(files_struct *start_fsp);
3775 bool file_find_subpath(files_struct *dir_fsp);
3776 void file_sync_all(connection_struct *conn);
3777 void file_free(struct smb_request *req, files_struct *fsp);
3778 files_struct *file_fsp(struct smb_request *req, uint16 fid);
3779 NTSTATUS dup_file_fsp(struct smb_request *req, files_struct *from,
3780 uint32 access_mask, uint32 share_access,
3781 uint32 create_options, files_struct *to);
3782 NTSTATUS file_name_hash(connection_struct *conn,
3783 const char *name, uint32_t *p_name_hash);
3784 NTSTATUS fsp_set_smb_fname(struct files_struct *fsp,
3785 const struct smb_filename *smb_fname_in);
3787 /* The following definitions come from smbd/ipc.c */
3789 void send_trans_reply(connection_struct *conn,
3790 struct smb_request *req,
3791 char *rparam, int rparam_len,
3792 char *rdata, int rdata_len,
3793 bool buffer_too_large);
3794 void reply_trans(struct smb_request *req);
3795 void reply_transs(struct smb_request *req);
3797 /* The following definitions come from smbd/lanman.c */
3799 void api_reply(connection_struct *conn, uint16 vuid,
3800 struct smb_request *req,
3801 char *data, char *params,
3802 int tdscnt, int tpscnt,
3803 int mdrcnt, int mprcnt);
3805 /* The following definitions come from smbd/mangle.c */
3807 void mangle_reset_cache(void);
3808 void mangle_change_to_posix(void);
3809 bool mangle_is_mangled(const char *s, const struct share_params *p);
3810 bool mangle_is_8_3(const char *fname, bool check_case,
3811 const struct share_params *p);
3812 bool mangle_is_8_3_wildcards(const char *fname, bool check_case,
3813 const struct share_params *p);
3814 bool mangle_must_mangle(const char *fname,
3815 const struct share_params *p);
3816 bool mangle_lookup_name_from_8_3(TALLOC_CTX *ctx,
3818 char **out, /* talloced on the given context. */
3819 const struct share_params *p);
3820 bool name_to_8_3(const char *in,
3823 const struct share_params *p);
3825 /* The following definitions come from smbd/mangle_hash.c */
3827 const struct mangle_fns *mangle_hash_init(void);
3829 /* The following definitions come from smbd/mangle_hash2.c */
3831 const struct mangle_fns *mangle_hash2_init(void);
3832 const struct mangle_fns *posix_mangle_init(void);
3834 /* The following definitions come from auth/user_util.c */
3836 bool map_username(TALLOC_CTX *ctx, const char *user_in, char **p_user_out);
3838 /* The following definitions come from auth/user_krb5.c */
3839 struct PAC_LOGON_INFO;
3840 NTSTATUS get_user_from_kerberos_info(TALLOC_CTX *mem_ctx,
3841 const char *cli_name,
3842 const char *princ_name,
3843 struct PAC_LOGON_INFO *logon_info,
3845 bool *mapped_to_guest,
3849 struct passwd **_pw);
3850 NTSTATUS make_server_info_krb5(TALLOC_CTX *mem_ctx,
3855 struct PAC_LOGON_INFO *logon_info,
3856 bool mapped_to_guest,
3857 struct auth_serversupplied_info **server_info);
3859 /* The following definitions come from smbd/message.c */
3861 void reply_sends(struct smb_request *req);
3862 void reply_sendstrt(struct smb_request *req);
3863 void reply_sendtxt(struct smb_request *req);
3864 void reply_sendend(struct smb_request *req);
3866 /* The following definitions come from smbd/msdfs.c */
3868 bool is_msdfs_link(connection_struct *conn,
3870 SMB_STRUCT_STAT *sbufp);
3871 struct junction_map;
3872 NTSTATUS get_referred_path(TALLOC_CTX *ctx,
3873 const char *dfs_path,
3874 struct junction_map *jucn,
3876 bool *self_referralp);
3877 int setup_dfs_referral(connection_struct *orig_conn,
3878 const char *dfs_path,
3879 int max_referral_level,
3880 char **ppdata, NTSTATUS *pstatus);
3881 bool create_junction(TALLOC_CTX *ctx,
3882 const char *dfs_path,
3883 struct junction_map *jucn);
3884 bool create_msdfs_link(const struct junction_map *jucn);
3885 bool remove_msdfs_link(const struct junction_map *jucn);
3886 struct junction_map *enum_msdfs_links(TALLOC_CTX *ctx, size_t *p_num_jn);
3887 NTSTATUS resolve_dfspath(TALLOC_CTX *ctx,
3888 connection_struct *conn,
3890 const char *name_in,
3891 char **pp_name_out);
3892 NTSTATUS resolve_dfspath_wcard(TALLOC_CTX *ctx,
3893 connection_struct *conn,
3895 const char *name_in,
3898 bool *ppath_contains_wcard);
3899 NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
3900 connection_struct **pconn,
3903 const struct auth_serversupplied_info *session_info,
3906 /* The following definitions come from smbd/negprot.c */
3908 void reply_negprot(struct smb_request *req);
3910 /* The following definitions come from smbd/notify.c */
3912 void change_notify_reply(struct smb_request *req,
3913 NTSTATUS error_code,
3915 struct notify_change_buf *notify_buf,
3916 void (*reply_fn)(struct smb_request *req,
3917 NTSTATUS error_code,
3918 uint8_t *buf, size_t len));
3919 NTSTATUS change_notify_create(struct files_struct *fsp, uint32 filter,
3921 NTSTATUS change_notify_add_request(struct smb_request *req,
3923 uint32 filter, bool recursive,
3924 struct files_struct *fsp,
3925 void (*reply_fn)(struct smb_request *req,
3926 NTSTATUS error_code,
3927 uint8_t *buf, size_t len));
3928 void remove_pending_change_notify_requests_by_mid(
3929 struct smbd_server_connection *sconn, uint64_t mid);
3930 void remove_pending_change_notify_requests_by_fid(files_struct *fsp,
3932 void notify_fname(connection_struct *conn, uint32 action, uint32 filter,
3934 char *notify_filter_string(TALLOC_CTX *mem_ctx, uint32 filter);
3935 struct sys_notify_context *sys_notify_context_create(connection_struct *conn,
3936 TALLOC_CTX *mem_ctx,
3937 struct event_context *ev);
3938 NTSTATUS sys_notify_watch(struct sys_notify_context *ctx,
3939 struct notify_entry *e,
3940 void (*callback)(struct sys_notify_context *ctx,
3942 struct notify_event *ev),
3943 void *private_data, void *handle);
3945 /* The following definitions come from smbd/notify_inotify.c */
3947 NTSTATUS inotify_watch(struct sys_notify_context *ctx,
3948 struct notify_entry *e,
3949 void (*callback)(struct sys_notify_context *ctx,
3951 struct notify_event *ev),
3955 /* The following definitions come from smbd/notify_internal.c */
3957 struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server,
3958 struct messaging_context *messaging_ctx,
3959 struct event_context *ev,
3960 connection_struct *conn);
3961 bool notify_internal_parent_init(TALLOC_CTX *mem_ctx);
3962 NTSTATUS notify_add(struct notify_context *notify, struct notify_entry *e0,
3963 void (*callback)(void *, const struct notify_event *),
3964 void *private_data);
3965 NTSTATUS notify_remove(struct notify_context *notify, void *private_data);
3966 NTSTATUS notify_remove_onelevel(struct notify_context *notify,
3967 const struct file_id *fid,
3968 void *private_data);
3969 void notify_onelevel(struct notify_context *notify, uint32_t action,
3970 uint32_t filter, struct file_id fid, const char *name);
3971 void notify_trigger(struct notify_context *notify,
3972 uint32_t action, uint32_t filter, const char *path);
3974 /* The following definitions come from smbd/ntquotas.c */
3976 int vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, struct dom_sid *psid, SMB_NTQUOTA_STRUCT *qt);
3977 int vfs_set_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, struct dom_sid *psid, SMB_NTQUOTA_STRUCT *qt);
3978 int vfs_get_user_ntquota_list(files_struct *fsp, SMB_NTQUOTA_LIST **qt_list);
3979 void *init_quota_handle(TALLOC_CTX *mem_ctx);
3981 /* The following definitions come from smbd/nttrans.c */
3983 void send_nt_replies(connection_struct *conn,
3984 struct smb_request *req, NTSTATUS nt_error,
3985 char *params, int paramsize,
3986 char *pdata, int datasize);
3987 void reply_ntcreate_and_X(struct smb_request *req);
3988 NTSTATUS set_sd(files_struct *fsp, uint8_t *data, uint32_t sd_len,
3989 uint32_t security_info_sent);
3990 struct ea_list *read_nttrans_ea_list(TALLOC_CTX *ctx, const char *pdata, size_t data_size);
3991 void reply_ntcancel(struct smb_request *req);
3992 void reply_ntrename(struct smb_request *req);
3993 NTSTATUS smbd_do_query_security_desc(connection_struct *conn,
3994 TALLOC_CTX *mem_ctx,
3996 uint32_t security_info_wanted,
3997 uint32_t max_data_count,
3998 uint8_t **ppmarshalled_sd,
4000 void reply_nttrans(struct smb_request *req);
4001 void reply_nttranss(struct smb_request *req);
4003 /* The following definitions come from smbd/open.c */
4005 NTSTATUS smb1_file_se_access_check(connection_struct *conn,
4006 const struct security_descriptor *sd,
4007 const struct security_token *token,
4008 uint32_t access_desired,
4009 uint32_t *access_granted);
4010 NTSTATUS fd_close(files_struct *fsp);
4011 void change_file_owner_to_parent(connection_struct *conn,
4012 const char *inherit_from_dir,
4014 NTSTATUS change_dir_owner_to_parent(connection_struct *conn,
4015 const char *inherit_from_dir,
4017 SMB_STRUCT_STAT *psbuf);
4018 bool is_executable(const char *fname);
4019 bool is_stat_open(uint32 access_mask);
4020 bool request_timed_out(struct timeval request_time,
4021 struct timeval timeout);
4022 bool open_match_attributes(connection_struct *conn,
4023 uint32 old_dos_attr,
4024 uint32 new_dos_attr,
4025 mode_t existing_unx_mode,
4026 mode_t new_unx_mode,
4027 mode_t *returned_unx_mode);
4028 NTSTATUS fcb_or_dos_open(struct smb_request *req,
4029 connection_struct *conn,
4030 files_struct *fsp_to_dup_into,
4031 const struct smb_filename *smb_fname,
4036 uint32 share_access,
4037 uint32 create_options);
4038 bool map_open_params_to_ntcreate(const struct smb_filename *smb_fname,
4039 int deny_mode, int open_func,
4040 uint32 *paccess_mask,
4041 uint32 *pshare_mode,
4042 uint32 *pcreate_disposition,
4043 uint32 *pcreate_options,
4044 uint32_t *pprivate_flags);
4045 void remove_deferred_open_entry(struct file_id id, uint64_t mid,
4046 struct server_id pid);
4047 NTSTATUS open_file_fchmod(connection_struct *conn,
4048 struct smb_filename *smb_fname,
4049 files_struct **result);
4050 NTSTATUS create_directory(connection_struct *conn, struct smb_request *req,
4051 struct smb_filename *smb_dname);
4052 void msg_file_was_renamed(struct messaging_context *msg,
4055 struct server_id server_id,
4057 NTSTATUS open_streams_for_delete(connection_struct *conn,
4059 NTSTATUS create_file_default(connection_struct *conn,
4060 struct smb_request *req,
4061 uint16_t root_dir_fid,
4062 struct smb_filename * smb_fname,
4063 uint32_t access_mask,
4064 uint32_t share_access,
4065 uint32_t create_disposition,
4066 uint32_t create_options,
4067 uint32_t file_attributes,
4068 uint32_t oplock_request,
4069 uint64_t allocation_size,
4070 uint32_t private_flags,
4071 struct security_descriptor *sd,
4072 struct ea_list *ea_list,
4074 files_struct **result,
4076 NTSTATUS get_relative_fid_filename(connection_struct *conn,
4077 struct smb_request *req,
4078 uint16_t root_dir_fid,
4079 const struct smb_filename *smb_fname,
4080 struct smb_filename **smb_fname_out);
4082 /* The following definitions come from smbd/oplock.c */
4084 int32 get_number_of_exclusive_open_oplocks(void);
4085 void break_kernel_oplock(struct messaging_context *msg_ctx, files_struct *fsp);
4086 bool set_file_oplock(files_struct *fsp, int oplock_type);
4087 void release_file_oplock(files_struct *fsp);
4088 bool remove_oplock(files_struct *fsp);
4089 bool downgrade_oplock(files_struct *fsp);
4090 bool should_notify_deferred_opens(void);
4091 void break_level2_to_none_async(files_struct *fsp);
4092 void reply_to_oplock_break_requests(files_struct *fsp);
4093 void process_oplock_async_level2_break_message(struct messaging_context *msg_ctx,
4096 struct server_id src,
4098 void contend_level2_oplocks_begin(files_struct *fsp,
4099 enum level2_contention_type type);
4100 void contend_level2_oplocks_end(files_struct *fsp,
4101 enum level2_contention_type type);
4102 void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e);
4103 void message_to_share_mode_entry(struct share_mode_entry *e, char *msg);
4104 bool init_oplocks(struct messaging_context *msg_ctx);
4106 /* The following definitions come from smbd/oplock_irix.c */
4108 struct kernel_oplocks *irix_init_kernel_oplocks(TALLOC_CTX *mem_ctx) ;
4110 /* The following definitions come from smbd/oplock_linux.c */
4112 void linux_set_lease_capability(void);
4113 int linux_set_lease_sighandler(int fd);
4114 int linux_setlease(int fd, int leasetype);
4115 struct kernel_oplocks *linux_init_kernel_oplocks(TALLOC_CTX *mem_ctx) ;
4117 /* The following definitions come from smbd/oplock_onefs.c */
4119 struct kernel_oplocks *onefs_init_kernel_oplocks(TALLOC_CTX *mem_ctx);
4121 /* The following definitions come from smbd/password.c */
4123 user_struct *get_valid_user_struct(struct smbd_server_connection *sconn,
4125 bool is_partial_auth_vuid(struct smbd_server_connection *sconn, uint16 vuid);
4126 user_struct *get_partial_auth_user_struct(struct smbd_server_connection *sconn,
4128 void invalidate_vuid(struct smbd_server_connection *sconn, uint16 vuid);
4129 void invalidate_all_vuids(struct smbd_server_connection *sconn);
4130 int register_initial_vuid(struct smbd_server_connection *sconn);
4131 int register_homes_share(const char *username);
4132 int register_existing_vuid(struct smbd_server_connection *sconn,
4134 struct auth_serversupplied_info *session_info,
4135 DATA_BLOB response_blob,
4136 const char *smb_name);
4137 void add_session_user(struct smbd_server_connection *sconn, const char *user);
4138 void add_session_workgroup(struct smbd_server_connection *sconn,
4139 const char *workgroup);
4140 const char *get_session_workgroup(struct smbd_server_connection *sconn);
4141 bool user_in_netgroup(TALLOC_CTX *ctx, const char *user, const char *ngname);
4142 bool user_in_list(TALLOC_CTX *ctx, const char *user,const char **list);
4143 bool authorise_login(struct smbd_server_connection *sconn,
4144 int snum, fstring user, DATA_BLOB password,
4147 /* The following definitions come from smbd/pipes.c */
4149 NTSTATUS open_np_file(struct smb_request *smb_req, const char *name,
4150 struct files_struct **pfsp);
4151 void reply_open_pipe_and_X(connection_struct *conn, struct smb_request *req);
4152 void reply_pipe_write(struct smb_request *req);
4153 void reply_pipe_write_and_X(struct smb_request *req);
4154 void reply_pipe_read_and_X(struct smb_request *req);
4156 /* The following definitions come from smbd/posix_acls.c */
4158 void create_file_sids(const SMB_STRUCT_STAT *psbuf, struct dom_sid *powner_sid, struct dom_sid *pgroup_sid);
4159 bool nt4_compatible_acls(void);
4160 uint32_t map_canon_ace_perms(int snum,
4161 enum security_ace_type *pacl_type,
4163 bool directory_ace);
4164 NTSTATUS unpack_nt_owners(connection_struct *conn, uid_t *puser, gid_t *pgrp, uint32 security_info_sent, const struct security_descriptor *psd);
4165 SMB_ACL_T free_empty_sys_acl(connection_struct *conn, SMB_ACL_T the_acl);
4166 NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info,
4167 struct security_descriptor **ppdesc);
4168 NTSTATUS posix_get_nt_acl(struct connection_struct *conn, const char *name,
4169 uint32_t security_info, struct security_descriptor **ppdesc);
4170 NTSTATUS try_chown(files_struct *fsp, uid_t uid, gid_t gid);
4171 NTSTATUS append_parent_acl(files_struct *fsp,
4172 const struct security_descriptor *pcsd,
4173 struct security_descriptor **pp_new_sd);
4174 NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, const struct security_descriptor *psd);
4175 int get_acl_group_bits( connection_struct *conn, const char *fname, mode_t *mode );
4176 int chmod_acl(connection_struct *conn, const char *name, mode_t mode);
4177 int inherit_access_posix_acl(connection_struct *conn, const char *inherit_from_dir,
4178 const char *name, mode_t mode);
4179 int fchmod_acl(files_struct *fsp, mode_t mode);
4180 bool set_unix_posix_default_acl(connection_struct *conn, const char *fname,
4181 const SMB_STRUCT_STAT *psbuf,
4182 uint16 num_def_acls, const char *pdata);
4183 bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp, const char *fname, uint16 num_acls, const char *pdata);
4184 struct security_descriptor *get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname);
4185 NTSTATUS make_default_filesystem_acl(TALLOC_CTX *ctx,
4187 SMB_STRUCT_STAT *psbuf,
4188 struct security_descriptor **ppdesc);
4190 /* The following definitions come from smbd/process.c */
4192 void smbd_setup_sig_term_handler(void);
4193 void smbd_setup_sig_hup_handler(struct tevent_context *ev,
4194 struct messaging_context *msg_ctx);
4195 bool srv_send_smb(struct smbd_server_connection *sconn, char *buffer,
4196 bool no_signing, uint32_t seqnum,
4198 struct smb_perfcount_data *pcd);
4199 int srv_set_message(char *buf,
4203 void remove_deferred_open_message_smb(uint64_t mid);
4204 void schedule_deferred_open_message_smb(uint64_t mid);
4205 bool open_was_deferred(uint64_t mid);
4206 bool get_deferred_open_message_state(struct smb_request *smbreq,
4207 struct timeval *p_request_time,
4209 bool push_deferred_open_message_smb(struct smb_request *req,
4210 struct timeval request_time,
4211 struct timeval timeout,
4215 struct idle_event *event_add_idle(struct event_context *event_ctx,
4216 TALLOC_CTX *mem_ctx,
4217 struct timeval interval,
4219 bool (*handler)(const struct timeval *now,
4220 void *private_data),
4221 void *private_data);
4222 NTSTATUS allow_new_trans(struct trans_state *list, uint64_t mid);
4223 void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes);
4224 const char *smb_fn_name(int type);
4225 void add_to_common_flags2(uint32 v);
4226 void remove_from_common_flags2(uint32 v);
4227 void construct_reply_common_req(struct smb_request *req, char *outbuf);
4228 size_t req_wct_ofs(struct smb_request *req);
4229 void chain_reply(struct smb_request *req);
4230 bool req_is_in_chain(struct smb_request *req);
4231 void smbd_process(struct smbd_server_connection *sconn);
4233 /* The following definitions come from smbd/quotas.c */
4235 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
4236 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
4237 bool disk_quotas(const char *path,
4241 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
4242 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
4243 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
4244 bool disk_quotas_vxfs(const char *name, char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
4245 bool disk_quotas(const char *path,uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
4246 bool disk_quotas(const char *path,uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
4248 /* The following definitions come from smbd/reply.c */
4250 NTSTATUS check_path_syntax(char *path);
4251 NTSTATUS check_path_syntax_wcard(char *path, bool *p_contains_wcard);
4252 NTSTATUS check_path_syntax_posix(char *path);
4253 size_t srvstr_get_path_wcard(TALLOC_CTX *ctx,
4261 bool *contains_wcard);
4262 size_t srvstr_get_path(TALLOC_CTX *ctx,
4270 size_t srvstr_get_path_req_wcard(TALLOC_CTX *mem_ctx, struct smb_request *req,
4271 char **pp_dest, const char *src, int flags,
4272 NTSTATUS *err, bool *contains_wcard);
4273 size_t srvstr_get_path_req(TALLOC_CTX *mem_ctx, struct smb_request *req,
4274 char **pp_dest, const char *src, int flags,
4276 bool check_fsp_open(connection_struct *conn, struct smb_request *req,
4278 bool check_fsp(connection_struct *conn, struct smb_request *req,
4280 bool check_fsp_ntquota_handle(connection_struct *conn, struct smb_request *req,
4282 void reply_special(struct smbd_server_connection *sconn, char *inbuf, size_t inbuf_len);
4283 void reply_tcon(struct smb_request *req);
4284 void reply_tcon_and_X(struct smb_request *req);
4285 void reply_unknown_new(struct smb_request *req, uint8 type);
4286 void reply_ioctl(struct smb_request *req);
4287 void reply_checkpath(struct smb_request *req);
4288 void reply_getatr(struct smb_request *req);
4289 void reply_setatr(struct smb_request *req);
4290 void reply_dskattr(struct smb_request *req);
4291 void reply_search(struct smb_request *req);
4292 void reply_fclose(struct smb_request *req);
4293 void reply_open(struct smb_request *req);
4294 void reply_open_and_X(struct smb_request *req);
4295 void reply_ulogoffX(struct smb_request *req);
4296 void reply_mknew(struct smb_request *req);
4297 void reply_ctemp(struct smb_request *req);
4298 NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req,
4299 uint32 dirtype, struct smb_filename *smb_fname,
4301 void reply_unlink(struct smb_request *req);
4302 ssize_t fake_sendfile(files_struct *fsp, SMB_OFF_T startpos, size_t nread);
4303 void sendfile_short_send(files_struct *fsp,
4307 void reply_readbraw(struct smb_request *req);
4308 void reply_lockread(struct smb_request *req);
4309 void reply_read(struct smb_request *req);
4310 void reply_read_and_X(struct smb_request *req);
4311 void error_to_writebrawerr(struct smb_request *req);
4312 void reply_writebraw(struct smb_request *req);
4313 void reply_writeunlock(struct smb_request *req);
4314 void reply_write(struct smb_request *req);
4315 bool is_valid_writeX_buffer(struct smbd_server_connection *sconn,
4316 const uint8_t *inbuf);
4317 void reply_write_and_X(struct smb_request *req);
4318 void reply_lseek(struct smb_request *req);
4319 void reply_flush(struct smb_request *req);
4320 void reply_exit(struct smb_request *req);
4321 void reply_close(struct smb_request *req);
4322 void reply_writeclose(struct smb_request *req);
4323 void reply_lock(struct smb_request *req);
4324 void reply_unlock(struct smb_request *req);
4325 void reply_tdis(struct smb_request *req);
4326 void reply_echo(struct smb_request *req);
4327 void reply_printopen(struct smb_request *req);
4328 void reply_printclose(struct smb_request *req);
4329 void reply_printqueue(struct smb_request *req);
4330 void reply_printwrite(struct smb_request *req);
4331 void reply_mkdir(struct smb_request *req);
4332 void reply_rmdir(struct smb_request *req);
4333 NTSTATUS rename_internals_fsp(connection_struct *conn,
4335 const struct smb_filename *smb_fname_dst_in,
4337 bool replace_if_exists);
4338 NTSTATUS rename_internals(TALLOC_CTX *ctx,
4339 connection_struct *conn,
4340 struct smb_request *req,
4341 struct smb_filename *smb_fname_src,
4342 struct smb_filename *smb_fname_dst,
4344 bool replace_if_exists,
4347 uint32_t access_mask);
4348 void reply_mv(struct smb_request *req);
4349 NTSTATUS copy_file(TALLOC_CTX *ctx,
4350 connection_struct *conn,
4351 struct smb_filename *smb_fname_src,
4352 struct smb_filename *smb_fname_dst,
4355 bool target_is_directory);
4356 void reply_copy(struct smb_request *req);
4357 uint64_t get_lock_pid(const uint8_t *data, int data_offset,
4358 bool large_file_format);
4359 uint64_t get_lock_count(const uint8_t *data, int data_offset,
4360 bool large_file_format);
4361 uint64_t get_lock_offset(const uint8_t *data, int data_offset,
4362 bool large_file_format, bool *err);
4363 void reply_lockingX(struct smb_request *req);
4364 void reply_readbmpx(struct smb_request *req);
4365 void reply_readbs(struct smb_request *req);
4366 void reply_setattrE(struct smb_request *req);
4367 void reply_writebmpx(struct smb_request *req);
4368 void reply_writebs(struct smb_request *req);
4369 void reply_getattrE(struct smb_request *req);
4371 /* The following definitions come from smbd/seal.c */
4373 uint16_t srv_enc_ctx(void);
4374 bool is_encrypted_packet(const uint8_t *inbuf);
4375 void srv_free_enc_buffer(char *buf);
4376 NTSTATUS srv_decrypt_buffer(char *buf);
4377 NTSTATUS srv_encrypt_buffer(char *buf, char **buf_out);
4378 NTSTATUS srv_request_encryption_setup(connection_struct *conn,
4379 unsigned char **ppdata,
4380 size_t *p_data_size,
4381 unsigned char **pparam,
4382 size_t *p_param_size);
4383 NTSTATUS srv_encryption_start(connection_struct *conn);
4384 void server_encryption_shutdown(void);
4386 /* The following definitions come from smbd/sec_ctx.c */
4388 bool unix_token_equal(const struct security_unix_token *t1, const struct security_unix_token *t2);
4389 bool push_sec_ctx(void);
4390 void set_sec_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups, struct security_token *token);
4391 void set_root_sec_ctx(void);
4392 bool pop_sec_ctx(void);
4393 void init_sec_ctx(void);
4395 /* The following definitions come from lib/server_contexts.c */
4396 struct tevent_context *server_event_context(void);
4397 void server_event_context_free(void);
4398 struct messaging_context *server_messaging_context(void);
4399 void server_messaging_context_free(void);
4401 /* The following definitions come from smbd/server.c */
4403 struct event_context *smbd_event_context(void);
4404 struct messaging_context *smbd_messaging_context(void);
4405 struct memcache *smbd_memcache(void);
4406 void reload_printers(struct tevent_context *ev,
4407 struct messaging_context *msg_ctx);
4408 bool reload_services(struct messaging_context *msg_ctx, int smb_sock,
4410 void reload_pcap_change_notify(struct tevent_context *ev,
4411 struct messaging_context *msg_ctx);
4412 void exit_server(const char *const explanation);
4413 void exit_server_cleanly(const char *const explanation);
4414 void exit_server_fault(void);
4416 /* The following definitions come from smbd/service.c */
4418 bool set_conn_connectpath(connection_struct *conn, const char *connectpath);
4419 NTSTATUS set_conn_force_user_group(connection_struct *conn, int snum);
4420 bool set_current_service(connection_struct *conn, uint16 flags, bool do_chdir);
4421 void load_registry_shares(void);
4422 int add_home_service(const char *service, const char *username, const char *homedir);
4423 int find_service(TALLOC_CTX *ctx, const char *service, char **p_service_out);
4424 connection_struct *make_connection_snum(struct smbd_server_connection *sconn,
4425 int snum, user_struct *vuser,
4429 connection_struct *make_connection(struct smbd_server_connection *sconn,
4430 const char *service_in, DATA_BLOB password,
4431 const char *pdev, uint16 vuid,
4433 void close_cnum(connection_struct *conn, uint16 vuid);
4435 /* The following definitions come from smbd/session.c */
4437 bool session_init(void);
4438 bool session_claim(struct smbd_server_connection *sconn, user_struct *vuser);
4439 void session_yield(user_struct *vuser);
4440 int list_sessions(TALLOC_CTX *mem_ctx, struct sessionid **session_list);
4442 /* The following definitions come from lib/sessionid_tdb.c */
4444 bool sessionid_init(void);
4445 struct db_record *sessionid_fetch_record(TALLOC_CTX *mem_ctx, const char *key);
4446 int sessionid_traverse(int (*fn)(struct db_record *rec, const char *key,
4447 struct sessionid *session,
4448 void *private_data),
4449 void *private_data);
4450 int sessionid_traverse_read(int (*fn)(const char *key,
4451 struct sessionid *session,
4452 void *private_data),
4453 void *private_data);
4455 /* The following definitions come from smbd/sesssetup.c */
4457 NTSTATUS do_map_to_guest(NTSTATUS status,
4458 struct auth_serversupplied_info **session_info,
4459 const char *user, const char *domain);
4461 NTSTATUS parse_spnego_mechanisms(TALLOC_CTX *ctx,
4463 DATA_BLOB *pblob_out,
4464 char **kerb_mechOID);
4465 void reply_sesssetup_and_X(struct smb_request *req);
4467 /* The following definitions come from smbd/share_access.c */
4469 bool token_contains_name_in_list(const char *username,
4471 const char *sharename,
4472 const struct security_token *token,
4474 bool user_ok_token(const char *username, const char *domain,
4475 const struct security_token *token, int snum);
4476 bool is_share_read_only_for_token(const char *username,
4478 const struct security_token *token,
4479 connection_struct *conn);
4481 /* The following definitions come from smbd/srvstr.c */
4483 size_t srvstr_push_fn(const char *base_ptr, uint16 smb_flags2, void *dest,
4484 const char *src, int dest_len, int flags);
4485 ssize_t message_push_string(uint8 **outbuf, const char *str, int flags);
4487 /* The following definitions come from smbd/statcache.c */
4489 void stat_cache_add( const char *full_orig_name,
4490 char *translated_path,
4491 bool case_sensitive);
4492 bool stat_cache_lookup(connection_struct *conn,
4496 SMB_STRUCT_STAT *pst);
4497 void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
4499 void stat_cache_delete(const char *name);
4500 unsigned int fast_string_hash(TDB_DATA *key);
4501 bool reset_stat_cache( void );
4503 /* The following definitions come from smbd/statvfs.c */
4505 int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf);
4507 /* The following definitions come from smbd/trans2.c */
4509 uint64_t smb_roundup(connection_struct *conn, uint64_t val);
4510 uint64_t get_FileIndex(connection_struct *conn, const SMB_STRUCT_STAT *psbuf);
4511 NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn,
4512 files_struct *fsp, const char *fname,
4513 const char *ea_name, struct ea_struct *pea);
4514 NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn,
4515 files_struct *fsp, const char *fname,
4516 char ***pnames, size_t *pnum_names);
4517 NTSTATUS set_ea(connection_struct *conn, files_struct *fsp,
4518 const struct smb_filename *smb_fname, struct ea_list *ea_list);
4519 struct ea_list *read_ea_list_entry(TALLOC_CTX *ctx, const char *pdata, size_t data_size, size_t *pbytes_used);
4520 void send_trans2_replies(connection_struct *conn,
4521 struct smb_request *req,
4526 int max_data_bytes);
4527 unsigned char *create_volume_objectid(connection_struct *conn, unsigned char objid[16]);
4528 NTSTATUS hardlink_internals(TALLOC_CTX *ctx,
4529 connection_struct *conn,
4530 struct smb_request *req,
4531 bool overwrite_if_exists,
4532 const struct smb_filename *smb_fname_old,
4533 struct smb_filename *smb_fname_new);
4534 NTSTATUS smb_set_file_time(connection_struct *conn,
4536 const struct smb_filename *smb_fname,
4537 struct smb_file_time *ft,
4538 bool setting_write_time);
4539 void reply_findclose(struct smb_request *req);
4540 void reply_findnclose(struct smb_request *req);
4541 void reply_trans2(struct smb_request *req);
4542 void reply_transs2(struct smb_request *req);
4544 /* The following definitions come from smbd/uid.c */
4546 bool change_to_guest(void);
4547 void conn_clear_vuid_cache(connection_struct *conn, uint16_t vuid);
4548 bool change_to_user(connection_struct *conn, uint16 vuid);
4549 bool change_to_root_user(void);
4550 bool become_authenticated_pipe_user(struct pipes_struct *p);
4551 bool unbecome_authenticated_pipe_user(void);
4552 void become_root(void);
4553 void unbecome_root(void);
4554 bool become_user(connection_struct *conn, uint16 vuid);
4555 bool unbecome_user(void);
4556 uid_t get_current_uid(connection_struct *conn);
4557 gid_t get_current_gid(connection_struct *conn);
4558 const struct security_unix_token *get_current_utok(connection_struct *conn);
4559 const struct security_token *get_current_nttok(connection_struct *conn);
4560 uint16_t get_current_vuid(connection_struct *conn);
4562 /* The following definitions come from smbd/utmp.c */
4564 void sys_utmp_claim(const char *username, const char *hostname,
4565 const char *ip_addr_str,
4566 const char *id_str, int id_num);
4567 void sys_utmp_yield(const char *username, const char *hostname,
4568 const char *ip_addr_str,
4569 const char *id_str, int id_num);
4570 void sys_utmp_yield(const char *username, const char *hostname,
4571 const char *ip_addr_str,
4572 const char *id_str, int id_num);
4573 void sys_utmp_claim(const char *username, const char *hostname,
4574 const char *ip_addr_str,
4575 const char *id_str, int id_num);
4577 /* The following definitions come from smbd/vfs.c */
4579 NTSTATUS smb_register_vfs(int version, const char *name,
4580 const struct vfs_fn_pointers *fns);
4581 bool vfs_init_custom(connection_struct *conn, const char *vfs_object);
4582 void *vfs_add_fsp_extension_notype(vfs_handle_struct *handle,
4583 files_struct *fsp, size_t ext_size,
4584 void (*destroy_fn)(void *p_data));
4585 void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
4586 void *vfs_memctx_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
4587 void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
4588 bool smbd_vfs_init(connection_struct *conn);
4589 NTSTATUS vfs_file_exist(connection_struct *conn, struct smb_filename *smb_fname);
4590 ssize_t vfs_read_data(files_struct *fsp, char *buf, size_t byte_count);
4591 ssize_t vfs_pread_data(files_struct *fsp, char *buf,
4592 size_t byte_count, SMB_OFF_T offset);
4593 ssize_t vfs_write_data(struct smb_request *req,
4597 ssize_t vfs_pwrite_data(struct smb_request *req,
4602 int vfs_allocate_file_space(files_struct *fsp, uint64_t len);
4603 int vfs_set_filelen(files_struct *fsp, SMB_OFF_T len);
4604 int vfs_slow_fallocate(files_struct *fsp, SMB_OFF_T offset, SMB_OFF_T len);
4605 int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len);
4606 SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n);
4607 const char *vfs_readdirname(connection_struct *conn, void *p,
4608 SMB_STRUCT_STAT *sbuf, char **talloced);
4609 int vfs_ChDir(connection_struct *conn, const char *path);
4610 char *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn);
4611 NTSTATUS check_reduced_name(connection_struct *conn, const char *fname);
4612 int vfs_stat_smb_fname(struct connection_struct *conn, const char *fname,
4613 SMB_STRUCT_STAT *psbuf);
4614 int vfs_lstat_smb_fname(struct connection_struct *conn, const char *fname,
4615 SMB_STRUCT_STAT *psbuf);
4616 NTSTATUS vfs_stat_fsp(files_struct *fsp);
4617 NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid);
4619 /* The following definitions come from utils/passwd_util.c */
4621 char *stdin_new_passwd( void);
4622 char *get_pass( const char *prompt, bool stdin_get);
4624 /* The following definitions come from winbindd/nss_info.c */
4627 /* The following definitions come from winbindd/nss_info_template.c */
4629 NTSTATUS nss_info_template_init( void );
4631 /* The following definitions come from lib/avahi.c */
4633 struct AvahiPoll *tevent_avahi_poll(TALLOC_CTX *mem_ctx,
4634 struct tevent_context *ev);
4636 /* The following definitions come from smbd/avahi_register.c */
4638 void *avahi_start_register(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
4641 /* The following definitions come from smbd/msg_idmap.c */
4643 void msg_idmap_register_msgs(struct messaging_context *ctx);
4645 /* The following definitions come from lib/fncall.c */
4647 struct fncall_context *fncall_context_init(TALLOC_CTX *mem_ctx,
4649 struct tevent_req *fncall_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
4650 struct fncall_context *ctx,
4651 void (*fn)(void *private_data),
4652 void *private_data);
4653 int fncall_recv(struct tevent_req *req, int *perr);
4655 /* The following definitions come from libsmb/smbsock_connect.c */
4657 struct tevent_req *smbsock_connect_send(TALLOC_CTX *mem_ctx,
4658 struct tevent_context *ev,
4659 const struct sockaddr_storage *addr,
4661 const char *called_name,
4663 const char *calling_name,
4665 NTSTATUS smbsock_connect_recv(struct tevent_req *req, int *sock,
4666 uint16_t *ret_port);
4667 NTSTATUS smbsock_connect(const struct sockaddr_storage *addr, uint16_t port,
4668 const char *called_name, int called_type,
4669 const char *calling_name, int calling_type,
4670 int *pfd, uint16_t *ret_port);
4672 struct tevent_req *smbsock_any_connect_send(TALLOC_CTX *mem_ctx,
4673 struct tevent_context *ev,
4674 const struct sockaddr_storage *addrs,
4675 const char **called_names,
4677 const char **calling_names,
4679 size_t num_addrs, uint16_t port);
4680 NTSTATUS smbsock_any_connect_recv(struct tevent_req *req, int *pfd,
4681 size_t *chosen_index, uint16_t *chosen_port);
4682 NTSTATUS smbsock_any_connect(const struct sockaddr_storage *addrs,
4683 const char **called_names,
4685 const char **calling_names,
4689 int *pfd, size_t *chosen_index,
4690 uint16_t *chosen_port);
4692 /* The following definitions come from rpc_server/srv_samr_nt.c */
4693 NTSTATUS access_check_object( struct security_descriptor *psd, struct security_token *token,
4694 enum sec_privilege needed_priv_1, enum sec_privilege needed_priv_2,
4696 uint32 des_access, uint32 *acc_granted,
4697 const char *debug );
4698 void map_max_allowed_access(const struct security_token *nt_token,
4699 const struct security_unix_token *unix_token,
4700 uint32_t *pacc_requested);
4702 #endif /* _PROTO_H_ */