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