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/>.
26 #include <sys/types.h>
29 #include "lib/util/access.h"
30 #include "nsswitch/libwbclient/wbclient.h"
32 /* The following definitions come from lib/adt_tree.c */
34 /* The following definitions come from lib/audit.c */
36 const char *audit_category_str(uint32_t category
);
37 const char *audit_param_str(uint32_t category
);
38 const char *audit_description_str(uint32_t category
);
39 bool get_audit_category_from_param(const char *param
, uint32_t *audit_category
);
40 const char *audit_policy_str(TALLOC_CTX
*mem_ctx
, uint32_t policy
);
42 /* The following definitions come from lib/charcnv.c */
44 void gfree_charcnv(void);
45 size_t push_ascii(void *dest
, const char *src
, size_t dest_len
, int flags
);
46 size_t push_ascii_fstring(void *dest
, const char *src
);
47 size_t push_ascii_nstring(void *dest
, const char *src
);
48 size_t pull_ascii(char *dest
, const void *src
, size_t dest_len
, size_t src_len
, int flags
);
49 size_t pull_ascii_fstring(char *dest
, const void *src
);
50 size_t pull_ascii_nstring(char *dest
, size_t dest_len
, const void *src
);
51 size_t push_string_check_fn(void *dest
, const char *src
,
52 size_t dest_len
, int flags
);
53 size_t push_string_base(const char *base
, uint16_t flags2
,
54 void *dest
, const char *src
,
55 size_t dest_len
, int flags
);
56 size_t pull_string_talloc(TALLOC_CTX
*ctx
,
63 size_t dos_PutUniCode(char *dst
,const char *src
, size_t len
, bool null_terminate
);
64 int rpcstr_push_talloc(TALLOC_CTX
*ctx
, smb_ucs2_t
**dest
, const char *src
);
66 /* The following definitions come from lib/dmallocmsg.c */
68 void register_dmalloc_msgs(struct messaging_context
*msg_ctx
);
70 /* The following definitions come from lib/dprintf.c */
72 void display_set_stderr(void);
74 /* The following definitions come from lib/errmap_unix.c */
76 NTSTATUS
map_nt_error_from_unix(int unix_error
);
78 /* The following definitions come from lib/file_id.c */
80 struct file_id
vfs_file_id_from_sbuf(connection_struct
*conn
, const SMB_STRUCT_STAT
*sbuf
);
82 NTSTATUS
vfs_at_fspcwd(TALLOC_CTX
*mem_ctx
,
83 struct connection_struct
*conn
,
84 struct files_struct
**_fsp
);
86 #include "source3/lib/interface.h"
88 /* The following definitions come from lib/ldap_debug_handler.c */
90 void init_ldap_debugging(void);
92 /* The following definitions come from lib/ldap_escape.c */
94 char *escape_ldap_string(TALLOC_CTX
*mem_ctx
, const char *s
);
95 char *escape_rdn_val_string_alloc(const char *s
);
97 /* The following definitions come from lib/ms_fnmatch.c */
99 int ms_fnmatch(const char *pattern
, const char *string
, bool translate_pattern
,
100 bool is_case_sensitive
);
102 /* The following definitions come from lib/recvfile.c */
104 ssize_t
sys_recvfile(int fromfd
,
108 ssize_t
sys_recvfile(int fromfd
,
112 ssize_t
drain_socket(int sockfd
, size_t count
);
114 /* The following definitions come from lib/sendfile.c */
116 ssize_t
sys_sendfile(int tofd
, int fromfd
, const DATA_BLOB
*header
, off_t offset
, size_t count
);
118 /* The following definitions come from lib/server_mutex.c */
120 struct named_mutex
*grab_named_mutex(TALLOC_CTX
*mem_ctx
, const char *name
,
123 /* The following definitions come from lib/sharesec.c */
125 NTSTATUS
share_info_db_init(void);
126 struct security_descriptor
*get_share_security( TALLOC_CTX
*ctx
, const char *servicename
,
128 NTSTATUS
set_share_security(const char *share_name
,
129 struct security_descriptor
*psd
);
130 NTSTATUS
delete_share_security(const char *servicename
);
131 bool share_access_check(const struct security_token
*token
,
132 const char *sharename
,
133 uint32_t desired_access
,
135 bool parse_usershare_acl(TALLOC_CTX
*ctx
, const char *acl_str
, struct security_descriptor
**ppsd
);
137 /* The following definitions come from lib/smbrun.c */
139 int smbrun_no_sanitize(const char *cmd
, int *outfd
, char * const *env
);
140 int smbrun(const char *cmd
, int *outfd
, char * const *env
);
141 int smbrunsecret(const char *cmd
, const char *secret
);
143 /* The following definitions come from lib/sysquotas.c */
145 int sys_get_quota(const char *path
, enum SMB_QUOTA_TYPE qtype
, unid_t id
, SMB_DISK_QUOTA
*dp
);
146 int sys_set_quota(const char *path
, enum SMB_QUOTA_TYPE qtype
, unid_t id
, SMB_DISK_QUOTA
*dp
);
148 /* The following definitions come from lib/sysquotas_*.c */
150 int sys_get_vfs_quota(const char *path
, const char *bdev
, enum SMB_QUOTA_TYPE qtype
, unid_t id
, SMB_DISK_QUOTA
*dp
);
151 int sys_set_vfs_quota(const char *path
, const char *bdev
, enum SMB_QUOTA_TYPE qtype
, unid_t id
, SMB_DISK_QUOTA
*dp
);
153 int sys_get_xfs_quota(const char *path
, const char *bdev
, enum SMB_QUOTA_TYPE qtype
, unid_t id
, SMB_DISK_QUOTA
*dp
);
154 int sys_set_xfs_quota(const char *path
, const char *bdev
, enum SMB_QUOTA_TYPE qtype
, unid_t id
, SMB_DISK_QUOTA
*dp
);
156 int sys_get_jfs2_quota(const char *path
, const char *bdev
, enum SMB_QUOTA_TYPE qtype
, unid_t id
, SMB_DISK_QUOTA
*dp
);
157 int sys_set_jfs2_quota(const char *path
, const char *bdev
, enum SMB_QUOTA_TYPE qtype
, unid_t id
, SMB_DISK_QUOTA
*dp
);
159 int sys_get_nfs_quota(const char *path
, const char *bdev
,
160 enum SMB_QUOTA_TYPE qtype
,
161 unid_t id
, SMB_DISK_QUOTA
*dp
);
162 int sys_set_nfs_quota(const char *path
, const char *bdev
,
163 enum SMB_QUOTA_TYPE qtype
,
164 unid_t id
, SMB_DISK_QUOTA
*dp
);
166 /* The following definitions come from lib/system.c */
168 ssize_t
sys_send(int s
, const void *msg
, size_t len
, int flags
);
169 ssize_t
sys_recvfrom(int s
, void *buf
, size_t len
, int flags
, struct sockaddr
*from
, socklen_t
*fromlen
);
170 int sys_fcntl_ptr(int fd
, int cmd
, void *arg
);
171 int sys_fcntl_long(int fd
, int cmd
, long arg
);
172 int sys_fcntl_int(int fd
, int cmd
, int arg
);
173 void update_stat_ex_mtime(struct stat_ex
*dst
, struct timespec write_ts
);
174 void update_stat_ex_create_time(struct stat_ex
*dst
, struct timespec create_time
);
175 void update_stat_ex_from_saved_stat(struct stat_ex
*dst
,
176 const struct stat_ex
*src
);
177 void copy_stat_ex_timestamps(struct stat_ex
*st
,
178 const struct smb_file_time
*ft
);
179 int sys_stat(const char *fname
, SMB_STRUCT_STAT
*sbuf
,
180 bool fake_dir_create_times
);
181 int sys_fstat(int fd
, SMB_STRUCT_STAT
*sbuf
,
182 bool fake_dir_create_times
);
183 int sys_lstat(const char *fname
,SMB_STRUCT_STAT
*sbuf
,
184 bool fake_dir_create_times
);
185 int sys_fstatat(int fd
,
186 const char *pathname
,
187 SMB_STRUCT_STAT
*sbuf
,
189 bool fake_dir_create_times
);
190 int sys_posix_fallocate(int fd
, off_t offset
, off_t len
);
191 int sys_fallocate(int fd
, uint32_t mode
, off_t offset
, off_t len
);
192 DIR *sys_fdopendir(int fd
);
193 int sys_mknod(const char *path
, mode_t mode
, SMB_DEV_T dev
);
194 int sys_mknodat(int dirfd
, const char *path
, mode_t mode
, SMB_DEV_T dev
);
195 char *sys_getwd(void);
196 void set_effective_capability(enum smbd_capability capability
);
197 void drop_effective_capability(enum smbd_capability capability
);
198 long sys_random(void);
199 void sys_srandom(unsigned int seed
);
200 int getgroups_max(void);
201 int setgroups_max(void);
202 int sys_getgroups(int setlen
, gid_t
*gidset
);
203 int sys_setgroups(gid_t
UNUSED(primary_gid
), int setlen
, gid_t
*gidset
);
204 uint32_t unix_dev_major(SMB_DEV_T dev
);
205 uint32_t unix_dev_minor(SMB_DEV_T dev
);
206 char *sys_realpath(const char *path
);
208 int sys_get_number_of_cores(void);
211 struct sys_proc_fd_path_buf
{
212 char buf
[35]; /* "/proc/self/fd/" + strlen(2^64) + 0-terminator */
214 bool sys_have_proc_fds(void);
215 char *sys_proc_fd_path(int fd
, struct sys_proc_fd_path_buf
*buf
);
218 void init_stat_ex_from_stat (struct stat_ex
*dst
,
219 const struct stat
*src
,
220 bool fake_dir_create_times
);
222 /* The following definitions come from lib/system_smbd.c */
224 bool getgroups_unix_user(TALLOC_CTX
*mem_ctx
, const char *user
,
226 gid_t
**ret_groups
, uint32_t *p_ngroups
);
228 /* The following definitions come from lib/time.c */
230 uint32_t convert_time_t_to_uint32_t(time_t t
);
231 time_t convert_uint32_t_to_time_t(uint32_t u
);
232 bool nt_time_is_zero(const NTTIME
*nt
);
233 time_t generalized_to_unix_time(const char *str
);
234 int get_server_zone_offset(void);
235 int set_server_zone_offset(time_t t
);
236 char *timeval_string(TALLOC_CTX
*ctx
, const struct timeval
*tp
, bool hires
);
237 char *current_timestring(TALLOC_CTX
*ctx
, bool hires
);
238 void srv_put_dos_date(char *buf
,int offset
,time_t unixdate
);
239 void srv_put_dos_date2_ts(char *buf
, int offset
, struct timespec unix_ts
);
240 void srv_put_dos_date3(char *buf
,int offset
,time_t unixdate
);
241 void round_timespec(enum timestamp_set_resolution res
, struct timespec
*ts
);
242 void put_long_date_timespec(enum timestamp_set_resolution res
, char *p
, struct timespec ts
);
243 void put_long_date_full_timespec(enum timestamp_set_resolution res
,
245 const struct timespec
*ts
);
246 struct timespec
pull_long_date_full_timespec(const char *p
);
247 void put_long_date(char *p
, time_t t
);
248 void dos_filetime_timespec(struct timespec
*tsp
);
249 time_t make_unix_date(const void *date_ptr
, int zone_offset
);
250 time_t make_unix_date2(const void *date_ptr
, int zone_offset
);
251 time_t make_unix_date3(const void *date_ptr
, int zone_offset
);
252 time_t srv_make_unix_date(const void *date_ptr
);
253 time_t srv_make_unix_date2(const void *date_ptr
);
254 time_t srv_make_unix_date3(const void *date_ptr
);
255 struct timespec
interpret_long_date(NTTIME nt
);
257 void get_process_uptime(struct timeval
*ret_time
);
258 void get_startup_time(struct timeval
*ret_time
);
259 time_t nt_time_to_unix_abs(const NTTIME
*nt
);
260 void unix_to_nt_time_abs(NTTIME
*nt
, time_t t
);
261 const char *time_to_asc(const time_t t
);
262 const char *display_time(NTTIME nttime
);
263 bool nt_time_is_set(const NTTIME
*nt
);
265 /* The following definitions come from lib/username.c */
267 void flush_pwnam_cache(void);
268 char *get_user_home_dir(TALLOC_CTX
*mem_ctx
, const char *user
);
269 struct passwd
*Get_Pwnam_alloc(TALLOC_CTX
*mem_ctx
, const char *user
);
271 /* The following definitions come from lib/util_names.c */
272 const char *get_global_sam_name(void);
273 const char *my_sam_name(void);
274 bool is_allowed_domain(const char *domain_name
);
276 /* The following definitions come from lib/util.c */
278 void set_Protocol(enum protocol_types p
);
279 void gfree_all( void );
280 bool file_exist_stat(const char *fname
,SMB_STRUCT_STAT
*sbuf
,
281 bool fake_dir_create_times
);
282 bool socket_exist(const char *fname
);
283 uint64_t get_file_size_stat(const SMB_STRUCT_STAT
*sbuf
);
284 bool check_same_dev_ino(const SMB_STRUCT_STAT
*sbuf1
,
285 const SMB_STRUCT_STAT
*sbuf2
);
286 bool check_same_stat(const SMB_STRUCT_STAT
*sbuf1
,
287 const SMB_STRUCT_STAT
*sbuf2
);
288 void show_msg(const char *buf
);
289 int set_message_bcc(char *buf
,int num_bytes
);
290 ssize_t
message_push_blob(uint8_t **outbuf
, DATA_BLOB blob
);
291 char *unix_clean_name(TALLOC_CTX
*ctx
, const char *s
);
292 char *clean_name(TALLOC_CTX
*ctx
, const char *s
);
293 ssize_t
write_data_at_offset(int fd
, const char *buffer
, size_t N
, off_t pos
);
294 NTSTATUS
init_before_fork(void);
295 int parent_watch_fd(void);
296 NTSTATUS
reinit_after_fork(struct messaging_context
*msg_ctx
,
297 struct tevent_context
*ev_ctx
,
298 bool parent_longlived
);
299 NTSTATUS
smbd_reinit_after_fork(struct messaging_context
*msg_ctx
,
300 struct tevent_context
*ev_ctx
,
301 bool parent_longlived
);
302 void *malloc_(size_t size
);
303 void *Realloc(void *p
, size_t size
, bool free_old_on_error
);
304 void add_to_large_array(TALLOC_CTX
*mem_ctx
, size_t element_size
,
305 void *element
, void *_array
, uint32_t *num_elements
,
306 ssize_t
*array_size
);
307 char *get_myname(TALLOC_CTX
*ctx
);
308 char *get_mydnsdomname(TALLOC_CTX
*ctx
);
309 char *automount_lookup(TALLOC_CTX
*ctx
, const char *user_name
);
310 char *automount_lookup(TALLOC_CTX
*ctx
, const char *user_name
);
311 bool process_exists(const struct server_id pid
);
312 const char *uidtoname(uid_t uid
);
313 char *gidtoname(gid_t gid
);
314 uid_t
nametouid(const char *name
);
315 gid_t
nametogid(const char *name
);
316 void smb_panic_s3(const char *why
);
317 void log_panic_action(const char *msg
);
318 const char *readdirname(DIR *p
);
319 bool is_in_path(const char *name
,
320 struct name_compare_entry
*namelist
,
321 bool case_sensitive
);
322 bool token_contains_name(TALLOC_CTX
*mem_ctx
,
323 const char *username
,
325 const char *sharename
,
326 const struct security_token
*token
,
329 bool append_to_namearray(TALLOC_CTX
*mem_ctx
,
330 const char *namelist_in
,
331 struct name_compare_entry
**_name_array
);
332 bool set_namearray(TALLOC_CTX
*mem_ctx
,
333 const char *namelist
,
334 struct name_compare_entry
**_name_array
);
335 bool fcntl_lock(int fd
, int op
, off_t offset
, off_t count
, int type
);
336 bool fcntl_getlock(int fd
, int op
, off_t
*poffset
, off_t
*pcount
, int *ptype
, pid_t
*ppid
);
337 int map_process_lock_to_ofd_lock(int op
);
338 bool is_myname(const char *s
);
339 void ra_lanman_string( const char *native_lanman
);
340 const char *get_remote_arch_str(void);
341 enum remote_arch_types
get_remote_arch_from_str(const char *remote_arch_string
);
342 void set_remote_arch(enum remote_arch_types type
);
343 enum remote_arch_types
get_remote_arch(void);
344 bool remote_arch_cache_update(const struct GUID
*client_guid
);
345 bool remote_arch_cache_delete(const struct GUID
*client_guid
);
346 int str_checksum(const char *s
);
347 void zero_free(void *p
, size_t size
);
348 int set_maxfiles(int requested_max
);
349 void *smb_xmalloc_array(size_t size
, unsigned int count
);
350 char *myhostname(void);
351 char *myhostname_upper(void);
352 #include "lib/util_path.h"
353 bool parent_dirname(TALLOC_CTX
*mem_ctx
, const char *dir
, char **parent
,
355 bool ms_has_wild(const char *s
);
356 bool ms_has_wild_w(const smb_ucs2_t
*s
);
357 bool mask_match(const char *string
, const char *pattern
, bool is_case_sensitive
);
358 bool mask_match_list(const char *string
, char **list
, int listLen
, bool is_case_sensitive
);
359 #include "lib/util/unix_match.h"
361 #include "lib/util_procid.h"
363 struct server_id
interpret_pid(const char *pid_string
);
364 bool is_offset_safe(const char *buf_base
, size_t buf_len
, char *ptr
, size_t off
);
365 char *get_safe_str_ptr(const char *buf_base
, size_t buf_len
, char *ptr
, size_t off
);
366 bool split_domain_user(TALLOC_CTX
*mem_ctx
,
367 const char *full_name
,
370 const char *strip_hostname(const char *s
);
371 bool any_nt_status_not_ok(NTSTATUS err1
, NTSTATUS err2
, NTSTATUS
*result
);
372 int timeval_to_msec(struct timeval t
);
373 char *valid_share_pathname(TALLOC_CTX
*ctx
, const char *dos_pathname
);
374 bool is_executable(const char *fname
);
375 bool map_open_params_to_ntcreate(const char *smb_base_fname
,
376 int deny_mode
, int open_func
,
377 uint32_t *paccess_mask
,
378 uint32_t *pshare_mode
,
379 uint32_t *pcreate_disposition
,
380 uint32_t *pcreate_options
,
381 uint32_t *pprivate_flags
);
382 struct security_unix_token
*copy_unix_token(TALLOC_CTX
*ctx
, const struct security_unix_token
*tok
);
383 struct security_unix_token
*root_unix_token(TALLOC_CTX
*mem_ctx
);
384 char *utok_string(TALLOC_CTX
*mem_ctx
, const struct security_unix_token
*tok
);
385 bool dir_check_ftype(uint32_t mode
, uint32_t dirtype
);
387 /* The following definitions come from lib/util_builtin.c */
389 bool lookup_builtin_rid(TALLOC_CTX
*mem_ctx
, uint32_t rid
, const char **name
);
390 bool lookup_builtin_name(const char *name
, uint32_t *rid
);
391 const char *builtin_domain_name(void);
392 bool sid_check_is_builtin(const struct dom_sid
*sid
);
393 bool sid_check_is_in_builtin(const struct dom_sid
*sid
);
394 bool sid_check_is_wellknown_builtin(const struct dom_sid
*sid
);
396 /* The following definitions come from lib/util_nscd.c */
398 void smb_nscd_flush_user_cache(void);
399 void smb_nscd_flush_group_cache(void);
401 /* The following definitions come from lib/util_nttoken.c */
403 NTSTATUS
merge_with_system_token(TALLOC_CTX
*mem_ctx
,
404 const struct security_token
*token_1
,
405 struct security_token
**token_out
);
406 bool token_sid_in_ace(const struct security_token
*token
, const struct security_ace
*ace
);
408 /* The following definitions come from lib/util_sec.c */
411 uid_t
sec_initial_uid(void);
412 gid_t
sec_initial_gid(void);
413 bool root_mode(void);
414 bool non_root_mode(void);
415 void gain_root_privilege(void);
416 void gain_root_group_privilege(void);
417 void set_effective_uid(uid_t uid
);
418 void set_effective_gid(gid_t gid
);
419 void save_re_uid(void);
420 void restore_re_uid_fromroot(void);
421 void restore_re_uid(void);
422 void save_re_gid(void);
423 void restore_re_gid(void);
424 int set_re_uid(void);
425 void become_user_permanently(uid_t uid
, gid_t gid
);
426 int set_thread_credentials(uid_t uid
,
429 const gid_t
*gidset
);
430 bool is_setuid_root(void) ;
432 /* The following definitions come from lib/util_sid.c */
434 char *sid_to_fstring(fstring sidstr_out
, const struct dom_sid
*sid
);
435 bool sid_linearize(uint8_t *outbuf
, size_t len
, const struct dom_sid
*sid
);
436 bool non_mappable_sid(struct dom_sid
*sid
);
437 char *sid_binstring_hex_talloc(TALLOC_CTX
*mem_ctx
, const struct dom_sid
*sid
);
438 struct netr_SamInfo3
;
439 NTSTATUS
sid_array_from_info3(TALLOC_CTX
*mem_ctx
,
440 const struct netr_SamInfo3
*info3
,
441 struct dom_sid
**user_sids
,
442 uint32_t *num_user_sids
,
443 bool include_user_group_rid
);
444 bool security_token_find_npa_flags(const struct security_token
*token
,
446 void security_token_del_npa_flags(struct security_token
*token
);
448 /* The following definitions come from lib/util_sock.c */
450 bool is_broadcast_addr(const struct sockaddr
*pss
);
451 bool is_loopback_ip_v4(struct in_addr ip
);
452 bool is_loopback_addr(const struct sockaddr
*pss
);
453 bool is_zero_addr(const struct sockaddr_storage
*pss
);
454 void zero_ip_v4(struct in_addr
*ip
);
455 void in_addr_to_sockaddr_storage(struct sockaddr_storage
*ss
,
457 bool same_net(const struct sockaddr
*ip1
,
458 const struct sockaddr
*ip2
,
459 const struct sockaddr
*mask
);
460 bool sockaddr_equal(const struct sockaddr
*ip1
,
461 const struct sockaddr
*ip2
);
462 bool is_address_any(const struct sockaddr
*psa
);
463 uint16_t get_sockaddr_port(const struct sockaddr_storage
*pss
);
464 char *print_sockaddr(char *dest
,
466 const struct sockaddr_storage
*psa
);
467 char *print_canonical_sockaddr(TALLOC_CTX
*ctx
,
468 const struct sockaddr_storage
*pss
);
469 bool is_a_socket(int fd
);
470 void set_socket_options(int fd
, const char *options
);
471 NTSTATUS
read_fd_with_timeout(int fd
, char *buf
,
472 size_t mincnt
, size_t maxcnt
,
473 unsigned int time_out
,
475 NTSTATUS
read_data_ntstatus(int fd
, char *buffer
, size_t N
);
477 NTSTATUS
read_smb_length_return_keepalive(int fd
, char *inbuf
,
478 unsigned int timeout
,
480 NTSTATUS
receive_smb_raw(int fd
,
483 unsigned int timeout
,
488 const struct sockaddr_storage
*paddr
,
491 NTSTATUS
open_socket_out(const struct sockaddr_storage
*pss
, uint16_t port
,
492 int timeout
, int *pfd
);
493 struct tevent_req
*open_socket_out_send(TALLOC_CTX
*mem_ctx
,
494 struct tevent_context
*ev
,
495 const struct sockaddr_storage
*pss
,
498 NTSTATUS
open_socket_out_recv(struct tevent_req
*req
, int *pfd
);
499 struct tevent_req
*open_socket_out_defer_send(TALLOC_CTX
*mem_ctx
,
500 struct tevent_context
*ev
,
501 struct timeval wait_time
,
502 const struct sockaddr_storage
*pss
,
505 NTSTATUS
open_socket_out_defer_recv(struct tevent_req
*req
, int *pfd
);
506 const char *get_peer_addr(int fd
, char *addr
, size_t addr_len
);
508 struct tsocket_address
;
510 int get_remote_hostname(const struct tsocket_address
*remote_address
,
512 TALLOC_CTX
*mem_ctx
);
514 int create_pipe_sock(const char *socket_dir
,
515 const char *socket_name
,
517 const char *get_mydnsfullname(void);
518 bool is_myname_or_ipaddr(const char *s
);
519 int poll_one_fd(int fd
, int events
, int timeout
, int *revents
);
520 int poll_intr_one_fd(int fd
, int events
, int timeout
, int *revents
);
522 /* The following definitions come from lib/util_str.c */
524 bool next_token(const char **ptr
, char *buff
, const char *sep
, size_t bufsize
);
525 bool strnequal(const char *s1
,const char *s2
,size_t n
);
526 bool strcsequal(const char *s1
,const char *s2
);
527 char *skip_string(const char *base
, size_t len
, char *buf
);
528 size_t str_charnum(const char *s
);
529 bool trim_char(char *s
,char cfront
,char cback
);
530 bool strhasupper(const char *s
);
531 bool strhaslower(const char *s
);
532 bool in_list(const char *s
, const char *list
, bool casesensitive
);
533 char *realloc_string_sub2(char *string
,
536 bool remove_unsafe_characters
,
537 bool allow_trailing_dollar
);
538 char *realloc_string_sub(char *string
,
541 void all_string_sub(char *s
,const char *pattern
,const char *insert
, size_t len
);
542 char *string_truncate(char *s
, unsigned int length
);
543 bool strlower_m(char *s
);
544 bool strupper_m(char *s
);
545 int fstr_sprintf(fstring s
, const char *fmt
, ...);
547 uint64_t STR_TO_SMB_BIG_UINT(const char *nptr
, const char **entptr
);
548 uint64_t conv_str_size(const char * str
);
549 char *talloc_asprintf_strupper_m(TALLOC_CTX
*t
, const char *fmt
, ...)
550 PRINTF_ATTRIBUTE(2,3);
551 char *talloc_asprintf_strlower_m(TALLOC_CTX
*t
, const char *fmt
, ...)
552 PRINTF_ATTRIBUTE(2,3);
553 bool validate_net_name( const char *name
,
554 const char *invalid_chars
,
556 char *escape_shell_string(const char *src
);
557 ssize_t
full_path_tos(const char *dir
, const char *name
,
558 char *tmpbuf
, size_t tmpbuf_len
,
559 char **pdst
, char **to_free
);
561 /* The following definitions come from lib/version.c */
563 const char *samba_version_string(void);
564 const char *samba_copyright_string(void);
566 /* The following definitions come from lib/wins_srv.c */
568 bool wins_srv_is_dead(struct in_addr wins_ip
, struct in_addr src_ip
);
569 void wins_srv_alive(struct in_addr wins_ip
, struct in_addr src_ip
);
570 void wins_srv_died(struct in_addr wins_ip
, struct in_addr src_ip
);
571 unsigned wins_srv_count(void);
572 char **wins_srv_tags(void);
573 void wins_srv_tags_free(char **list
);
574 struct in_addr
wins_srv_ip_tag(const char *tag
, struct in_addr src_ip
);
575 bool wins_server_tag_ips(const char *tag
, TALLOC_CTX
*mem_ctx
,
576 struct in_addr
**pservers
, size_t *pnum_servers
);
577 unsigned wins_srv_count_tag(const char *tag
);
579 /* The following definitions come from libsmb/conncache.c */
581 NTSTATUS
check_negative_conn_cache( const char *domain
, const char *server
);
582 void add_failed_connection_entry(const char *domain
, const char *server
, NTSTATUS result
) ;
583 void flush_negative_conn_cache_for_domain(const char *domain
);
585 /* The following definitions come from libsmb/errormap.c */
587 NTSTATUS
dos_to_ntstatus(uint8_t eclass
, uint32_t ecode
);
588 NTSTATUS
map_nt_error_from_wbcErr(wbcErr wbc_err
);
590 /* The following definitions come from libsmb/namecache.c */
592 bool namecache_store(const char *name
,
595 struct samba_sockaddr
*sa_list
);
596 bool namecache_fetch(TALLOC_CTX
*ctx
,
599 struct samba_sockaddr
**sa_list
,
601 bool namecache_delete(const char *name
, int name_type
);
602 void namecache_flush(void);
603 bool namecache_status_store(const char *keyname
, int keyname_type
,
604 int name_type
, const struct sockaddr_storage
*keyip
,
605 const char *srvname
);
606 bool namecache_status_fetch(const char *keyname
,
609 const struct sockaddr_storage
*keyip
,
612 /* The following definitions come from libsmb/namequery_dc.c */
614 bool get_dc_name(const char *domain
,
617 struct sockaddr_storage
*ss_out
);
619 /* The following definitions come from libsmb/smberr.c */
621 const char *smb_dos_err_name(uint8_t e_class
, uint16_t num
);
622 const char *get_dos_error_msg(WERROR result
);
623 const char *smb_dos_err_class(uint8_t e_class
);
624 WERROR
map_werror_from_unix(int error
);
626 /* The following definitions come from libsmb/trusts_util.c */
628 struct netlogon_creds_cli_context
;
629 struct messaging_context
;
630 struct dcerpc_binding_handle
;
631 char *trust_pw_new_value(TALLOC_CTX
*mem_ctx
,
632 enum netr_SchannelType sec_channel_type
,
634 NTSTATUS
trust_pw_change(struct netlogon_creds_cli_context
*context
,
635 struct messaging_context
*msg_ctx
,
636 struct dcerpc_binding_handle
*b
,
641 /* The following definitions come from lib/sessionid_tdb.c */
643 NTSTATUS
sessionid_traverse_read(int (*fn
)(const char *key
,
644 struct sessionid
*session
,
648 /* The following definitions come from lib/avahi.c */
650 struct AvahiPoll
*tevent_avahi_poll(TALLOC_CTX
*mem_ctx
,
651 struct tevent_context
*ev
);
653 /* The following definitions come from libsmb/smbsock_connect.c */
655 struct tevent_req
*smbsock_connect_send(TALLOC_CTX
*mem_ctx
,
656 struct tevent_context
*ev
,
657 const struct sockaddr_storage
*addr
,
659 const char *called_name
,
661 const char *calling_name
,
663 NTSTATUS
smbsock_connect_recv(struct tevent_req
*req
, int *sock
,
665 NTSTATUS
smbsock_connect(const struct sockaddr_storage
*addr
, uint16_t port
,
666 const char *called_name
, int called_type
,
667 const char *calling_name
, int calling_type
,
668 int *pfd
, uint16_t *ret_port
, int sec_timeout
);
670 struct tevent_req
*smbsock_any_connect_send(TALLOC_CTX
*mem_ctx
,
671 struct tevent_context
*ev
,
672 const struct sockaddr_storage
*addrs
,
673 const char **called_names
,
675 const char **calling_names
,
677 size_t num_addrs
, uint16_t port
);
678 NTSTATUS
smbsock_any_connect_recv(struct tevent_req
*req
, int *pfd
,
679 size_t *chosen_index
, uint16_t *chosen_port
);
680 NTSTATUS
smbsock_any_connect(const struct sockaddr_storage
*addrs
,
681 const char **called_names
,
683 const char **calling_names
,
688 int *pfd
, size_t *chosen_index
,
689 uint16_t *chosen_port
);
691 /* The following definitions come from lib/util_wellknown.c */
693 bool sid_check_is_wellknown_domain(const struct dom_sid
*sid
, const char **name
);
694 bool sid_check_is_in_wellknown_domain(const struct dom_sid
*sid
);
695 bool lookup_wellknown_sid(TALLOC_CTX
*mem_ctx
, const struct dom_sid
*sid
,
696 const char **domain
, const char **name
);
697 bool lookup_wellknown_name(TALLOC_CTX
*mem_ctx
, const char *name
,
698 struct dom_sid
*sid
, const char **domain
);
700 /* The following definitions come from lib/filename_util.c */
702 NTSTATUS
get_full_smb_filename(TALLOC_CTX
*ctx
, const struct smb_filename
*smb_fname
,
704 struct smb_filename
*synthetic_smb_fname(TALLOC_CTX
*mem_ctx
,
705 const char *base_name
,
706 const char *stream_name
,
707 const SMB_STRUCT_STAT
*psbuf
,
710 NTSTATUS
safe_symlink_target_path(TALLOC_CTX
*mem_ctx
,
711 const char *connectpath
,
716 NTSTATUS
filename_convert_dirfsp_rel(TALLOC_CTX
*mem_ctx
,
717 connection_struct
*conn
,
718 struct files_struct
*basedir
,
722 struct files_struct
**_dirfsp
,
723 struct smb_filename
**_smb_fname
,
724 struct smb_filename
**_smb_fname_rel
);
725 NTSTATUS
filename_convert_dirfsp(
727 connection_struct
*conn
,
731 struct files_struct
**pdirfsp
,
732 struct smb_filename
**psmb_name_rel
);
733 char *full_path_from_dirfsp_at_basename(TALLOC_CTX
*mem_ctx
,
734 const struct files_struct
*dirfsp
,
735 const char *at_base_name
);
736 struct smb_filename
*full_path_from_dirfsp_atname(
738 const struct files_struct
*dirfsp
,
739 const struct smb_filename
*atname
);
740 struct smb_filename
*synthetic_smb_fname_split(TALLOC_CTX
*ctx
,
743 const char *smb_fname_str_dbg(const struct smb_filename
*smb_fname
);
744 const char *fsp_str_dbg(const struct files_struct
*fsp
);
745 const char *fsp_fnum_dbg(const struct files_struct
*fsp
);
746 struct smb_filename
*cp_smb_filename(TALLOC_CTX
*mem_ctx
,
747 const struct smb_filename
*in
);
748 struct smb_filename
*cp_smb_filename_nostream(TALLOC_CTX
*mem_ctx
,
749 const struct smb_filename
*in
);
750 bool is_ntfs_stream_smb_fname(const struct smb_filename
*smb_fname
);
751 bool is_ntfs_default_stream_smb_fname(const struct smb_filename
*smb_fname
);
752 bool is_named_stream(const struct smb_filename
*smb_fname
);
753 bool is_invalid_windows_ea_name(const char *name
);
754 bool ea_list_has_invalid_name(struct ea_list
*ea_list
);
755 bool split_stream_filename(TALLOC_CTX
*ctx
,
756 const char *filename_in
,
758 char **streamname_out
);
760 /* The following definitions come from lib/dummyroot.c */
762 void become_root(void);
763 void unbecome_root(void);
765 /* The following definitions come from lib/smbd_shim.c */
767 int find_service(TALLOC_CTX
*ctx
, const char *service_in
, char **p_service_out
);
768 bool lp_allow_local_address(
769 int snum
, const struct tsocket_address
*local_address
);
770 bool change_to_root_user(void);
771 bool become_authenticated_pipe_user(struct auth_session_info
*session_info
);
772 bool unbecome_authenticated_pipe_user(void);
774 void contend_level2_oplocks_begin(files_struct
*fsp
,
775 enum level2_contention_type type
);
776 void contend_level2_oplocks_end(files_struct
*fsp
,
777 enum level2_contention_type type
);
779 /* The following definitions come from lib/per_thread_cwd.c */
781 void per_thread_cwd_check(void);
782 bool per_thread_cwd_supported(void);
783 void per_thread_cwd_disable(void);
784 void per_thread_cwd_activate(void);
786 #endif /* _PROTO_H_ */