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