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