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 /* The following definitions come from lib/access.c */
28 bool client_match(const char *tok, const void *item);
29 bool list_match(const char **list,const void *item,
30 bool (*match_fn)(const char *, const void *));
31 bool allow_access(const char **deny_list,
32 const char **allow_list,
36 /* The following definitions come from lib/adt_tree.c */
39 /* The following definitions come from lib/afs.c */
41 char *afs_createtoken_str(const char *username, const char *cell);
42 bool afs_login(connection_struct *conn);
43 bool afs_login(connection_struct *conn);
44 char *afs_createtoken_str(const char *username, const char *cell);
46 /* The following definitions come from lib/afs_settoken.c */
48 int afs_syscall( int subcall,
53 bool afs_settoken_str(const char *token_string);
54 bool afs_settoken_str(const char *token_string);
56 /* The following definitions come from lib/audit.c */
58 const char *audit_category_str(uint32 category);
59 const char *audit_param_str(uint32 category);
60 const char *audit_description_str(uint32 category);
61 bool get_audit_category_from_param(const char *param, uint32 *audit_category);
62 const char *audit_policy_str(TALLOC_CTX *mem_ctx, uint32 policy);
64 /* The following definitions come from lib/bitmap.c */
66 struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n);
67 int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src);
68 bool bitmap_set(struct bitmap *bm, unsigned i);
69 bool bitmap_clear(struct bitmap *bm, unsigned i);
70 bool bitmap_query(struct bitmap *bm, unsigned i);
71 int bitmap_find(struct bitmap *bm, unsigned ofs);
73 /* The following definitions come from lib/charcnv.c */
75 void lazy_initialize_conv(void);
76 void gfree_charcnv(void);
77 void init_iconv(void);
78 bool convert_string(charset_t from, charset_t to,
79 void const *src, size_t srclen,
80 void *dest, size_t destlen,
81 size_t *converted_size);
82 bool convert_string_error(charset_t from, charset_t to,
83 void const *src, size_t srclen,
84 void *dest, size_t destlen,
85 size_t *converted_size);
86 bool unix_strupper(const char *src, size_t srclen, char *dest, size_t destlen);
87 char *talloc_strdup_upper(TALLOC_CTX *ctx, const char *s);
88 char *strupper_talloc(TALLOC_CTX *ctx, const char *s);
89 bool unix_strlower(const char *src, size_t srclen, char *dest, size_t destlen);
90 char *talloc_strdup_lower(TALLOC_CTX *ctx, const char *s);
91 char *strlower_talloc(TALLOC_CTX *ctx, const char *s);
92 size_t ucs2_align(const void *base_ptr, const void *p, int flags);
93 size_t push_ascii(void *dest, const char *src, size_t dest_len, int flags);
94 size_t push_ascii_fstring(void *dest, const char *src);
95 size_t push_ascii_nstring(void *dest, const char *src);
96 size_t pull_ascii(char *dest, const void *src, size_t dest_len, size_t src_len, int flags);
97 size_t pull_ascii_fstring(char *dest, const void *src);
98 size_t pull_ascii_nstring(char *dest, size_t dest_len, const void *src);
99 size_t push_ucs2(const void *base_ptr, void *dest, const char *src, size_t dest_len, int flags);
100 bool push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
101 size_t *converted_size);
102 bool push_ucs2_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src,
103 size_t *converted_size);
104 bool pull_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
105 size_t *converted_size);
106 bool pull_ucs2_talloc(TALLOC_CTX *ctx, char **dest, const smb_ucs2_t *src,
107 size_t *converted_size);
108 bool pull_ascii_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
109 size_t *converted_size);
110 size_t push_string_check_fn(void *dest, const char *src,
111 size_t dest_len, int flags);
112 size_t push_string_base(const char *base, uint16 flags2,
113 void *dest, const char *src,
114 size_t dest_len, int flags);
115 size_t pull_string_fn(const void *base_ptr,
122 size_t pull_string_talloc(TALLOC_CTX *ctx,
123 const void *base_ptr,
129 size_t align_string(const void *base_ptr, const char *p, int flags);
130 size_t dos_PutUniCode(char *dst,const char *src, size_t len, bool null_terminate);
131 int rpcstr_push(void *dest, const char *src, size_t dest_len, int flags);
132 int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src);
134 /* The following definitions come from lib/conn_tdb.c */
136 struct db_record *connections_fetch_entry(TALLOC_CTX *mem_ctx,
137 connection_struct *conn,
139 int connections_traverse(int (*fn)(struct db_record *rec,
142 int connections_forall(int (*fn)(struct db_record *rec,
143 const struct connections_key *key,
144 const struct connections_data *data,
147 int connections_forall_read(int (*fn)(const struct connections_key *key,
148 const struct connections_data *data,
151 bool connections_init(bool rw);
153 /* The following definitions come from lib/dmallocmsg.c */
155 void register_dmalloc_msgs(struct messaging_context *msg_ctx);
157 /* The following definitions come from lib/dprintf.c */
159 void display_set_stderr(void);
161 /* The following definitions come from lib/errmap_unix.c */
163 NTSTATUS map_nt_error_from_unix(int unix_error);
164 int map_errno_from_nt_status(NTSTATUS status);
166 /* The following definitions come from lib/file_id.c */
168 struct file_id vfs_file_id_from_sbuf(connection_struct *conn, const SMB_STRUCT_STAT *sbuf);
169 bool file_id_equal(const struct file_id *id1, const struct file_id *id2);
170 const char *file_id_string_tos(const struct file_id *id);
171 void push_file_id_16(char *buf, const struct file_id *id);
172 void push_file_id_24(char *buf, const struct file_id *id);
173 void pull_file_id_24(char *buf, struct file_id *id);
175 /* The following definitions come from lib/gencache.c */
177 bool gencache_set(const char *keystr, const char *value, time_t timeout);
178 bool gencache_del(const char *keystr);
179 bool gencache_get(const char *keystr, char **valstr, time_t *timeout);
180 bool gencache_parse(const char *keystr,
181 void (*parser)(time_t timeout, DATA_BLOB blob,
184 bool gencache_get_data_blob(const char *keystr, DATA_BLOB *blob,
185 time_t *timeout, bool *was_expired);
186 bool gencache_stabilize(void);
187 bool gencache_set_data_blob(const char *keystr, const DATA_BLOB *blob, time_t timeout);
188 void gencache_iterate_blobs(void (*fn)(const char *key, DATA_BLOB value,
189 time_t timeout, void *private_data),
190 void *private_data, const char *pattern);
191 void gencache_iterate(void (*fn)(const char* key, const char *value, time_t timeout, void* dptr),
192 void* data, const char* keystr_pattern);
194 /* The following definitions come from lib/interface.c */
196 bool ismyaddr(const struct sockaddr *ip);
197 bool ismyip_v4(struct in_addr ip);
198 bool is_local_net(const struct sockaddr *from);
199 void setup_linklocal_scope_id(struct sockaddr *pss);
200 bool is_local_net_v4(struct in_addr from);
201 int iface_count(void);
202 int iface_count_v4_nl(void);
203 const struct in_addr *first_ipv4_iface(void);
204 struct interface *get_interface(int n);
205 const struct sockaddr_storage *iface_n_sockaddr_storage(int n);
206 const struct in_addr *iface_n_ip_v4(int n);
207 const struct in_addr *iface_n_bcast_v4(int n);
208 const struct sockaddr_storage *iface_n_bcast(int n);
209 const struct sockaddr_storage *iface_ip(const struct sockaddr *ip);
210 bool iface_local(const struct sockaddr *ip);
211 void load_interfaces(void);
212 void gfree_interfaces(void);
213 bool interfaces_changed(void);
215 /* The following definitions come from lib/ldap_debug_handler.c */
217 void init_ldap_debugging(void);
219 /* The following definitions come from lib/ldap_escape.c */
221 char *escape_ldap_string(TALLOC_CTX *mem_ctx, const char *s);
222 char *escape_rdn_val_string_alloc(const char *s);
224 /* The following definitions come from lib/module.c */
226 NTSTATUS smb_load_module(const char *module_name);
227 int smb_load_modules(const char **modules);
228 NTSTATUS smb_probe_module(const char *subsystem, const char *module);
229 NTSTATUS smb_load_module(const char *module_name);
230 int smb_load_modules(const char **modules);
231 NTSTATUS smb_probe_module(const char *subsystem, const char *module);
232 void init_modules(void);
234 /* The following definitions come from lib/ms_fnmatch.c */
236 int ms_fnmatch(const char *pattern, const char *string, bool translate_pattern,
237 bool is_case_sensitive);
238 int gen_fnmatch(const char *pattern, const char *string);
240 /* The following definitions come from lib/pidfile.c */
242 pid_t pidfile_pid(const char *name);
243 void pidfile_create(const char *program_name);
244 void pidfile_unlink(void);
246 /* The following definitions come from lib/recvfile.c */
248 ssize_t sys_recvfile(int fromfd,
252 ssize_t sys_recvfile(int fromfd,
256 ssize_t drain_socket(int sockfd, size_t count);
258 /* The following definitions come from lib/secdesc.c */
260 uint32_t get_sec_info(const struct security_descriptor *sd);
261 struct security_descriptor *sec_desc_merge(TALLOC_CTX *ctx, struct security_descriptor *new_sdb, struct security_descriptor *old_sdb);
262 struct sec_desc_buf *sec_desc_merge_buf(TALLOC_CTX *ctx, struct sec_desc_buf *new_sdb, struct sec_desc_buf *old_sdb);
263 struct security_descriptor *make_sec_desc(TALLOC_CTX *ctx,
264 enum security_descriptor_revision revision,
266 const struct dom_sid *owner_sid, const struct dom_sid *grp_sid,
267 struct security_acl *sacl, struct security_acl *dacl, size_t *sd_size);
268 struct security_descriptor *dup_sec_desc(TALLOC_CTX *ctx, const struct security_descriptor *src);
269 NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx,
270 struct security_descriptor *secdesc,
271 uint8 **data, size_t *len);
272 NTSTATUS marshall_sec_desc_buf(TALLOC_CTX *mem_ctx,
273 struct sec_desc_buf *secdesc_buf,
274 uint8_t **data, size_t *len);
275 NTSTATUS unmarshall_sec_desc(TALLOC_CTX *mem_ctx, uint8 *data, size_t len,
276 struct security_descriptor **psecdesc);
277 NTSTATUS unmarshall_sec_desc_buf(TALLOC_CTX *mem_ctx, uint8_t *data, size_t len,
278 struct sec_desc_buf **psecdesc_buf);
279 struct security_descriptor *make_standard_sec_desc(TALLOC_CTX *ctx, const struct dom_sid *owner_sid, const struct dom_sid *grp_sid,
280 struct security_acl *dacl, size_t *sd_size);
281 struct sec_desc_buf *make_sec_desc_buf(TALLOC_CTX *ctx, size_t len, struct security_descriptor *sec_desc);
282 struct sec_desc_buf *dup_sec_desc_buf(TALLOC_CTX *ctx, struct sec_desc_buf *src);
283 NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, struct security_descriptor **psd, const struct dom_sid *sid, uint32 mask, size_t *sd_size);
284 NTSTATUS sec_desc_mod_sid(struct security_descriptor *sd, struct dom_sid *sid, uint32 mask);
285 NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, struct security_descriptor **psd, struct dom_sid *sid, size_t *sd_size);
286 bool sd_has_inheritable_components(const struct security_descriptor *parent_ctr, bool container);
287 NTSTATUS se_create_child_secdesc(TALLOC_CTX *ctx,
288 struct security_descriptor **ppsd,
290 const struct security_descriptor *parent_ctr,
291 const struct dom_sid *owner_sid,
292 const struct dom_sid *group_sid,
294 NTSTATUS se_create_child_secdesc_buf(TALLOC_CTX *ctx,
295 struct sec_desc_buf **ppsdb,
296 const struct security_descriptor *parent_ctr,
299 /* The following definitions come from lib/sendfile.c */
301 ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
303 /* The following definitions come from lib/server_mutex.c */
305 struct named_mutex *grab_named_mutex(TALLOC_CTX *mem_ctx, const char *name,
308 /* The following definitions come from lib/sharesec.c */
310 bool share_info_db_init(void);
311 struct security_descriptor *get_share_security_default( TALLOC_CTX *ctx, size_t *psize, uint32 def_access);
312 struct security_descriptor *get_share_security( TALLOC_CTX *ctx, const char *servicename,
314 bool set_share_security(const char *share_name, struct security_descriptor *psd);
315 bool delete_share_security(const char *servicename);
316 bool share_access_check(const struct security_token *token, const char *sharename,
317 uint32 desired_access);
318 bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, struct security_descriptor **ppsd);
320 /* The following definitions come from lib/smbrun.c */
322 int smbrun_no_sanitize(const char *cmd, int *outfd);
323 int smbrun(const char *cmd, int *outfd);
324 int smbrunsecret(const char *cmd, const char *secret);
326 /* The following definitions come from lib/sock_exec.c */
328 int sock_exec(const char *prog);
330 /* The following definitions come from lib/substitute.c */
332 void free_local_machine_name(void);
333 bool set_local_machine_name(const char *local_name, bool perm);
334 const char *get_local_machine_name(void);
335 bool set_remote_machine_name(const char *remote_name, bool perm);
336 const char *get_remote_machine_name(void);
337 void sub_set_smb_name(const char *name);
338 void set_current_user_info(const char *smb_name, const char *unix_name,
340 void sub_set_socket_ids(const char *peeraddr, const char *peername,
341 const char *sockaddr);
342 const char *get_current_username(void);
343 void standard_sub_basic(const char *smb_name, const char *domain_name,
344 char *str, size_t len);
345 char *talloc_sub_basic(TALLOC_CTX *mem_ctx, const char *smb_name,
346 const char *domain_name, const char *str);
347 char *talloc_sub_specified(TALLOC_CTX *mem_ctx,
348 const char *input_string,
349 const char *username,
353 char *talloc_sub_advanced(TALLOC_CTX *mem_ctx,
354 const char *servicename, const char *user,
355 const char *connectpath, gid_t gid,
356 const char *smb_name, const char *domain_name,
358 void standard_sub_advanced(const char *servicename, const char *user,
359 const char *connectpath, gid_t gid,
360 const char *smb_name, const char *domain_name,
361 char *str, size_t len);
362 char *standard_sub_conn(TALLOC_CTX *ctx, connection_struct *conn, const char *str);
364 /* The following definitions come from lib/sysacls.c */
366 int sys_acl_get_entry(SMB_ACL_T acl_d, int entry_id, SMB_ACL_ENTRY_T *entry_p);
367 int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *type_p);
368 int sys_acl_get_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
369 void *sys_acl_get_qualifier(SMB_ACL_ENTRY_T entry_d);
370 int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset_d);
371 int sys_acl_add_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
372 int sys_acl_get_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
373 char *sys_acl_to_text(SMB_ACL_T acl_d, ssize_t *len_p);
374 SMB_ACL_T sys_acl_init(int count);
375 int sys_acl_create_entry(SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p);
376 int sys_acl_set_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type);
377 int sys_acl_set_qualifier(SMB_ACL_ENTRY_T entry_d, void *qual_p);
378 int sys_acl_set_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d);
379 int sys_acl_free_text(char *text);
380 int sys_acl_free_acl(SMB_ACL_T acl_d) ;
381 int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype);
382 int sys_acl_valid(SMB_ACL_T acl_d);
383 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
384 const char *path_p, SMB_ACL_TYPE_T type);
385 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
386 int sys_acl_set_file(vfs_handle_struct *handle,
387 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
388 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
390 int sys_acl_delete_def_file(vfs_handle_struct *handle,
392 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
393 const char *path_p, SMB_ACL_TYPE_T type);
394 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
395 int sys_acl_set_file(vfs_handle_struct *handle,
396 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
397 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
399 int sys_acl_delete_def_file(vfs_handle_struct *handle,
401 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
402 const char *path_p, SMB_ACL_TYPE_T type);
403 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
404 int sys_acl_set_file(vfs_handle_struct *handle,
405 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
406 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
408 int sys_acl_delete_def_file(vfs_handle_struct *handle,
410 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
411 const char *path_p, SMB_ACL_TYPE_T type);
412 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
413 int sys_acl_set_file(vfs_handle_struct *handle,
414 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
415 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
417 int sys_acl_delete_def_file(vfs_handle_struct *handle,
419 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
420 const char *path_p, SMB_ACL_TYPE_T type);
421 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
422 int sys_acl_set_file(vfs_handle_struct *handle,
423 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
424 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
426 int sys_acl_delete_def_file(vfs_handle_struct *handle,
428 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
429 const char *path_p, SMB_ACL_TYPE_T type);
430 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
431 int sys_acl_set_file(vfs_handle_struct *handle,
432 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
433 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
435 int sys_acl_delete_def_file(vfs_handle_struct *handle,
437 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
438 const char *path_p, SMB_ACL_TYPE_T type);
439 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
440 int sys_acl_set_file(vfs_handle_struct *handle,
441 const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
442 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
444 int sys_acl_delete_def_file(vfs_handle_struct *handle,
446 int no_acl_syscall_error(int err);
448 /* The following definitions come from lib/sysquotas.c */
450 int sys_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
451 int sys_set_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
453 /* The following definitions come from lib/sysquotas_*.c */
455 int sys_get_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
456 int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
458 int sys_get_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
459 int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
461 int sys_get_nfs_quota(const char *path, const char *bdev,
462 enum SMB_QUOTA_TYPE qtype,
463 unid_t id, SMB_DISK_QUOTA *dp);
464 int sys_set_nfs_quota(const char *path, const char *bdev,
465 enum SMB_QUOTA_TYPE qtype,
466 unid_t id, SMB_DISK_QUOTA *dp);
468 /* The following definitions come from lib/system.c */
470 void *sys_memalign( size_t align, size_t size );
471 int sys_usleep(long usecs);
472 ssize_t sys_read(int fd, void *buf, size_t count);
473 ssize_t sys_write(int fd, const void *buf, size_t count);
474 ssize_t sys_writev(int fd, const struct iovec *iov, int iovcnt);
475 ssize_t sys_pread(int fd, void *buf, size_t count, SMB_OFF_T off);
476 ssize_t sys_pwrite(int fd, const void *buf, size_t count, SMB_OFF_T off);
477 ssize_t sys_send(int s, const void *msg, size_t len, int flags);
478 ssize_t sys_sendto(int s, const void *msg, size_t len, int flags, const struct sockaddr *to, socklen_t tolen);
479 ssize_t sys_recv(int fd, void *buf, size_t count, int flags);
480 ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen);
481 int sys_fcntl_ptr(int fd, int cmd, void *arg);
482 int sys_fcntl_long(int fd, int cmd, long arg);
483 void update_stat_ex_mtime(struct stat_ex *dst, struct timespec write_ts);
484 void update_stat_ex_create_time(struct stat_ex *dst, struct timespec create_time);
485 int sys_stat(const char *fname, SMB_STRUCT_STAT *sbuf,
486 bool fake_dir_create_times);
487 int sys_fstat(int fd, SMB_STRUCT_STAT *sbuf,
488 bool fake_dir_create_times);
489 int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf,
490 bool fake_dir_create_times);
491 int sys_ftruncate(int fd, SMB_OFF_T offset);
492 int sys_posix_fallocate(int fd, SMB_OFF_T offset, SMB_OFF_T len);
493 int sys_fallocate(int fd, enum vfs_fallocate_mode mode, SMB_OFF_T offset, SMB_OFF_T len);
494 SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence);
495 int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence);
496 SMB_OFF_T sys_ftell(FILE *fp);
497 int sys_creat(const char *path, mode_t mode);
498 int sys_open(const char *path, int oflag, mode_t mode);
499 FILE *sys_fopen(const char *path, const char *type);
500 void kernel_flock(int fd, uint32 share_mode, uint32 access_mask);
501 SMB_STRUCT_DIR *sys_opendir(const char *name);
502 SMB_STRUCT_DIR *sys_fdopendir(int fd);
503 SMB_STRUCT_DIRENT *sys_readdir(SMB_STRUCT_DIR *dirp);
504 void sys_seekdir(SMB_STRUCT_DIR *dirp, long offset);
505 long sys_telldir(SMB_STRUCT_DIR *dirp);
506 void sys_rewinddir(SMB_STRUCT_DIR *dirp);
507 int sys_closedir(SMB_STRUCT_DIR *dirp);
508 int sys_mknod(const char *path, mode_t mode, SMB_DEV_T dev);
509 int sys_waitpid(pid_t pid,int *status,int options);
510 char *sys_getwd(char *s);
511 void set_effective_capability(enum smbd_capability capability);
512 void drop_effective_capability(enum smbd_capability capability);
513 long sys_random(void);
514 void sys_srandom(unsigned int seed);
515 int groups_max(void);
516 int sys_getgroups(int setlen, gid_t *gidset);
517 int sys_setgroups(gid_t UNUSED(primary_gid), int setlen, gid_t *gidset);
518 int sys_popen(const char *command);
519 int sys_pclose(int fd);
520 ssize_t sys_getxattr (const char *path, const char *name, void *value, size_t size);
521 ssize_t sys_lgetxattr (const char *path, const char *name, void *value, size_t size);
522 ssize_t sys_fgetxattr (int filedes, const char *name, void *value, size_t size);
523 ssize_t sys_listxattr (const char *path, char *list, size_t size);
524 ssize_t sys_llistxattr (const char *path, char *list, size_t size);
525 ssize_t sys_flistxattr (int filedes, char *list, size_t size);
526 int sys_removexattr (const char *path, const char *name);
527 int sys_lremovexattr (const char *path, const char *name);
528 int sys_fremovexattr (int filedes, const char *name);
529 int sys_setxattr (const char *path, const char *name, const void *value, size_t size, int flags);
530 int sys_lsetxattr (const char *path, const char *name, const void *value, size_t size, int flags);
531 int sys_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags);
532 uint32 unix_dev_major(SMB_DEV_T dev);
533 uint32 unix_dev_minor(SMB_DEV_T dev);
534 int sys_aio_read(SMB_STRUCT_AIOCB *aiocb);
535 int sys_aio_write(SMB_STRUCT_AIOCB *aiocb);
536 ssize_t sys_aio_return(SMB_STRUCT_AIOCB *aiocb);
537 int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb);
538 int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb);
539 int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb);
540 int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout);
541 int sys_aio_read(SMB_STRUCT_AIOCB *aiocb);
542 int sys_aio_write(SMB_STRUCT_AIOCB *aiocb);
543 ssize_t sys_aio_return(SMB_STRUCT_AIOCB *aiocb);
544 int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb);
545 int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb);
546 int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb);
547 int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout);
548 int sys_getpeereid( int s, uid_t *uid);
549 int sys_getnameinfo(const struct sockaddr *psa,
556 int sys_connect(int fd, const struct sockaddr * addr);
558 /* The following definitions come from lib/system_smbd.c */
560 bool getgroups_unix_user(TALLOC_CTX *mem_ctx, const char *user,
562 gid_t **ret_groups, uint32_t *p_ngroups);
564 /* The following definitions come from lib/tallocmsg.c */
566 void register_msg_pool_usage(struct messaging_context *msg_ctx);
568 /* The following definitions come from lib/time.c */
570 void push_dos_date(uint8_t *buf, int offset, time_t unixdate, int zone_offset);
571 void push_dos_date2(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
572 void push_dos_date3(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
573 uint32_t convert_time_t_to_uint32_t(time_t t);
574 time_t convert_uint32_t_to_time_t(uint32_t u);
575 bool nt_time_is_zero(const NTTIME *nt);
576 time_t generalized_to_unix_time(const char *str);
577 int get_server_zone_offset(void);
578 int set_server_zone_offset(time_t t);
579 char *timeval_string(TALLOC_CTX *ctx, const struct timeval *tp, bool hires);
580 char *current_timestring(TALLOC_CTX *ctx, bool hires);
581 void srv_put_dos_date(char *buf,int offset,time_t unixdate);
582 void srv_put_dos_date2(char *buf,int offset, time_t unixdate);
583 void srv_put_dos_date3(char *buf,int offset,time_t unixdate);
584 void round_timespec(enum timestamp_set_resolution res, struct timespec *ts);
585 void put_long_date_timespec(enum timestamp_set_resolution res, char *p, struct timespec ts);
586 void put_long_date(char *p, time_t t);
587 void dos_filetime_timespec(struct timespec *tsp);
588 time_t make_unix_date(const void *date_ptr, int zone_offset);
589 time_t make_unix_date2(const void *date_ptr, int zone_offset);
590 time_t make_unix_date3(const void *date_ptr, int zone_offset);
591 time_t srv_make_unix_date(const void *date_ptr);
592 time_t srv_make_unix_date2(const void *date_ptr);
593 time_t srv_make_unix_date3(const void *date_ptr);
594 struct timespec convert_time_t_to_timespec(time_t t);
595 struct timespec convert_timeval_to_timespec(const struct timeval tv);
596 struct timeval convert_timespec_to_timeval(const struct timespec ts);
597 struct timespec timespec_current(void);
598 struct timespec timespec_min(const struct timespec *ts1,
599 const struct timespec *ts2);
600 int timespec_compare(const struct timespec *ts1, const struct timespec *ts2);
601 void round_timespec_to_sec(struct timespec *ts);
602 void round_timespec_to_usec(struct timespec *ts);
603 struct timespec interpret_long_date(const char *p);
605 void get_process_uptime(struct timeval *ret_time);
606 void get_startup_time(struct timeval *ret_time);
607 time_t nt_time_to_unix_abs(const NTTIME *nt);
608 time_t uint64s_nt_time_to_unix_abs(const uint64_t *src);
609 void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts);
610 void unix_to_nt_time_abs(NTTIME *nt, time_t t);
611 const char *time_to_asc(const time_t t);
612 const char *display_time(NTTIME nttime);
613 bool nt_time_is_set(const NTTIME *nt);
615 /* The following definitions come from lib/username.c */
617 void flush_pwnam_cache(void);
618 char *get_user_home_dir(TALLOC_CTX *mem_ctx, const char *user);
619 struct passwd *Get_Pwnam_alloc(TALLOC_CTX *mem_ctx, const char *user);
621 /* The following definitions come from lib/util_names.c */
622 void gfree_netbios_names(void);
623 bool set_global_myname(const char *myname);
624 const char *global_myname(void);
625 bool set_global_myworkgroup(const char *myworkgroup);
626 const char *lp_workgroup(void);
627 const char *get_global_sam_name(void);
629 /* The following definitions come from lib/util.c */
631 enum protocol_types get_Protocol(void);
632 void set_Protocol(enum protocol_types p);
633 bool all_zero(const uint8_t *ptr, size_t size);
634 bool set_global_scope(const char *scope);
635 const char *global_scope(void);
636 void gfree_names(void);
637 void gfree_all( void );
638 const char *my_netbios_names(int i);
639 bool set_netbios_aliases(const char **str_array);
640 bool init_names(void);
641 bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf,
642 bool fake_dir_create_times);
643 bool socket_exist(const char *fname);
644 uint64_t get_file_size_stat(const SMB_STRUCT_STAT *sbuf);
645 SMB_OFF_T get_file_size(char *file_name);
646 char *attrib_string(uint16 mode);
647 void show_msg(char *buf);
648 void smb_set_enclen(char *buf,int len,uint16 enc_ctx_num);
649 void smb_setlen(char *buf,int len);
650 int set_message_bcc(char *buf,int num_bytes);
651 ssize_t message_push_blob(uint8 **outbuf, DATA_BLOB blob);
652 char *unix_clean_name(TALLOC_CTX *ctx, const char *s);
653 char *clean_name(TALLOC_CTX *ctx, const char *s);
654 ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, SMB_OFF_T pos);
655 int set_blocking(int fd, bool set);
656 NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
657 struct event_context *ev_ctx,
659 bool parent_longlived);
660 void *malloc_(size_t size);
661 void *memalign_array(size_t el_size, size_t align, unsigned int count);
662 void *calloc_array(size_t size, size_t nmemb);
663 void *Realloc(void *p, size_t size, bool free_old_on_error);
664 void add_to_large_array(TALLOC_CTX *mem_ctx, size_t element_size,
665 void *element, void *_array, uint32 *num_elements,
666 ssize_t *array_size);
667 char *get_myname(TALLOC_CTX *ctx);
668 char *get_mydnsdomname(TALLOC_CTX *ctx);
669 int interpret_protocol(const char *str,int def);
670 char *automount_lookup(TALLOC_CTX *ctx, const char *user_name);
671 char *automount_lookup(TALLOC_CTX *ctx, const char *user_name);
672 bool process_exists(const struct server_id pid);
673 const char *uidtoname(uid_t uid);
674 char *gidtoname(gid_t gid);
675 uid_t nametouid(const char *name);
676 gid_t nametogid(const char *name);
677 void smb_panic_s3(const char *why);
678 void log_stack_trace(void);
679 const char *readdirname(SMB_STRUCT_DIR *p);
680 bool is_in_path(const char *name, name_compare_entry *namelist, bool case_sensitive);
681 void set_namearray(name_compare_entry **ppname_array, const char *namelist);
682 void free_namearray(name_compare_entry *name_array);
683 bool fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
684 bool fcntl_getlock(int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid);
685 bool is_myname(const char *s);
686 bool is_myworkgroup(const char *s);
687 void ra_lanman_string( const char *native_lanman );
688 const char *get_remote_arch_str(void);
689 void set_remote_arch(enum remote_arch_types type);
690 enum remote_arch_types get_remote_arch(void);
691 const char *tab_depth(int level, int depth);
692 int str_checksum(const char *s);
693 void zero_free(void *p, size_t size);
694 int set_maxfiles(int requested_max);
695 int smb_mkstemp(char *name_template);
696 void *smb_xmalloc_array(size_t size, unsigned int count);
697 char *myhostname(void);
698 char *lock_path(const char *name);
699 char *pid_path(const char *name);
700 char *lib_path(const char *name);
701 char *modules_path(const char *name);
702 char *data_path(const char *name);
703 char *state_path(const char *name);
704 char *cache_path(const char *name);
705 const char *shlib_ext(void);
706 bool parent_dirname(TALLOC_CTX *mem_ctx, const char *dir, char **parent,
708 bool ms_has_wild(const char *s);
709 bool ms_has_wild_w(const smb_ucs2_t *s);
710 bool mask_match(const char *string, const char *pattern, bool is_case_sensitive);
711 bool mask_match_search(const char *string, const char *pattern, bool is_case_sensitive);
712 bool mask_match_list(const char *string, char **list, int listLen, bool is_case_sensitive);
713 bool unix_wild_match(const char *pattern, const char *string);
714 bool name_to_fqdn(fstring fqdn, const char *name);
715 void *talloc_append_blob(TALLOC_CTX *mem_ctx, void *buf, DATA_BLOB blob);
716 uint32 map_share_mode_to_deny_mode(uint32 share_access, uint32 private_options);
717 pid_t procid_to_pid(const struct server_id *proc);
718 void set_my_vnn(uint32 vnn);
719 uint32 get_my_vnn(void);
720 void set_my_unique_id(uint64_t unique_id);
721 struct server_id pid_to_procid(pid_t pid);
722 struct server_id procid_self(void);
723 bool procid_equal(const struct server_id *p1, const struct server_id *p2);
724 bool cluster_id_equal(const struct server_id *id1,
725 const struct server_id *id2);
726 bool procid_is_me(const struct server_id *pid);
727 struct server_id interpret_pid(const char *pid_string);
728 char *procid_str(TALLOC_CTX *mem_ctx, const struct server_id *pid);
729 char *procid_str_static(const struct server_id *pid);
730 bool procid_valid(const struct server_id *pid);
731 bool procid_is_local(const struct server_id *pid);
732 bool trans_oob(uint32_t bufsize, uint32_t offset, uint32_t length);
733 bool is_offset_safe(const char *buf_base, size_t buf_len, char *ptr, size_t off);
734 char *get_safe_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
735 char *get_safe_str_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
736 int get_safe_SVAL(const char *buf_base, size_t buf_len, char *ptr, size_t off, int failval);
737 int get_safe_IVAL(const char *buf_base, size_t buf_len, char *ptr, size_t off, int failval);
738 void split_domain_user(TALLOC_CTX *mem_ctx,
739 const char *full_name,
742 void *_talloc_zero_zeronull(const void *ctx, size_t size, const char *name);
743 void *_talloc_memdup_zeronull(const void *t, const void *p, size_t size, const char *name);
744 void *_talloc_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
745 void *_talloc_zero_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
746 void *talloc_zeronull(const void *context, size_t size, const char *name);
747 const char *strip_hostname(const char *s);
748 bool tevent_req_poll_ntstatus(struct tevent_req *req,
749 struct tevent_context *ev,
751 bool any_nt_status_not_ok(NTSTATUS err1, NTSTATUS err2, NTSTATUS *result);
752 int timeval_to_msec(struct timeval t);
754 /* The following definitions come from lib/util_cmdline.c */
756 struct user_auth_info *user_auth_info_init(TALLOC_CTX *mem_ctx);
757 const char *get_cmdline_auth_info_username(const struct user_auth_info *auth_info);
758 void set_cmdline_auth_info_username(struct user_auth_info *auth_info,
759 const char *username);
760 const char *get_cmdline_auth_info_domain(const struct user_auth_info *auth_info);
761 void set_cmdline_auth_info_domain(struct user_auth_info *auth_info,
763 void set_cmdline_auth_info_password(struct user_auth_info *auth_info,
764 const char *password);
765 const char *get_cmdline_auth_info_password(const struct user_auth_info *auth_info);
766 bool set_cmdline_auth_info_signing_state(struct user_auth_info *auth_info,
768 int get_cmdline_auth_info_signing_state(const struct user_auth_info *auth_info);
769 void set_cmdline_auth_info_use_ccache(struct user_auth_info *auth_info,
771 bool get_cmdline_auth_info_use_ccache(const struct user_auth_info *auth_info);
772 void set_cmdline_auth_info_use_kerberos(struct user_auth_info *auth_info,
774 bool get_cmdline_auth_info_use_kerberos(const struct user_auth_info *auth_info);
775 void set_cmdline_auth_info_fallback_after_kerberos(struct user_auth_info *auth_info,
777 bool get_cmdline_auth_info_fallback_after_kerberos(const struct user_auth_info *auth_info);
778 void set_cmdline_auth_info_use_krb5_ticket(struct user_auth_info *auth_info);
779 void set_cmdline_auth_info_smb_encrypt(struct user_auth_info *auth_info);
780 void set_cmdline_auth_info_use_machine_account(struct user_auth_info *auth_info);
781 bool get_cmdline_auth_info_got_pass(const struct user_auth_info *auth_info);
782 bool get_cmdline_auth_info_smb_encrypt(const struct user_auth_info *auth_info);
783 bool get_cmdline_auth_info_use_machine_account(const struct user_auth_info *auth_info);
784 struct user_auth_info *get_cmdline_auth_info_copy(TALLOC_CTX *mem_ctx,
785 const struct user_auth_info *info);
786 bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_info);
787 void set_cmdline_auth_info_getpass(struct user_auth_info *auth_info);
789 /* The following definitions come from lib/util_builtin.c */
791 bool lookup_builtin_rid(TALLOC_CTX *mem_ctx, uint32 rid, const char **name);
792 bool lookup_builtin_name(const char *name, uint32 *rid);
793 const char *builtin_domain_name(void);
794 bool sid_check_is_builtin(const struct dom_sid *sid);
795 bool sid_check_is_in_builtin(const struct dom_sid *sid);
797 /* The following definitions come from lib/util_file.c */
799 char **file_lines_pload(const char *syscmd, int *numlines);
800 void file_lines_free(char **lines);
802 /* The following definitions come from lib/util_nscd.c */
804 void smb_nscd_flush_user_cache(void);
805 void smb_nscd_flush_group_cache(void);
807 /* The following definitions come from lib/util_nttoken.c */
809 struct security_token *dup_nt_token(TALLOC_CTX *mem_ctx, const struct security_token *ptoken);
810 NTSTATUS merge_nt_token(TALLOC_CTX *mem_ctx,
811 const struct security_token *token_1,
812 const struct security_token *token_2,
813 struct security_token **token_out);
814 bool token_sid_in_ace(const struct security_token *token, const struct security_ace *ace);
816 /* The following definitions come from lib/util_sec.c */
819 uid_t sec_initial_uid(void);
820 gid_t sec_initial_gid(void);
821 bool non_root_mode(void);
822 void gain_root_privilege(void);
823 void gain_root_group_privilege(void);
824 void set_effective_uid(uid_t uid);
825 void set_effective_gid(gid_t gid);
826 void save_re_uid(void);
827 void restore_re_uid_fromroot(void);
828 void restore_re_uid(void);
829 void save_re_gid(void);
830 void restore_re_gid(void);
831 int set_re_uid(void);
832 void become_user_permanently(uid_t uid, gid_t gid);
833 bool is_setuid_root(void) ;
835 /* The following definitions come from lib/util_sid.c */
837 char *sid_to_fstring(fstring sidstr_out, const struct dom_sid *sid);
838 char *sid_string_talloc(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
839 char *sid_string_dbg(const struct dom_sid *sid);
840 char *sid_string_tos(const struct dom_sid *sid);
841 bool sid_linearize(char *outbuf, size_t len, const struct dom_sid *sid);
842 bool non_mappable_sid(struct dom_sid *sid);
843 char *sid_binstring_hex(const struct dom_sid *sid);
844 struct netr_SamInfo3;
845 NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx,
846 const struct netr_SamInfo3 *info3,
847 struct dom_sid **user_sids,
848 uint32_t *num_user_sids,
849 bool include_user_group_rid,
850 bool skip_ressource_groups);
852 /* The following definitions come from lib/util_sock.c */
854 bool is_broadcast_addr(const struct sockaddr *pss);
855 bool is_loopback_ip_v4(struct in_addr ip);
856 bool is_loopback_addr(const struct sockaddr *pss);
857 bool is_zero_addr(const struct sockaddr_storage *pss);
858 void zero_ip_v4(struct in_addr *ip);
859 void in_addr_to_sockaddr_storage(struct sockaddr_storage *ss,
861 bool same_net(const struct sockaddr *ip1,
862 const struct sockaddr *ip2,
863 const struct sockaddr *mask);
864 bool sockaddr_equal(const struct sockaddr *ip1,
865 const struct sockaddr *ip2);
866 bool is_address_any(const struct sockaddr *psa);
867 uint16_t get_sockaddr_port(const struct sockaddr_storage *pss);
868 char *print_sockaddr(char *dest,
870 const struct sockaddr_storage *psa);
871 char *print_canonical_sockaddr(TALLOC_CTX *ctx,
872 const struct sockaddr_storage *pss);
873 const char *client_name(int fd);
874 int get_socket_port(int fd);
875 const char *client_addr(int fd, char *addr, size_t addrlen);
876 const char *client_socket_addr(int fd, char *addr, size_t addr_len);
877 int client_socket_port(int fd);
878 void set_smb_read_error(enum smb_read_errors *pre,
879 enum smb_read_errors newerr);
880 void cond_set_smb_read_error(enum smb_read_errors *pre,
881 enum smb_read_errors newerr);
882 bool is_a_socket(int fd);
883 void set_socket_options(int fd, const char *options);
884 ssize_t read_udp_v4_socket(int fd,
887 struct sockaddr_storage *psa);
888 NTSTATUS read_fd_with_timeout(int fd, char *buf,
889 size_t mincnt, size_t maxcnt,
890 unsigned int time_out,
892 NTSTATUS read_data(int fd, char *buffer, size_t N);
893 ssize_t write_data(int fd, const char *buffer, size_t N);
894 ssize_t write_data_iov(int fd, const struct iovec *orig_iov, int iovcnt);
895 bool send_keepalive(int client);
896 NTSTATUS read_smb_length_return_keepalive(int fd, char *inbuf,
897 unsigned int timeout,
899 NTSTATUS receive_smb_raw(int fd,
902 unsigned int timeout,
905 int open_socket_in(int type,
908 const struct sockaddr_storage *psock,
910 NTSTATUS open_socket_out(const struct sockaddr_storage *pss, uint16_t port,
911 int timeout, int *pfd);
912 struct tevent_req *open_socket_out_send(TALLOC_CTX *mem_ctx,
913 struct event_context *ev,
914 const struct sockaddr_storage *pss,
917 NTSTATUS open_socket_out_recv(struct tevent_req *req, int *pfd);
918 struct tevent_req *open_socket_out_defer_send(TALLOC_CTX *mem_ctx,
919 struct event_context *ev,
920 struct timeval wait_time,
921 const struct sockaddr_storage *pss,
924 NTSTATUS open_socket_out_defer_recv(struct tevent_req *req, int *pfd);
925 int open_udp_socket(const char *host, int port);
926 const char *get_peer_name(int fd, bool force_lookup);
927 const char *get_peer_addr(int fd, char *addr, size_t addr_len);
928 int create_pipe_sock(const char *socket_dir,
929 const char *socket_name,
931 const char *get_mydnsfullname(void);
932 bool is_myname_or_ipaddr(const char *s);
933 struct tevent_req *getaddrinfo_send(TALLOC_CTX *mem_ctx,
934 struct tevent_context *ev,
935 struct fncall_context *ctx,
938 const struct addrinfo *hints);
939 int getaddrinfo_recv(struct tevent_req *req, struct addrinfo **res);
940 int poll_one_fd(int fd, int events, int timeout, int *revents);
941 int poll_intr_one_fd(int fd, int events, int timeout, int *revents);
942 struct tevent_req *tstream_read_packet_send(TALLOC_CTX *mem_ctx,
943 struct tevent_context *ev,
944 struct tstream_context *stream,
946 ssize_t (*more)(uint8_t *buf,
950 ssize_t tstream_read_packet_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
951 uint8_t **pbuf, int *perrno);
953 /* The following definitions come from lib/util_str.c */
955 bool next_token(const char **ptr, char *buff, const char *sep, size_t bufsize);
956 int StrCaseCmp(const char *s, const char *t);
957 int StrnCaseCmp(const char *s, const char *t, size_t len);
958 bool strnequal(const char *s1,const char *s2,size_t n);
959 bool strcsequal(const char *s1,const char *s2);
960 void strnorm(char *s, int case_default);
961 char *push_skip_string(char *buf);
962 char *skip_string(const char *base, size_t len, char *buf);
963 size_t str_charnum(const char *s);
964 size_t str_ascii_charnum(const char *s);
965 bool trim_char(char *s,char cfront,char cback);
966 bool strhasupper(const char *s);
967 bool strhaslower(const char *s);
968 char *safe_strcpy_fn(char *dest,
971 char *safe_strcat_fn(char *dest,
974 char *alpha_strcpy(char *dest,
976 const char *other_safe_chars,
978 char *StrnCpy(char *dest,const char *src,size_t n);
979 bool in_list(const char *s, const char *list, bool casesensitive);
980 void string_free(char **s);
981 bool string_set(char **dest,const char *src);
982 void string_sub2(char *s,const char *pattern, const char *insert, size_t len,
983 bool remove_unsafe_characters, bool replace_once,
984 bool allow_trailing_dollar);
985 void string_sub_once(char *s, const char *pattern,
986 const char *insert, size_t len);
987 void string_sub(char *s,const char *pattern, const char *insert, size_t len);
988 void fstring_sub(char *s,const char *pattern,const char *insert);
989 char *realloc_string_sub2(char *string,
992 bool remove_unsafe_characters,
993 bool allow_trailing_dollar);
994 char *realloc_string_sub(char *string,
997 char *talloc_string_sub2(TALLOC_CTX *mem_ctx, const char *src,
1000 bool remove_unsafe_characters,
1002 bool allow_trailing_dollar);
1003 char *talloc_string_sub(TALLOC_CTX *mem_ctx,
1005 const char *pattern,
1006 const char *insert);
1007 void all_string_sub(char *s,const char *pattern,const char *insert, size_t len);
1008 char *talloc_all_string_sub(TALLOC_CTX *ctx,
1010 const char *pattern,
1011 const char *insert);
1012 char *octal_string(int i);
1013 char *string_truncate(char *s, unsigned int length);
1014 char *strchr_m(const char *src, char c);
1015 char *strrchr_m(const char *s, char c);
1016 char *strnrchr_m(const char *s, char c, unsigned int n);
1017 char *strstr_m(const char *src, const char *findstr);
1018 void strlower_m(char *s);
1019 void strupper_m(char *s);
1020 size_t strlen_m(const char *s);
1021 size_t strlen_m_term(const char *s);
1022 size_t strlen_m_term_null(const char *s);
1023 int fstr_sprintf(fstring s, const char *fmt, ...);
1024 bool str_list_sub_basic( char **list, const char *smb_name,
1025 const char *domain_name );
1026 bool str_list_substitute(char **list, const char *pattern, const char *insert);
1028 char *ipstr_list_make(char **ipstr_list,
1029 const struct ip_service *ip_list,
1031 int ipstr_list_parse(const char *ipstr_list, struct ip_service **ip_list);
1032 void ipstr_list_free(char* ipstr_list);
1033 uint64_t STR_TO_SMB_BIG_UINT(const char *nptr, const char **entptr);
1034 SMB_OFF_T conv_str_size(const char * str);
1035 void string_append(char **left, const char *right);
1036 bool add_string_to_array(TALLOC_CTX *mem_ctx,
1037 const char *str, const char ***strings,
1039 void sprintf_append(TALLOC_CTX *mem_ctx, char **string, ssize_t *len,
1040 size_t *bufsize, const char *fmt, ...);
1041 int asprintf_strupper_m(char **strp, const char *fmt, ...);
1042 char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...);
1043 char *talloc_asprintf_strlower_m(TALLOC_CTX *t, const char *fmt, ...);
1044 char *sstring_sub(const char *src, char front, char back);
1045 bool validate_net_name( const char *name,
1046 const char *invalid_chars,
1048 char *escape_shell_string(const char *src);
1049 char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep);
1050 char *sanitize_username(TALLOC_CTX *mem_ctx, const char *username);
1052 /* The following definitions come from lib/version.c */
1054 const char *samba_version_string(void);
1056 /* The following definitions come from lib/wins_srv.c */
1058 bool wins_srv_is_dead(struct in_addr wins_ip, struct in_addr src_ip);
1059 void wins_srv_alive(struct in_addr wins_ip, struct in_addr src_ip);
1060 void wins_srv_died(struct in_addr wins_ip, struct in_addr src_ip);
1061 unsigned wins_srv_count(void);
1062 char **wins_srv_tags(void);
1063 void wins_srv_tags_free(char **list);
1064 struct in_addr wins_srv_ip_tag(const char *tag, struct in_addr src_ip);
1065 unsigned wins_srv_count_tag(const char *tag);
1067 /* The following definitions come from libsmb/cliconnect.c */
1069 ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
1070 const char *pass, const char *user_domain,
1071 const char * dest_realm);
1073 NTSTATUS cli_session_setup(struct cli_state *cli,
1075 const char *pass, int passlen,
1076 const char *ntpass, int ntpasslen,
1077 const char *workgroup);
1078 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
1079 struct event_context *ev,
1080 struct cli_state *cli,
1081 struct tevent_req **psmbreq);
1082 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
1083 struct event_context *ev,
1084 struct cli_state *cli);
1085 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
1086 struct tevent_req *cli_ulogoff_send(TALLOC_CTX *mem_ctx,
1087 struct tevent_context *ev,
1088 struct cli_state *cli);
1089 NTSTATUS cli_ulogoff_recv(struct tevent_req *req);
1090 NTSTATUS cli_ulogoff(struct cli_state *cli);
1091 struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
1092 struct event_context *ev,
1093 struct cli_state *cli,
1094 const char *share, const char *dev,
1095 const char *pass, int passlen,
1096 struct tevent_req **psmbreq);
1097 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
1098 struct event_context *ev,
1099 struct cli_state *cli,
1100 const char *share, const char *dev,
1101 const char *pass, int passlen);
1102 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
1103 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
1104 const char *dev, const char *pass, int passlen);
1105 struct tevent_req *cli_tdis_send(TALLOC_CTX *mem_ctx,
1106 struct tevent_context *ev,
1107 struct cli_state *cli);
1108 NTSTATUS cli_tdis_recv(struct tevent_req *req);
1109 NTSTATUS cli_tdis(struct cli_state *cli);
1110 NTSTATUS cli_negprot(struct cli_state *cli);
1111 struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
1112 struct event_context *ev,
1113 struct cli_state *cli);
1114 NTSTATUS cli_negprot_recv(struct tevent_req *req);
1115 bool cli_session_request(struct cli_state *cli,
1116 struct nmb_name *calling, struct nmb_name *called);
1117 NTSTATUS cli_connect(struct cli_state *cli,
1119 struct sockaddr_storage *dest_ss);
1120 NTSTATUS cli_start_connection(struct cli_state **output_cli,
1121 const char *my_name,
1122 const char *dest_host,
1123 struct sockaddr_storage *dest_ss, int port,
1124 int signing_state, int flags);
1125 NTSTATUS cli_full_connection(struct cli_state **output_cli,
1126 const char *my_name,
1127 const char *dest_host,
1128 struct sockaddr_storage *dest_ss, int port,
1129 const char *service, const char *service_type,
1130 const char *user, const char *domain,
1131 const char *password, int flags,
1133 bool attempt_netbios_session_request(struct cli_state **ppcli, const char *srchost, const char *desthost,
1134 struct sockaddr_storage *pdest_ss);
1135 NTSTATUS cli_raw_tcon(struct cli_state *cli,
1136 const char *service, const char *pass, const char *dev,
1137 uint16 *max_xmit, uint16 *tid);
1138 struct cli_state *get_ipc_connect(char *server,
1139 struct sockaddr_storage *server_ss,
1140 const struct user_auth_info *user_info);
1141 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
1142 struct ip_service *mb_ip,
1143 const struct user_auth_info *user_info,
1144 char **pp_workgroup_out);
1145 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
1146 const struct user_auth_info *user_info,
1147 char **pp_workgroup_out);
1149 /* The following definitions come from libsmb/clidfs.c */
1151 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
1152 const char *username,
1153 const char *password,
1155 const char *sharename);
1156 struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
1157 struct cli_state *referring_cli,
1160 const struct user_auth_info *auth_info,
1166 void cli_cm_display(const struct cli_state *c);
1167 struct client_dfs_referral;
1168 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
1169 struct cli_state *cli,
1171 struct client_dfs_referral **refs,
1174 bool cli_resolve_path(TALLOC_CTX *ctx,
1175 const char *mountpt,
1176 const struct user_auth_info *dfs_auth_info,
1177 struct cli_state *rootcli,
1179 struct cli_state **targetcli,
1180 char **pp_targetpath);
1182 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
1183 struct cli_state *cli,
1184 const char *sharename,
1185 char **pp_newserver,
1188 const char *username,
1189 const char *password,
1190 const char *domain);
1192 /* The following definitions come from libsmb/clientgen.c */
1194 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
1195 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
1196 void cli_set_port(struct cli_state *cli, int port);
1197 bool cli_state_seqnum_persistent(struct cli_state *cli,
1199 bool cli_state_seqnum_remove(struct cli_state *cli,
1201 bool cli_receive_smb(struct cli_state *cli);
1202 bool cli_send_smb(struct cli_state *cli);
1203 bool cli_send_smb_direct_writeX(struct cli_state *cli,
1206 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
1207 void cli_setup_packet(struct cli_state *cli);
1208 void cli_setup_bcc(struct cli_state *cli, void *p);
1209 NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
1210 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);
1211 NTSTATUS cli_set_password(struct cli_state *cli, const char *password);
1212 NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password);
1213 struct cli_state *cli_initialise(void);
1214 struct cli_state *cli_initialise_ex(int signing_state);
1215 void cli_nt_pipes_close(struct cli_state *cli);
1216 void cli_shutdown(struct cli_state *cli);
1217 void cli_sockopt(struct cli_state *cli, const char *options);
1218 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
1219 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
1220 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
1221 struct cli_state *cli, uint16_t num_echos,
1223 NTSTATUS cli_echo_recv(struct tevent_req *req);
1224 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
1225 bool cli_ucs2(struct cli_state *cli);
1226 bool is_andx_req(uint8_t cmd);
1227 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
1228 uint8_t smb_command, uint8_t additional_flags,
1229 uint8_t wct, uint16_t *vwv,
1230 uint32_t num_bytes, const uint8_t *bytes,
1231 struct tevent_req **result_parent,
1232 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
1233 uint32_t *pnum_bytes, uint8_t **pbytes);
1235 /* The following definitions come from libsmb/clierror.c */
1237 const char *cli_errstr(struct cli_state *cli);
1238 NTSTATUS cli_nt_error(struct cli_state *cli);
1239 void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode);
1240 int cli_errno(struct cli_state *cli);
1241 bool cli_is_error(struct cli_state *cli);
1242 bool cli_is_nt_error(struct cli_state *cli);
1243 bool cli_is_dos_error(struct cli_state *cli);
1244 NTSTATUS cli_get_nt_error(struct cli_state *cli);
1245 void cli_set_nt_error(struct cli_state *cli, NTSTATUS status);
1246 void cli_reset_error(struct cli_state *cli);
1247 bool cli_state_is_connected(struct cli_state *cli);
1249 /* The following definitions come from libsmb/clifile.c */
1251 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
1252 struct tevent_context *ev,
1253 struct cli_state *cli,
1258 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
1259 NTSTATUS cli_setpathinfo(struct cli_state *cli,
1265 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
1266 struct event_context *ev,
1267 struct cli_state *cli,
1268 const char *oldname,
1269 const char *newname);
1270 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
1271 NTSTATUS cli_posix_symlink(struct cli_state *cli,
1272 const char *oldname,
1273 const char *newname);
1274 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
1275 struct event_context *ev,
1276 struct cli_state *cli,
1279 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
1280 char *retpath, size_t len);
1281 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
1282 char *linkpath, size_t len);
1283 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
1284 struct event_context *ev,
1285 struct cli_state *cli,
1286 const char *oldname,
1287 const char *newname);
1288 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
1289 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
1290 const char *oldname,
1291 const char *newname);
1292 uint32_t unix_perms_to_wire(mode_t perms);
1293 mode_t wire_perms_to_unix(uint32_t perms);
1294 struct tevent_req *cli_posix_getfacl_send(TALLOC_CTX *mem_ctx,
1295 struct event_context *ev,
1296 struct cli_state *cli,
1298 NTSTATUS cli_posix_getfacl_recv(struct tevent_req *req,
1299 TALLOC_CTX *mem_ctx,
1302 NTSTATUS cli_posix_getfacl(struct cli_state *cli,
1304 TALLOC_CTX *mem_ctx,
1307 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
1308 struct event_context *ev,
1309 struct cli_state *cli,
1311 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
1312 SMB_STRUCT_STAT *sbuf);
1313 NTSTATUS cli_posix_stat(struct cli_state *cli,
1315 SMB_STRUCT_STAT *sbuf);
1316 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
1317 struct event_context *ev,
1318 struct cli_state *cli,
1321 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
1322 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
1323 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
1324 struct event_context *ev,
1325 struct cli_state *cli,
1329 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
1330 NTSTATUS cli_posix_chown(struct cli_state *cli,
1334 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
1335 struct event_context *ev,
1336 struct cli_state *cli,
1337 const char *fname_src,
1338 const char *fname_dst);
1339 NTSTATUS cli_rename_recv(struct tevent_req *req);
1340 NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
1341 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
1342 struct event_context *ev,
1343 struct cli_state *cli,
1344 const char *fname_src,
1345 const char *fname_dst);
1346 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
1347 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
1349 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
1350 struct event_context *ev,
1351 struct cli_state *cli,
1352 const char *fname_src,
1353 const char *fname_dst);
1354 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
1355 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
1357 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
1358 struct event_context *ev,
1359 struct cli_state *cli,
1361 uint16_t mayhave_attrs);
1362 NTSTATUS cli_unlink_recv(struct tevent_req *req);
1363 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
1365 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
1366 struct event_context *ev,
1367 struct cli_state *cli,
1369 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
1370 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
1371 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
1372 struct event_context *ev,
1373 struct cli_state *cli,
1375 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
1376 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
1377 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
1378 struct event_context *ev,
1379 struct cli_state *cli,
1382 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
1383 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
1384 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
1385 struct event_context *ev,
1386 struct cli_state *cli,
1388 uint32_t CreatFlags,
1389 uint32_t DesiredAccess,
1390 uint32_t FileAttributes,
1391 uint32_t ShareAccess,
1392 uint32_t CreateDisposition,
1393 uint32_t CreateOptions,
1394 uint8_t SecurityFlags);
1395 NTSTATUS cli_ntcreate_recv(struct tevent_req *req, uint16_t *pfnum);
1396 NTSTATUS cli_ntcreate(struct cli_state *cli,
1398 uint32_t CreatFlags,
1399 uint32_t DesiredAccess,
1400 uint32_t FileAttributes,
1401 uint32_t ShareAccess,
1402 uint32_t CreateDisposition,
1403 uint32_t CreateOptions,
1404 uint8_t SecurityFlags,
1406 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
1407 size_t str_len, size_t *pconverted_size);
1408 uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
1409 const uint8_t *bytes, size_t num_bytes);
1410 struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx,
1411 struct event_context *ev,
1412 struct cli_state *cli, const char *fname,
1413 int flags, int share_mode,
1414 struct tevent_req **psmbreq);
1415 struct tevent_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
1416 struct cli_state *cli, const char *fname,
1417 int flags, int share_mode);
1418 NTSTATUS cli_open_recv(struct tevent_req *req, uint16_t *fnum);
1419 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
1420 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
1421 struct event_context *ev,
1422 struct cli_state *cli, uint16_t fnum,
1423 struct tevent_req **psubreq);
1424 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
1425 struct event_context *ev,
1426 struct cli_state *cli, uint16_t fnum);
1427 NTSTATUS cli_close_recv(struct tevent_req *req);
1428 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
1429 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
1430 struct event_context *ev,
1431 struct cli_state *cli,
1434 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
1435 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
1436 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
1437 uint32_t offset, uint32_t len,
1438 int timeout, unsigned char locktype);
1439 bool cli_lock(struct cli_state *cli, uint16_t fnum,
1440 uint32_t offset, uint32_t len, int timeout, enum brl_type lock_type);
1441 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
1442 struct event_context *ev,
1443 struct cli_state *cli,
1447 NTSTATUS cli_unlock_recv(struct tevent_req *req);
1448 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
1449 bool cli_lock64(struct cli_state *cli, uint16_t fnum,
1450 uint64_t offset, uint64_t len, int timeout, enum brl_type lock_type);
1451 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
1452 struct event_context *ev,
1453 struct cli_state *cli,
1457 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
1458 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
1459 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
1460 struct event_context *ev,
1461 struct cli_state *cli,
1466 enum brl_type lock_type);
1467 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
1468 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
1469 uint64_t offset, uint64_t len,
1470 bool wait_lock, enum brl_type lock_type);
1471 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
1472 struct event_context *ev,
1473 struct cli_state *cli,
1477 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
1478 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
1479 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
1480 struct event_context *ev,
1481 struct cli_state *cli,
1483 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
1486 time_t *change_time,
1487 time_t *access_time,
1488 time_t *write_time);
1489 NTSTATUS cli_getattrE(struct cli_state *cli,
1493 time_t *change_time,
1494 time_t *access_time,
1495 time_t *write_time);
1496 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
1497 struct event_context *ev,
1498 struct cli_state *cli,
1503 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
1504 NTSTATUS cli_setattrE(struct cli_state *cli,
1509 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
1510 struct event_context *ev,
1511 struct cli_state *cli,
1513 NTSTATUS cli_getatr_recv(struct tevent_req *req,
1516 time_t *write_time);
1517 NTSTATUS cli_getatr(struct cli_state *cli,
1521 time_t *write_time);
1522 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
1523 struct event_context *ev,
1524 struct cli_state *cli,
1528 NTSTATUS cli_setatr_recv(struct tevent_req *req);
1529 NTSTATUS cli_setatr(struct cli_state *cli,
1533 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
1534 struct event_context *ev,
1535 struct cli_state *cli,
1537 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
1538 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
1539 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
1540 struct event_context *ev,
1541 struct cli_state *cli);
1542 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
1544 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
1545 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
1546 struct event_context *ev,
1547 struct cli_state *cli,
1549 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
1553 NTSTATUS cli_ctemp(struct cli_state *cli,
1558 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
1559 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
1560 const char *ea_name, const char *ea_val,
1562 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
1563 const char *ea_name, const char *ea_val,
1565 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
1566 struct tevent_context *ev,
1567 struct cli_state *cli,
1569 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1570 size_t *pnum_eas, struct ea_struct **peas);
1571 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
1574 struct ea_struct **pea_list);
1575 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
1576 struct event_context *ev,
1577 struct cli_state *cli,
1581 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
1582 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
1583 int flags, mode_t mode, uint16_t *fnum);
1584 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
1585 struct event_context *ev,
1586 struct cli_state *cli,
1589 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
1590 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
1592 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
1593 struct event_context *ev,
1594 struct cli_state *cli,
1596 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
1597 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
1599 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
1600 struct event_context *ev,
1601 struct cli_state *cli,
1603 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1604 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
1605 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
1606 struct tevent_context *ev,
1607 struct cli_state *cli, uint16_t fnum,
1608 uint32_t buffer_size,
1609 uint32_t completion_filter, bool recursive);
1610 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1611 uint32_t *pnum_changes,
1612 struct notify_change **pchanges);
1614 /* The following definitions come from libsmb/clifsinfo.c */
1616 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
1617 struct tevent_context *ev,
1618 struct cli_state *cli);
1619 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
1620 uint16_t *pmajor, uint16_t *pminor,
1622 uint32_t *pcaphigh);
1623 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor,
1624 uint16 *pminor, uint32 *pcaplow,
1626 struct tevent_req *cli_set_unix_extensions_capabilities_send(
1627 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
1628 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
1629 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
1630 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
1631 uint16 major, uint16 minor,
1632 uint32 caplow, uint32 caphigh);
1633 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
1634 struct tevent_context *ev,
1635 struct cli_state *cli);
1636 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
1637 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
1638 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name,
1639 uint32 *pserial_number, time_t *pdate);
1640 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
1641 uint64_t *total_allocation_units,
1642 uint64_t *caller_allocation_units,
1643 uint64_t *actual_allocation_units,
1644 uint64_t *sectors_per_allocation_unit,
1645 uint64_t *bytes_per_sector);
1646 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
1647 uint32 *optimal_transfer_size,
1649 uint64_t *total_blocks,
1650 uint64_t *blocks_available,
1651 uint64_t *user_blocks_available,
1652 uint64_t *total_file_nodes,
1653 uint64_t *free_file_nodes,
1654 uint64_t *fs_identifier);
1655 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
1658 const char *domain);
1659 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
1660 NTSTATUS cli_force_encryption(struct cli_state *c,
1661 const char *username,
1662 const char *password,
1663 const char *domain);
1665 /* The following definitions come from libsmb/clikrb5.c */
1667 bool unwrap_edata_ntstatus(TALLOC_CTX *mem_ctx,
1669 DATA_BLOB *edata_out);
1670 bool unwrap_pac(TALLOC_CTX *mem_ctx, DATA_BLOB *auth_data, DATA_BLOB *unwrapped_pac_data);
1672 /* The following definitions come from libsmb/clilist.c */
1674 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
1675 NTSTATUS (*fn)(const char *, struct file_info *,
1676 const char *, void *), void *state);
1677 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
1678 uint16_t attribute, int info_level,
1679 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
1680 const char *mask, void *private_data),
1681 void *private_data);
1682 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
1683 struct tevent_context *ev,
1684 struct cli_state *cli,
1687 uint16_t info_level);
1688 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1689 struct file_info **finfo, size_t *num_finfo);
1690 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
1691 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
1692 void *), void *state);
1694 /* The following definitions come from libsmb/climessage.c */
1696 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
1697 struct tevent_context *ev,
1698 struct cli_state *cli,
1699 const char *host, const char *username,
1700 const char *message);
1701 NTSTATUS cli_message_recv(struct tevent_req *req);
1702 NTSTATUS cli_message(struct cli_state *cli, const char *host,
1703 const char *username, const char *message);
1705 /* The following definitions come from libsmb/clioplock.c */
1707 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
1708 struct tevent_context *ev,
1709 struct cli_state *cli,
1710 uint16_t fnum, uint8_t level);
1711 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
1712 NTSTATUS cli_oplock_ack(struct cli_state *cli, uint16_t fnum, unsigned char level);
1713 void cli_oplock_handler(struct cli_state *cli,
1714 NTSTATUS (*handler)(struct cli_state *, uint16_t, unsigned char));
1716 /* The following definitions come from libsmb/cliprint.c */
1718 int cli_print_queue(struct cli_state *cli,
1719 void (*fn)(struct print_job_info *));
1720 int cli_printjob_del(struct cli_state *cli, int job);
1722 /* The following definitions come from libsmb/cliquota.c */
1724 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
1725 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
1726 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
1727 SMB_NTQUOTA_STRUCT *pqt);
1728 NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
1729 SMB_NTQUOTA_STRUCT *pqt);
1730 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
1731 SMB_NTQUOTA_LIST **pqt_list);
1732 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
1733 SMB_NTQUOTA_STRUCT *pqt);
1734 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
1735 SMB_NTQUOTA_STRUCT *pqt);
1737 /* The following definitions come from libsmb/clireadwrite.c */
1739 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
1740 struct event_context *ev,
1741 struct cli_state *cli, uint16_t fnum,
1742 off_t offset, size_t size,
1743 struct tevent_req **psmbreq);
1744 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
1745 struct event_context *ev,
1746 struct cli_state *cli, uint16_t fnum,
1747 off_t offset, size_t size);
1748 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
1750 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
1751 struct event_context *ev,
1752 struct cli_state *cli,
1753 uint16_t fnum, off_t start_offset,
1754 SMB_OFF_T size, size_t window_size,
1755 NTSTATUS (*sink)(char *buf, size_t n,
1758 NTSTATUS cli_pull_recv(struct tevent_req *req, SMB_OFF_T *received);
1759 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
1760 off_t start_offset, SMB_OFF_T size, size_t window_size,
1761 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
1762 void *priv, SMB_OFF_T *received);
1763 ssize_t cli_read(struct cli_state *cli, uint16_t fnum, char *buf,
1764 off_t offset, size_t size);
1765 ssize_t cli_write(struct cli_state *cli,
1766 uint16_t fnum, uint16 write_mode,
1767 const char *buf, off_t offset, size_t size);
1768 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
1769 off_t offset, size_t size1, size_t *ptotal);
1770 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
1771 struct event_context *ev,
1772 struct cli_state *cli, uint16_t fnum,
1773 uint16_t mode, const uint8_t *buf,
1774 off_t offset, size_t size,
1775 struct tevent_req **reqs_before,
1776 int num_reqs_before,
1777 struct tevent_req **psmbreq);
1778 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
1779 struct event_context *ev,
1780 struct cli_state *cli, uint16_t fnum,
1781 uint16_t mode, const uint8_t *buf,
1782 off_t offset, size_t size);
1783 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
1785 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
1786 struct cli_state *cli,
1787 uint16_t fnum, uint16_t mode,
1788 off_t start_offset, size_t window_size,
1789 size_t (*source)(uint8_t *buf, size_t n,
1792 NTSTATUS cli_push_recv(struct tevent_req *req);
1793 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
1794 off_t start_offset, size_t window_size,
1795 size_t (*source)(uint8_t *buf, size_t n, void *priv),
1798 /* The following definitions come from libsmb/clisecdesc.c */
1800 struct security_descriptor *cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
1801 TALLOC_CTX *mem_ctx);
1802 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
1803 struct security_descriptor *sd);
1805 /* The following definitions come from libsmb/clispnego.c */
1807 DATA_BLOB spnego_gen_negTokenInit(TALLOC_CTX *ctx,
1809 DATA_BLOB *psecblob,
1810 const char *principal);
1812 #ifndef ASN1_MAX_OIDS
1813 #define ASN1_MAX_OIDS 20
1815 bool spnego_parse_negTokenInit(TALLOC_CTX *ctx,
1817 char *OIDs[ASN1_MAX_OIDS],
1819 DATA_BLOB *secblob);
1820 DATA_BLOB spnego_gen_krb5_wrap(TALLOC_CTX *ctx, const DATA_BLOB ticket, const uint8 tok_id[2]);
1821 bool spnego_parse_krb5_wrap(TALLOC_CTX *ctx, DATA_BLOB blob, DATA_BLOB *ticket, uint8 tok_id[2]);
1822 int spnego_gen_krb5_negTokenInit(TALLOC_CTX *ctx,
1823 const char *principal, int time_offset,
1825 DATA_BLOB *session_key_krb5, uint32 extra_ap_opts,
1826 time_t *expire_time);
1827 bool spnego_parse_challenge(TALLOC_CTX *ctx, const DATA_BLOB blob,
1828 DATA_BLOB *chal1, DATA_BLOB *chal2);
1829 DATA_BLOB spnego_gen_auth(TALLOC_CTX *ctx, DATA_BLOB blob);
1830 bool spnego_parse_auth(TALLOC_CTX *ctx, DATA_BLOB blob, DATA_BLOB *auth);
1831 DATA_BLOB spnego_gen_auth_response(TALLOC_CTX *ctx, DATA_BLOB *reply, NTSTATUS nt_status,
1832 const char *mechOID);
1833 bool spnego_parse_auth_response(TALLOC_CTX *ctx,
1834 DATA_BLOB blob, NTSTATUS nt_status,
1835 const char *mechOID,
1838 bool spnego_parse_auth_and_mic(TALLOC_CTX *ctx, DATA_BLOB blob,
1839 DATA_BLOB *auth, DATA_BLOB *signature);
1840 DATA_BLOB spnego_gen_auth_response_and_mic(TALLOC_CTX *ctx,
1842 const char *mechOID,
1844 DATA_BLOB *mechlistMIC);
1845 bool spnego_mech_list_blob(TALLOC_CTX *mem_ctx,
1846 char **oid_list, DATA_BLOB *data);
1848 /* The following definitions come from libsmb/clistr.c */
1850 size_t clistr_push_fn(struct cli_state *cli,
1855 size_t clistr_pull_fn(const char *inbuf,
1861 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
1868 size_t clistr_align_out(struct cli_state *cli, const void *p, int flags);
1870 /* The following definitions come from libsmb/clitrans.c */
1872 struct tevent_req *cli_trans_send(
1873 TALLOC_CTX *mem_ctx, struct event_context *ev,
1874 struct cli_state *cli, uint8_t cmd,
1875 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
1876 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
1877 uint8_t *param, uint32_t num_param, uint32_t max_param,
1878 uint8_t *data, uint32_t num_data, uint32_t max_data);
1879 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1880 uint16_t *recv_flags2,
1881 uint16_t **setup, uint8_t min_setup,
1883 uint8_t **param, uint32_t min_param,
1884 uint32_t *num_param,
1885 uint8_t **data, uint32_t min_data,
1886 uint32_t *num_data);
1887 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
1889 const char *pipe_name, uint16_t fid, uint16_t function,
1891 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
1892 uint8_t *param, uint32_t num_param, uint32_t max_param,
1893 uint8_t *data, uint32_t num_data, uint32_t max_data,
1894 uint16_t *recv_flags2,
1895 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
1896 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
1897 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
1899 /* The following definitions come from libsmb/conncache.c */
1901 NTSTATUS check_negative_conn_cache( const char *domain, const char *server);
1902 void add_failed_connection_entry(const char *domain, const char *server, NTSTATUS result) ;
1903 void flush_negative_conn_cache_for_domain(const char *domain);
1905 /* The following definitions come from libsmb/dsgetdcname.c */
1907 struct netr_DsRGetDCNameInfo;
1909 void debug_dsdcinfo_flags(int lvl, uint32_t flags);
1910 NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx,
1911 struct messaging_context *msg_ctx,
1912 const char *domain_name,
1913 const struct GUID *domain_guid,
1914 const char *site_name,
1916 struct netr_DsRGetDCNameInfo **info);
1918 /* The following definitions come from libsmb/errormap.c */
1920 NTSTATUS dos_to_ntstatus(uint8 eclass, uint32 ecode);
1921 void ntstatus_to_dos(NTSTATUS ntstatus, uint8 *eclass, uint32 *ecode);
1922 NTSTATUS werror_to_ntstatus(WERROR error);
1923 WERROR ntstatus_to_werror(NTSTATUS error);
1924 NTSTATUS map_nt_error_from_gss(uint32 gss_maj, uint32 minor);
1926 /* The following definitions come from libsmb/namecache.c */
1928 bool namecache_store(const char *name,
1931 struct ip_service *ip_list);
1932 bool namecache_fetch(const char *name,
1934 struct ip_service **ip_list,
1936 bool namecache_delete(const char *name, int name_type);
1937 void namecache_flush(void);
1938 bool namecache_status_store(const char *keyname, int keyname_type,
1939 int name_type, const struct sockaddr_storage *keyip,
1940 const char *srvname);
1941 bool namecache_status_fetch(const char *keyname,
1944 const struct sockaddr_storage *keyip,
1947 /* The following definitions come from libsmb/namequery.c */
1949 bool saf_store( const char *domain, const char *servername );
1950 bool saf_join_store( const char *domain, const char *servername );
1951 bool saf_delete( const char *domain );
1952 char *saf_fetch( const char *domain );
1953 struct tevent_req *node_status_query_send(TALLOC_CTX *mem_ctx,
1954 struct tevent_context *ev,
1955 struct nmb_name *name,
1956 const struct sockaddr_storage *addr);
1957 NTSTATUS node_status_query_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1958 struct node_status **pnode_status,
1960 struct node_status_extra *extra);
1961 NTSTATUS node_status_query(TALLOC_CTX *mem_ctx, struct nmb_name *name,
1962 const struct sockaddr_storage *addr,
1963 struct node_status **pnode_status,
1965 struct node_status_extra *extra);
1966 bool name_status_find(const char *q_name,
1969 const struct sockaddr_storage *to_ss,
1971 int ip_service_compare(struct ip_service *ss1, struct ip_service *ss2);
1972 struct tevent_req *name_query_send(TALLOC_CTX *mem_ctx,
1973 struct tevent_context *ev,
1974 const char *name, int name_type,
1975 bool bcast, bool recurse,
1976 const struct sockaddr_storage *addr);
1977 NTSTATUS name_query_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1978 struct sockaddr_storage **addrs, int *num_addrs,
1980 NTSTATUS name_query(const char *name, int name_type,
1981 bool bcast, bool recurse,
1982 const struct sockaddr_storage *to_ss,
1983 TALLOC_CTX *mem_ctx,
1984 struct sockaddr_storage **addrs,
1985 int *num_addrs, uint8_t *flags);
1986 NTSTATUS name_resolve_bcast(const char *name,
1988 struct ip_service **return_iplist,
1990 NTSTATUS resolve_wins(const char *name,
1992 struct ip_service **return_iplist,
1994 NTSTATUS internal_resolve_name(const char *name,
1996 const char *sitename,
1997 struct ip_service **return_iplist,
1999 const char *resolve_order);
2000 bool resolve_name(const char *name,
2001 struct sockaddr_storage *return_ss,
2004 NTSTATUS resolve_name_list(TALLOC_CTX *ctx,
2007 struct sockaddr_storage **return_ss_arr,
2008 unsigned int *p_num_entries);
2009 bool find_master_ip(const char *group, struct sockaddr_storage *master_ss);
2010 bool get_pdc_ip(const char *domain, struct sockaddr_storage *pss);
2011 NTSTATUS get_sorted_dc_list( const char *domain,
2012 const char *sitename,
2013 struct ip_service **ip_list,
2016 NTSTATUS get_kdc_list( const char *realm,
2017 const char *sitename,
2018 struct ip_service **ip_list,
2021 /* The following definitions come from libsmb/namequery_dc.c */
2023 bool get_dc_name(const char *domain,
2026 struct sockaddr_storage *ss_out);
2028 /* The following definitions come from libsmb/nterr.c */
2030 const char *nt_errstr(NTSTATUS nt_code);
2031 const char *get_friendly_nt_error_msg(NTSTATUS nt_code);
2032 const char *get_nt_error_c_code(NTSTATUS nt_code);
2033 NTSTATUS nt_status_string_to_code(const char *nt_status_str);
2034 NTSTATUS nt_status_squash(NTSTATUS nt_status);
2036 /* The following definitions come from libsmb/ntlmssp.c */
2037 struct ntlmssp_state;
2038 NTSTATUS ntlmssp_set_username(struct ntlmssp_state *ntlmssp_state, const char *user) ;
2039 NTSTATUS ntlmssp_set_hashes(struct ntlmssp_state *ntlmssp_state,
2040 const uint8_t lm_hash[16],
2041 const uint8_t nt_hash[16]) ;
2042 NTSTATUS ntlmssp_set_password(struct ntlmssp_state *ntlmssp_state, const char *password) ;
2043 NTSTATUS ntlmssp_set_domain(struct ntlmssp_state *ntlmssp_state, const char *domain) ;
2044 void ntlmssp_want_feature_list(struct ntlmssp_state *ntlmssp_state, char *feature_list);
2045 void ntlmssp_want_feature(struct ntlmssp_state *ntlmssp_state, uint32_t feature);
2046 NTSTATUS ntlmssp_update(struct ntlmssp_state *ntlmssp_state,
2047 const DATA_BLOB in, DATA_BLOB *out) ;
2048 NTSTATUS ntlmssp_server_start(TALLOC_CTX *mem_ctx,
2050 const char *netbios_name,
2051 const char *netbios_domain,
2052 const char *dns_name,
2053 const char *dns_domain,
2054 struct ntlmssp_state **ntlmssp_state);
2055 NTSTATUS ntlmssp_client_start(TALLOC_CTX *mem_ctx,
2056 const char *netbios_name,
2057 const char *netbios_domain,
2059 struct ntlmssp_state **_ntlmssp_state);
2061 /* The following definitions come from libsmb/passchange.c */
2063 NTSTATUS remote_password_change(const char *remote_machine, const char *user_name,
2064 const char *old_passwd, const char *new_passwd,
2067 /* The following definitions come from libsmb/samlogon_cache.c */
2069 bool netsamlogon_cache_init(void);
2070 bool netsamlogon_cache_shutdown(void);
2071 void netsamlogon_clear_cached_user(const struct dom_sid *user_sid);
2072 bool netsamlogon_cache_store(const char *username, struct netr_SamInfo3 *info3);
2073 struct netr_SamInfo3 *netsamlogon_cache_get(TALLOC_CTX *mem_ctx, const struct dom_sid *user_sid);
2074 bool netsamlogon_cache_have(const struct dom_sid *user_sid);
2076 /* The following definitions come from libsmb/smb_seal.c */
2078 NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16 *p_enc_ctx_num);
2079 bool common_encryption_on(struct smb_trans_enc_state *es);
2080 NTSTATUS common_ntlm_decrypt_buffer(struct ntlmssp_state *ntlmssp_state, char *buf);
2081 NTSTATUS common_ntlm_encrypt_buffer(struct ntlmssp_state *ntlmssp_state,
2085 NTSTATUS common_encrypt_buffer(struct smb_trans_enc_state *es, char *buffer, char **buf_out);
2086 NTSTATUS common_decrypt_buffer(struct smb_trans_enc_state *es, char *buf);
2087 void common_free_encryption_state(struct smb_trans_enc_state **pp_es);
2088 void common_free_enc_buffer(struct smb_trans_enc_state *es, char *buf);
2089 bool cli_encryption_on(struct cli_state *cli);
2090 void cli_free_encryption_context(struct cli_state *cli);
2091 void cli_free_enc_buffer(struct cli_state *cli, char *buf);
2092 NTSTATUS cli_decrypt_message(struct cli_state *cli);
2093 NTSTATUS cli_encrypt_message(struct cli_state *cli, char *buf, char **buf_out);
2095 /* The following definitions come from libsmb/clisigning.c */
2097 bool cli_simple_set_signing(struct cli_state *cli,
2098 const DATA_BLOB user_session_key,
2099 const DATA_BLOB response);
2100 bool cli_temp_set_signing(struct cli_state *cli);
2101 void cli_calculate_sign_mac(struct cli_state *cli, char *buf, uint32_t *seqnum);
2102 bool cli_check_sign_mac(struct cli_state *cli, const char *buf, uint32_t seqnum);
2103 bool client_is_signing_on(struct cli_state *cli);
2104 bool client_is_signing_allowed(struct cli_state *cli);
2105 bool client_is_signing_mandatory(struct cli_state *cli);
2106 void cli_set_signing_negotiated(struct cli_state *cli);
2108 /* The following definitions come from libsmb/smberr.c */
2110 const char *smb_dos_err_name(uint8 e_class, uint16 num);
2111 const char *get_dos_error_msg(WERROR result);
2112 const char *smb_dos_err_class(uint8 e_class);
2113 char *smb_dos_errstr(char *inbuf);
2114 WERROR map_werror_from_unix(int error);
2116 /* The following definitions come from libsmb/trustdom_cache.c */
2118 bool trustdom_cache_enable(void);
2119 bool trustdom_cache_shutdown(void);
2120 bool trustdom_cache_store(char* name, char* alt_name, const struct dom_sid *sid,
2122 bool trustdom_cache_fetch(const char* name, struct dom_sid* sid);
2123 uint32 trustdom_cache_fetch_timestamp( void );
2124 bool trustdom_cache_store_timestamp( uint32 t, time_t timeout );
2125 void trustdom_cache_flush(void);
2126 void update_trustdom_cache( void );
2128 /* The following definitions come from libsmb/trusts_util.c */
2130 NTSTATUS trust_pw_change_and_store_it(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
2132 const char *account_name,
2133 unsigned char orig_trust_passwd_hash[16],
2134 enum netr_SchannelType sec_channel_type);
2135 NTSTATUS trust_pw_find_change_and_store_it(struct rpc_pipe_client *cli,
2136 TALLOC_CTX *mem_ctx,
2137 const char *domain) ;
2138 bool enumerate_domain_trusts( TALLOC_CTX *mem_ctx, const char *domain,
2139 char ***domain_names, uint32 *num_domains,
2140 struct dom_sid **sids );
2141 NTSTATUS change_trust_account_password( const char *domain, const char *remote_machine);
2143 /* The following definitions come from modules/vfs_default.c */
2145 ssize_t vfswrap_llistxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size);
2146 ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size);
2147 NTSTATUS vfs_default_init(void);
2149 /* The following definitions come from param/loadparm.c */
2151 char *lp_smb_ports(void);
2152 char *lp_dos_charset(void);
2153 char *lp_unix_charset(void);
2154 char *lp_display_charset(void);
2155 char *lp_logfile(void);
2156 char *lp_configfile(void);
2157 char *lp_smb_passwd_file(void);
2158 char *lp_private_dir(void);
2159 char *lp_serverstring(void);
2160 int lp_printcap_cache_time(void);
2161 char *lp_addport_cmd(void);
2162 char *lp_enumports_cmd(void);
2163 char *lp_addprinter_cmd(void);
2164 char *lp_deleteprinter_cmd(void);
2165 char *lp_os2_driver_map(void);
2166 char *lp_lockdir(void);
2167 char *lp_statedir(void);
2168 char *lp_cachedir(void);
2169 char *lp_piddir(void);
2170 char *lp_mangling_method(void);
2171 int lp_mangle_prefix(void);
2172 char *lp_utmpdir(void);
2173 char *lp_wtmpdir(void);
2175 char *lp_rootdir(void);
2176 char *lp_defaultservice(void);
2177 char *lp_msg_command(void);
2178 char *lp_get_quota_command(void);
2179 char *lp_set_quota_command(void);
2180 char *lp_auto_services(void);
2181 char *lp_passwd_program(void);
2182 char *lp_passwd_chat(void);
2183 char *lp_passwordserver(void);
2184 char *lp_name_resolve_order(void);
2185 char *lp_realm(void);
2186 const char *lp_afs_username_map(void);
2187 int lp_afs_token_lifetime(void);
2188 char *lp_log_nt_token_command(void);
2189 char *lp_username_map(void);
2190 const char *lp_logon_script(void);
2191 const char *lp_logon_path(void);
2192 const char *lp_logon_drive(void);
2193 const char *lp_logon_home(void);
2194 char *lp_remote_announce(void);
2195 char *lp_remote_browse_sync(void);
2196 bool lp_nmbd_bind_explicit_broadcast(void);
2197 const char **lp_wins_server_list(void);
2198 const char **lp_interfaces(void);
2199 const char *lp_socket_address(void);
2200 char *lp_nis_home_map_name(void);
2201 const char **lp_netbios_aliases(void);
2202 const char *lp_passdb_backend(void);
2203 const char **lp_preload_modules(void);
2204 char *lp_panic_action(void);
2205 char *lp_adduser_script(void);
2206 char *lp_renameuser_script(void);
2207 char *lp_deluser_script(void);
2208 const char *lp_guestaccount(void);
2209 char *lp_addgroup_script(void);
2210 char *lp_delgroup_script(void);
2211 char *lp_addusertogroup_script(void);
2212 char *lp_deluserfromgroup_script(void);
2213 char *lp_setprimarygroup_script(void);
2214 char *lp_addmachine_script(void);
2215 char *lp_shutdown_script(void);
2216 char *lp_abort_shutdown_script(void);
2217 char *lp_username_map_script(void);
2218 int lp_username_map_cache_time(void);
2219 char *lp_check_password_script(void);
2220 char *lp_wins_hook(void);
2221 const char *lp_template_homedir(void);
2222 const char *lp_template_shell(void);
2223 const char *lp_winbind_separator(void);
2224 int lp_acl_compatibility(void);
2225 bool lp_winbind_enum_users(void);
2226 bool lp_winbind_enum_groups(void);
2227 bool lp_winbind_use_default_domain(void);
2228 bool lp_winbind_trusted_domains_only(void);
2229 bool lp_winbind_nested_groups(void);
2230 int lp_winbind_expand_groups(void);
2231 bool lp_winbind_refresh_tickets(void);
2232 bool lp_winbind_offline_logon(void);
2233 bool lp_winbind_normalize_names(void);
2234 bool lp_winbind_rpc_only(void);
2235 bool lp_create_krb5_conf(void);
2236 int lp_winbind_max_domain_connections(void);
2237 const char *lp_idmap_backend(void);
2238 int lp_idmap_cache_time(void);
2239 int lp_idmap_negative_cache_time(void);
2240 int lp_keepalive(void);
2241 bool lp_passdb_expand_explicit(void);
2242 char *lp_ldap_suffix(void);
2243 char *lp_ldap_admin_dn(void);
2244 int lp_ldap_ssl(void);
2245 bool lp_ldap_ssl_ads(void);
2246 int lp_ldap_deref(void);
2247 int lp_ldap_follow_referral(void);
2248 int lp_ldap_passwd_sync(void);
2249 bool lp_ldap_delete_dn(void);
2250 int lp_ldap_replication_sleep(void);
2251 int lp_ldap_timeout(void);
2252 int lp_ldap_connection_timeout(void);
2253 int lp_ldap_page_size(void);
2254 int lp_ldap_debug_level(void);
2255 int lp_ldap_debug_threshold(void);
2256 char *lp_add_share_cmd(void);
2257 char *lp_change_share_cmd(void);
2258 char *lp_delete_share_cmd(void);
2259 char *lp_usershare_path(void);
2260 const char **lp_usershare_prefix_allow_list(void);
2261 const char **lp_usershare_prefix_deny_list(void);
2262 const char **lp_eventlog_list(void);
2263 bool lp_registry_shares(void);
2264 bool lp_usershare_allow_guests(void);
2265 bool lp_usershare_owner_only(void);
2266 bool lp_disable_netbios(void);
2267 bool lp_reset_on_zero_vc(void);
2268 bool lp_log_writeable_files_on_exit(void);
2269 bool lp_ms_add_printer_wizard(void);
2270 bool lp_dns_proxy(void);
2271 bool lp_wins_support(void);
2272 bool lp_we_are_a_wins_server(void);
2273 bool lp_wins_proxy(void);
2274 bool lp_local_master(void);
2275 bool lp_domain_logons(void);
2276 const char **lp_init_logon_delayed_hosts(void);
2277 int lp_init_logon_delay(void);
2278 bool lp_load_printers(void);
2279 bool lp_readraw(void);
2280 bool _lp_readraw(void);
2281 bool lp_large_readwrite(void);
2282 bool lp_writeraw(void);
2283 bool _lp_writeraw(void);
2284 bool lp_null_passwords(void);
2285 bool lp_obey_pam_restrictions(void);
2286 bool lp_encrypted_passwords(void);
2287 int lp_client_schannel(void);
2288 int lp_server_schannel(void);
2289 bool lp_syslog_only(void);
2290 bool lp_timestamp_logs(void);
2291 bool lp_debug_prefix_timestamp(void);
2292 bool lp_debug_hires_timestamp(void);
2293 bool lp_debug_pid(void);
2294 bool lp_debug_uid(void);
2295 bool lp_debug_class(void);
2296 bool lp_enable_core_files(void);
2297 bool lp_browse_list(void);
2298 bool lp_nis_home_map(void);
2299 bool lp_bind_interfaces_only(void);
2300 bool lp_pam_password_change(void);
2301 bool lp_unix_password_sync(void);
2302 bool lp_passwd_chat_debug(void);
2303 int lp_passwd_chat_timeout(void);
2304 bool lp_nt_pipe_support(void);
2305 bool lp_nt_status_support(void);
2306 bool lp_stat_cache(void);
2307 int lp_max_stat_cache_size(void);
2308 bool lp_allow_trusted_domains(void);
2309 bool lp_map_untrusted_to_domain(void);
2310 int lp_restrict_anonymous(void);
2311 bool lp_lanman_auth(void);
2312 bool lp_ntlm_auth(void);
2313 bool lp_client_plaintext_auth(void);
2314 bool lp_client_lanman_auth(void);
2315 bool lp_client_ntlmv2_auth(void);
2316 bool lp_host_msdfs(void);
2317 bool lp_kernel_oplocks(void);
2318 bool lp_enhanced_browsing(void);
2319 bool lp_use_mmap(void);
2320 bool lp_unix_extensions(void);
2321 bool lp_use_spnego(void);
2322 bool lp_client_use_spnego(void);
2323 bool lp_client_use_spnego_principal(void);
2324 bool lp_send_spnego_principal(void);
2325 bool lp_hostname_lookups(void);
2326 bool lp_change_notify(const struct share_params *p );
2327 bool lp_kernel_change_notify(const struct share_params *p );
2328 char * lp_dedicated_keytab_file(void);
2329 int lp_kerberos_method(void);
2330 bool lp_defer_sharing_violations(void);
2331 bool lp_enable_privileges(void);
2332 bool lp_enable_asu_support(void);
2333 int lp_os_level(void);
2334 int lp_max_ttl(void);
2335 int lp_max_wins_ttl(void);
2336 int lp_min_wins_ttl(void);
2337 int lp_max_log_size(void);
2338 int lp_max_open_files(void);
2339 int lp_open_files_db_hash_size(void);
2340 int lp_maxxmit(void);
2341 int lp_maxmux(void);
2342 int lp_passwordlevel(void);
2343 int lp_usernamelevel(void);
2344 int lp_deadtime(void);
2345 bool lp_getwd_cache(void);
2346 int lp_maxprotocol(void);
2347 int lp_minprotocol(void);
2348 int lp_security(void);
2349 const char **lp_auth_methods(void);
2350 bool lp_paranoid_server_security(void);
2351 int lp_maxdisksize(void);
2352 int lp_lpqcachetime(void);
2353 int lp_max_smbd_processes(void);
2354 bool _lp_disable_spoolss(void);
2355 int lp_syslog(void);
2356 int lp_lm_announce(void);
2357 int lp_lm_interval(void);
2358 int lp_machine_password_timeout(void);
2359 int lp_map_to_guest(void);
2360 int lp_oplock_break_wait_time(void);
2361 int lp_lock_spin_time(void);
2362 int lp_usershare_max_shares(void);
2363 const char *lp_socket_options(void);
2364 int lp_config_backend(void);
2365 int lp_smb2_max_read(void);
2366 int lp_smb2_max_write(void);
2367 int lp_smb2_max_trans(void);
2368 int lp_smb2_max_credits(void);
2369 char *lp_preexec(int );
2370 char *lp_postexec(int );
2371 char *lp_rootpreexec(int );
2372 char *lp_rootpostexec(int );
2373 char *lp_servicename(int );
2374 const char *lp_const_servicename(int );
2375 char *lp_pathname(int );
2376 char *lp_dontdescend(int );
2377 char *lp_username(int );
2378 const char **lp_invalid_users(int );
2379 const char **lp_valid_users(int );
2380 const char **lp_admin_users(int );
2381 const char **lp_svcctl_list(void);
2382 char *lp_cups_options(int );
2383 char *lp_cups_server(void);
2384 int lp_cups_encrypt(void);
2385 char *lp_iprint_server(void);
2386 int lp_cups_connection_timeout(void);
2387 const char *lp_ctdbd_socket(void);
2388 const char **lp_cluster_addresses(void);
2389 bool lp_clustering(void);
2390 int lp_ctdb_timeout(void);
2391 int lp_ctdb_locktime_warn_threshold(void);
2392 char *lp_printcommand(int );
2393 char *lp_lpqcommand(int );
2394 char *lp_lprmcommand(int );
2395 char *lp_lppausecommand(int );
2396 char *lp_lpresumecommand(int );
2397 char *lp_queuepausecommand(int );
2398 char *lp_queueresumecommand(int );
2399 const char *lp_printjob_username(int );
2400 const char **lp_hostsallow(int );
2401 const char **lp_hostsdeny(int );
2402 char *lp_magicscript(int );
2403 char *lp_magicoutput(int );
2404 char *lp_comment(int );
2405 char *lp_force_user(int );
2406 char *lp_force_group(int );
2407 const char **lp_readlist(int );
2408 const char **lp_writelist(int );
2409 const char **lp_printer_admin(int );
2410 char *lp_fstype(int );
2411 const char **lp_vfs_objects(int );
2412 char *lp_msdfs_proxy(int );
2413 char *lp_veto_files(int );
2414 char *lp_hide_files(int );
2415 char *lp_veto_oplocks(int );
2416 bool lp_msdfs_root(int );
2417 char *lp_aio_write_behind(int );
2418 char *lp_dfree_command(int );
2419 bool lp_autoloaded(int );
2420 bool lp_preexec_close(int );
2421 bool lp_rootpreexec_close(int );
2422 int lp_casesensitive(int );
2423 bool lp_preservecase(int );
2424 bool lp_shortpreservecase(int );
2425 bool lp_hide_dot_files(int );
2426 bool lp_hide_special_files(int );
2427 bool lp_hideunreadable(int );
2428 bool lp_hideunwriteable_files(int );
2429 bool lp_browseable(int );
2430 bool lp_access_based_share_enum(int );
2431 bool lp_readonly(int );
2432 bool lp_no_set_dir(int );
2433 bool lp_guest_ok(int );
2434 bool lp_guest_only(int );
2435 bool lp_administrative_share(int );
2436 bool lp_print_ok(int );
2437 bool lp_print_notify_backchannel(int );
2438 bool lp_map_hidden(int );
2439 bool lp_map_archive(int );
2440 bool lp_store_dos_attributes(int );
2441 bool lp_dmapi_support(int );
2442 bool lp_locking(const struct share_params *p );
2443 int lp_strict_locking(const struct share_params *p );
2444 bool lp_posix_locking(const struct share_params *p );
2445 bool lp_share_modes(int );
2446 bool lp_oplocks(int );
2447 bool lp_level2_oplocks(int );
2448 bool lp_onlyuser(int );
2449 bool lp_manglednames(const struct share_params *p );
2450 bool lp_widelinks(int );
2451 bool lp_symlinks(int );
2452 bool lp_syncalways(int );
2453 bool lp_strict_allocate(int );
2454 bool lp_strict_sync(int );
2455 bool lp_map_system(int );
2456 bool lp_delete_readonly(int );
2457 bool lp_fake_oplocks(int );
2458 bool lp_recursive_veto_delete(int );
2459 bool lp_dos_filemode(int );
2460 bool lp_dos_filetimes(int );
2461 bool lp_dos_filetime_resolution(int );
2462 bool lp_fake_dir_create_times(int);
2463 bool lp_async_smb_echo_handler(void);
2464 bool lp_multicast_dns_register(void);
2465 bool lp_blocking_locks(int );
2466 bool lp_inherit_perms(int );
2467 bool lp_inherit_acls(int );
2468 bool lp_inherit_owner(int );
2469 bool lp_use_client_driver(int );
2470 bool lp_default_devmode(int );
2471 bool lp_force_printername(int );
2472 bool lp_nt_acl_support(int );
2473 bool lp_force_unknown_acl_user(int );
2474 bool lp_ea_support(int );
2475 bool _lp_use_sendfile(int );
2476 bool lp_profile_acls(int );
2477 bool lp_map_acl_inherit(int );
2478 bool lp_afs_share(int );
2479 bool lp_acl_check_permissions(int );
2480 bool lp_acl_group_control(int );
2481 bool lp_acl_map_full_control(int );
2482 int lp_create_mask(int );
2483 int lp_force_create_mode(int );
2484 int lp_security_mask(int );
2485 int lp_force_security_mode(int );
2486 int lp_dir_mask(int );
2487 int lp_force_dir_mode(int );
2488 int lp_dir_security_mask(int );
2489 int lp_force_dir_security_mode(int );
2490 int lp_max_connections(int );
2491 int lp_defaultcase(int );
2492 int lp_minprintspace(int );
2493 int lp_printing(int );
2494 int lp_max_reported_jobs(int );
2495 int lp_oplock_contention_limit(int );
2496 int lp_csc_policy(int );
2497 int lp_write_cache_size(int );
2498 int lp_block_size(int );
2499 int lp_dfree_cache_time(int );
2500 int lp_allocation_roundup_size(int );
2501 int lp_aio_read_size(int );
2502 int lp_aio_write_size(int );
2503 int lp_map_readonly(int );
2504 int lp_directory_name_cache_size(int );
2505 int lp_smb_encrypt(int );
2506 char lp_magicchar(const struct share_params *p );
2507 int lp_winbind_cache_time(void);
2508 int lp_winbind_reconnect_delay(void);
2509 int lp_winbind_max_clients(void);
2510 const char **lp_winbind_nss_info(void);
2511 int lp_algorithmic_rid_base(void);
2512 int lp_name_cache_timeout(void);
2513 int lp_client_signing(void);
2514 int lp_server_signing(void);
2515 int lp_client_ldap_sasl_wrapping(void);
2516 char *lp_parm_talloc_string(int snum, const char *type, const char *option, const char *def);
2517 const char *lp_parm_const_string(int snum, const char *type, const char *option, const char *def);
2518 const char **lp_parm_string_list(int snum, const char *type, const char *option, const char **def);
2519 int lp_parm_int(int snum, const char *type, const char *option, int def);
2520 unsigned long lp_parm_ulong(int snum, const char *type, const char *option, unsigned long def);
2521 bool lp_parm_bool(int snum, const char *type, const char *option, bool def);
2522 int lp_parm_enum(int snum, const char *type, const char *option,
2523 const struct enum_list *_enum, int def);
2524 char *canonicalize_servicename(TALLOC_CTX *ctx, const char *src);
2525 bool lp_add_home(const char *pszHomename, int iDefaultService,
2526 const char *user, const char *pszHomedir);
2527 int lp_add_service(const char *pszService, int iDefaultService);
2528 bool lp_add_printer(const char *pszPrintername, int iDefaultService);
2529 bool lp_parameter_is_valid(const char *pszParmName);
2530 bool lp_parameter_is_global(const char *pszParmName);
2531 bool lp_parameter_is_canonical(const char *parm_name);
2532 bool lp_canonicalize_parameter(const char *parm_name, const char **canon_parm,
2534 bool lp_canonicalize_parameter_with_value(const char *parm_name,
2536 const char **canon_parm,
2537 const char **canon_val);
2538 void show_parameter_list(void);
2539 bool lp_string_is_valid_boolean(const char *parm_value);
2540 bool lp_invert_boolean(const char *str, const char **inverse_str);
2541 bool lp_canonicalize_boolean(const char *str, const char**canon_str);
2542 bool service_ok(int iService);
2543 bool process_registry_service(const char *service_name);
2544 bool process_registry_shares(void);
2545 bool lp_config_backend_is_registry(void);
2546 bool lp_config_backend_is_file(void);
2547 bool lp_file_list_changed(void);
2548 bool lp_idmap_uid(uid_t *low, uid_t *high);
2549 bool lp_idmap_gid(gid_t *low, gid_t *high);
2550 const char *lp_ldap_machine_suffix(void);
2551 const char *lp_ldap_user_suffix(void);
2552 const char *lp_ldap_group_suffix(void);
2553 const char *lp_ldap_idmap_suffix(void);
2554 void *lp_local_ptr_by_snum(int snum, void *ptr);
2555 bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue);
2556 bool lp_set_cmdline(const char *pszParmName, const char *pszParmValue);
2557 bool lp_set_option(const char *option);
2558 void init_locals(void);
2559 bool lp_is_default(int snum, struct parm_struct *parm);
2560 bool dump_a_parameter(int snum, char *parm_name, FILE * f, bool isGlobal);
2561 struct parm_struct *lp_get_parameter(const char *param_name);
2562 struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters);
2563 bool lp_snum_ok(int iService);
2564 void lp_add_one_printer(const char *name, const char *comment, void *pdata);
2565 bool lp_loaded(void);
2566 void lp_killunused(bool (*snumused) (int));
2567 void lp_kill_all_services(void);
2568 void lp_killservice(int iServiceIn);
2569 const char* server_role_str(uint32 role);
2570 enum usershare_err parse_usershare_file(TALLOC_CTX *ctx,
2571 SMB_STRUCT_STAT *psbuf,
2572 const char *servicename,
2576 char **pp_sharepath,
2578 char **pp_cp_share_name,
2579 struct security_descriptor **ppsd,
2580 bool *pallow_guest);
2581 int load_usershare_service(const char *servicename);
2582 int load_usershare_shares(void);
2583 void gfree_loadparm(void);
2584 void lp_set_in_client(bool b);
2585 bool lp_is_in_client(void);
2586 bool lp_load(const char *pszFname,
2590 bool initialize_globals);
2591 bool lp_load_initial_only(const char *pszFname);
2592 bool lp_load_with_registry_shares(const char *pszFname,
2596 bool initialize_globals);
2597 int lp_numservices(void);
2598 void lp_dump(FILE *f, bool show_defaults, int maxtoprint);
2599 void lp_dump_one(FILE * f, bool show_defaults, int snum);
2600 int lp_servicenumber(const char *pszServiceName);
2601 bool share_defined(const char *service_name);
2602 struct share_params *get_share_params(TALLOC_CTX *mem_ctx,
2603 const char *sharename);
2604 struct share_iterator *share_list_all(TALLOC_CTX *mem_ctx);
2605 struct share_params *next_share(struct share_iterator *list);
2606 struct share_params *next_printer(struct share_iterator *list);
2607 struct share_params *snum2params_static(int snum);
2608 const char *volume_label(int snum);
2609 bool lp_domain_master(void);
2610 bool lp_domain_master_true_or_auto(void);
2611 bool lp_preferred_master(void);
2612 void lp_remove_service(int snum);
2613 void lp_copy_service(int snum, const char *new_name);
2614 int lp_default_server_announce(void);
2615 int lp_major_announce_version(void);
2616 int lp_minor_announce_version(void);
2617 void lp_set_name_resolve_order(const char *new_order);
2618 const char *lp_printername(int snum);
2619 void lp_set_logfile(const char *name);
2620 int lp_maxprintjobs(int snum);
2621 const char *lp_printcapname(void);
2622 bool lp_disable_spoolss( void );
2623 void lp_set_spoolss_state( uint32 state );
2624 uint32 lp_get_spoolss_state( void );
2625 bool lp_use_sendfile(int snum, struct smb_signing_state *signing_state);
2626 void set_use_sendfile(int snum, bool val);
2627 void set_store_dos_attributes(int snum, bool val);
2628 void lp_set_mangling_method(const char *new_method);
2629 bool lp_posix_pathnames(void);
2630 void lp_set_posix_pathnames(void);
2631 enum brl_flavour lp_posix_cifsu_locktype(files_struct *fsp);
2632 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val);
2633 int lp_min_receive_file_size(void);
2634 char* lp_perfcount_module(void);
2635 void lp_set_passdb_backend(const char *backend);
2636 void widelinks_warning(int snum);
2637 char *lp_ncalrpc_dir(void);
2639 /* The following definitions come from param/loadparm_server_role.c */
2641 int lp_server_role(void);
2642 void set_server_role(void);
2644 /* The following definitions come from param/util.c */
2646 uint32 get_int_param( const char* param );
2647 char* get_string_param( const char* param );
2649 /* The following definitions come from librpc/rpc/rpc_common.c */
2650 struct ndr_interface_table;
2651 bool smb_register_ndr_interface(const struct ndr_interface_table *interface);
2652 const struct ndr_interface_table *get_iface_from_syntax(
2653 const struct ndr_syntax_id *syntax);
2654 const char *get_pipe_name_from_syntax(TALLOC_CTX *mem_ctx,
2655 const struct ndr_syntax_id *syntax);
2657 /* The following definitions come from rpc_server/rpc_ncacn_np.c */
2658 struct auth_serversupplied_info;
2659 struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx,
2660 const struct ndr_syntax_id *syntax,
2661 struct client_address *client_id,
2662 const struct auth_serversupplied_info *session_info,
2663 struct messaging_context *msg_ctx);
2664 struct dcerpc_binding_handle;
2665 NTSTATUS rpcint_binding_handle(TALLOC_CTX *mem_ctx,
2666 const struct ndr_interface_table *ndr_table,
2667 struct client_address *client_id,
2668 const struct auth_serversupplied_info *session_info,
2669 struct messaging_context *msg_ctx,
2670 struct dcerpc_binding_handle **binding_handle);
2671 NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx,
2672 const struct ndr_syntax_id *abstract_syntax,
2673 const struct auth_serversupplied_info *serversupplied_info,
2674 struct client_address *client_id,
2675 struct messaging_context *msg_ctx,
2676 struct rpc_pipe_client **presult);
2677 NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx,
2678 const struct ndr_syntax_id *syntax,
2679 const struct auth_serversupplied_info *session_info,
2680 struct client_address *client_id,
2681 struct messaging_context *msg_ctx,
2682 struct rpc_pipe_client **cli_pipe);
2684 /* The following definitions come from rpc_client/cli_pipe_schannel.c */
2686 NTSTATUS get_schannel_session_key(struct cli_state *cli,
2689 struct rpc_pipe_client **presult);
2691 /* The following definitions come from rpc_server/rpc_handles.c */
2693 size_t num_pipe_handles(struct pipes_struct *p);
2694 bool init_pipe_handles(struct pipes_struct *p, const struct ndr_syntax_id *syntax);
2695 bool create_policy_hnd(struct pipes_struct *p, struct policy_handle *hnd, void *data_ptr);
2696 bool find_policy_by_hnd(struct pipes_struct *p, const struct policy_handle *hnd,
2698 bool close_policy_hnd(struct pipes_struct *p, struct policy_handle *hnd);
2699 void close_policy_by_pipe(struct pipes_struct *p);
2700 bool pipe_access_check(struct pipes_struct *p);
2702 void *_policy_handle_create(struct pipes_struct *p, struct policy_handle *hnd,
2703 uint32_t access_granted, size_t data_size,
2704 const char *type, NTSTATUS *pstatus);
2705 #define policy_handle_create(_p, _hnd, _access, _type, _pstatus) \
2706 (_type *)_policy_handle_create((_p), (_hnd), (_access), sizeof(_type), #_type, \
2709 void *_policy_handle_find(struct pipes_struct *p,
2710 const struct policy_handle *hnd,
2711 uint32_t access_required, uint32_t *paccess_granted,
2712 const char *name, const char *location,
2714 #define policy_handle_find(_p, _hnd, _access_required, _access_granted, _type, _pstatus) \
2715 (_type *)_policy_handle_find((_p), (_hnd), (_access_required), \
2716 (_access_granted), #_type, __location__, (_pstatus))
2719 /* The following definitions come from rpc_server/srv_rpc_register.c */
2721 struct rpc_srv_callbacks {
2722 bool (*init)(void *private_data);
2723 bool (*shutdown)(void *private_data);
2728 NTSTATUS rpc_srv_register(int version, const char *clnt,
2730 const struct ndr_interface_table *iface,
2731 const struct api_struct *cmds, int size,
2732 const struct rpc_srv_callbacks *rpc_srv_cb);
2734 NTSTATUS rpc_srv_unregister(const struct ndr_interface_table *iface);
2736 /* The following definitions come from rpc_server/srv_pipe.c */
2737 struct ncacn_packet;
2738 bool create_next_pdu(struct pipes_struct *p);
2739 bool api_pipe_bind_auth3(struct pipes_struct *p, struct ncacn_packet *pkt);
2740 bool setup_fault_pdu(struct pipes_struct *p, NTSTATUS status);
2741 NTSTATUS rpc_pipe_register_commands(int version, const char *clnt,
2743 const struct ndr_syntax_id *interface,
2744 const struct api_struct *cmds, int size);
2745 bool is_known_pipename(const char *cli_filename, struct ndr_syntax_id *syntax);
2747 /* The following definitions come from rpc_server/srv_pipe_hnd.c */
2749 struct pipes_struct *get_first_internal_pipe(void);
2750 struct pipes_struct *get_next_internal_pipe(struct pipes_struct *p);
2751 bool check_open_pipes(void);
2752 int close_internal_rpc_pipe_hnd(struct pipes_struct *p);
2754 bool fsp_is_np(struct files_struct *fsp);
2755 struct tsocket_address;
2756 NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name,
2757 const struct tsocket_address *local_address,
2758 const struct tsocket_address *remote_address,
2759 struct client_address *client_id,
2760 struct auth_serversupplied_info *session_info,
2761 struct messaging_context *msg_ctx,
2762 struct fake_file_handle **phandle);
2763 bool np_read_in_progress(struct fake_file_handle *handle);
2764 struct tevent_req *np_write_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
2765 struct fake_file_handle *handle,
2766 const uint8_t *data, size_t len);
2767 NTSTATUS np_write_recv(struct tevent_req *req, ssize_t *pnwritten);
2768 struct tevent_req *np_read_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
2769 struct fake_file_handle *handle,
2770 uint8_t *data, size_t len);
2771 NTSTATUS np_read_recv(struct tevent_req *req, ssize_t *nread,
2772 bool *is_data_outstanding);
2774 ssize_t process_incoming_data(struct pipes_struct *p, char *data, size_t n);
2776 /* The following definitions come from rpc_server/srv_spoolss_nt.c */
2777 void srv_spoolss_cleanup(void);
2779 void do_drv_upgrade_printer(struct messaging_context *msg,
2782 struct server_id server_id,
2784 void update_monitored_printq_cache(struct messaging_context *msg_ctx);
2786 /* The following definitions come from rpc_server/srv_srvsvc_nt.c */
2788 char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname);
2790 /* The following definitions come from rpc_server/srv_svcctl_nt.c */
2792 bool init_service_op_table( void );
2793 bool shutdown_service_op_table(void);
2795 /* The following definitions come from lib/server_contexts.c */
2796 struct tevent_context *server_event_context(void);
2797 void server_event_context_free(void);
2798 struct messaging_context *server_messaging_context(void);
2799 void server_messaging_context_free(void);
2801 /* The following definitions come from lib/sessionid_tdb.c */
2803 bool sessionid_init(void);
2804 struct db_record *sessionid_fetch_record(TALLOC_CTX *mem_ctx, const char *key);
2805 int sessionid_traverse(int (*fn)(struct db_record *rec, const char *key,
2806 struct sessionid *session,
2807 void *private_data),
2808 void *private_data);
2809 int sessionid_traverse_read(int (*fn)(const char *key,
2810 struct sessionid *session,
2811 void *private_data),
2812 void *private_data);
2814 /* The following definitions come from utils/passwd_util.c */
2816 char *stdin_new_passwd( void);
2817 char *get_pass( const char *prompt, bool stdin_get);
2819 /* The following definitions come from winbindd/nss_info.c */
2822 /* The following definitions come from winbindd/nss_info_template.c */
2824 NTSTATUS nss_info_template_init( void );
2826 /* The following definitions come from lib/avahi.c */
2828 struct AvahiPoll *tevent_avahi_poll(TALLOC_CTX *mem_ctx,
2829 struct tevent_context *ev);
2831 /* The following definitions come from lib/fncall.c */
2833 struct fncall_context *fncall_context_init(TALLOC_CTX *mem_ctx,
2835 struct tevent_req *fncall_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
2836 struct fncall_context *ctx,
2837 void (*fn)(void *private_data),
2838 void *private_data);
2839 int fncall_recv(struct tevent_req *req, int *perr);
2841 /* The following definitions come from libsmb/smbsock_connect.c */
2843 struct tevent_req *smbsock_connect_send(TALLOC_CTX *mem_ctx,
2844 struct tevent_context *ev,
2845 const struct sockaddr_storage *addr,
2847 const char *called_name,
2849 const char *calling_name,
2851 NTSTATUS smbsock_connect_recv(struct tevent_req *req, int *sock,
2852 uint16_t *ret_port);
2853 NTSTATUS smbsock_connect(const struct sockaddr_storage *addr, uint16_t port,
2854 const char *called_name, int called_type,
2855 const char *calling_name, int calling_type,
2856 int *pfd, uint16_t *ret_port);
2858 struct tevent_req *smbsock_any_connect_send(TALLOC_CTX *mem_ctx,
2859 struct tevent_context *ev,
2860 const struct sockaddr_storage *addrs,
2861 const char **called_names,
2863 const char **calling_names,
2865 size_t num_addrs, uint16_t port);
2866 NTSTATUS smbsock_any_connect_recv(struct tevent_req *req, int *pfd,
2867 size_t *chosen_index, uint16_t *chosen_port);
2868 NTSTATUS smbsock_any_connect(const struct sockaddr_storage *addrs,
2869 const char **called_names,
2871 const char **calling_names,
2875 int *pfd, size_t *chosen_index,
2876 uint16_t *chosen_port);
2878 /* The following definitions come from lib/util_wellknown.c */
2880 bool sid_check_is_wellknown_domain(const struct dom_sid *sid, const char **name);
2881 bool sid_check_is_in_wellknown_domain(const struct dom_sid *sid);
2882 bool lookup_wellknown_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
2883 const char **domain, const char **name);
2884 bool lookup_wellknown_name(TALLOC_CTX *mem_ctx, const char *name,
2885 struct dom_sid *sid, const char **domain);
2887 /* The following definitions come from lib/util_unixsids.c */
2889 bool sid_check_is_unix_users(const struct dom_sid *sid);
2890 bool sid_check_is_in_unix_users(const struct dom_sid *sid);
2891 void uid_to_unix_users_sid(uid_t uid, struct dom_sid *sid);
2892 void gid_to_unix_groups_sid(gid_t gid, struct dom_sid *sid);
2893 const char *unix_users_domain_name(void);
2894 bool lookup_unix_user_name(const char *name, struct dom_sid *sid);
2895 bool sid_check_is_unix_groups(const struct dom_sid *sid);
2896 bool sid_check_is_in_unix_groups(const struct dom_sid *sid);
2897 const char *unix_groups_domain_name(void);
2898 bool lookup_unix_group_name(const char *name, struct dom_sid *sid);
2900 /* The following definitions come from lib/filename_util.c */
2902 NTSTATUS get_full_smb_filename(TALLOC_CTX *ctx, const struct smb_filename *smb_fname,
2904 NTSTATUS create_synthetic_smb_fname(TALLOC_CTX *ctx, const char *base_name,
2905 const char *stream_name,
2906 const SMB_STRUCT_STAT *psbuf,
2907 struct smb_filename **smb_fname_out);
2908 NTSTATUS create_synthetic_smb_fname_split(TALLOC_CTX *ctx,
2910 const SMB_STRUCT_STAT *psbuf,
2911 struct smb_filename **smb_fname_out);
2912 const char *smb_fname_str_dbg(const struct smb_filename *smb_fname);
2913 const char *fsp_str_dbg(const struct files_struct *fsp);
2914 NTSTATUS copy_smb_filename(TALLOC_CTX *ctx,
2915 const struct smb_filename *smb_fname_in,
2916 struct smb_filename **smb_fname_out);
2917 bool is_ntfs_stream_smb_fname(const struct smb_filename *smb_fname);
2918 bool is_ntfs_default_stream_smb_fname(const struct smb_filename *smb_fname);
2920 /* The following definitions come from lib/dummyroot.c */
2922 void become_root(void);
2923 void unbecome_root(void);
2925 /* The following definitions come from lib/dummysmbd.c */
2927 int find_service(TALLOC_CTX *ctx, const char *service_in, char **p_service_out);
2928 bool conn_snum_used(int snum);
2929 void cancel_pending_lock_requests_by_fid(files_struct *fsp,
2930 struct byte_range_lock *br_lck,
2931 enum file_close_type close_type);
2932 void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
2934 NTSTATUS can_delete_directory(struct connection_struct *conn,
2935 const char *dirname);
2936 bool change_to_root_user(void);
2937 struct event_context *smbd_event_context(void);
2938 void contend_level2_oplocks_begin(files_struct *fsp,
2939 enum level2_contention_type type);
2940 void contend_level2_oplocks_end(files_struct *fsp,
2941 enum level2_contention_type type);
2943 #endif /* _PROTO_H_ */