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