b5b1c860fc3589bb8ea90db2fe499f87d3495866
[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 NTSTATUS make_server_info_sam(struct auth_serversupplied_info **server_info,
127                               struct samu *sampass);
128 NTSTATUS create_local_token(struct auth_serversupplied_info *server_info);
129 NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
130                                     bool is_guest,
131                                     uid_t *uid, gid_t *gid,
132                                     char **found_username,
133                                     struct security_token **token);
134 bool user_in_group_sid(const char *username, const struct dom_sid *group_sid);
135 bool user_in_group(const char *username, const char *groupname);
136 NTSTATUS make_server_info_pw(struct auth_serversupplied_info **server_info,
137                              char *unix_username,
138                              struct passwd *pwd);
139 NTSTATUS make_serverinfo_from_username(TALLOC_CTX *mem_ctx,
140                                        const char *username,
141                                        bool is_guest,
142                                        struct auth_serversupplied_info **presult);
143 struct auth_serversupplied_info *copy_serverinfo(TALLOC_CTX *mem_ctx,
144                                                  const struct auth_serversupplied_info *src);
145 bool init_guest_info(void);
146 NTSTATUS init_system_info(void);
147 bool session_info_set_session_key(struct auth_serversupplied_info *info,
148                                  DATA_BLOB session_key);
149 NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx,
150                                 struct auth_serversupplied_info **server_info);
151 NTSTATUS make_session_info_system(TALLOC_CTX *mem_ctx,
152                                  struct auth_serversupplied_info **session_info);
153 const struct auth_serversupplied_info *get_session_info_system(void);
154 bool copy_current_user(struct current_user *dst, struct current_user *src);
155 struct passwd *smb_getpwnam( TALLOC_CTX *mem_ctx, const char *domuser,
156                              char **p_save_username, bool create );
157 NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx, 
158                                 const char *sent_nt_username,
159                                 const char *domain,
160                                 struct auth_serversupplied_info **server_info,
161                                 struct netr_SamInfo3 *info3);
162 NTSTATUS make_server_info_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
163                                           const char *sent_nt_username,
164                                           const char *domain,
165                                           const struct wbcAuthUserInfo *info,
166                                           struct auth_serversupplied_info **server_info);
167 void free_user_info(struct auth_usersupplied_info **user_info);
168 bool make_auth_methods(struct auth_context *auth_context, auth_methods **auth_method) ;
169 bool is_trusted_domain(const char* dom_name);
170
171 /* The following definitions come from auth/user_info.c  */
172
173 NTSTATUS make_user_info(struct auth_usersupplied_info **ret_user_info,
174                         const char *smb_name,
175                         const char *internal_username,
176                         const char *client_domain,
177                         const char *domain,
178                         const char *workstation_name,
179                         const DATA_BLOB *lm_pwd,
180                         const DATA_BLOB *nt_pwd,
181                         const struct samr_Password *lm_interactive_pwd,
182                         const struct samr_Password *nt_interactive_pwd,
183                         const char *plaintext_password,
184                         enum auth_password_state password_state);
185 void free_user_info(struct auth_usersupplied_info **user_info);
186
187 /* The following definitions come from auth/auth_winbind.c  */
188
189 NTSTATUS auth_winbind_init(void);
190
191 /* The following definitions come from auth/server_info.c  */
192
193 struct netr_SamInfo2;
194 struct netr_SamInfo3;
195 struct netr_SamInfo6;
196
197 struct auth_serversupplied_info *make_server_info(TALLOC_CTX *mem_ctx);
198 NTSTATUS serverinfo_to_SamInfo2(struct auth_serversupplied_info *server_info,
199                                 uint8_t *pipe_session_key,
200                                 size_t pipe_session_key_len,
201                                 struct netr_SamInfo2 *sam2);
202 NTSTATUS serverinfo_to_SamInfo3(const struct auth_serversupplied_info *server_info,
203                                 uint8_t *pipe_session_key,
204                                 size_t pipe_session_key_len,
205                                 struct netr_SamInfo3 *sam3);
206 NTSTATUS serverinfo_to_SamInfo6(struct auth_serversupplied_info *server_info,
207                                 uint8_t *pipe_session_key,
208                                 size_t pipe_session_key_len,
209                                 struct netr_SamInfo6 *sam6);
210 NTSTATUS samu_to_SamInfo3(TALLOC_CTX *mem_ctx,
211                           struct samu *samu,
212                           const char *login_server,
213                           struct netr_SamInfo3 **_info3,
214                           struct extra_auth_info *extra);
215 struct netr_SamInfo3 *copy_netr_SamInfo3(TALLOC_CTX *mem_ctx,
216                                          struct netr_SamInfo3 *orig);
217 struct netr_SamInfo3 *wbcAuthUserInfo_to_netr_SamInfo3(TALLOC_CTX *mem_ctx,
218                                         const struct wbcAuthUserInfo *info);
219
220 /* The following definitions come from auth/auth_wbc.c  */
221
222 NTSTATUS auth_wbc_init(void);
223
224 /* The following definitions come from auth/pampass.c  */
225
226 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
227 bool smb_pam_close_session(char *user, char *tty, char *rhost);
228 NTSTATUS smb_pam_accountcheck(const char *user, const char *rhost);
229 NTSTATUS smb_pam_passcheck(const char * user, const char * rhost,
230                            const char * password);
231 bool smb_pam_passchange(const char *user, const char *rhost,
232                         const char *oldpassword, const char *newpassword);
233 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
234 bool smb_pam_close_session(char *in_user, char *tty, char *rhost);
235
236 /* The following definitions come from auth/pass_check.c  */
237
238 void dfs_unlogin(void);
239 NTSTATUS pass_check(const struct passwd *pass,
240                     const char *user,
241                     const char *rhost,
242                     const char *password,
243                     bool run_cracker);
244
245 /* The following definitions come from auth/token_util.c  */
246
247 bool nt_token_check_sid ( const struct dom_sid *sid, const struct security_token *token );
248 bool nt_token_check_domain_rid( struct security_token *token, uint32 rid );
249 struct security_token *get_root_nt_token( void );
250 NTSTATUS add_aliases(const struct dom_sid *domain_sid,
251                      struct security_token *token);
252 NTSTATUS create_builtin_users(const struct dom_sid *sid);
253 NTSTATUS create_builtin_administrators(const struct dom_sid *sid);
254 struct security_token *create_local_nt_token(TALLOC_CTX *mem_ctx,
255                                             const struct dom_sid *user_sid,
256                                             bool is_guest,
257                                             int num_groupsids,
258                                             const struct dom_sid *groupsids);
259 NTSTATUS create_local_nt_token_from_info3(TALLOC_CTX *mem_ctx,
260                                           bool is_guest,
261                                           struct netr_SamInfo3 *info3,
262                                           struct extra_auth_info *extra,
263                                           struct security_token **ntok);
264 void debug_unix_user_token(int dbg_class, int dbg_lev, uid_t uid, gid_t gid,
265                            int n_groups, gid_t *groups);
266
267 /* The following definitions come from groupdb/mapping.c  */
268
269 NTSTATUS add_initial_entry(gid_t gid, const char *sid, enum lsa_SidType sid_name_use, const char *nt_name, const char *comment);
270 bool get_domain_group_from_sid(struct dom_sid sid, GROUP_MAP *map);
271 int smb_create_group(const char *unix_group, gid_t *new_gid);
272 int smb_delete_group(const char *unix_group);
273 int smb_set_primary_group(const char *unix_group, const char* unix_user);
274 int smb_add_user_group(const char *unix_group, const char *unix_user);
275 int smb_delete_user_group(const char *unix_group, const char *unix_user);
276 NTSTATUS pdb_default_getgrsid(struct pdb_methods *methods, GROUP_MAP *map,
277                                  struct dom_sid sid);
278 NTSTATUS pdb_default_getgrgid(struct pdb_methods *methods, GROUP_MAP *map,
279                                  gid_t gid);
280 NTSTATUS pdb_default_getgrnam(struct pdb_methods *methods, GROUP_MAP *map,
281                                  const char *name);
282 NTSTATUS pdb_default_add_group_mapping_entry(struct pdb_methods *methods,
283                                                 GROUP_MAP *map);
284 NTSTATUS pdb_default_update_group_mapping_entry(struct pdb_methods *methods,
285                                                    GROUP_MAP *map);
286 NTSTATUS pdb_default_delete_group_mapping_entry(struct pdb_methods *methods,
287                                                    struct dom_sid sid);
288 NTSTATUS pdb_default_enum_group_mapping(struct pdb_methods *methods,
289                                            const struct dom_sid *sid, enum lsa_SidType sid_name_use,
290                                            GROUP_MAP **pp_rmap, size_t *p_num_entries,
291                                            bool unix_only);
292 NTSTATUS pdb_default_create_alias(struct pdb_methods *methods,
293                                   const char *name, uint32 *rid);
294 NTSTATUS pdb_default_delete_alias(struct pdb_methods *methods,
295                                   const struct dom_sid *sid);
296 NTSTATUS pdb_default_get_aliasinfo(struct pdb_methods *methods,
297                                    const struct dom_sid *sid,
298                                    struct acct_info *info);
299 NTSTATUS pdb_default_set_aliasinfo(struct pdb_methods *methods,
300                                    const struct dom_sid *sid,
301                                    struct acct_info *info);
302 NTSTATUS pdb_default_add_aliasmem(struct pdb_methods *methods,
303                                   const struct dom_sid *alias, const struct dom_sid *member);
304 NTSTATUS pdb_default_del_aliasmem(struct pdb_methods *methods,
305                                   const struct dom_sid *alias, const struct dom_sid *member);
306 NTSTATUS pdb_default_enum_aliasmem(struct pdb_methods *methods,
307                                    const struct dom_sid *alias, TALLOC_CTX *mem_ctx,
308                                    struct dom_sid **pp_members,
309                                    size_t *p_num_members);
310 NTSTATUS pdb_default_alias_memberships(struct pdb_methods *methods,
311                                        TALLOC_CTX *mem_ctx,
312                                        const struct dom_sid *domain_sid,
313                                        const struct dom_sid *members,
314                                        size_t num_members,
315                                        uint32 **pp_alias_rids,
316                                        size_t *p_num_alias_rids);
317 NTSTATUS pdb_nop_getgrsid(struct pdb_methods *methods, GROUP_MAP *map,
318                                  struct dom_sid sid);
319 NTSTATUS pdb_nop_getgrgid(struct pdb_methods *methods, GROUP_MAP *map,
320                                  gid_t gid);
321 NTSTATUS pdb_nop_getgrnam(struct pdb_methods *methods, GROUP_MAP *map,
322                                  const char *name);
323 NTSTATUS pdb_nop_add_group_mapping_entry(struct pdb_methods *methods,
324                                                 GROUP_MAP *map);
325 NTSTATUS pdb_nop_update_group_mapping_entry(struct pdb_methods *methods,
326                                                    GROUP_MAP *map);
327 NTSTATUS pdb_nop_delete_group_mapping_entry(struct pdb_methods *methods,
328                                                    struct dom_sid sid);
329 NTSTATUS pdb_nop_enum_group_mapping(struct pdb_methods *methods,
330                                            enum lsa_SidType sid_name_use,
331                                            GROUP_MAP **rmap, size_t *num_entries,
332                                            bool unix_only);
333 bool pdb_get_dom_grp_info(const struct dom_sid *sid, struct acct_info *info);
334 bool pdb_set_dom_grp_info(const struct dom_sid *sid, const struct acct_info *info);
335 NTSTATUS pdb_create_builtin_alias(uint32 rid);
336
337 /* The following definitions come from groupdb/mapping_tdb.c  */
338
339 const struct mapping_backend *groupdb_tdb_init(void);
340
341 /* The following definitions come from intl/lang_tdb.c  */
342
343 bool lang_tdb_init(const char *lang);
344 const char *lang_msg(const char *msgid);
345 void lang_msg_free(const char *msgstr);
346 char *lang_tdb_current(void);
347
348 /* The following definitions come from lib/access.c  */
349
350 bool client_match(const char *tok, const void *item);
351 bool list_match(const char **list,const void *item,
352                 bool (*match_fn)(const char *, const void *));
353 bool allow_access(const char **deny_list,
354                 const char **allow_list,
355                 const char *cname,
356                 const char *caddr);
357
358 /* The following definitions come from passdb/account_pol.c  */
359
360 void account_policy_names_list(const char ***names, int *num_names);
361 const char *decode_account_policy_name(enum pdb_policy_type type);
362 const char *get_account_policy_attr(enum pdb_policy_type type);
363 const char *account_policy_get_desc(enum pdb_policy_type type);
364 enum pdb_policy_type account_policy_name_to_typenum(const char *name);
365 bool account_policy_get_default(enum pdb_policy_type type, uint32_t *val);
366 bool init_account_policy(void);
367 bool account_policy_get(enum pdb_policy_type type, uint32_t *value);
368 bool account_policy_set(enum pdb_policy_type type, uint32_t value);
369 bool cache_account_policy_set(enum pdb_policy_type type, uint32_t value);
370 bool cache_account_policy_get(enum pdb_policy_type type, uint32_t *value);
371 struct db_context *get_account_pol_db( void );
372
373 /* The following definitions come from lib/adt_tree.c  */
374
375
376 /* The following definitions come from lib/afs.c  */
377
378 char *afs_createtoken_str(const char *username, const char *cell);
379 bool afs_login(connection_struct *conn);
380 bool afs_login(connection_struct *conn);
381 char *afs_createtoken_str(const char *username, const char *cell);
382
383 /* The following definitions come from lib/afs_settoken.c  */
384
385 int afs_syscall( int subcall,
386           char * path,
387           int cmd,
388           char * cmarg,
389           int follow);
390 bool afs_settoken_str(const char *token_string);
391 bool afs_settoken_str(const char *token_string);
392
393 /* The following definitions come from lib/audit.c  */
394
395 const char *audit_category_str(uint32 category);
396 const char *audit_param_str(uint32 category);
397 const char *audit_description_str(uint32 category);
398 bool get_audit_category_from_param(const char *param, uint32 *audit_category);
399 const char *audit_policy_str(TALLOC_CTX *mem_ctx, uint32 policy);
400
401 /* The following definitions come from lib/bitmap.c  */
402
403 struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n);
404 int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src);
405 bool bitmap_set(struct bitmap *bm, unsigned i);
406 bool bitmap_clear(struct bitmap *bm, unsigned i);
407 bool bitmap_query(struct bitmap *bm, unsigned i);
408 int bitmap_find(struct bitmap *bm, unsigned ofs);
409
410 /* The following definitions come from lib/charcnv.c  */
411
412 void lazy_initialize_conv(void);
413 void gfree_charcnv(void);
414 void init_iconv(void);
415 size_t convert_string(charset_t from, charset_t to,
416                       void const *src, size_t srclen, 
417                       void *dest, size_t destlen);
418 size_t convert_string_error(charset_t from, charset_t to,
419                             void const *src, size_t srclen,
420                             void *dest, size_t destlen,
421                             size_t *converted_size);
422 size_t unix_strupper(const char *src, size_t srclen, char *dest, size_t destlen);
423 char *talloc_strdup_upper(TALLOC_CTX *ctx, const char *s);
424 char *strupper_talloc(TALLOC_CTX *ctx, const char *s);
425 size_t unix_strlower(const char *src, size_t srclen, char *dest, size_t destlen);
426 char *talloc_strdup_lower(TALLOC_CTX *ctx, const char *s);
427 char *strlower_talloc(TALLOC_CTX *ctx, const char *s);
428 size_t ucs2_align(const void *base_ptr, const void *p, int flags);
429 size_t push_ascii(void *dest, const char *src, size_t dest_len, int flags);
430 size_t push_ascii_fstring(void *dest, const char *src);
431 size_t push_ascii_nstring(void *dest, const char *src);
432 size_t pull_ascii(char *dest, const void *src, size_t dest_len, size_t src_len, int flags);
433 size_t pull_ascii_fstring(char *dest, const void *src);
434 size_t pull_ascii_nstring(char *dest, size_t dest_len, const void *src);
435 size_t push_ucs2(const void *base_ptr, void *dest, const char *src, size_t dest_len, int flags);
436 size_t push_utf8_fstring(void *dest, const char *src);
437 bool push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
438                       size_t *converted_size);
439 size_t pull_ucs2(const void *base_ptr, char *dest, const void *src, size_t dest_len, size_t src_len, int flags);
440 size_t pull_ucs2_fstring(char *dest, const void *src);
441 bool push_ucs2_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src,
442                       size_t *converted_size);
443 bool pull_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
444                       size_t *converted_size);
445 bool pull_ucs2_talloc(TALLOC_CTX *ctx, char **dest, const smb_ucs2_t *src,
446                       size_t *converted_size);
447 bool pull_ascii_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
448                        size_t *converted_size);
449 size_t push_string_check_fn(void *dest, const char *src,
450                             size_t dest_len, int flags);
451 size_t push_string_base(const char *base, uint16 flags2,
452                         void *dest, const char *src,
453                         size_t dest_len, int flags);
454 size_t pull_string_fn(const void *base_ptr,
455                         uint16 smb_flags2,
456                         char *dest,
457                         const void *src,
458                         size_t dest_len,
459                         size_t src_len,
460                         int flags);
461 size_t pull_string_talloc(TALLOC_CTX *ctx,
462                         const void *base_ptr,
463                         uint16 smb_flags2,
464                         char **ppdest,
465                         const void *src,
466                         size_t src_len,
467                         int flags);
468 size_t align_string(const void *base_ptr, const char *p, int flags);
469
470 /* The following definitions come from lib/conn_tdb.c  */
471
472 struct db_record *connections_fetch_entry(TALLOC_CTX *mem_ctx,
473                                           connection_struct *conn,
474                                           const char *name);
475 int connections_traverse(int (*fn)(struct db_record *rec,
476                                    void *private_data),
477                          void *private_data);
478 int connections_forall(int (*fn)(struct db_record *rec,
479                                  const struct connections_key *key,
480                                  const struct connections_data *data,
481                                  void *private_data),
482                        void *private_data);
483 int connections_forall_read(int (*fn)(const struct connections_key *key,
484                                       const struct connections_data *data,
485                                       void *private_data),
486                             void *private_data);
487 bool connections_init(bool rw);
488
489 /* The following definitions come from lib/dmallocmsg.c  */
490
491 void register_dmalloc_msgs(struct messaging_context *msg_ctx);
492
493 /* The following definitions come from lib/dprintf.c  */
494
495 void display_set_stderr(void);
496
497 /* The following definitions come from lib/errmap_unix.c  */
498
499 NTSTATUS map_nt_error_from_unix(int unix_error);
500 int map_errno_from_nt_status(NTSTATUS status);
501
502 /* The following definitions come from lib/file_id.c  */
503
504 struct file_id vfs_file_id_from_sbuf(connection_struct *conn, const SMB_STRUCT_STAT *sbuf);
505 bool file_id_equal(const struct file_id *id1, const struct file_id *id2);
506 const char *file_id_string_tos(const struct file_id *id);
507 void push_file_id_16(char *buf, const struct file_id *id);
508 void push_file_id_24(char *buf, const struct file_id *id);
509 void pull_file_id_24(char *buf, struct file_id *id);
510
511 /* The following definitions come from lib/gencache.c  */
512
513 bool gencache_set(const char *keystr, const char *value, time_t timeout);
514 bool gencache_del(const char *keystr);
515 bool gencache_get(const char *keystr, char **valstr, time_t *timeout);
516 bool gencache_parse(const char *keystr,
517                     void (*parser)(time_t timeout, DATA_BLOB blob,
518                                    void *private_data),
519                     void *private_data);
520 bool gencache_get_data_blob(const char *keystr, DATA_BLOB *blob,
521                             time_t *timeout, bool *was_expired);
522 bool gencache_stabilize(void);
523 bool gencache_set_data_blob(const char *keystr, const DATA_BLOB *blob, time_t timeout);
524 void gencache_iterate_blobs(void (*fn)(const char *key, DATA_BLOB value,
525                                        time_t timeout, void *private_data),
526                             void *private_data, const char *pattern);
527 void gencache_iterate(void (*fn)(const char* key, const char *value, time_t timeout, void* dptr),
528                       void* data, const char* keystr_pattern);
529
530 /* The following definitions come from lib/interface.c  */
531
532 bool ismyaddr(const struct sockaddr *ip);
533 bool ismyip_v4(struct in_addr ip);
534 bool is_local_net(const struct sockaddr *from);
535 void setup_linklocal_scope_id(struct sockaddr *pss);
536 bool is_local_net_v4(struct in_addr from);
537 int iface_count(void);
538 int iface_count_v4_nl(void);
539 const struct in_addr *first_ipv4_iface(void);
540 struct interface *get_interface(int n);
541 const struct sockaddr_storage *iface_n_sockaddr_storage(int n);
542 const struct in_addr *iface_n_ip_v4(int n);
543 const struct in_addr *iface_n_bcast_v4(int n);
544 const struct sockaddr_storage *iface_n_bcast(int n);
545 const struct sockaddr_storage *iface_ip(const struct sockaddr *ip);
546 bool iface_local(const struct sockaddr *ip);
547 void load_interfaces(void);
548 void gfree_interfaces(void);
549 bool interfaces_changed(void);
550
551 /* The following definitions come from lib/ldap_debug_handler.c  */
552
553 void init_ldap_debugging(void);
554
555 /* The following definitions come from lib/ldap_escape.c  */
556
557 char *escape_ldap_string(TALLOC_CTX *mem_ctx, const char *s);
558 char *escape_rdn_val_string_alloc(const char *s);
559
560 /* The following definitions come from lib/module.c  */
561
562 NTSTATUS smb_load_module(const char *module_name);
563 int smb_load_modules(const char **modules);
564 NTSTATUS smb_probe_module(const char *subsystem, const char *module);
565 NTSTATUS smb_load_module(const char *module_name);
566 int smb_load_modules(const char **modules);
567 NTSTATUS smb_probe_module(const char *subsystem, const char *module);
568 void init_modules(void);
569
570 /* The following definitions come from lib/ms_fnmatch.c  */
571
572 int ms_fnmatch(const char *pattern, const char *string, bool translate_pattern,
573                bool is_case_sensitive);
574 int gen_fnmatch(const char *pattern, const char *string);
575
576 /* The following definitions come from lib/pidfile.c  */
577
578 pid_t pidfile_pid(const char *name);
579 void pidfile_create(const char *program_name);
580 void pidfile_unlink(void);
581
582 /* The following definitions come from lib/privileges.c  */
583
584 bool get_privileges_for_sids(uint64_t *privileges, struct dom_sid *slist, int scount);
585 NTSTATUS get_privileges_for_sid_as_set(TALLOC_CTX *mem_ctx, PRIVILEGE_SET **privileges, struct dom_sid *sid);
586 NTSTATUS privilege_enumerate_accounts(struct dom_sid **sids, int *num_sids);
587 NTSTATUS privilege_enum_sids(enum sec_privilege privilege, TALLOC_CTX *mem_ctx,
588                              struct dom_sid **sids, int *num_sids);
589 bool grant_privilege_set(const struct dom_sid *sid, struct lsa_PrivilegeSet *set);
590 bool grant_privilege_by_name( const struct dom_sid *sid, const char *name);
591 bool revoke_all_privileges( const struct dom_sid *sid );
592 bool revoke_privilege_set(const struct dom_sid *sid, struct lsa_PrivilegeSet *set);
593 bool revoke_privilege_by_name(const struct dom_sid *sid, const char *name);
594 NTSTATUS privilege_create_account(const struct dom_sid *sid );
595 NTSTATUS privilege_delete_account(const struct dom_sid *sid);
596 bool is_privileged_sid( const struct dom_sid *sid );
597 bool grant_all_privileges( const struct dom_sid *sid );
598
599 /* The following definitions come from lib/recvfile.c  */
600
601 ssize_t sys_recvfile(int fromfd,
602                         int tofd,
603                         SMB_OFF_T offset,
604                         size_t count);
605 ssize_t sys_recvfile(int fromfd,
606                         int tofd,
607                         SMB_OFF_T offset,
608                         size_t count);
609 ssize_t drain_socket(int sockfd, size_t count);
610
611 /* The following definitions come from lib/secdesc.c  */
612
613 uint32_t get_sec_info(const struct security_descriptor *sd);
614 struct security_descriptor *sec_desc_merge(TALLOC_CTX *ctx, struct security_descriptor *new_sdb, struct security_descriptor *old_sdb);
615 struct sec_desc_buf *sec_desc_merge_buf(TALLOC_CTX *ctx, struct sec_desc_buf *new_sdb, struct sec_desc_buf *old_sdb);
616 struct security_descriptor *make_sec_desc(TALLOC_CTX *ctx,
617                         enum security_descriptor_revision revision,
618                         uint16 type,
619                         const struct dom_sid *owner_sid, const struct dom_sid *grp_sid,
620                         struct security_acl *sacl, struct security_acl *dacl, size_t *sd_size);
621 struct security_descriptor *dup_sec_desc(TALLOC_CTX *ctx, const struct security_descriptor *src);
622 NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx,
623                            struct security_descriptor *secdesc,
624                            uint8 **data, size_t *len);
625 NTSTATUS marshall_sec_desc_buf(TALLOC_CTX *mem_ctx,
626                                struct sec_desc_buf *secdesc_buf,
627                                uint8_t **data, size_t *len);
628 NTSTATUS unmarshall_sec_desc(TALLOC_CTX *mem_ctx, uint8 *data, size_t len,
629                              struct security_descriptor **psecdesc);
630 NTSTATUS unmarshall_sec_desc_buf(TALLOC_CTX *mem_ctx, uint8_t *data, size_t len,
631                                  struct sec_desc_buf **psecdesc_buf);
632 struct security_descriptor *make_standard_sec_desc(TALLOC_CTX *ctx, const struct dom_sid *owner_sid, const struct dom_sid *grp_sid,
633                                  struct security_acl *dacl, size_t *sd_size);
634 struct sec_desc_buf *make_sec_desc_buf(TALLOC_CTX *ctx, size_t len, struct security_descriptor *sec_desc);
635 struct sec_desc_buf *dup_sec_desc_buf(TALLOC_CTX *ctx, struct sec_desc_buf *src);
636 NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, struct security_descriptor **psd, const struct dom_sid *sid, uint32 mask, size_t *sd_size);
637 NTSTATUS sec_desc_mod_sid(struct security_descriptor *sd, struct dom_sid *sid, uint32 mask);
638 NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, struct security_descriptor **psd, struct dom_sid *sid, size_t *sd_size);
639 bool sd_has_inheritable_components(const struct security_descriptor *parent_ctr, bool container);
640 NTSTATUS se_create_child_secdesc(TALLOC_CTX *ctx,
641                                         struct security_descriptor **ppsd,
642                                         size_t *psize,
643                                         const struct security_descriptor *parent_ctr,
644                                         const struct dom_sid *owner_sid,
645                                         const struct dom_sid *group_sid,
646                                         bool container);
647 NTSTATUS se_create_child_secdesc_buf(TALLOC_CTX *ctx,
648                                         struct sec_desc_buf **ppsdb,
649                                         const struct security_descriptor *parent_ctr,
650                                         bool container);
651
652 /* The following definitions come from lib/sendfile.c  */
653
654 ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
655
656 /* The following definitions come from lib/server_mutex.c  */
657
658 struct named_mutex *grab_named_mutex(TALLOC_CTX *mem_ctx, const char *name,
659                                      int timeout);
660
661 /* The following definitions come from lib/sharesec.c  */
662
663 bool share_info_db_init(void);
664 struct security_descriptor *get_share_security_default( TALLOC_CTX *ctx, size_t *psize, uint32 def_access);
665 struct security_descriptor *get_share_security( TALLOC_CTX *ctx, const char *servicename,
666                               size_t *psize);
667 bool set_share_security(const char *share_name, struct security_descriptor *psd);
668 bool delete_share_security(const char *servicename);
669 bool share_access_check(const struct security_token *token, const char *sharename,
670                         uint32 desired_access);
671 bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, struct security_descriptor **ppsd);
672
673 /* The following definitions come from lib/smbrun.c  */
674
675 int smbrun_no_sanitize(const char *cmd, int *outfd);
676 int smbrun(const char *cmd, int *outfd);
677 int smbrunsecret(const char *cmd, const char *secret);
678
679 /* The following definitions come from lib/sock_exec.c  */
680
681 int sock_exec(const char *prog);
682
683 /* The following definitions come from lib/substitute.c  */
684
685 void free_local_machine_name(void);
686 bool set_local_machine_name(const char *local_name, bool perm);
687 const char *get_local_machine_name(void);
688 bool set_remote_machine_name(const char *remote_name, bool perm);
689 const char *get_remote_machine_name(void);
690 void sub_set_smb_name(const char *name);
691 void set_current_user_info(const char *smb_name, const char *unix_name,
692                            const char *domain);
693 void sub_set_socket_ids(const char *peeraddr, const char *peername,
694                         const char *sockaddr);
695 const char *get_current_username(void);
696 void standard_sub_basic(const char *smb_name, const char *domain_name,
697                         char *str, size_t len);
698 char *talloc_sub_basic(TALLOC_CTX *mem_ctx, const char *smb_name,
699                        const char *domain_name, const char *str);
700 char *talloc_sub_specified(TALLOC_CTX *mem_ctx,
701                         const char *input_string,
702                         const char *username,
703                         const char *domain,
704                         uid_t uid,
705                         gid_t gid);
706 char *talloc_sub_advanced(TALLOC_CTX *mem_ctx,
707                           const char *servicename, const char *user,
708                           const char *connectpath, gid_t gid,
709                           const char *smb_name, const char *domain_name,
710                           const char *str);
711 void standard_sub_advanced(const char *servicename, const char *user,
712                            const char *connectpath, gid_t gid,
713                            const char *smb_name, const char *domain_name,
714                            char *str, size_t len);
715 char *standard_sub_conn(TALLOC_CTX *ctx, connection_struct *conn, const char *str);
716
717 /* The following definitions come from lib/sysacls.c  */
718
719 int sys_acl_get_entry(SMB_ACL_T acl_d, int entry_id, SMB_ACL_ENTRY_T *entry_p);
720 int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *type_p);
721 int sys_acl_get_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
722 void *sys_acl_get_qualifier(SMB_ACL_ENTRY_T entry_d);
723 int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset_d);
724 int sys_acl_add_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
725 int sys_acl_get_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
726 char *sys_acl_to_text(SMB_ACL_T acl_d, ssize_t *len_p);
727 SMB_ACL_T sys_acl_init(int count);
728 int sys_acl_create_entry(SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p);
729 int sys_acl_set_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type);
730 int sys_acl_set_qualifier(SMB_ACL_ENTRY_T entry_d, void *qual_p);
731 int sys_acl_set_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d);
732 int sys_acl_free_text(char *text);
733 int sys_acl_free_acl(SMB_ACL_T acl_d) ;
734 int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype);
735 int sys_acl_valid(SMB_ACL_T acl_d);
736 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle, 
737                            const char *path_p, SMB_ACL_TYPE_T type);
738 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
739 int sys_acl_set_file(vfs_handle_struct *handle,
740                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
741 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
742                    SMB_ACL_T acl_d);
743 int sys_acl_delete_def_file(vfs_handle_struct *handle,
744                             const char *path);
745 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
746                            const char *path_p, SMB_ACL_TYPE_T type);
747 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
748 int sys_acl_set_file(vfs_handle_struct *handle,
749                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
750 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
751                    SMB_ACL_T acl_d);
752 int sys_acl_delete_def_file(vfs_handle_struct *handle,
753                             const char *path);
754 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
755                            const char *path_p, SMB_ACL_TYPE_T type);
756 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
757 int sys_acl_set_file(vfs_handle_struct *handle,
758                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
759 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
760                    SMB_ACL_T acl_d);
761 int sys_acl_delete_def_file(vfs_handle_struct *handle,
762                             const char *path);
763 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
764                            const char *path_p, SMB_ACL_TYPE_T type);
765 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
766 int sys_acl_set_file(vfs_handle_struct *handle,
767                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
768 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
769                    SMB_ACL_T acl_d);
770 int sys_acl_delete_def_file(vfs_handle_struct *handle,
771                             const char *path);
772 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
773                            const char *path_p, SMB_ACL_TYPE_T type);
774 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
775 int sys_acl_set_file(vfs_handle_struct *handle,
776                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
777 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
778                    SMB_ACL_T acl_d);
779 int sys_acl_delete_def_file(vfs_handle_struct *handle,
780                             const char *path);
781 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
782                            const char *path_p, SMB_ACL_TYPE_T type);
783 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
784 int sys_acl_set_file(vfs_handle_struct *handle,
785                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
786 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
787                    SMB_ACL_T acl_d);
788 int sys_acl_delete_def_file(vfs_handle_struct *handle,
789                             const char *path);
790 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
791                            const char *path_p, SMB_ACL_TYPE_T type);
792 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
793 int sys_acl_set_file(vfs_handle_struct *handle,
794                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
795 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
796                    SMB_ACL_T acl_d);
797 int sys_acl_delete_def_file(vfs_handle_struct *handle,
798                             const char *path);
799 int no_acl_syscall_error(int err);
800
801 /* The following definitions come from lib/sysquotas.c  */
802
803 int sys_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
804 int sys_set_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
805
806 /* The following definitions come from lib/sysquotas_*.c  */
807
808 int sys_get_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
809 int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
810
811 int sys_get_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
812 int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
813
814 int sys_get_nfs_quota(const char *path, const char *bdev,
815                       enum SMB_QUOTA_TYPE qtype,
816                       unid_t id, SMB_DISK_QUOTA *dp);
817 int sys_set_nfs_quota(const char *path, const char *bdev,
818                       enum SMB_QUOTA_TYPE qtype,
819                       unid_t id, SMB_DISK_QUOTA *dp);
820
821 /* The following definitions come from lib/system.c  */
822
823 void *sys_memalign( size_t align, size_t size );
824 int sys_usleep(long usecs);
825 ssize_t sys_read(int fd, void *buf, size_t count);
826 ssize_t sys_write(int fd, const void *buf, size_t count);
827 ssize_t sys_writev(int fd, const struct iovec *iov, int iovcnt);
828 ssize_t sys_pread(int fd, void *buf, size_t count, SMB_OFF_T off);
829 ssize_t sys_pwrite(int fd, const void *buf, size_t count, SMB_OFF_T off);
830 ssize_t sys_send(int s, const void *msg, size_t len, int flags);
831 ssize_t sys_sendto(int s,  const void *msg, size_t len, int flags, const struct sockaddr *to, socklen_t tolen);
832 ssize_t sys_recv(int fd, void *buf, size_t count, int flags);
833 ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen);
834 int sys_fcntl_ptr(int fd, int cmd, void *arg);
835 int sys_fcntl_long(int fd, int cmd, long arg);
836 void update_stat_ex_mtime(struct stat_ex *dst, struct timespec write_ts);
837 void update_stat_ex_create_time(struct stat_ex *dst, struct timespec create_time);
838 int sys_stat(const char *fname, SMB_STRUCT_STAT *sbuf,
839              bool fake_dir_create_times);
840 int sys_fstat(int fd, SMB_STRUCT_STAT *sbuf,
841               bool fake_dir_create_times);
842 int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf,
843               bool fake_dir_create_times);
844 int sys_ftruncate(int fd, SMB_OFF_T offset);
845 int sys_posix_fallocate(int fd, SMB_OFF_T offset, SMB_OFF_T len);
846 int sys_fallocate(int fd, enum vfs_fallocate_mode mode, SMB_OFF_T offset, SMB_OFF_T len);
847 SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence);
848 int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence);
849 SMB_OFF_T sys_ftell(FILE *fp);
850 int sys_creat(const char *path, mode_t mode);
851 int sys_open(const char *path, int oflag, mode_t mode);
852 FILE *sys_fopen(const char *path, const char *type);
853 void kernel_flock(int fd, uint32 share_mode, uint32 access_mask);
854 SMB_STRUCT_DIR *sys_opendir(const char *name);
855 SMB_STRUCT_DIR *sys_fdopendir(int fd);
856 SMB_STRUCT_DIRENT *sys_readdir(SMB_STRUCT_DIR *dirp);
857 void sys_seekdir(SMB_STRUCT_DIR *dirp, long offset);
858 long sys_telldir(SMB_STRUCT_DIR *dirp);
859 void sys_rewinddir(SMB_STRUCT_DIR *dirp);
860 int sys_closedir(SMB_STRUCT_DIR *dirp);
861 int sys_mknod(const char *path, mode_t mode, SMB_DEV_T dev);
862 int sys_waitpid(pid_t pid,int *status,int options);
863 char *sys_getwd(char *s);
864 void set_effective_capability(enum smbd_capability capability);
865 void drop_effective_capability(enum smbd_capability capability);
866 long sys_random(void);
867 void sys_srandom(unsigned int seed);
868 int groups_max(void);
869 int sys_getgroups(int setlen, gid_t *gidset);
870 int sys_setgroups(gid_t UNUSED(primary_gid), int setlen, gid_t *gidset);
871 void sys_setpwent(void);
872 struct passwd *sys_getpwent(void);
873 void sys_endpwent(void);
874 struct passwd *sys_getpwnam(const char *name);
875 struct passwd *sys_getpwuid(uid_t uid);
876 struct group *sys_getgrnam(const char *name);
877 struct group *sys_getgrgid(gid_t gid);
878 int sys_popen(const char *command);
879 int sys_pclose(int fd);
880 ssize_t sys_getxattr (const char *path, const char *name, void *value, size_t size);
881 ssize_t sys_lgetxattr (const char *path, const char *name, void *value, size_t size);
882 ssize_t sys_fgetxattr (int filedes, const char *name, void *value, size_t size);
883 ssize_t sys_listxattr (const char *path, char *list, size_t size);
884 ssize_t sys_llistxattr (const char *path, char *list, size_t size);
885 ssize_t sys_flistxattr (int filedes, char *list, size_t size);
886 int sys_removexattr (const char *path, const char *name);
887 int sys_lremovexattr (const char *path, const char *name);
888 int sys_fremovexattr (int filedes, const char *name);
889 int sys_setxattr (const char *path, const char *name, const void *value, size_t size, int flags);
890 int sys_lsetxattr (const char *path, const char *name, const void *value, size_t size, int flags);
891 int sys_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags);
892 uint32 unix_dev_major(SMB_DEV_T dev);
893 uint32 unix_dev_minor(SMB_DEV_T dev);
894 int sys_aio_read(SMB_STRUCT_AIOCB *aiocb);
895 int sys_aio_write(SMB_STRUCT_AIOCB *aiocb);
896 ssize_t sys_aio_return(SMB_STRUCT_AIOCB *aiocb);
897 int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb);
898 int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb);
899 int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb);
900 int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout);
901 int sys_aio_read(SMB_STRUCT_AIOCB *aiocb);
902 int sys_aio_write(SMB_STRUCT_AIOCB *aiocb);
903 ssize_t sys_aio_return(SMB_STRUCT_AIOCB *aiocb);
904 int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb);
905 int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb);
906 int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb);
907 int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout);
908 int sys_getpeereid( int s, uid_t *uid);
909 int sys_getnameinfo(const struct sockaddr *psa,
910                         socklen_t salen,
911                         char *host,
912                         size_t hostlen,
913                         char *service,
914                         size_t servlen,
915                         int flags);
916 int sys_connect(int fd, const struct sockaddr * addr);
917
918 /* The following definitions come from lib/system_smbd.c  */
919
920 bool getgroups_unix_user(TALLOC_CTX *mem_ctx, const char *user,
921                          gid_t primary_gid,
922                          gid_t **ret_groups, uint32_t *p_ngroups);
923
924 /* The following definitions come from lib/tallocmsg.c  */
925
926 void register_msg_pool_usage(struct messaging_context *msg_ctx);
927
928 /* The following definitions come from lib/time.c  */
929
930 void push_dos_date(uint8_t *buf, int offset, time_t unixdate, int zone_offset);
931 void push_dos_date2(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
932 void push_dos_date3(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
933 uint32_t convert_time_t_to_uint32_t(time_t t);
934 time_t convert_uint32_t_to_time_t(uint32_t u);
935 bool nt_time_is_zero(const NTTIME *nt);
936 time_t generalized_to_unix_time(const char *str);
937 int get_server_zone_offset(void);
938 int set_server_zone_offset(time_t t);
939 char *timeval_string(TALLOC_CTX *ctx, const struct timeval *tp, bool hires);
940 char *current_timestring(TALLOC_CTX *ctx, bool hires);
941 void srv_put_dos_date(char *buf,int offset,time_t unixdate);
942 void srv_put_dos_date2(char *buf,int offset, time_t unixdate);
943 void srv_put_dos_date3(char *buf,int offset,time_t unixdate);
944 void round_timespec(enum timestamp_set_resolution res, struct timespec *ts);
945 void put_long_date_timespec(enum timestamp_set_resolution res, char *p, struct timespec ts);
946 void put_long_date(char *p, time_t t);
947 void dos_filetime_timespec(struct timespec *tsp);
948 time_t make_unix_date(const void *date_ptr, int zone_offset);
949 time_t make_unix_date2(const void *date_ptr, int zone_offset);
950 time_t make_unix_date3(const void *date_ptr, int zone_offset);
951 time_t srv_make_unix_date(const void *date_ptr);
952 time_t srv_make_unix_date2(const void *date_ptr);
953 time_t srv_make_unix_date3(const void *date_ptr);
954 struct timespec convert_time_t_to_timespec(time_t t);
955 struct timespec convert_timeval_to_timespec(const struct timeval tv);
956 struct timeval convert_timespec_to_timeval(const struct timespec ts);
957 struct timespec timespec_current(void);
958 struct timespec timespec_min(const struct timespec *ts1,
959                            const struct timespec *ts2);
960 int timespec_compare(const struct timespec *ts1, const struct timespec *ts2);
961 void round_timespec_to_sec(struct timespec *ts);
962 void round_timespec_to_usec(struct timespec *ts);
963 struct timespec interpret_long_date(const char *p);
964 void TimeInit(void);
965 void get_process_uptime(struct timeval *ret_time);
966 void get_startup_time(struct timeval *ret_time);
967 time_t nt_time_to_unix_abs(const NTTIME *nt);
968 time_t uint64s_nt_time_to_unix_abs(const uint64_t *src);
969 void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts);
970 void unix_to_nt_time_abs(NTTIME *nt, time_t t);
971 const char *time_to_asc(const time_t t);
972 const char *display_time(NTTIME nttime);
973 bool nt_time_is_set(const NTTIME *nt);
974
975 /* The following definitions come from lib/username.c  */
976
977 struct passwd *tcopy_passwd(TALLOC_CTX *mem_ctx, const struct passwd *from) ;
978 void flush_pwnam_cache(void);
979 struct passwd *getpwuid_alloc(TALLOC_CTX *mem_ctx, uid_t uid) ;
980 char *get_user_home_dir(TALLOC_CTX *mem_ctx, const char *user);
981 struct passwd *Get_Pwnam_alloc(TALLOC_CTX *mem_ctx, const char *user);
982
983 /* The following definitions come from lib/util_names.c  */
984 void gfree_netbios_names(void);
985 bool set_global_myname(const char *myname);
986 const char *global_myname(void);
987 bool set_global_myworkgroup(const char *myworkgroup);
988 const char *lp_workgroup(void);
989 const char *get_global_sam_name(void);
990
991 /* The following definitions come from lib/util.c  */
992
993 enum protocol_types get_Protocol(void);
994 void set_Protocol(enum protocol_types  p);
995 bool all_zero(const uint8_t *ptr, size_t size);
996 bool set_global_scope(const char *scope);
997 const char *global_scope(void);
998 void gfree_names(void);
999 void gfree_all( void );
1000 const char *my_netbios_names(int i);
1001 bool set_netbios_aliases(const char **str_array);
1002 bool init_names(void);
1003 struct user_auth_info *user_auth_info_init(TALLOC_CTX *mem_ctx);
1004 const char *get_cmdline_auth_info_username(const struct user_auth_info *auth_info);
1005 void set_cmdline_auth_info_username(struct user_auth_info *auth_info,
1006                                     const char *username);
1007 const char *get_cmdline_auth_info_domain(const struct user_auth_info *auth_info);
1008 void set_cmdline_auth_info_domain(struct user_auth_info *auth_info,
1009                                   const char *domain);
1010 void set_cmdline_auth_info_password(struct user_auth_info *auth_info,
1011                                     const char *password);
1012 const char *get_cmdline_auth_info_password(const struct user_auth_info *auth_info);
1013 bool set_cmdline_auth_info_signing_state(struct user_auth_info *auth_info,
1014                                          const char *arg);
1015 int get_cmdline_auth_info_signing_state(const struct user_auth_info *auth_info);
1016 void set_cmdline_auth_info_use_ccache(struct user_auth_info *auth_info,
1017                                       bool b);
1018 bool get_cmdline_auth_info_use_ccache(const struct user_auth_info *auth_info);
1019 void set_cmdline_auth_info_use_kerberos(struct user_auth_info *auth_info,
1020                                         bool b);
1021 bool get_cmdline_auth_info_use_kerberos(const struct user_auth_info *auth_info);
1022 void set_cmdline_auth_info_fallback_after_kerberos(struct user_auth_info *auth_info,
1023                                         bool b);
1024 bool get_cmdline_auth_info_fallback_after_kerberos(const struct user_auth_info *auth_info);
1025 void set_cmdline_auth_info_use_krb5_ticket(struct user_auth_info *auth_info);
1026 void set_cmdline_auth_info_smb_encrypt(struct user_auth_info *auth_info);
1027 void set_cmdline_auth_info_use_machine_account(struct user_auth_info *auth_info);
1028 bool get_cmdline_auth_info_got_pass(const struct user_auth_info *auth_info);
1029 bool get_cmdline_auth_info_smb_encrypt(const struct user_auth_info *auth_info);
1030 bool get_cmdline_auth_info_use_machine_account(const struct user_auth_info *auth_info);
1031 struct user_auth_info *get_cmdline_auth_info_copy(TALLOC_CTX *mem_ctx,
1032                                                  const struct user_auth_info *info);
1033 bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_info);
1034 void set_cmdline_auth_info_getpass(struct user_auth_info *auth_info);
1035 bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf,
1036                      bool fake_dir_create_times);
1037 bool socket_exist(const char *fname);
1038 uint64_t get_file_size_stat(const SMB_STRUCT_STAT *sbuf);
1039 SMB_OFF_T get_file_size(char *file_name);
1040 char *attrib_string(uint16 mode);
1041 void show_msg(char *buf);
1042 void smb_set_enclen(char *buf,int len,uint16 enc_ctx_num);
1043 void smb_setlen(char *buf,int len);
1044 int set_message_bcc(char *buf,int num_bytes);
1045 ssize_t message_push_blob(uint8 **outbuf, DATA_BLOB blob);
1046 char *unix_clean_name(TALLOC_CTX *ctx, const char *s);
1047 char *clean_name(TALLOC_CTX *ctx, const char *s);
1048 ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, SMB_OFF_T pos);
1049 int set_blocking(int fd, bool set);
1050 NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
1051                            struct event_context *ev_ctx,
1052                            struct server_id id,
1053                            bool parent_longlived);
1054 void *malloc_(size_t size);
1055 void *memalign_array(size_t el_size, size_t align, unsigned int count);
1056 void *calloc_array(size_t size, size_t nmemb);
1057 void *Realloc(void *p, size_t size, bool free_old_on_error);
1058 void add_to_large_array(TALLOC_CTX *mem_ctx, size_t element_size,
1059                         void *element, void *_array, uint32 *num_elements,
1060                         ssize_t *array_size);
1061 char *get_myname(TALLOC_CTX *ctx);
1062 char *get_mydnsdomname(TALLOC_CTX *ctx);
1063 int interpret_protocol(const char *str,int def);
1064 char *automount_lookup(TALLOC_CTX *ctx, const char *user_name);
1065 char *automount_lookup(TALLOC_CTX *ctx, const char *user_name);
1066 bool process_exists(const struct server_id pid);
1067 const char *uidtoname(uid_t uid);
1068 char *gidtoname(gid_t gid);
1069 uid_t nametouid(const char *name);
1070 gid_t nametogid(const char *name);
1071 void smb_panic_s3(const char *why);
1072 void log_stack_trace(void);
1073 const char *readdirname(SMB_STRUCT_DIR *p);
1074 bool is_in_path(const char *name, name_compare_entry *namelist, bool case_sensitive);
1075 void set_namearray(name_compare_entry **ppname_array, const char *namelist);
1076 void free_namearray(name_compare_entry *name_array);
1077 bool fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
1078 bool fcntl_getlock(int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid);
1079 bool is_myname(const char *s);
1080 bool is_myworkgroup(const char *s);
1081 void ra_lanman_string( const char *native_lanman );
1082 const char *get_remote_arch_str(void);
1083 void set_remote_arch(enum remote_arch_types type);
1084 enum remote_arch_types get_remote_arch(void);
1085 const char *tab_depth(int level, int depth);
1086 int str_checksum(const char *s);
1087 void zero_free(void *p, size_t size);
1088 int set_maxfiles(int requested_max);
1089 int smb_mkstemp(char *name_template);
1090 void *smb_xmalloc_array(size_t size, unsigned int count);
1091 char *myhostname(void);
1092 char *lock_path(const char *name);
1093 char *pid_path(const char *name);
1094 char *lib_path(const char *name);
1095 char *modules_path(const char *name);
1096 char *data_path(const char *name);
1097 char *state_path(const char *name);
1098 char *cache_path(const char *name);
1099 const char *shlib_ext(void);
1100 bool parent_dirname(TALLOC_CTX *mem_ctx, const char *dir, char **parent,
1101                     const char **name);
1102 bool ms_has_wild(const char *s);
1103 bool ms_has_wild_w(const smb_ucs2_t *s);
1104 bool mask_match(const char *string, const char *pattern, bool is_case_sensitive);
1105 bool mask_match_search(const char *string, const char *pattern, bool is_case_sensitive);
1106 bool mask_match_list(const char *string, char **list, int listLen, bool is_case_sensitive);
1107 bool unix_wild_match(const char *pattern, const char *string);
1108 bool name_to_fqdn(fstring fqdn, const char *name);
1109 void *talloc_append_blob(TALLOC_CTX *mem_ctx, void *buf, DATA_BLOB blob);
1110 uint32 map_share_mode_to_deny_mode(uint32 share_access, uint32 private_options);
1111 pid_t procid_to_pid(const struct server_id *proc);
1112 void set_my_vnn(uint32 vnn);
1113 uint32 get_my_vnn(void);
1114 void set_my_unique_id(uint64_t unique_id);
1115 struct server_id pid_to_procid(pid_t pid);
1116 struct server_id procid_self(void);
1117 bool procid_equal(const struct server_id *p1, const struct server_id *p2);
1118 bool cluster_id_equal(const struct server_id *id1,
1119                       const struct server_id *id2);
1120 bool procid_is_me(const struct server_id *pid);
1121 struct server_id interpret_pid(const char *pid_string);
1122 char *procid_str(TALLOC_CTX *mem_ctx, const struct server_id *pid);
1123 char *procid_str_static(const struct server_id *pid);
1124 bool procid_valid(const struct server_id *pid);
1125 bool procid_is_local(const struct server_id *pid);
1126 bool trans_oob(uint32_t bufsize, uint32_t offset, uint32_t length);
1127 bool is_offset_safe(const char *buf_base, size_t buf_len, char *ptr, size_t off);
1128 char *get_safe_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
1129 char *get_safe_str_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
1130 int get_safe_SVAL(const char *buf_base, size_t buf_len, char *ptr, size_t off, int failval);
1131 int get_safe_IVAL(const char *buf_base, size_t buf_len, char *ptr, size_t off, int failval);
1132 void split_domain_user(TALLOC_CTX *mem_ctx,
1133                        const char *full_name,
1134                        char **domain,
1135                        char **user);
1136 void *_talloc_zero_zeronull(const void *ctx, size_t size, const char *name);
1137 void *_talloc_memdup_zeronull(const void *t, const void *p, size_t size, const char *name);
1138 void *_talloc_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
1139 void *_talloc_zero_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
1140 void *talloc_zeronull(const void *context, size_t size, const char *name);
1141 const char *strip_hostname(const char *s);
1142 bool tevent_req_poll_ntstatus(struct tevent_req *req,
1143                               struct tevent_context *ev,
1144                               NTSTATUS *status);
1145 bool any_nt_status_not_ok(NTSTATUS err1, NTSTATUS err2, NTSTATUS *result);
1146 int timeval_to_msec(struct timeval t);
1147
1148 /* The following definitions come from lib/util_file.c  */
1149
1150 char **file_lines_pload(const char *syscmd, int *numlines);
1151 void file_lines_free(char **lines);
1152
1153 /* The following definitions come from lib/util_nscd.c  */
1154
1155 void smb_nscd_flush_user_cache(void);
1156 void smb_nscd_flush_group_cache(void);
1157
1158 /* The following definitions come from lib/util_nttoken.c  */
1159
1160 struct security_token *dup_nt_token(TALLOC_CTX *mem_ctx, const struct security_token *ptoken);
1161 NTSTATUS merge_nt_token(TALLOC_CTX *mem_ctx,
1162                         const struct security_token *token_1,
1163                         const struct security_token *token_2,
1164                         struct security_token **token_out);
1165 bool token_sid_in_ace(const struct security_token *token, const struct security_ace *ace);
1166
1167 /* The following definitions come from ..libcli/registry/util_reg.c  */
1168
1169 const char *str_regtype(int type);
1170 int regtype_by_string(const char *str);
1171 bool push_reg_sz(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char *s);
1172 bool push_reg_multi_sz(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char **a);
1173 bool pull_reg_sz(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, const char **s);
1174 bool pull_reg_multi_sz(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, const char ***a);
1175
1176 /* The following definitions come from lib/util_sec.c  */
1177
1178 void sec_init(void);
1179 uid_t sec_initial_uid(void);
1180 gid_t sec_initial_gid(void);
1181 bool non_root_mode(void);
1182 void gain_root_privilege(void);
1183 void gain_root_group_privilege(void);
1184 void set_effective_uid(uid_t uid);
1185 void set_effective_gid(gid_t gid);
1186 void save_re_uid(void);
1187 void restore_re_uid_fromroot(void);
1188 void restore_re_uid(void);
1189 void save_re_gid(void);
1190 void restore_re_gid(void);
1191 int set_re_uid(void);
1192 void become_user_permanently(uid_t uid, gid_t gid);
1193 bool is_setuid_root(void) ;
1194
1195 /* The following definitions come from lib/util_sid.c  */
1196
1197 char *sid_to_fstring(fstring sidstr_out, const struct dom_sid *sid);
1198 char *sid_string_talloc(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
1199 char *sid_string_dbg(const struct dom_sid *sid);
1200 char *sid_string_tos(const struct dom_sid *sid);
1201 bool sid_linearize(char *outbuf, size_t len, const struct dom_sid *sid);
1202 bool non_mappable_sid(struct dom_sid *sid);
1203 char *sid_binstring_hex(const struct dom_sid *sid);
1204 NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx,
1205                               const struct netr_SamInfo3 *info3,
1206                               struct dom_sid **user_sids,
1207                               uint32_t *num_user_sids,
1208                               bool include_user_group_rid,
1209                               bool skip_ressource_groups);
1210
1211 /* The following definitions come from lib/util_sock.c  */
1212
1213 bool is_broadcast_addr(const struct sockaddr *pss);
1214 bool is_loopback_ip_v4(struct in_addr ip);
1215 bool is_loopback_addr(const struct sockaddr *pss);
1216 bool is_zero_addr(const struct sockaddr_storage *pss);
1217 void zero_ip_v4(struct in_addr *ip);
1218 void in_addr_to_sockaddr_storage(struct sockaddr_storage *ss,
1219                 struct in_addr ip);
1220 bool same_net(const struct sockaddr *ip1,
1221                 const struct sockaddr *ip2,
1222                 const struct sockaddr *mask);
1223 bool sockaddr_equal(const struct sockaddr *ip1,
1224                 const struct sockaddr *ip2);
1225 bool is_address_any(const struct sockaddr *psa);
1226 uint16_t get_sockaddr_port(const struct sockaddr_storage *pss);
1227 char *print_sockaddr(char *dest,
1228                         size_t destlen,
1229                         const struct sockaddr_storage *psa);
1230 char *print_canonical_sockaddr(TALLOC_CTX *ctx,
1231                         const struct sockaddr_storage *pss);
1232 const char *client_name(int fd);
1233 int get_socket_port(int fd);
1234 const char *client_addr(int fd, char *addr, size_t addrlen);
1235 const char *client_socket_addr(int fd, char *addr, size_t addr_len);
1236 int client_socket_port(int fd);
1237 void set_smb_read_error(enum smb_read_errors *pre,
1238                         enum smb_read_errors newerr);
1239 void cond_set_smb_read_error(enum smb_read_errors *pre,
1240                         enum smb_read_errors newerr);
1241 bool is_a_socket(int fd);
1242 void set_socket_options(int fd, const char *options);
1243 ssize_t read_udp_v4_socket(int fd,
1244                         char *buf,
1245                         size_t len,
1246                         struct sockaddr_storage *psa);
1247 NTSTATUS read_fd_with_timeout(int fd, char *buf,
1248                                   size_t mincnt, size_t maxcnt,
1249                                   unsigned int time_out,
1250                                   size_t *size_ret);
1251 NTSTATUS read_data(int fd, char *buffer, size_t N);
1252 ssize_t write_data(int fd, const char *buffer, size_t N);
1253 ssize_t write_data_iov(int fd, const struct iovec *orig_iov, int iovcnt);
1254 bool send_keepalive(int client);
1255 NTSTATUS read_smb_length_return_keepalive(int fd, char *inbuf,
1256                                           unsigned int timeout,
1257                                           size_t *len);
1258 NTSTATUS receive_smb_raw(int fd,
1259                         char *buffer,
1260                         size_t buflen,
1261                         unsigned int timeout,
1262                         size_t maxlen,
1263                         size_t *p_len);
1264 int open_socket_in(int type,
1265                 uint16_t port,
1266                 int dlevel,
1267                 const struct sockaddr_storage *psock,
1268                 bool rebind);
1269 NTSTATUS open_socket_out(const struct sockaddr_storage *pss, uint16_t port,
1270                          int timeout, int *pfd);
1271 struct tevent_req *open_socket_out_send(TALLOC_CTX *mem_ctx,
1272                                         struct event_context *ev,
1273                                         const struct sockaddr_storage *pss,
1274                                         uint16_t port,
1275                                         int timeout);
1276 NTSTATUS open_socket_out_recv(struct tevent_req *req, int *pfd);
1277 struct tevent_req *open_socket_out_defer_send(TALLOC_CTX *mem_ctx,
1278                                               struct event_context *ev,
1279                                               struct timeval wait_time,
1280                                               const struct sockaddr_storage *pss,
1281                                               uint16_t port,
1282                                               int timeout);
1283 NTSTATUS open_socket_out_defer_recv(struct tevent_req *req, int *pfd);
1284 int open_udp_socket(const char *host, int port);
1285 const char *get_peer_name(int fd, bool force_lookup);
1286 const char *get_peer_addr(int fd, char *addr, size_t addr_len);
1287 int create_pipe_sock(const char *socket_dir,
1288                      const char *socket_name,
1289                      mode_t dir_perms);
1290 const char *get_mydnsfullname(void);
1291 bool is_myname_or_ipaddr(const char *s);
1292 struct tevent_req *getaddrinfo_send(TALLOC_CTX *mem_ctx,
1293                                     struct tevent_context *ev,
1294                                     struct fncall_context *ctx,
1295                                     const char *node,
1296                                     const char *service,
1297                                     const struct addrinfo *hints);
1298 int getaddrinfo_recv(struct tevent_req *req, struct addrinfo **res);
1299 int poll_one_fd(int fd, int events, int timeout, int *revents);
1300 int poll_intr_one_fd(int fd, int events, int timeout, int *revents);
1301 struct tevent_req *tstream_read_packet_send(TALLOC_CTX *mem_ctx,
1302                                             struct tevent_context *ev,
1303                                             struct tstream_context *stream,
1304                                             size_t initial,
1305                                             ssize_t (*more)(uint8_t *buf,
1306                                                             size_t buflen,
1307                                                             void *private_data),
1308                                             void *private_data);
1309 ssize_t tstream_read_packet_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1310                                  uint8_t **pbuf, int *perrno);
1311
1312 /* The following definitions come from lib/util_str.c  */
1313
1314 bool next_token(const char **ptr, char *buff, const char *sep, size_t bufsize);
1315 int StrCaseCmp(const char *s, const char *t);
1316 int StrnCaseCmp(const char *s, const char *t, size_t len);
1317 bool strnequal(const char *s1,const char *s2,size_t n);
1318 bool strcsequal(const char *s1,const char *s2);
1319 void strnorm(char *s, int case_default);
1320 bool strisnormal(const char *s, int case_default);
1321 char *push_skip_string(char *buf);
1322 char *skip_string(const char *base, size_t len, char *buf);
1323 size_t str_charnum(const char *s);
1324 size_t str_ascii_charnum(const char *s);
1325 bool trim_char(char *s,char cfront,char cback);
1326 bool strhasupper(const char *s);
1327 bool strhaslower(const char *s);
1328 char *safe_strcpy_fn(char *dest,
1329                 const char *src,
1330                 size_t maxlength);
1331 char *safe_strcat_fn(char *dest,
1332                 const char *src,
1333                 size_t maxlength);
1334 char *alpha_strcpy(char *dest,
1335                 const char *src,
1336                 const char *other_safe_chars,
1337                 size_t maxlength);
1338 char *StrnCpy(char *dest,const char *src,size_t n);
1339 bool in_list(const char *s, const char *list, bool casesensitive);
1340 void string_free(char **s);
1341 bool string_set(char **dest,const char *src);
1342 void string_sub2(char *s,const char *pattern, const char *insert, size_t len,
1343                  bool remove_unsafe_characters, bool replace_once,
1344                  bool allow_trailing_dollar);
1345 void string_sub_once(char *s, const char *pattern,
1346                 const char *insert, size_t len);
1347 void string_sub(char *s,const char *pattern, const char *insert, size_t len);
1348 void fstring_sub(char *s,const char *pattern,const char *insert);
1349 char *realloc_string_sub2(char *string,
1350                         const char *pattern,
1351                         const char *insert,
1352                         bool remove_unsafe_characters,
1353                         bool allow_trailing_dollar);
1354 char *realloc_string_sub(char *string,
1355                         const char *pattern,
1356                         const char *insert);
1357 char *talloc_string_sub2(TALLOC_CTX *mem_ctx, const char *src,
1358                         const char *pattern,
1359                         const char *insert,
1360                         bool remove_unsafe_characters,
1361                         bool replace_once,
1362                         bool allow_trailing_dollar);
1363 char *talloc_string_sub(TALLOC_CTX *mem_ctx,
1364                         const char *src,
1365                         const char *pattern,
1366                         const char *insert);
1367 void all_string_sub(char *s,const char *pattern,const char *insert, size_t len);
1368 char *talloc_all_string_sub(TALLOC_CTX *ctx,
1369                                 const char *src,
1370                                 const char *pattern,
1371                                 const char *insert);
1372 char *octal_string(int i);
1373 char *string_truncate(char *s, unsigned int length);
1374 char *strchr_m(const char *src, char c);
1375 char *strrchr_m(const char *s, char c);
1376 char *strnrchr_m(const char *s, char c, unsigned int n);
1377 char *strstr_m(const char *src, const char *findstr);
1378 void strlower_m(char *s);
1379 void strupper_m(char *s);
1380 size_t strlen_m(const char *s);
1381 size_t strlen_m_term(const char *s);
1382 size_t strlen_m_term_null(const char *s);
1383 int fstr_sprintf(fstring s, const char *fmt, ...);
1384 bool str_list_sub_basic( char **list, const char *smb_name,
1385                          const char *domain_name );
1386 bool str_list_substitute(char **list, const char *pattern, const char *insert);
1387
1388 char *ipstr_list_make(char **ipstr_list,
1389                         const struct ip_service *ip_list,
1390                         int ip_count);
1391 int ipstr_list_parse(const char *ipstr_list, struct ip_service **ip_list);
1392 void ipstr_list_free(char* ipstr_list);
1393 DATA_BLOB base64_decode_data_blob(const char *s);
1394 void base64_decode_inplace(char *s);
1395 char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data);
1396 uint64_t STR_TO_SMB_BIG_UINT(const char *nptr, const char **entptr);
1397 SMB_OFF_T conv_str_size(const char * str);
1398 void string_append(char **left, const char *right);
1399 bool add_string_to_array(TALLOC_CTX *mem_ctx,
1400                          const char *str, const char ***strings,
1401                          int *num);
1402 void sprintf_append(TALLOC_CTX *mem_ctx, char **string, ssize_t *len,
1403                     size_t *bufsize, const char *fmt, ...);
1404 int asprintf_strupper_m(char **strp, const char *fmt, ...);
1405 char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...);
1406 char *talloc_asprintf_strlower_m(TALLOC_CTX *t, const char *fmt, ...);
1407 char *sstring_sub(const char *src, char front, char back);
1408 bool validate_net_name( const char *name,
1409                 const char *invalid_chars,
1410                 int max_len);
1411 char *escape_shell_string(const char *src);
1412 char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep);
1413 char *sanitize_username(TALLOC_CTX *mem_ctx, const char *username);
1414
1415 /* The following definitions come from lib/util_unistr.c  */
1416
1417 void gfree_case_tables(void);
1418 void load_case_tables(void);
1419 size_t dos_PutUniCode(char *dst,const char *src, size_t len, bool null_terminate);
1420 char *skip_unibuf(char *src, size_t len);
1421 int rpcstr_push(void *dest, const char *src, size_t dest_len, int flags);
1422 int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src);
1423 bool isvalid83_w(smb_ucs2_t c);
1424 size_t strlen_w(const smb_ucs2_t *src);
1425 size_t strnlen_w(const smb_ucs2_t *src, size_t max);
1426 smb_ucs2_t *strchr_w(const smb_ucs2_t *s, smb_ucs2_t c);
1427 smb_ucs2_t *strchr_wa(const smb_ucs2_t *s, char c);
1428 smb_ucs2_t *strrchr_w(const smb_ucs2_t *s, smb_ucs2_t c);
1429 smb_ucs2_t *strnrchr_w(const smb_ucs2_t *s, smb_ucs2_t c, unsigned int n);
1430 smb_ucs2_t *strstr_w(const smb_ucs2_t *s, const smb_ucs2_t *ins);
1431 bool strlower_w(smb_ucs2_t *s);
1432 bool strupper_w(smb_ucs2_t *s);
1433 void strnorm_w(smb_ucs2_t *s, int case_default);
1434 int strcmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b);
1435 int strncmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len);
1436 int strcasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b);
1437 int strncasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len);
1438 bool strequal_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2);
1439 bool strnequal_w(const smb_ucs2_t *s1,const smb_ucs2_t *s2,size_t n);
1440 smb_ucs2_t *strdup_w(const smb_ucs2_t *src);
1441 smb_ucs2_t *strndup_w(const smb_ucs2_t *src, size_t len);
1442 smb_ucs2_t *strncpy_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const size_t max);
1443 smb_ucs2_t *strncat_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const size_t max);
1444 smb_ucs2_t *strcat_w(smb_ucs2_t *dest, const smb_ucs2_t *src);
1445 void string_replace_w(smb_ucs2_t *s, smb_ucs2_t oldc, smb_ucs2_t newc);
1446 bool trim_string_w(smb_ucs2_t *s, const smb_ucs2_t *front,
1447                                   const smb_ucs2_t *back);
1448 int strcmp_wa(const smb_ucs2_t *a, const char *b);
1449 int strncmp_wa(const smb_ucs2_t *a, const char *b, size_t len);
1450 smb_ucs2_t *strpbrk_wa(const smb_ucs2_t *s, const char *p);
1451 smb_ucs2_t *strstr_wa(const smb_ucs2_t *s, const char *ins);
1452 int toupper_ascii(int c);
1453 int tolower_ascii(int c);
1454 int isupper_ascii(int c);
1455 int islower_ascii(int c);
1456
1457 /* The following definitions come from lib/version.c  */
1458
1459 const char *samba_version_string(void);
1460
1461 /* The following definitions come from lib/winbind_util.c  */
1462
1463 bool winbind_lookup_name(const char *dom_name, const char *name, struct dom_sid *sid,
1464                          enum lsa_SidType *name_type);
1465 bool winbind_lookup_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
1466                         const char **domain, const char **name,
1467                         enum lsa_SidType *name_type);
1468 bool winbind_ping(void);
1469 bool winbind_sid_to_uid(uid_t *puid, const struct dom_sid *sid);
1470 bool winbind_uid_to_sid(struct dom_sid *sid, uid_t uid);
1471 bool winbind_sid_to_gid(gid_t *pgid, const struct dom_sid *sid);
1472 bool winbind_gid_to_sid(struct dom_sid *sid, gid_t gid);
1473 struct passwd * winbind_getpwnam(const char * sname);
1474 struct passwd * winbind_getpwsid(const struct dom_sid *sid);
1475 wbcErr wb_is_trusted_domain(const char *domain);
1476 bool winbind_lookup_rids(TALLOC_CTX *mem_ctx,
1477                          const struct dom_sid *domain_sid,
1478                          int num_rids, uint32 *rids,
1479                          const char **domain_name,
1480                          const char ***names, enum lsa_SidType **types);
1481 bool winbind_allocate_uid(uid_t *uid);
1482 bool winbind_allocate_gid(gid_t *gid);
1483 bool winbind_get_groups(TALLOC_CTX *mem_ctx,
1484                         const char *account,
1485                         uint32_t *num_groups,
1486                         gid_t ** _groups);
1487 bool winbind_get_sid_aliases(TALLOC_CTX *mem_ctx,
1488                              const struct dom_sid *dom_sid,
1489                              const struct dom_sid *members,
1490                              size_t num_members,
1491                              uint32_t **pp_alias_rids,
1492                              size_t *p_num_alias_rids);
1493
1494
1495 /* The following definitions come from lib/wins_srv.c  */
1496
1497 bool wins_srv_is_dead(struct in_addr wins_ip, struct in_addr src_ip);
1498 void wins_srv_alive(struct in_addr wins_ip, struct in_addr src_ip);
1499 void wins_srv_died(struct in_addr wins_ip, struct in_addr src_ip);
1500 unsigned wins_srv_count(void);
1501 char **wins_srv_tags(void);
1502 void wins_srv_tags_free(char **list);
1503 struct in_addr wins_srv_ip_tag(const char *tag, struct in_addr src_ip);
1504 unsigned wins_srv_count_tag(const char *tag);
1505
1506 /* The following definitions come from libsmb/cliconnect.c  */
1507
1508 ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user, 
1509                               const char *pass, const char *user_domain,
1510                                     const char * dest_realm);
1511
1512 NTSTATUS cli_session_setup(struct cli_state *cli,
1513                            const char *user,
1514                            const char *pass, int passlen,
1515                            const char *ntpass, int ntpasslen,
1516                            const char *workgroup);
1517 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
1518                                                   struct event_context *ev,
1519                                                   struct cli_state *cli,
1520                                                   struct tevent_req **psmbreq);
1521 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
1522                                                 struct event_context *ev,
1523                                                 struct cli_state *cli);
1524 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
1525 struct tevent_req *cli_ulogoff_send(TALLOC_CTX *mem_ctx,
1526                                     struct tevent_context *ev,
1527                                     struct cli_state *cli);
1528 NTSTATUS cli_ulogoff_recv(struct tevent_req *req);
1529 NTSTATUS cli_ulogoff(struct cli_state *cli);
1530 struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
1531                                         struct event_context *ev,
1532                                         struct cli_state *cli,
1533                                         const char *share, const char *dev,
1534                                         const char *pass, int passlen,
1535                                         struct tevent_req **psmbreq);
1536 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
1537                                       struct event_context *ev,
1538                                       struct cli_state *cli,
1539                                       const char *share, const char *dev,
1540                                       const char *pass, int passlen);
1541 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
1542 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
1543                        const char *dev, const char *pass, int passlen);
1544 struct tevent_req *cli_tdis_send(TALLOC_CTX *mem_ctx,
1545                                  struct tevent_context *ev,
1546                                  struct cli_state *cli);
1547 NTSTATUS cli_tdis_recv(struct tevent_req *req);
1548 NTSTATUS cli_tdis(struct cli_state *cli);
1549 void cli_negprot_sendsync(struct cli_state *cli);
1550 NTSTATUS cli_negprot(struct cli_state *cli);
1551 struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
1552                                     struct event_context *ev,
1553                                     struct cli_state *cli);
1554 NTSTATUS cli_negprot_recv(struct tevent_req *req);
1555 bool cli_session_request(struct cli_state *cli,
1556                          struct nmb_name *calling, struct nmb_name *called);
1557 NTSTATUS cli_connect(struct cli_state *cli,
1558                 const char *host,
1559                 struct sockaddr_storage *dest_ss);
1560 NTSTATUS cli_start_connection(struct cli_state **output_cli, 
1561                               const char *my_name, 
1562                               const char *dest_host, 
1563                               struct sockaddr_storage *dest_ss, int port,
1564                               int signing_state, int flags);
1565 NTSTATUS cli_full_connection(struct cli_state **output_cli, 
1566                              const char *my_name, 
1567                              const char *dest_host, 
1568                              struct sockaddr_storage *dest_ss, int port,
1569                              const char *service, const char *service_type,
1570                              const char *user, const char *domain, 
1571                              const char *password, int flags,
1572                              int signing_state);
1573 bool attempt_netbios_session_request(struct cli_state **ppcli, const char *srchost, const char *desthost,
1574                                      struct sockaddr_storage *pdest_ss);
1575 NTSTATUS cli_raw_tcon(struct cli_state *cli, 
1576                       const char *service, const char *pass, const char *dev,
1577                       uint16 *max_xmit, uint16 *tid);
1578 struct cli_state *get_ipc_connect(char *server,
1579                                 struct sockaddr_storage *server_ss,
1580                                 const struct user_auth_info *user_info);
1581 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
1582                                 struct ip_service *mb_ip,
1583                                 const struct user_auth_info *user_info,
1584                                 char **pp_workgroup_out);
1585 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
1586                                         const struct user_auth_info *user_info,
1587                                         char **pp_workgroup_out);
1588
1589 /* The following definitions come from libsmb/clidfs.c  */
1590
1591 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
1592                         const char *username,
1593                         const char *password,
1594                         const char *domain,
1595                         const char *sharename);
1596 struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
1597                                 struct cli_state *referring_cli,
1598                                 const char *server,
1599                                 const char *share,
1600                                 const struct user_auth_info *auth_info,
1601                                 bool show_hdr,
1602                                 bool force_encrypt,
1603                                 int max_protocol,
1604                                 int port,
1605                                 int name_type);
1606 void cli_cm_display(const struct cli_state *c);
1607 struct client_dfs_referral;
1608 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
1609                         struct cli_state *cli,
1610                         const char *path,
1611                         struct client_dfs_referral **refs,
1612                         size_t *num_refs,
1613                         size_t *consumed);
1614 bool cli_resolve_path(TALLOC_CTX *ctx,
1615                         const char *mountpt,
1616                         const struct user_auth_info *dfs_auth_info,
1617                         struct cli_state *rootcli,
1618                         const char *path,
1619                         struct cli_state **targetcli,
1620                         char **pp_targetpath);
1621
1622 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
1623                         struct cli_state *cli,
1624                         const char *sharename,
1625                         char **pp_newserver,
1626                         char **pp_newshare,
1627                         bool force_encrypt,
1628                         const char *username,
1629                         const char *password,
1630                         const char *domain);
1631
1632 /* The following definitions come from libsmb/clientgen.c  */
1633
1634 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
1635 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
1636 void cli_set_port(struct cli_state *cli, int port);
1637 bool cli_state_seqnum_persistent(struct cli_state *cli,
1638                                  uint16_t mid);
1639 bool cli_state_seqnum_remove(struct cli_state *cli,
1640                              uint16_t mid);
1641 bool cli_receive_smb(struct cli_state *cli);
1642 bool cli_send_smb(struct cli_state *cli);
1643 bool cli_send_smb_direct_writeX(struct cli_state *cli,
1644                                 const char *p,
1645                                 size_t extradata);
1646 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
1647 void cli_setup_packet(struct cli_state *cli);
1648 void cli_setup_bcc(struct cli_state *cli, void *p);
1649 NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
1650 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);
1651 NTSTATUS cli_set_password(struct cli_state *cli, const char *password);
1652 NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password);
1653 struct cli_state *cli_initialise(void);
1654 struct cli_state *cli_initialise_ex(int signing_state);
1655 void cli_nt_pipes_close(struct cli_state *cli);
1656 void cli_shutdown(struct cli_state *cli);
1657 void cli_sockopt(struct cli_state *cli, const char *options);
1658 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
1659 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
1660 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
1661                                  struct cli_state *cli, uint16_t num_echos,
1662                                  DATA_BLOB data);
1663 NTSTATUS cli_echo_recv(struct tevent_req *req);
1664 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
1665 bool cli_ucs2(struct cli_state *cli);
1666 bool is_andx_req(uint8_t cmd);
1667 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
1668                  uint8_t smb_command, uint8_t additional_flags,
1669                  uint8_t wct, uint16_t *vwv,
1670                  uint32_t num_bytes, const uint8_t *bytes,
1671                  struct tevent_req **result_parent,
1672                  uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
1673                  uint32_t *pnum_bytes, uint8_t **pbytes);
1674
1675 /* The following definitions come from libsmb/clierror.c  */
1676
1677 const char *cli_errstr(struct cli_state *cli);
1678 NTSTATUS cli_nt_error(struct cli_state *cli);
1679 void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode);
1680 int cli_errno(struct cli_state *cli);
1681 bool cli_is_error(struct cli_state *cli);
1682 bool cli_is_nt_error(struct cli_state *cli);
1683 bool cli_is_dos_error(struct cli_state *cli);
1684 NTSTATUS cli_get_nt_error(struct cli_state *cli);
1685 void cli_set_nt_error(struct cli_state *cli, NTSTATUS status);
1686 void cli_reset_error(struct cli_state *cli);
1687 bool cli_state_is_connected(struct cli_state *cli);
1688
1689 /* The following definitions come from libsmb/clifile.c  */
1690
1691 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
1692                                         struct tevent_context *ev,
1693                                         struct cli_state *cli,
1694                                         uint16_t level,
1695                                         const char *path,
1696                                         uint8_t *data,
1697                                         size_t data_len);
1698 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
1699 NTSTATUS cli_setpathinfo(struct cli_state *cli,
1700                          uint16_t level,
1701                          const char *path,
1702                          uint8_t *data,
1703                          size_t data_len);
1704
1705 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
1706                                         struct event_context *ev,
1707                                         struct cli_state *cli,
1708                                         const char *oldname,
1709                                         const char *newname);
1710 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
1711 NTSTATUS cli_posix_symlink(struct cli_state *cli,
1712                         const char *oldname,
1713                         const char *newname);
1714 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
1715                                         struct event_context *ev,
1716                                         struct cli_state *cli,
1717                                         const char *fname,
1718                                         size_t len);
1719 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
1720                                 char *retpath, size_t len);
1721 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
1722                         char *linkpath, size_t len);
1723 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
1724                                         struct event_context *ev,
1725                                         struct cli_state *cli,
1726                                         const char *oldname,
1727                                         const char *newname);
1728 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
1729 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
1730                         const char *oldname,
1731                         const char *newname);
1732 uint32_t unix_perms_to_wire(mode_t perms);
1733 mode_t wire_perms_to_unix(uint32_t perms);
1734 struct tevent_req *cli_posix_getfacl_send(TALLOC_CTX *mem_ctx,
1735                                         struct event_context *ev,
1736                                         struct cli_state *cli,
1737                                         const char *fname);
1738 NTSTATUS cli_posix_getfacl_recv(struct tevent_req *req,
1739                                 TALLOC_CTX *mem_ctx,
1740                                 size_t *prb_size,
1741                                 char **retbuf);
1742 NTSTATUS cli_posix_getfacl(struct cli_state *cli,
1743                         const char *fname,
1744                         TALLOC_CTX *mem_ctx,
1745                         size_t *prb_size,
1746                         char **retbuf);
1747 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
1748                                         struct event_context *ev,
1749                                         struct cli_state *cli,
1750                                         const char *fname);
1751 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
1752                                 SMB_STRUCT_STAT *sbuf);
1753 NTSTATUS cli_posix_stat(struct cli_state *cli,
1754                         const char *fname,
1755                         SMB_STRUCT_STAT *sbuf);
1756 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
1757                                         struct event_context *ev,
1758                                         struct cli_state *cli,
1759                                         const char *fname,
1760                                         mode_t mode);
1761 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
1762 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
1763 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
1764                                         struct event_context *ev,
1765                                         struct cli_state *cli,
1766                                         const char *fname,
1767                                         uid_t uid,
1768                                         gid_t gid);
1769 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
1770 NTSTATUS cli_posix_chown(struct cli_state *cli,
1771                         const char *fname,
1772                         uid_t uid,
1773                         gid_t gid);
1774 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
1775                                 struct event_context *ev,
1776                                 struct cli_state *cli,
1777                                 const char *fname_src,
1778                                 const char *fname_dst);
1779 NTSTATUS cli_rename_recv(struct tevent_req *req);
1780 NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
1781 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
1782                                 struct event_context *ev,
1783                                 struct cli_state *cli,
1784                                 const char *fname_src,
1785                                 const char *fname_dst);
1786 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
1787 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
1788
1789 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
1790                                 struct event_context *ev,
1791                                 struct cli_state *cli,
1792                                 const char *fname_src,
1793                                 const char *fname_dst);
1794 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
1795 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
1796
1797 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
1798                                 struct event_context *ev,
1799                                 struct cli_state *cli,
1800                                 const char *fname,
1801                                 uint16_t mayhave_attrs);
1802 NTSTATUS cli_unlink_recv(struct tevent_req *req);
1803 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
1804
1805 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
1806                                   struct event_context *ev,
1807                                   struct cli_state *cli,
1808                                   const char *dname);
1809 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
1810 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
1811 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
1812                                   struct event_context *ev,
1813                                   struct cli_state *cli,
1814                                   const char *dname);
1815 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
1816 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
1817 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
1818                                         struct event_context *ev,
1819                                         struct cli_state *cli,
1820                                         uint16_t fnum,
1821                                         bool flag);
1822 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
1823 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
1824 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
1825                                      struct event_context *ev,
1826                                      struct cli_state *cli,
1827                                      const char *fname,
1828                                      uint32_t CreatFlags,
1829                                      uint32_t DesiredAccess,
1830                                      uint32_t FileAttributes,
1831                                      uint32_t ShareAccess,
1832                                      uint32_t CreateDisposition,
1833                                      uint32_t CreateOptions,
1834                                      uint8_t SecurityFlags);
1835 NTSTATUS cli_ntcreate_recv(struct tevent_req *req, uint16_t *pfnum);
1836 NTSTATUS cli_ntcreate(struct cli_state *cli,
1837                       const char *fname,
1838                       uint32_t CreatFlags,
1839                       uint32_t DesiredAccess,
1840                       uint32_t FileAttributes,
1841                       uint32_t ShareAccess,
1842                       uint32_t CreateDisposition,
1843                       uint32_t CreateOptions,
1844                       uint8_t SecurityFlags,
1845                       uint16_t *pfid);
1846 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
1847                             size_t str_len, size_t *pconverted_size);
1848 uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
1849                               const uint8_t *bytes, size_t num_bytes);
1850 struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx,
1851                                    struct event_context *ev,
1852                                    struct cli_state *cli, const char *fname,
1853                                    int flags, int share_mode,
1854                                    struct tevent_req **psmbreq);
1855 struct tevent_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
1856                                  struct cli_state *cli, const char *fname,
1857                                  int flags, int share_mode);
1858 NTSTATUS cli_open_recv(struct tevent_req *req, uint16_t *fnum);
1859 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
1860 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
1861                                     struct event_context *ev,
1862                                     struct cli_state *cli, uint16_t fnum,
1863                                     struct tevent_req **psubreq);
1864 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
1865                                   struct event_context *ev,
1866                                   struct cli_state *cli, uint16_t fnum);
1867 NTSTATUS cli_close_recv(struct tevent_req *req);
1868 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
1869 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
1870                                         struct event_context *ev,
1871                                         struct cli_state *cli,
1872                                         uint16_t fnum,
1873                                         uint64_t size);
1874 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
1875 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
1876 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
1877                       uint32_t offset, uint32_t len,
1878                       int timeout, unsigned char locktype);
1879 bool cli_lock(struct cli_state *cli, uint16_t fnum,
1880               uint32_t offset, uint32_t len, int timeout, enum brl_type lock_type);
1881 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
1882                                 struct event_context *ev,
1883                                 struct cli_state *cli,
1884                                 uint16_t fnum,
1885                                 uint64_t offset,
1886                                 uint64_t len);
1887 NTSTATUS cli_unlock_recv(struct tevent_req *req);
1888 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
1889 bool cli_lock64(struct cli_state *cli, uint16_t fnum,
1890                 uint64_t offset, uint64_t len, int timeout, enum brl_type lock_type);
1891 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
1892                                 struct event_context *ev,
1893                                 struct cli_state *cli,
1894                                 uint16_t fnum,
1895                                 uint64_t offset,
1896                                 uint64_t len);
1897 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
1898 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
1899 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
1900                                         struct event_context *ev,
1901                                         struct cli_state *cli,
1902                                         uint16_t fnum,
1903                                         uint64_t offset,
1904                                         uint64_t len,
1905                                         bool wait_lock,
1906                                         enum brl_type lock_type);
1907 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
1908 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
1909                         uint64_t offset, uint64_t len,
1910                         bool wait_lock, enum brl_type lock_type);
1911 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
1912                                         struct event_context *ev,
1913                                         struct cli_state *cli,
1914                                         uint16_t fnum,
1915                                         uint64_t offset,
1916                                         uint64_t len);
1917 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
1918 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
1919 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
1920                                 struct event_context *ev,
1921                                 struct cli_state *cli,
1922                                 uint16_t fnum);
1923 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
1924                         uint16_t *attr,
1925                         SMB_OFF_T *size,
1926                         time_t *change_time,
1927                         time_t *access_time,
1928                         time_t *write_time);
1929 NTSTATUS cli_getattrE(struct cli_state *cli,
1930                         uint16_t fnum,
1931                         uint16_t *attr,
1932                         SMB_OFF_T *size,
1933                         time_t *change_time,
1934                         time_t *access_time,
1935                         time_t *write_time);
1936 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
1937                                 struct event_context *ev,
1938                                 struct cli_state *cli,
1939                                 uint16_t fnum,
1940                                 time_t change_time,
1941                                 time_t access_time,
1942                                 time_t write_time);
1943 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
1944 NTSTATUS cli_setattrE(struct cli_state *cli,
1945                         uint16_t fnum,
1946                         time_t change_time,
1947                         time_t access_time,
1948                         time_t write_time);
1949 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
1950                                 struct event_context *ev,
1951                                 struct cli_state *cli,
1952                                 const char *fname);
1953 NTSTATUS cli_getatr_recv(struct tevent_req *req,
1954                                 uint16_t *attr,
1955                                 SMB_OFF_T *size,
1956                                 time_t *write_time);
1957 NTSTATUS cli_getatr(struct cli_state *cli,
1958                         const char *fname,
1959                         uint16_t *attr,
1960                         SMB_OFF_T *size,
1961                         time_t *write_time);
1962 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
1963                                 struct event_context *ev,
1964                                 struct cli_state *cli,
1965                                 const char *fname,
1966                                 uint16_t attr,
1967                                 time_t mtime);
1968 NTSTATUS cli_setatr_recv(struct tevent_req *req);
1969 NTSTATUS cli_setatr(struct cli_state *cli,
1970                 const char *fname,
1971                 uint16_t attr,
1972                 time_t mtime);
1973 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
1974                                   struct event_context *ev,
1975                                   struct cli_state *cli,
1976                                   const char *fname);
1977 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
1978 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
1979 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
1980                                   struct event_context *ev,
1981                                   struct cli_state *cli);
1982 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
1983                           int *avail);
1984 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
1985 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
1986                                 struct event_context *ev,
1987                                 struct cli_state *cli,
1988                                 const char *path);
1989 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
1990                         TALLOC_CTX *ctx,
1991                         uint16_t *pfnum,
1992                         char **outfile);
1993 NTSTATUS cli_ctemp(struct cli_state *cli,
1994                         TALLOC_CTX *ctx,
1995                         const char *path,
1996                         uint16_t *pfnum,
1997                         char **out_path);
1998 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
1999 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
2000                          const char *ea_name, const char *ea_val,
2001                          size_t ea_len);
2002 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
2003                          const char *ea_name, const char *ea_val,
2004                          size_t ea_len);
2005 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
2006                                              struct tevent_context *ev,
2007                                              struct cli_state *cli,
2008                                              const char *fname);
2009 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
2010                                    size_t *pnum_eas, struct ea_struct **peas);
2011 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
2012                 TALLOC_CTX *ctx,
2013                 size_t *pnum_eas,
2014                 struct ea_struct **pea_list);
2015 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
2016                                         struct event_context *ev,
2017                                         struct cli_state *cli,
2018                                         const char *fname,
2019                                         int flags,
2020                                         mode_t mode);
2021 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
2022 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
2023                         int flags, mode_t mode, uint16_t *fnum);
2024 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
2025                                         struct event_context *ev,
2026                                         struct cli_state *cli,
2027                                         const char *fname,
2028                                         mode_t mode);
2029 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
2030 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
2031
2032 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
2033                                         struct event_context *ev,
2034                                         struct cli_state *cli,
2035                                         const char *fname);
2036 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
2037 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
2038
2039 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
2040                                         struct event_context *ev,
2041                                         struct cli_state *cli,
2042                                         const char *fname);
2043 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2044 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
2045 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
2046                                    struct tevent_context *ev,
2047                                    struct cli_state *cli, uint16_t fnum,
2048                                    uint32_t buffer_size,
2049                                    uint32_t completion_filter, bool recursive);
2050 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
2051                          uint32_t *pnum_changes,
2052                          struct notify_change **pchanges);
2053
2054 /* The following definitions come from libsmb/clifsinfo.c  */
2055
2056 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
2057                                                     struct tevent_context *ev,
2058                                                     struct cli_state *cli);
2059 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
2060                                           uint16_t *pmajor, uint16_t *pminor,
2061                                           uint32_t *pcaplow,
2062                                           uint32_t *pcaphigh);
2063 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor,
2064                                      uint16 *pminor, uint32 *pcaplow,
2065                                      uint32 *pcaphigh);
2066 struct tevent_req *cli_set_unix_extensions_capabilities_send(
2067         TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
2068         uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
2069 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
2070 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
2071                                               uint16 major, uint16 minor,
2072                                               uint32 caplow, uint32 caphigh);
2073 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
2074                                              struct tevent_context *ev,
2075                                              struct cli_state *cli);
2076 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
2077 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
2078 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name,
2079                                 uint32 *pserial_number, time_t *pdate);
2080 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
2081                                    uint64_t *total_allocation_units,
2082                                    uint64_t *caller_allocation_units,
2083                                    uint64_t *actual_allocation_units,
2084                                    uint64_t *sectors_per_allocation_unit,
2085                                    uint64_t *bytes_per_sector);
2086 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
2087                                uint32 *optimal_transfer_size,
2088                                uint32 *block_size,
2089                                uint64_t *total_blocks,
2090                                uint64_t *blocks_available,
2091                                uint64_t *user_blocks_available,
2092                                uint64_t *total_file_nodes,
2093                                uint64_t *free_file_nodes,
2094                                uint64_t *fs_identifier);
2095 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli, 
2096                                 const char *user,
2097                                 const char *pass,
2098                                 const char *domain);
2099 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
2100 NTSTATUS cli_force_encryption(struct cli_state *c,
2101                         const char *username,
2102                         const char *password,
2103                         const char *domain);
2104
2105 /* The following definitions come from libsmb/clikrb5.c  */
2106
2107 bool unwrap_edata_ntstatus(TALLOC_CTX *mem_ctx, 
2108                            DATA_BLOB *edata, 
2109                            DATA_BLOB *edata_out);
2110 bool unwrap_pac(TALLOC_CTX *mem_ctx, DATA_BLOB *auth_data, DATA_BLOB *unwrapped_pac_data);
2111
2112 /* The following definitions come from libsmb/clilist.c  */
2113
2114 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
2115                       NTSTATUS (*fn)(const char *, struct file_info *,
2116                                  const char *, void *), void *state);
2117 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
2118                         uint16_t attribute, int info_level,
2119                         NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
2120                                    const char *mask, void *private_data),
2121                         void *private_data);
2122 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
2123                                  struct tevent_context *ev,
2124                                  struct cli_state *cli,
2125                                  const char *mask,
2126                                  uint16_t attribute,
2127                                  uint16_t info_level);
2128 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
2129                        struct file_info **finfo, size_t *num_finfo);
2130 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
2131                   NTSTATUS (*fn)(const char *, struct file_info *, const char *,
2132                              void *), void *state);
2133
2134 /* The following definitions come from libsmb/climessage.c  */
2135
2136 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
2137                                     struct tevent_context *ev,
2138                                     struct cli_state *cli,
2139                                     const char *host, const char *username,
2140                                     const char *message);
2141 NTSTATUS cli_message_recv(struct tevent_req *req);
2142 NTSTATUS cli_message(struct cli_state *cli, const char *host,
2143                      const char *username, const char *message);
2144
2145 /* The following definitions come from libsmb/clioplock.c  */
2146
2147 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
2148                                        struct tevent_context *ev,
2149                                        struct cli_state *cli,
2150                                        uint16_t fnum, uint8_t level);
2151 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
2152 NTSTATUS cli_oplock_ack(struct cli_state *cli, uint16_t fnum, unsigned char level);
2153 void cli_oplock_handler(struct cli_state *cli, 
2154                         NTSTATUS (*handler)(struct cli_state *, uint16_t, unsigned char));
2155
2156 /* The following definitions come from libsmb/cliprint.c  */
2157
2158 int cli_print_queue(struct cli_state *cli,
2159                     void (*fn)(struct print_job_info *));
2160 int cli_printjob_del(struct cli_state *cli, int job);
2161
2162 /* The following definitions come from libsmb/cliquota.c  */
2163
2164 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
2165 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
2166 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
2167                             SMB_NTQUOTA_STRUCT *pqt);
2168 NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
2169                             SMB_NTQUOTA_STRUCT *pqt);
2170 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
2171                              SMB_NTQUOTA_LIST **pqt_list);
2172 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
2173                                SMB_NTQUOTA_STRUCT *pqt);
2174 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
2175                                SMB_NTQUOTA_STRUCT *pqt);
2176
2177 /* The following definitions come from libsmb/clireadwrite.c  */
2178
2179 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
2180                                         struct event_context *ev,
2181                                         struct cli_state *cli, uint16_t fnum,
2182                                         off_t offset, size_t size,
2183                                         struct tevent_req **psmbreq);
2184 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
2185                                       struct event_context *ev,
2186                                       struct cli_state *cli, uint16_t fnum,
2187                                       off_t offset, size_t size);
2188 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
2189                             uint8_t **rcvbuf);
2190 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
2191                                  struct event_context *ev,
2192                                  struct cli_state *cli,
2193                                  uint16_t fnum, off_t start_offset,
2194                                  SMB_OFF_T size, size_t window_size,
2195                                  NTSTATUS (*sink)(char *buf, size_t n,
2196                                                   void *priv),
2197                                  void *priv);
2198 NTSTATUS cli_pull_recv(struct tevent_req *req, SMB_OFF_T *received);
2199 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
2200                   off_t start_offset, SMB_OFF_T size, size_t window_size,
2201                   NTSTATUS (*sink)(char *buf, size_t n, void *priv),
2202                   void *priv, SMB_OFF_T *received);
2203 ssize_t cli_read(struct cli_state *cli, uint16_t fnum, char *buf,
2204                  off_t offset, size_t size);
2205 ssize_t cli_write(struct cli_state *cli,
2206                  uint16_t fnum, uint16 write_mode,
2207                  const char *buf, off_t offset, size_t size);
2208 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
2209                       off_t offset, size_t size1, size_t *ptotal);
2210 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
2211                                          struct event_context *ev,
2212                                          struct cli_state *cli, uint16_t fnum,
2213                                          uint16_t mode, const uint8_t *buf,
2214                                          off_t offset, size_t size,
2215                                          struct tevent_req **reqs_before,
2216                                          int num_reqs_before,
2217                                          struct tevent_req **psmbreq);
2218 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
2219                                        struct event_context *ev,
2220                                        struct cli_state *cli, uint16_t fnum,
2221                                        uint16_t mode, const uint8_t *buf,
2222                                        off_t offset, size_t size);
2223 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
2224
2225 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
2226                                  struct cli_state *cli,
2227                                  uint16_t fnum, uint16_t mode,
2228                                  off_t start_offset, size_t window_size,
2229                                  size_t (*source)(uint8_t *buf, size_t n,
2230                                                   void *priv),
2231                                  void *priv);
2232 NTSTATUS cli_push_recv(struct tevent_req *req);
2233 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
2234                   off_t start_offset, size_t window_size,
2235                   size_t (*source)(uint8_t *buf, size_t n, void *priv),
2236                   void *priv);
2237
2238 /* The following definitions come from libsmb/clisecdesc.c  */
2239
2240 struct security_descriptor *cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
2241                             TALLOC_CTX *mem_ctx);
2242 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
2243                          struct security_descriptor *sd);
2244
2245 /* The following definitions come from libsmb/clispnego.c  */
2246
2247 DATA_BLOB spnego_gen_negTokenInit(TALLOC_CTX *ctx,
2248                                   const char *OIDs[],
2249                                   DATA_BLOB *psecblob,
2250                                   const char *principal);
2251
2252 #ifndef ASN1_MAX_OIDS
2253 #define ASN1_MAX_OIDS 20
2254 #endif
2255 bool spnego_parse_negTokenInit(TALLOC_CTX *ctx,
2256                                DATA_BLOB blob,
2257                                char *OIDs[ASN1_MAX_OIDS],
2258                                char **principal,
2259                                DATA_BLOB *secblob);
2260 DATA_BLOB spnego_gen_krb5_wrap(TALLOC_CTX *ctx, const DATA_BLOB ticket, const uint8 tok_id[2]);
2261 bool spnego_parse_krb5_wrap(TALLOC_CTX *ctx, DATA_BLOB blob, DATA_BLOB *ticket, uint8 tok_id[2]);
2262 int spnego_gen_krb5_negTokenInit(TALLOC_CTX *ctx,
2263                             const char *principal, int time_offset,
2264                             DATA_BLOB *targ,
2265                             DATA_BLOB *session_key_krb5, uint32 extra_ap_opts,
2266                             time_t *expire_time);
2267 bool spnego_parse_challenge(TALLOC_CTX *ctx, const DATA_BLOB blob,
2268                             DATA_BLOB *chal1, DATA_BLOB *chal2);
2269 DATA_BLOB spnego_gen_auth(TALLOC_CTX *ctx, DATA_BLOB blob);
2270 bool spnego_parse_auth(TALLOC_CTX *ctx, DATA_BLOB blob, DATA_BLOB *auth);
2271 DATA_BLOB spnego_gen_auth_response(TALLOC_CTX *ctx, DATA_BLOB *reply, NTSTATUS nt_status,
2272                                    const char *mechOID);
2273 bool spnego_parse_auth_response(TALLOC_CTX *ctx,
2274                                 DATA_BLOB blob, NTSTATUS nt_status,
2275                                 const char *mechOID,
2276                                 DATA_BLOB *auth);
2277
2278 bool spnego_parse_auth_and_mic(TALLOC_CTX *ctx, DATA_BLOB blob,
2279                                 DATA_BLOB *auth, DATA_BLOB *signature);
2280 DATA_BLOB spnego_gen_auth_response_and_mic(TALLOC_CTX *ctx,
2281                                            NTSTATUS nt_status,
2282                                            const char *mechOID,
2283                                            DATA_BLOB *reply,
2284                                            DATA_BLOB *mechlistMIC);
2285 bool spnego_mech_list_blob(TALLOC_CTX *mem_ctx,
2286                            char **oid_list, DATA_BLOB *data);
2287
2288 /* The following definitions come from libsmb/clistr.c  */
2289
2290 size_t clistr_push_fn(struct cli_state *cli,
2291                         void *dest,
2292                         const char *src,
2293                         int dest_len,
2294                         int flags);
2295 size_t clistr_pull_fn(const char *inbuf,
2296                         char *dest,
2297                         const void *src,
2298                         int dest_len,
2299                         int src_len,
2300                         int flags);
2301 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
2302                           const char *base,
2303                           uint16_t flags2,
2304                           char **pp_dest,
2305                           const void *src,
2306                           int src_len,
2307                           int flags);
2308 size_t clistr_align_out(struct cli_state *cli, const void *p, int flags);
2309
2310 /* The following definitions come from libsmb/clitrans.c  */
2311
2312 struct tevent_req *cli_trans_send(
2313         TALLOC_CTX *mem_ctx, struct event_context *ev,
2314         struct cli_state *cli, uint8_t cmd,
2315         const char *pipe_name, uint16_t fid, uint16_t function, int flags,
2316         uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
2317         uint8_t *param, uint32_t num_param, uint32_t max_param,
2318         uint8_t *data, uint32_t num_data, uint32_t max_data);
2319 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
2320                         uint16_t *recv_flags2,
2321                         uint16_t **setup, uint8_t min_setup,
2322                         uint8_t *num_setup,
2323                         uint8_t **param, uint32_t min_param,
2324                         uint32_t *num_param,
2325                         uint8_t **data, uint32_t min_data,
2326                         uint32_t *num_data);
2327 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
2328                    uint8_t trans_cmd,
2329                    const char *pipe_name, uint16_t fid, uint16_t function,
2330                    int flags,
2331                    uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
2332                    uint8_t *param, uint32_t num_param, uint32_t max_param,
2333                    uint8_t *data, uint32_t num_data, uint32_t max_data,
2334                    uint16_t *recv_flags2,
2335                    uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
2336                    uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
2337                    uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
2338
2339 /* The following definitions come from libsmb/conncache.c  */
2340
2341 NTSTATUS check_negative_conn_cache( const char *domain, const char *server);
2342 void add_failed_connection_entry(const char *domain, const char *server, NTSTATUS result) ;
2343 void flush_negative_conn_cache_for_domain(const char *domain);
2344
2345 /* The following definitions come from libsmb/dsgetdcname.c  */
2346
2347 struct netr_DsRGetDCNameInfo;
2348
2349 void debug_dsdcinfo_flags(int lvl, uint32_t flags);
2350 NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx,
2351                      struct messaging_context *msg_ctx,
2352                      const char *domain_name,
2353                      const struct GUID *domain_guid,
2354                      const char *site_name,
2355                      uint32_t flags,
2356                      struct netr_DsRGetDCNameInfo **info);
2357
2358 /* The following definitions come from libsmb/errormap.c  */
2359
2360 NTSTATUS dos_to_ntstatus(uint8 eclass, uint32 ecode);
2361 void ntstatus_to_dos(NTSTATUS ntstatus, uint8 *eclass, uint32 *ecode);
2362 NTSTATUS werror_to_ntstatus(WERROR error);
2363 WERROR ntstatus_to_werror(NTSTATUS error);
2364 NTSTATUS map_nt_error_from_gss(uint32 gss_maj, uint32 minor);
2365
2366 /* The following definitions come from libsmb/namecache.c  */
2367
2368 bool namecache_store(const char *name,
2369                         int name_type,
2370                         int num_names,
2371                         struct ip_service *ip_list);
2372 bool namecache_fetch(const char *name,
2373                         int name_type,
2374                         struct ip_service **ip_list,
2375                         int *num_names);
2376 bool namecache_delete(const char *name, int name_type);
2377 void namecache_flush(void);
2378 bool namecache_status_store(const char *keyname, int keyname_type,
2379                 int name_type, const struct sockaddr_storage *keyip,
2380                 const char *srvname);
2381 bool namecache_status_fetch(const char *keyname,
2382                                 int keyname_type,
2383                                 int name_type,
2384                                 const struct sockaddr_storage *keyip,
2385                                 char *srvname_out);
2386
2387 /* The following definitions come from libsmb/namequery.c  */
2388
2389 bool saf_store( const char *domain, const char *servername );
2390 bool saf_join_store( const char *domain, const char *servername );
2391 bool saf_delete( const char *domain );
2392 char *saf_fetch( const char *domain );
2393 struct tevent_req *node_status_query_send(TALLOC_CTX *mem_ctx,
2394                                           struct tevent_context *ev,
2395                                           struct nmb_name *name,
2396                                           const struct sockaddr_storage *addr);
2397 NTSTATUS node_status_query_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
2398                                 struct node_status **pnode_status,
2399                                 int *pnum_names,
2400                                 struct node_status_extra *extra);
2401 NTSTATUS node_status_query(TALLOC_CTX *mem_ctx, struct nmb_name *name,
2402                            const struct sockaddr_storage *addr,
2403                            struct node_status **pnode_status,
2404                            int *pnum_names,
2405                            struct node_status_extra *extra);
2406 bool name_status_find(const char *q_name,
2407                         int q_type,
2408                         int type,
2409                         const struct sockaddr_storage *to_ss,
2410                         fstring name);
2411 int ip_service_compare(struct ip_service *ss1, struct ip_service *ss2);
2412 struct tevent_req *name_query_send(TALLOC_CTX *mem_ctx,
2413                                    struct tevent_context *ev,
2414                                    const char *name, int name_type,
2415                                    bool bcast, bool recurse,
2416                                    const struct sockaddr_storage *addr);
2417 NTSTATUS name_query_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
2418                          struct sockaddr_storage **addrs, int *num_addrs,
2419                          uint8_t *flags);
2420 NTSTATUS name_query(const char *name, int name_type,
2421                     bool bcast, bool recurse,
2422                     const struct sockaddr_storage *to_ss,
2423                     TALLOC_CTX *mem_ctx,
2424                     struct sockaddr_storage **addrs,
2425                     int *num_addrs, uint8_t *flags);
2426 NTSTATUS name_resolve_bcast(const char *name,
2427                         int name_type,
2428                         struct ip_service **return_iplist,
2429                         int *return_count);
2430 NTSTATUS resolve_wins(const char *name,
2431                 int name_type,
2432                 struct ip_service **return_iplist,
2433                 int *return_count);
2434 NTSTATUS internal_resolve_name(const char *name,
2435                                 int name_type,
2436                                 const char *sitename,
2437                                 struct ip_service **return_iplist,
2438                                 int *return_count,
2439                                 const char *resolve_order);
2440 bool resolve_name(const char *name,
2441                 struct sockaddr_storage *return_ss,
2442                 int name_type,
2443                 bool prefer_ipv4);
2444 NTSTATUS resolve_name_list(TALLOC_CTX *ctx,
2445                 const char *name,
2446                 int name_type,
2447                 struct sockaddr_storage **return_ss_arr,
2448                 unsigned int *p_num_entries);
2449 bool find_master_ip(const char *group, struct sockaddr_storage *master_ss);
2450 bool get_pdc_ip(const char *domain, struct sockaddr_storage *pss);
2451 NTSTATUS get_sorted_dc_list( const char *domain,
2452                         const char *sitename,
2453                         struct ip_service **ip_list,
2454                         int *count,
2455                         bool ads_only );
2456 NTSTATUS get_kdc_list( const char *realm,
2457                         const char *sitename,
2458                         struct ip_service **ip_list,
2459                         int *count);
2460
2461 /* The following definitions come from libsmb/namequery_dc.c  */
2462
2463 bool get_dc_name(const char *domain,
2464                 const char *realm,
2465                 fstring srv_name,
2466                 struct sockaddr_storage *ss_out);
2467
2468 /* The following definitions come from libsmb/nmblib.c  */
2469
2470 void debug_nmb_packet(struct packet_struct *p);
2471 void put_name(char *dest, const char *name, int pad, unsigned int name_type);
2472 char *nmb_namestr(const struct nmb_name *n);
2473 struct packet_struct *copy_packet(struct packet_struct *packet);
2474 void free_packet(struct packet_struct *packet);
2475 int packet_trn_id(struct packet_struct *p);
2476 struct packet_struct *parse_packet(char *buf,int length,
2477                                    enum packet_type packet_type,
2478                                    struct in_addr ip,
2479                                    int port);
2480 struct packet_struct *read_packet(int fd,enum packet_type packet_type);
2481 void make_nmb_name( struct nmb_name *n, const char *name, int type);
2482 bool nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2);
2483 int build_packet(char *buf, size_t buflen, struct packet_struct *p);
2484 bool send_packet(struct packet_struct *p);
2485 bool match_mailslot_name(struct packet_struct *p, const char *mailslot_name);
2486 int matching_len_bits(unsigned char *p1, unsigned char *p2, size_t len);
2487 void sort_query_replies(char *data, int n, struct in_addr ip);
2488 char *name_mangle(TALLOC_CTX *mem_ctx, const char *In, char name_type);
2489 int name_extract(unsigned char *buf,size_t buf_len, unsigned int ofs, fstring name);
2490 int name_len(unsigned char *s1, size_t buf_len);
2491
2492 /* The following definitions come from libsmb/nterr.c  */
2493
2494 const char *nt_errstr(NTSTATUS nt_code);
2495 const char *get_friendly_nt_error_msg(NTSTATUS nt_code);
2496 const char *get_nt_error_c_code(NTSTATUS nt_code);
2497 NTSTATUS nt_status_string_to_code(const char *nt_status_str);
2498 NTSTATUS nt_status_squash(NTSTATUS nt_status);
2499
2500 /* The following definitions come from libsmb/ntlmssp.c  */
2501 struct ntlmssp_state;
2502 NTSTATUS ntlmssp_set_username(struct ntlmssp_state *ntlmssp_state, const char *user) ;
2503 NTSTATUS ntlmssp_set_hashes(struct ntlmssp_state *ntlmssp_state,
2504                             const uint8_t lm_hash[16],
2505                             const uint8_t nt_hash[16]) ;
2506 NTSTATUS ntlmssp_set_password(struct ntlmssp_state *ntlmssp_state, const char *password) ;
2507 NTSTATUS ntlmssp_set_domain(struct ntlmssp_state *ntlmssp_state, const char *domain) ;
2508 void ntlmssp_want_feature_list(struct ntlmssp_state *ntlmssp_state, char *feature_list);
2509 void ntlmssp_want_feature(struct ntlmssp_state *ntlmssp_state, uint32_t feature);
2510 NTSTATUS ntlmssp_update(struct ntlmssp_state *ntlmssp_state,
2511                         const DATA_BLOB in, DATA_BLOB *out) ;
2512 NTSTATUS ntlmssp_server_start(TALLOC_CTX *mem_ctx,
2513                               bool is_standalone,
2514                               const char *netbios_name,
2515                               const char *netbios_domain,
2516                               const char *dns_name,
2517                               const char *dns_domain,
2518                               struct ntlmssp_state **ntlmssp_state);
2519 NTSTATUS ntlmssp_client_start(TALLOC_CTX *mem_ctx,
2520                               const char *netbios_name,
2521                               const char *netbios_domain,
2522                               bool use_ntlmv2,
2523                               struct ntlmssp_state **_ntlmssp_state);
2524
2525 /* The following definitions come from libsmb/passchange.c  */
2526
2527 NTSTATUS remote_password_change(const char *remote_machine, const char *user_name, 
2528                                 const char *old_passwd, const char *new_passwd,
2529                                 char **err_str);
2530
2531 /* The following definitions come from libsmb/samlogon_cache.c  */
2532
2533 bool netsamlogon_cache_init(void);
2534 bool netsamlogon_cache_shutdown(void);
2535 void netsamlogon_clear_cached_user(const struct dom_sid *user_sid);
2536 bool netsamlogon_cache_store(const char *username, struct netr_SamInfo3 *info3);
2537 struct netr_SamInfo3 *netsamlogon_cache_get(TALLOC_CTX *mem_ctx, const struct dom_sid *user_sid);
2538 bool netsamlogon_cache_have(const struct dom_sid *user_sid);
2539
2540 /* The following definitions come from libsmb/smb_seal.c  */
2541
2542 NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16 *p_enc_ctx_num);
2543 bool common_encryption_on(struct smb_trans_enc_state *es);
2544 NTSTATUS common_ntlm_decrypt_buffer(struct ntlmssp_state *ntlmssp_state, char *buf);
2545 NTSTATUS common_ntlm_encrypt_buffer(struct ntlmssp_state *ntlmssp_state,
2546                                 uint16 enc_ctx_num,
2547                                 char *buf,
2548                                 char **ppbuf_out);
2549 NTSTATUS common_encrypt_buffer(struct smb_trans_enc_state *es, char *buffer, char **buf_out);
2550 NTSTATUS common_decrypt_buffer(struct smb_trans_enc_state *es, char *buf);
2551 void common_free_encryption_state(struct smb_trans_enc_state **pp_es);
2552 void common_free_enc_buffer(struct smb_trans_enc_state *es, char *buf);
2553 bool cli_encryption_on(struct cli_state *cli);
2554 void cli_free_encryption_context(struct cli_state *cli);
2555 void cli_free_enc_buffer(struct cli_state *cli, char *buf);
2556 NTSTATUS cli_decrypt_message(struct cli_state *cli);
2557 NTSTATUS cli_encrypt_message(struct cli_state *cli, char *buf, char **buf_out);
2558
2559 /* The following definitions come from libsmb/clisigning.c  */
2560
2561 bool cli_simple_set_signing(struct cli_state *cli,
2562                             const DATA_BLOB user_session_key,
2563                             const DATA_BLOB response);
2564 bool cli_temp_set_signing(struct cli_state *cli);
2565 void cli_calculate_sign_mac(struct cli_state *cli, char *buf, uint32_t *seqnum);
2566 bool cli_check_sign_mac(struct cli_state *cli, const char *buf, uint32_t seqnum);
2567 bool client_is_signing_on(struct cli_state *cli);
2568 bool client_is_signing_allowed(struct cli_state *cli);
2569 bool client_is_signing_mandatory(struct cli_state *cli);
2570 void cli_set_signing_negotiated(struct cli_state *cli);
2571
2572 /* The following definitions come from smbd/signing.c  */
2573
2574 struct smbd_server_connection;
2575 bool srv_check_sign_mac(struct smbd_server_connection *conn,
2576                         const char *inbuf, uint32_t *seqnum, bool trusted_channel);
2577 void srv_calculate_sign_mac(struct smbd_server_connection *conn,
2578                             char *outbuf, uint32_t seqnum);
2579 void srv_cancel_sign_response(struct smbd_server_connection *conn);
2580 bool srv_init_signing(struct smbd_server_connection *conn);
2581 void srv_set_signing_negotiated(struct smbd_server_connection *conn);
2582 bool srv_is_signing_active(struct smbd_server_connection *conn);
2583 bool srv_is_signing_negotiated(struct smbd_server_connection *conn);
2584 void srv_set_signing(struct smbd_server_connection *conn,
2585                      const DATA_BLOB user_session_key,
2586                      const DATA_BLOB response);
2587
2588 /* The following definitions come from libsmb/smberr.c  */
2589
2590 const char *smb_dos_err_name(uint8 e_class, uint16 num);
2591 const char *get_dos_error_msg(WERROR result);
2592 const char *smb_dos_err_class(uint8 e_class);
2593 char *smb_dos_errstr(char *inbuf);
2594 WERROR map_werror_from_unix(int error);
2595
2596 /* The following definitions come from libsmb/trustdom_cache.c  */
2597
2598 bool trustdom_cache_enable(void);
2599 bool trustdom_cache_shutdown(void);
2600 bool trustdom_cache_store(char* name, char* alt_name, const struct dom_sid *sid,
2601                           time_t timeout);
2602 bool trustdom_cache_fetch(const char* name, struct dom_sid* sid);
2603 uint32 trustdom_cache_fetch_timestamp( void );
2604 bool trustdom_cache_store_timestamp( uint32 t, time_t timeout );
2605 void trustdom_cache_flush(void);
2606 void update_trustdom_cache( void );
2607
2608 /* The following definitions come from libsmb/trusts_util.c  */
2609
2610 NTSTATUS trust_pw_change_and_store_it(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, 
2611                                       const char *domain,
2612                                       const char *account_name,
2613                                       unsigned char orig_trust_passwd_hash[16],
2614                                       enum netr_SchannelType sec_channel_type);
2615 NTSTATUS trust_pw_find_change_and_store_it(struct rpc_pipe_client *cli, 
2616                                            TALLOC_CTX *mem_ctx, 
2617                                            const char *domain) ;
2618 bool enumerate_domain_trusts( TALLOC_CTX *mem_ctx, const char *domain,
2619                                      char ***domain_names, uint32 *num_domains,
2620                                      struct dom_sid **sids );
2621 NTSTATUS change_trust_account_password( const char *domain, const char *remote_machine);
2622
2623 /* The following definitions come from libsmb/unexpected.c  */
2624
2625 struct nb_packet_server;
2626 struct nb_packet_reader;
2627
2628 NTSTATUS nb_packet_server_create(TALLOC_CTX *mem_ctx,
2629                                  struct tevent_context *ev,
2630                                  int max_clients,
2631                                  struct nb_packet_server **presult);
2632 void nb_packet_dispatch(struct nb_packet_server *server,
2633                         struct packet_struct *p);
2634 struct tevent_req *nb_packet_reader_send(TALLOC_CTX *mem_ctx,
2635                                          struct tevent_context *ev,
2636                                          enum packet_type type,
2637                                          int trn_id,
2638                                          const char *mailslot_name);
2639 NTSTATUS nb_packet_reader_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
2640                                struct nb_packet_reader **preader);
2641 struct tevent_req *nb_packet_read_send(TALLOC_CTX *mem_ctx,
2642                                        struct tevent_context *ev,
2643                                        struct nb_packet_reader *reader);
2644 NTSTATUS nb_packet_read_recv(struct tevent_req *req,
2645                              struct packet_struct **ppacket);
2646
2647 /* The following definitions come from locking/brlock.c  */
2648
2649 bool brl_same_context(const struct lock_context *ctx1, 
2650                              const struct lock_context *ctx2);
2651 NTSTATUS brl_lock_failed(files_struct *fsp, const struct lock_struct *lock, bool blocking_lock);
2652 void brl_init(bool read_only);
2653 void brl_shutdown(void);
2654
2655 NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck,
2656                 struct lock_struct *plock,
2657                 bool blocking_lock);
2658
2659 NTSTATUS brl_lock(struct messaging_context *msg_ctx,
2660                 struct byte_range_lock *br_lck,
2661                 uint64_t smblctx,
2662                 struct server_id pid,
2663                 br_off start,
2664                 br_off size, 
2665                 enum brl_type lock_type,
2666                 enum brl_flavour lock_flav,
2667                 bool blocking_lock,
2668                 uint64_t *psmblctx,
2669                 struct blocking_lock_record *blr);
2670 bool brl_unlock(struct messaging_context *msg_ctx,
2671                 struct byte_range_lock *br_lck,
2672                 uint64_t smblctx,
2673                 struct server_id pid,
2674                 br_off start,
2675                 br_off size,
2676                 enum brl_flavour lock_flav);
2677 bool brl_unlock_windows_default(struct messaging_context *msg_ctx,
2678                                struct byte_range_lock *br_lck,
2679                                const struct lock_struct *plock);
2680 bool brl_locktest(struct byte_range_lock *br_lck,
2681                 uint64_t smblctx,
2682                 struct server_id pid,
2683                 br_off start,
2684                 br_off size, 
2685                 enum brl_type lock_type,
2686                 enum brl_flavour lock_flav);
2687 NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
2688                 uint64_t *psmblctx,
2689                 struct server_id pid,
2690                 br_off *pstart,
2691                 br_off *psize, 
2692                 enum brl_type *plock_type,
2693                 enum brl_flavour lock_flav);
2694 bool brl_lock_cancel(struct byte_range_lock *br_lck,
2695                 uint64_t smblctx,
2696                 struct server_id pid,
2697                 br_off start,
2698                 br_off size,
2699                 enum brl_flavour lock_flav,
2700                 struct blocking_lock_record *blr);
2701 bool brl_lock_cancel_default(struct byte_range_lock *br_lck,
2702                 struct lock_struct *plock);
2703 void brl_close_fnum(struct messaging_context *msg_ctx,
2704                     struct byte_range_lock *br_lck);
2705 int brl_forall(void (*fn)(struct file_id id, struct server_id pid,
2706                           enum brl_type lock_type,
2707                           enum brl_flavour lock_flav,
2708                           br_off start, br_off size,
2709                           void *private_data),
2710                void *private_data);
2711 struct byte_range_lock *brl_get_locks(TALLOC_CTX *mem_ctx,
2712                                         files_struct *fsp);
2713 struct byte_range_lock *brl_get_locks_readonly(files_struct *fsp);
2714 void brl_register_msgs(struct messaging_context *msg_ctx);
2715
2716 /* The following definitions come from locking/locking.c  */
2717
2718 const char *lock_type_name(enum brl_type lock_type);
2719 const char *lock_flav_name(enum brl_flavour lock_flav);
2720 void init_strict_lock_struct(files_struct *fsp,
2721                                 uint64_t smblctx,
2722                                 br_off start,
2723                                 br_off size,
2724                                 enum brl_type lock_type,
2725                                 struct lock_struct *plock);
2726 bool strict_lock_default(files_struct *fsp,
2727                                 struct lock_struct *plock);
2728 void strict_unlock_default(files_struct *fsp,
2729                                 struct lock_struct *plock);
2730 NTSTATUS query_lock(files_struct *fsp,
2731                         uint64_t *psmblctx,
2732                         uint64_t *pcount,
2733                         uint64_t *poffset,
2734                         enum brl_type *plock_type,
2735                         enum brl_flavour lock_flav);
2736 struct byte_range_lock *do_lock(struct messaging_context *msg_ctx,
2737                         files_struct *fsp,
2738                         uint64_t smblctx,
2739                         uint64_t count,
2740                         uint64_t offset,
2741                         enum brl_type lock_type,
2742                         enum brl_flavour lock_flav,
2743                         bool blocking_lock,
2744                         NTSTATUS *perr,
2745                         uint64_t *psmblctx,
2746                         struct blocking_lock_record *blr);
2747 NTSTATUS do_unlock(struct messaging_context *msg_ctx,
2748                         files_struct *fsp,
2749                         uint64_t smblctx,
2750                         uint64_t count,
2751                         uint64_t offset,
2752                         enum brl_flavour lock_flav);
2753 NTSTATUS do_lock_cancel(files_struct *fsp,
2754                         uint64 smblctx,
2755                         uint64_t count,
2756                         uint64_t offset,
2757                         enum brl_flavour lock_flav,
2758                         struct blocking_lock_record *blr);
2759 void locking_close_file(struct messaging_context *msg_ctx,
2760                         files_struct *fsp,
2761                         enum file_close_type close_type);
2762 bool locking_init(void);
2763 bool locking_init_readonly(void);
2764 bool locking_end(void);
2765 char *share_mode_str(TALLOC_CTX *ctx, int num, const struct share_mode_entry *e);
2766 struct share_mode_lock *get_share_mode_lock(TALLOC_CTX *mem_ctx,
2767                                             const struct file_id id,
2768                                             const char *servicepath,
2769                                             const struct smb_filename *smb_fname,
2770                                             const struct timespec *old_write_time);
2771 struct share_mode_lock *fetch_share_mode_unlocked(TALLOC_CTX *mem_ctx,
2772                                                   const struct file_id id);
2773 bool rename_share_filename(struct messaging_context *msg_ctx,
2774                         struct share_mode_lock *lck,
2775                         const char *servicepath,
2776                         uint32_t orig_name_hash,
2777                         uint32_t new_name_hash,
2778                         const struct smb_filename *smb_fname);
2779 void get_file_infos(struct file_id id,
2780                     uint32_t name_hash,
2781                     bool *delete_on_close,
2782                     struct timespec *write_time);
2783 bool is_valid_share_mode_entry(const struct share_mode_entry *e);
2784 bool is_deferred_open_entry(const struct share_mode_entry *e);
2785 bool is_unused_share_mode_entry(const struct share_mode_entry *e);
2786 void set_share_mode(struct share_mode_lock *lck, files_struct *fsp,
2787                     uid_t uid, uint64_t mid, uint16 op_type);
2788 void add_deferred_open(struct share_mode_lock *lck, uint64_t mid,
2789                        struct timeval request_time,
2790                        struct server_id pid, struct file_id id);
2791 bool del_share_mode(struct share_mode_lock *lck, files_struct *fsp);
2792 void del_deferred_open_entry(struct share_mode_lock *lck, uint64_t mid,
2793                              struct server_id pid);
2794 bool remove_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
2795 bool downgrade_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
2796 NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32 dosmode);
2797 const struct security_unix_token *get_delete_on_close_token(struct share_mode_lock *lck, uint32_t name_hash);
2798 void set_delete_on_close_lck(files_struct *fsp,
2799                         struct share_mode_lock *lck,
2800                         bool delete_on_close,
2801                         const struct security_unix_token *tok);
2802 bool set_delete_on_close(files_struct *fsp, bool delete_on_close, const struct security_unix_token *tok);
2803 bool is_delete_on_close_set(struct share_mode_lock *lck, uint32_t name_hash);
2804 bool set_sticky_write_time(struct file_id fileid, struct timespec write_time);
2805 bool set_write_time(struct file_id fileid, struct timespec write_time);
2806 int share_mode_forall(void (*fn)(const struct share_mode_entry *, const char *,
2807                                  const char *, void *),
2808                       void *private_data);
2809
2810 /* The following definitions come from locking/posix.c  */
2811
2812 bool is_posix_locked(files_struct *fsp,
2813                         uint64_t *pu_offset,
2814                         uint64_t *pu_count,
2815                         enum brl_type *plock_type,
2816                         enum brl_flavour lock_flav);
2817 bool posix_locking_init(bool read_only);
2818 bool posix_locking_end(void);
2819 void reduce_windows_lock_ref_count(files_struct *fsp, unsigned int dcount);
2820 int fd_close_posix(struct files_struct *fsp);
2821 bool set_posix_lock_windows_flavour(files_struct *fsp,
2822                         uint64_t u_offset,
2823                         uint64_t u_count,
2824                         enum brl_type lock_type,
2825                         const struct lock_context *lock_ctx,
2826                         const struct lock_struct *plocks,
2827                         int num_locks,
2828                         int *errno_ret);
2829 bool release_posix_lock_windows_flavour(files_struct *fsp,
2830                                 uint64_t u_offset,
2831                                 uint64_t u_count,
2832                                 enum brl_type deleted_lock_type,
2833                                 const struct lock_context *lock_ctx,
2834                                 const struct lock_struct *plocks,
2835                                 int num_locks);
2836 bool set_posix_lock_posix_flavour(files_struct *fsp,
2837                         uint64_t u_offset,
2838                         uint64_t u_count,
2839                         enum brl_type lock_type,
2840                         int *errno_ret);
2841 bool release_posix_lock_posix_flavour(files_struct *fsp,
2842                                 uint64_t u_offset,
2843                                 uint64_t u_count,
2844                                 const struct lock_context *lock_ctx,
2845                                 const struct lock_struct *plocks,
2846                                 int num_locks);
2847
2848 /* The following definitions come from modules/vfs_default.c  */
2849
2850 ssize_t vfswrap_llistxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size);
2851 ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size);
2852 NTSTATUS vfs_default_init(void);
2853
2854 /* The following definitions come from param/loadparm.c  */
2855
2856 char *lp_smb_ports(void);
2857 char *lp_dos_charset(void);
2858 char *lp_unix_charset(void);
2859 char *lp_display_charset(void);
2860 char *lp_logfile(void);
2861 char *lp_configfile(void);
2862 char *lp_smb_passwd_file(void);
2863 char *lp_private_dir(void);
2864 char *lp_serverstring(void);
2865 int lp_printcap_cache_time(void);
2866 char *lp_addport_cmd(void);
2867 char *lp_enumports_cmd(void);
2868 char *lp_addprinter_cmd(void);
2869 char *lp_deleteprinter_cmd(void);
2870 char *lp_os2_driver_map(void);
2871 char *lp_lockdir(void);
2872 char *lp_statedir(void);
2873 char *lp_cachedir(void);
2874 char *lp_piddir(void);
2875 char *lp_mangling_method(void);
2876 int lp_mangle_prefix(void);
2877 char *lp_utmpdir(void);
2878 char *lp_wtmpdir(void);
2879 bool lp_utmp(void);
2880 char *lp_rootdir(void);
2881 char *lp_defaultservice(void);
2882 char *lp_msg_command(void);
2883 char *lp_get_quota_command(void);
2884 char *lp_set_quota_command(void);
2885 char *lp_auto_services(void);
2886 char *lp_passwd_program(void);
2887 char *lp_passwd_chat(void);
2888 char *lp_passwordserver(void);
2889 char *lp_name_resolve_order(void);
2890 char *lp_realm(void);
2891 const char *lp_afs_username_map(void);
2892 int lp_afs_token_lifetime(void);
2893 char *lp_log_nt_token_command(void);
2894 char *lp_username_map(void);
2895 const char *lp_logon_script(void);
2896 const char *lp_logon_path(void);
2897 const char *lp_logon_drive(void);
2898 const char *lp_logon_home(void);
2899 char *lp_remote_announce(void);
2900 char *lp_remote_browse_sync(void);
2901 bool lp_nmbd_bind_explicit_broadcast(void);
2902 const char **lp_wins_server_list(void);
2903 const char **lp_interfaces(void);
2904 const char *lp_socket_address(void);
2905 char *lp_nis_home_map_name(void);
2906 const char **lp_netbios_aliases(void);
2907 const char *lp_passdb_backend(void);
2908 const char **lp_preload_modules(void);
2909 char *lp_panic_action(void);
2910 char *lp_adduser_script(void);
2911 char *lp_renameuser_script(void);
2912 char *lp_deluser_script(void);
2913 const char *lp_guestaccount(void);
2914 char *lp_addgroup_script(void);
2915 char *lp_delgroup_script(void);
2916 char *lp_addusertogroup_script(void);
2917 char *lp_deluserfromgroup_script(void);
2918 char *lp_setprimarygroup_script(void);
2919 char *lp_addmachine_script(void);
2920 char *lp_shutdown_script(void);
2921 char *lp_abort_shutdown_script(void);
2922 char *lp_username_map_script(void);
2923 int lp_username_map_cache_time(void);
2924 char *lp_check_password_script(void);
2925 char *lp_wins_hook(void);
2926 const char *lp_template_homedir(void);
2927 const char *lp_template_shell(void);
2928 const char *lp_winbind_separator(void);
2929 int lp_acl_compatibility(void);
2930 bool lp_winbind_enum_users(void);
2931 bool lp_winbind_enum_groups(void);
2932 bool lp_winbind_use_default_domain(void);
2933 bool lp_winbind_trusted_domains_only(void);
2934 bool lp_winbind_nested_groups(void);
2935 int lp_winbind_expand_groups(void);
2936 bool lp_winbind_refresh_tickets(void);
2937 bool lp_winbind_offline_logon(void);
2938 bool lp_winbind_normalize_names(void);
2939 bool lp_winbind_rpc_only(void);
2940 bool lp_create_krb5_conf(void);
2941 int lp_winbind_max_domain_connections(void);
2942 const char *lp_idmap_backend(void);
2943 int lp_idmap_cache_time(void);
2944 int lp_idmap_negative_cache_time(void);
2945 int lp_keepalive(void);
2946 bool lp_passdb_expand_explicit(void);
2947 char *lp_ldap_suffix(void);
2948 char *lp_ldap_admin_dn(void);
2949 int lp_ldap_ssl(void);
2950 bool lp_ldap_ssl_ads(void);
2951 int lp_ldap_deref(void);
2952 int lp_ldap_follow_referral(void);
2953 int lp_ldap_passwd_sync(void);
2954 bool lp_ldap_delete_dn(void);
2955 int lp_ldap_replication_sleep(void);
2956 int lp_ldap_timeout(void);
2957 int lp_ldap_connection_timeout(void);
2958 int lp_ldap_page_size(void);
2959 int lp_ldap_debug_level(void);
2960 int lp_ldap_debug_threshold(void);
2961 char *lp_add_share_cmd(void);
2962 char *lp_change_share_cmd(void);
2963 char *lp_delete_share_cmd(void);
2964 char *lp_usershare_path(void);
2965 const char **lp_usershare_prefix_allow_list(void);
2966 const char **lp_usershare_prefix_deny_list(void);
2967 const char **lp_eventlog_list(void);
2968 bool lp_registry_shares(void);
2969 bool lp_usershare_allow_guests(void);
2970 bool lp_usershare_owner_only(void);
2971 bool lp_disable_netbios(void);
2972 bool lp_reset_on_zero_vc(void);
2973 bool lp_log_writeable_files_on_exit(void);
2974 bool lp_ms_add_printer_wizard(void);
2975 bool lp_dns_proxy(void);
2976 bool lp_wins_support(void);
2977 bool lp_we_are_a_wins_server(void);
2978 bool lp_wins_proxy(void);
2979 bool lp_local_master(void);
2980 bool lp_domain_logons(void);
2981 const char **lp_init_logon_delayed_hosts(void);
2982 int lp_init_logon_delay(void);
2983 bool lp_load_printers(void);
2984 bool lp_readraw(void);
2985 bool _lp_readraw(void);
2986 bool lp_large_readwrite(void);
2987 bool lp_writeraw(void);
2988 bool _lp_writeraw(void);
2989 bool lp_null_passwords(void);
2990 bool lp_obey_pam_restrictions(void);
2991 bool lp_encrypted_passwords(void);
2992 int lp_client_schannel(void);
2993 int lp_server_schannel(void);
2994 bool lp_syslog_only(void);
2995 bool lp_timestamp_logs(void);
2996 bool lp_debug_prefix_timestamp(void);
2997 bool lp_debug_hires_timestamp(void);
2998 bool lp_debug_pid(void);
2999 bool lp_debug_uid(void);
3000 bool lp_debug_class(void);
3001 bool lp_enable_core_files(void);
3002 bool lp_browse_list(void);
3003 bool lp_nis_home_map(void);
3004 bool lp_bind_interfaces_only(void);
3005 bool lp_pam_password_change(void);
3006 bool lp_unix_password_sync(void);
3007 bool lp_passwd_chat_debug(void);
3008 int lp_passwd_chat_timeout(void);
3009 bool lp_nt_pipe_support(void);
3010 bool lp_nt_status_support(void);
3011 bool lp_stat_cache(void);
3012 int lp_max_stat_cache_size(void);
3013 bool lp_allow_trusted_domains(void);
3014 bool lp_map_untrusted_to_domain(void);
3015 int lp_restrict_anonymous(void);
3016 bool lp_lanman_auth(void);
3017 bool lp_ntlm_auth(void);
3018 bool lp_client_plaintext_auth(void);
3019 bool lp_client_lanman_auth(void);
3020 bool lp_client_ntlmv2_auth(void);
3021 bool lp_host_msdfs(void);
3022 bool lp_kernel_oplocks(void);
3023 bool lp_enhanced_browsing(void);
3024 bool lp_use_mmap(void);
3025 bool lp_unix_extensions(void);
3026 bool lp_use_spnego(void);
3027 bool lp_client_use_spnego(void);
3028 bool lp_client_use_spnego_principal(void);
3029 bool lp_send_spnego_principal(void);
3030 bool lp_hostname_lookups(void);
3031 bool lp_change_notify(const struct share_params *p );
3032 bool lp_kernel_change_notify(const struct share_params *p );
3033 char * lp_dedicated_keytab_file(void);
3034 int lp_kerberos_method(void);
3035 bool lp_defer_sharing_violations(void);
3036 bool lp_enable_privileges(void);
3037 bool lp_enable_asu_support(void);
3038 int lp_os_level(void);
3039 int lp_max_ttl(void);
3040 int lp_max_wins_ttl(void);
3041 int lp_min_wins_ttl(void);
3042 int lp_max_log_size(void);
3043 int lp_max_open_files(void);
3044 int lp_open_files_db_hash_size(void);
3045 int lp_maxxmit(void);
3046 int lp_maxmux(void);
3047 int lp_passwordlevel(void);
3048 int lp_usernamelevel(void);
3049 int lp_deadtime(void);
3050 bool lp_getwd_cache(void);
3051 int lp_maxprotocol(void);
3052 int lp_minprotocol(void);
3053 int lp_security(void);
3054 const char **lp_auth_methods(void);
3055 bool lp_paranoid_server_security(void);
3056 int lp_maxdisksize(void);
3057 int lp_lpqcachetime(void);
3058 int lp_max_smbd_processes(void);
3059 bool _lp_disable_spoolss(void);
3060 int lp_syslog(void);
3061 int lp_lm_announce(void);
3062 int lp_lm_interval(void);
3063 int lp_machine_password_timeout(void);
3064 int lp_map_to_guest(void);
3065 int lp_oplock_break_wait_time(void);
3066 int lp_lock_spin_time(void);
3067 int lp_usershare_max_shares(void);
3068 const char *lp_socket_options(void);
3069 int lp_config_backend(void);
3070 int lp_smb2_max_read(void);
3071 int lp_smb2_max_write(void);
3072 int lp_smb2_max_trans(void);
3073 int lp_smb2_max_credits(void);
3074 char *lp_preexec(int );
3075 char *lp_postexec(int );
3076 char *lp_rootpreexec(int );
3077 char *lp_rootpostexec(int );
3078 char *lp_servicename(int );
3079 const char *lp_const_servicename(int );
3080 char *lp_pathname(int );
3081 char *lp_dontdescend(int );
3082 char *lp_username(int );
3083 const char **lp_invalid_users(int );
3084 const char **lp_valid_users(int );
3085 const char **lp_admin_users(int );
3086 const char **lp_svcctl_list(void);
3087 char *lp_cups_options(int );
3088 char *lp_cups_server(void);
3089 int lp_cups_encrypt(void);
3090 char *lp_iprint_server(void);
3091 int lp_cups_connection_timeout(void);
3092 const char *lp_ctdbd_socket(void);
3093 const char **lp_cluster_addresses(void);
3094 bool lp_clustering(void);
3095 int lp_ctdb_timeout(void);
3096 int lp_ctdb_locktime_warn_threshold(void);
3097 char *lp_printcommand(int );
3098 char *lp_lpqcommand(int );
3099 char *lp_lprmcommand(int );
3100 char *lp_lppausecommand(int );
3101 char *lp_lpresumecommand(int );
3102 char *lp_queuepausecommand(int );
3103 char *lp_queueresumecommand(int );
3104 const char *lp_printjob_username(int );
3105 const char **lp_hostsallow(int );
3106 const char **lp_hostsdeny(int );
3107 char *lp_magicscript(int );
3108 char *lp_magicoutput(int );
3109 char *lp_comment(int );
3110 char *lp_force_user(int );
3111 char *lp_force_group(int );
3112 const char **lp_readlist(int );
3113 const char **lp_writelist(int );
3114 const char **lp_printer_admin(int );
3115 char *lp_fstype(int );
3116 const char **lp_vfs_objects(int );
3117 char *lp_msdfs_proxy(int );
3118 char *lp_veto_files(int );
3119 char *lp_hide_files(int );
3120 char *lp_veto_oplocks(int );
3121 bool lp_msdfs_root(int );
3122 char *lp_aio_write_behind(int );
3123 char *lp_dfree_command(int );
3124 bool lp_autoloaded(int );
3125 bool lp_preexec_close(int );
3126 bool lp_rootpreexec_close(int );
3127 int lp_casesensitive(int );
3128 bool lp_preservecase(int );
3129 bool lp_shortpreservecase(int );
3130 bool lp_hide_dot_files(int );
3131 bool lp_hide_special_files(int );
3132 bool lp_hideunreadable(int );
3133 bool lp_hideunwriteable_files(int );
3134 bool lp_browseable(int );
3135 bool lp_access_based_share_enum(int );
3136 bool lp_readonly(int );
3137 bool lp_no_set_dir(int );
3138 bool lp_guest_ok(int );
3139 bool lp_guest_only(int );
3140 bool lp_administrative_share(int );
3141 bool lp_print_ok(int );
3142 bool lp_print_notify_backchannel(int );
3143 bool lp_map_hidden(int );
3144 bool lp_map_archive(int );
3145 bool lp_store_dos_attributes(int );
3146 bool lp_dmapi_support(int );
3147 bool lp_locking(const struct share_params *p );
3148 int lp_strict_locking(const struct share_params *p );
3149 bool lp_posix_locking(const struct share_params *p );
3150 bool lp_share_modes(int );
3151 bool lp_oplocks(int );
3152 bool lp_level2_oplocks(int );
3153 bool lp_onlyuser(int );
3154 bool lp_manglednames(const struct share_params *p );
3155 bool lp_widelinks(int );
3156 bool lp_symlinks(int );
3157 bool lp_syncalways(int );
3158 bool lp_strict_allocate(int );
3159 bool lp_strict_sync(int );
3160 bool lp_map_system(int );
3161 bool lp_delete_readonly(int );
3162 bool lp_fake_oplocks(int );
3163 bool lp_recursive_veto_delete(int );
3164 bool lp_dos_filemode(int );
3165 bool lp_dos_filetimes(int );
3166 bool lp_dos_filetime_resolution(int );
3167 bool lp_fake_dir_create_times(int);
3168 bool lp_async_smb_echo_handler(void);
3169 bool lp_multicast_dns_register(void);
3170 bool lp_blocking_locks(int );
3171 bool lp_inherit_perms(int );
3172 bool lp_inherit_acls(int );
3173 bool lp_inherit_owner(int );
3174 bool lp_use_client_driver(int );
3175 bool lp_default_devmode(int );
3176 bool lp_force_printername(int );
3177 bool lp_nt_acl_support(int );
3178 bool lp_force_unknown_acl_user(int );
3179 bool lp_ea_support(int );
3180 bool _lp_use_sendfile(int );
3181 bool lp_profile_acls(int );
3182 bool lp_map_acl_inherit(int );
3183 bool lp_afs_share(int );
3184 bool lp_acl_check_permissions(int );
3185 bool lp_acl_group_control(int );
3186 bool lp_acl_map_full_control(int );
3187 int lp_create_mask(int );
3188 int lp_force_create_mode(int );
3189 int lp_security_mask(int );
3190 int lp_force_security_mode(int );
3191 int lp_dir_mask(int );
3192 int lp_force_dir_mode(int );
3193 int lp_dir_security_mask(int );
3194 int lp_force_dir_security_mode(int );
3195 int lp_max_connections(int );
3196 int lp_defaultcase(int );
3197 int lp_minprintspace(int );
3198 int lp_printing(int );
3199 int lp_max_reported_jobs(int );
3200 int lp_oplock_contention_limit(int );
3201 int lp_csc_policy(int );
3202 int lp_write_cache_size(int );
3203 int lp_block_size(int );
3204 int lp_dfree_cache_time(int );
3205 int lp_allocation_roundup_size(int );
3206 int lp_aio_read_size(int );
3207 int lp_aio_write_size(int );
3208 int lp_map_readonly(int );
3209 int lp_directory_name_cache_size(int );
3210 int lp_smb_encrypt(int );
3211 char lp_magicchar(const struct share_params *p );
3212 int lp_winbind_cache_time(void);
3213 int lp_winbind_reconnect_delay(void);
3214 int lp_winbind_max_clients(void);
3215 const char **lp_winbind_nss_info(void);
3216 int lp_algorithmic_rid_base(void);
3217 int lp_name_cache_timeout(void);
3218 int lp_client_signing(void);
3219 int lp_server_signing(void);
3220 int lp_client_ldap_sasl_wrapping(void);
3221 char *lp_parm_talloc_string(int snum, const char *type, const char *option, const char *def);
3222 const char *lp_parm_const_string(int snum, const char *type, const char *option, const char *def);
3223 const char **lp_parm_string_list(int snum, const char *type, const char *option, const char **def);
3224 int lp_parm_int(int snum, const char *type, const char *option, int def);
3225 unsigned long lp_parm_ulong(int snum, const char *type, const char *option, unsigned long def);
3226 bool lp_parm_bool(int snum, const char *type, const char *option, bool def);
3227 int lp_parm_enum(int snum, const char *type, const char *option,
3228                  const struct enum_list *_enum, int def);
3229 char *canonicalize_servicename(TALLOC_CTX *ctx, const char *src);
3230 bool lp_add_home(const char *pszHomename, int iDefaultService,
3231                  const char *user, const char *pszHomedir);
3232 int lp_add_service(const char *pszService, int iDefaultService);
3233 bool lp_add_printer(const char *pszPrintername, int iDefaultService);
3234 bool lp_parameter_is_valid(const char *pszParmName);
3235 bool lp_parameter_is_global(const char *pszParmName);
3236 bool lp_parameter_is_canonical(const char *parm_name);
3237 bool lp_canonicalize_parameter(const char *parm_name, const char **canon_parm,
3238                                bool *inverse);
3239 bool lp_canonicalize_parameter_with_value(const char *parm_name,
3240                                           const char *val,
3241                                           const char **canon_parm,
3242                                           const char **canon_val);
3243 void show_parameter_list(void);
3244 bool lp_string_is_valid_boolean(const char *parm_value);
3245 bool lp_invert_boolean(const char *str, const char **inverse_str);
3246 bool lp_canonicalize_boolean(const char *str, const char**canon_str);
3247 bool service_ok(int iService);
3248 bool process_registry_service(const char *service_name);
3249 bool process_registry_shares(void);
3250 bool lp_config_backend_is_registry(void);
3251 bool lp_config_backend_is_file(void);
3252 bool lp_file_list_changed(void);
3253 bool lp_idmap_uid(uid_t *low, uid_t *high);
3254 bool lp_idmap_gid(gid_t *low, gid_t *high);
3255 const char *lp_ldap_machine_suffix(void);
3256 const char *lp_ldap_user_suffix(void);
3257 const char *lp_ldap_group_suffix(void);
3258 const char *lp_ldap_idmap_suffix(void);
3259 void *lp_local_ptr_by_snum(int snum, void *ptr);
3260 bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue);
3261 bool lp_set_cmdline(const char *pszParmName, const char *pszParmValue);
3262 bool lp_set_option(const char *option);
3263 void init_locals(void);
3264 bool lp_is_default(int snum, struct parm_struct *parm);
3265 bool dump_a_parameter(int snum, char *parm_name, FILE * f, bool isGlobal);
3266 struct parm_struct *lp_get_parameter(const char *param_name);
3267 struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters);
3268 bool lp_snum_ok(int iService);
3269 void lp_add_one_printer(const char *name, const char *comment, void *pdata);
3270 bool lp_loaded(void);
3271 void lp_killunused(bool (*snumused) (int));
3272 void lp_kill_all_services(void);
3273 void lp_killservice(int iServiceIn);
3274 const char* server_role_str(uint32 role);
3275 enum usershare_err parse_usershare_file(TALLOC_CTX *ctx,
3276                         SMB_STRUCT_STAT *psbuf,
3277                         const char *servicename,
3278                         int snum,
3279                         char **lines,
3280                         int numlines,
3281                         char **pp_sharepath,
3282                         char **pp_comment,
3283                         char **pp_cp_share_name,
3284                         struct security_descriptor **ppsd,
3285                         bool *pallow_guest);
3286 int load_usershare_service(const char *servicename);
3287 int load_usershare_shares(void);
3288 void gfree_loadparm(void);
3289 void lp_set_in_client(bool b);
3290 bool lp_is_in_client(void);
3291 bool lp_load(const char *pszFname,
3292              bool global_only,
3293              bool save_defaults,
3294              bool add_ipc,
3295              bool initialize_globals);
3296 bool lp_load_initial_only(const char *pszFname);
3297 bool lp_load_with_registry_shares(const char *pszFname,
3298                                   bool global_only,
3299                                   bool save_defaults,
3300                                   bool add_ipc,
3301                                   bool initialize_globals);
3302 int lp_numservices(void);
3303 void lp_dump(FILE *f, bool show_defaults, int maxtoprint);
3304 void lp_dump_one(FILE * f, bool show_defaults, int snum);
3305 int lp_servicenumber(const char *pszServiceName);
3306 bool share_defined(const char *service_name);
3307 struct share_params *get_share_params(TALLOC_CTX *mem_ctx,
3308                                       const char *sharename);
3309 struct share_iterator *share_list_all(TALLOC_CTX *mem_ctx);
3310 struct share_params *next_share(struct share_iterator *list);
3311 struct share_params *next_printer(struct share_iterator *list);
3312 struct share_params *snum2params_static(int snum);
3313 const char *volume_label(int snum);
3314 bool lp_domain_master(void);
3315 bool lp_domain_master_true_or_auto(void);
3316 bool lp_preferred_master(void);
3317 void lp_remove_service(int snum);
3318 void lp_copy_service(int snum, const char *new_name);
3319 int lp_default_server_announce(void);
3320 int lp_major_announce_version(void);
3321 int lp_minor_announce_version(void);
3322 void lp_set_name_resolve_order(const char *new_order);
3323 const char *lp_printername(int snum);
3324 void lp_set_logfile(const char *name);
3325 int lp_maxprintjobs(int snum);
3326 const char *lp_printcapname(void);
3327 bool lp_disable_spoolss( void );
3328 void lp_set_spoolss_state( uint32 state );
3329 uint32 lp_get_spoolss_state( void );
3330 bool lp_use_sendfile(int snum, struct smb_signing_state *signing_state);
3331 void set_use_sendfile(int snum, bool val);
3332 void set_store_dos_attributes(int snum, bool val);
3333 void lp_set_mangling_method(const char *new_method);
3334 bool lp_posix_pathnames(void);
3335 void lp_set_posix_pathnames(void);
3336 enum brl_flavour lp_posix_cifsu_locktype(files_struct *fsp);
3337 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val);
3338 int lp_min_receive_file_size(void);
3339 char* lp_perfcount_module(void);
3340 void lp_set_passdb_backend(const char *backend);
3341 void widelinks_warning(int snum);
3342 char *lp_ncalrpc_dir(void);
3343
3344 /* The following definitions come from param/loadparm_server_role.c  */
3345
3346 int lp_server_role(void);
3347 void set_server_role(void);
3348
3349 /* The following definitions come from param/util.c  */
3350
3351 uint32 get_int_param( const char* param );
3352 char* get_string_param( const char* param );
3353
3354 /* The following definitions come from passdb/login_cache.c  */
3355
3356 bool login_cache_init(void);
3357 bool login_cache_shutdown(void);
3358 bool login_cache_read(struct samu *sampass, struct login_cache *entry);
3359 bool login_cache_write(const struct samu *sampass,
3360                        const struct login_cache *entry);
3361 bool login_cache_delentry(const struct samu *sampass);
3362
3363 /* The following definitions come from passdb/lookup_sid.c  */
3364
3365 bool lookup_name(TALLOC_CTX *mem_ctx,
3366                  const char *full_name, int flags,
3367                  const char **ret_domain, const char **ret_name,
3368                  struct dom_sid *ret_sid, enum lsa_SidType *ret_type);
3369 bool lookup_name_smbconf(TALLOC_CTX *mem_ctx,
3370                  const char *full_name, int flags,
3371                  const char **ret_domain, const char **ret_name,
3372                  struct dom_sid *ret_sid, enum lsa_SidType *ret_type);
3373 NTSTATUS lookup_sids(TALLOC_CTX *mem_ctx, int num_sids,
3374                      const struct dom_sid **sids, int level,
3375                      struct lsa_dom_info **ret_domains,
3376                      struct lsa_name_info **ret_names);
3377 bool lookup_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
3378                 const char **ret_domain, const char **ret_name,
3379                 enum lsa_SidType *ret_type);
3380 void store_uid_sid_cache(const struct dom_sid *psid, uid_t uid);
3381 void store_gid_sid_cache(const struct dom_sid *psid, gid_t gid);
3382 void uid_to_sid(struct dom_sid *psid, uid_t uid);
3383 void gid_to_sid(struct dom_sid *psid, gid_t gid);
3384 bool sid_to_uid(const struct dom_sid *psid, uid_t *puid);
3385 bool sid_to_gid(const struct dom_sid *psid, gid_t *pgid);
3386 NTSTATUS get_primary_group_sid(TALLOC_CTX *mem_ctx,
3387                                 const char *username,
3388                                 struct passwd **_pwd,
3389                                 struct dom_sid **_group_sid);
3390 bool delete_uid_cache(uid_t uid);
3391 bool delete_gid_cache(gid_t gid);
3392 bool delete_sid_cache(const struct dom_sid* psid);
3393 void flush_uid_cache(void);
3394 void flush_gid_cache(void);
3395
3396 /* The following definitions come from passdb/machine_sid.c  */
3397
3398 struct dom_sid  *get_global_sam_sid(void);
3399 void reset_global_sam_sid(void) ;
3400 bool sid_check_is_domain(const struct dom_sid  *sid);
3401 bool sid_check_is_in_our_domain(const struct dom_sid  *sid);
3402
3403 /* The following definitions come from passdb/passdb.c  */
3404
3405 const char *my_sam_name(void);
3406 struct samu *samu_new( TALLOC_CTX *ctx );
3407 NTSTATUS samu_set_unix(struct samu *user, const struct passwd *pwd);
3408 NTSTATUS samu_alloc_rid_unix(struct samu *user, const struct passwd *pwd);
3409 char *pdb_encode_acct_ctrl(uint32_t acct_ctrl, size_t length);
3410 uint32_t pdb_decode_acct_ctrl(const char *p);
3411 void pdb_sethexpwd(char p[33], const unsigned char *pwd, uint32_t acct_ctrl);
3412 bool pdb_gethexpwd(const char *p, unsigned char *pwd);
3413 void pdb_sethexhours(char *p, const unsigned char *hours);
3414 bool pdb_gethexhours(const char *p, unsigned char *hours);
3415 int algorithmic_rid_base(void);
3416 uid_t algorithmic_pdb_user_rid_to_uid(uint32_t user_rid);
3417 uid_t max_algorithmic_uid(void);
3418 uint32_t algorithmic_pdb_uid_to_user_rid(uid_t uid);
3419 gid_t pdb_group_rid_to_gid(uint32_t group_rid);
3420 gid_t max_algorithmic_gid(void);
3421 uint32_t algorithmic_pdb_gid_to_group_rid(gid_t gid);
3422 bool algorithmic_pdb_rid_is_user(uint32_t rid);
3423 bool lookup_global_sam_name(const char *name, int flags, uint32_t *rid,
3424                             enum lsa_SidType *type);
3425 NTSTATUS local_password_change(const char *user_name,
3426                                 int local_flags,
3427                                 const char *new_passwd, 
3428                                 char **pp_err_str,
3429                                 char **pp_msg_str);
3430 bool init_samu_from_buffer(struct samu *sampass, uint32_t level,
3431                            uint8_t *buf, uint32_t buflen);
3432 uint32_t init_buffer_from_samu (uint8_t **buf, struct samu *sampass, bool size_only);
3433 bool pdb_copy_sam_account(struct samu *dst, struct samu *src );
3434 bool pdb_update_bad_password_count(struct samu *sampass, bool *updated);
3435 bool pdb_update_autolock_flag(struct samu *sampass, bool *updated);
3436 bool pdb_increment_bad_password_count(struct samu *sampass);
3437 bool is_dc_trusted_domain_situation(const char *domain_name);
3438 bool get_trust_pw_clear(const char *domain, char **ret_pwd,
3439                         const char **account_name,
3440                         enum netr_SchannelType *channel);
3441 bool get_trust_pw_hash(const char *domain, uint8_t ret_pwd[16],
3442                        const char **account_name,
3443                        enum netr_SchannelType *channel);
3444
3445 /* The following definitions come from passdb/pdb_compat.c  */
3446
3447 uint32_t pdb_get_user_rid (const struct samu *sampass);
3448 uint32_t pdb_get_group_rid (struct samu *sampass);
3449 bool pdb_set_user_sid_from_rid (struct samu *sampass, uint32_t rid, enum pdb_value_state flag);
3450 bool pdb_set_group_sid_from_rid (struct samu *sampass, uint32_t grid, enum pdb_value_state flag);
3451
3452 /* The following definitions come from passdb/pdb_get_set.c  */
3453
3454 uint32_t pdb_get_acct_ctrl(const struct samu *sampass);
3455 time_t pdb_get_logon_time(const struct samu *sampass);
3456 time_t pdb_get_logoff_time(const struct samu *sampass);
3457 time_t pdb_get_kickoff_time(const struct samu *sampass);
3458 time_t pdb_get_bad_password_time(const struct samu *sampass);
3459 time_t pdb_get_pass_last_set_time(const struct samu *sampass);
3460 time_t pdb_get_pass_can_change_time(const struct samu *sampass);
3461 time_t pdb_get_pass_can_change_time_noncalc(const struct samu *sampass);
3462 time_t pdb_get_pass_must_change_time(const struct samu *sampass);
3463 bool pdb_get_pass_can_change(const struct samu *sampass);
3464 uint16_t pdb_get_logon_divs(const struct samu *sampass);
3465 uint32_t pdb_get_hours_len(const struct samu *sampass);
3466 const uint8_t *pdb_get_hours(const struct samu *sampass);
3467 const uint8_t *pdb_get_nt_passwd(const struct samu *sampass);
3468 const uint8_t *pdb_get_lanman_passwd(const struct samu *sampass);
3469 const uint8_t *pdb_get_pw_history(const struct samu *sampass, uint32_t *current_hist_len);
3470 const char *pdb_get_plaintext_passwd(const struct samu *sampass);
3471 const struct dom_sid *pdb_get_user_sid(const struct samu *sampass);
3472 const struct dom_sid *pdb_get_group_sid(struct samu *sampass);
3473 enum pdb_value_state pdb_get_init_flags(const struct samu *sampass, enum pdb_elements element);
3474 const char *pdb_get_username(const struct samu *sampass);
3475 const char *pdb_get_domain(const struct samu *sampass);
3476 const char *pdb_get_nt_username(const struct samu *sampass);
3477 const char *pdb_get_fullname(const struct samu *sampass);
3478 const char *pdb_get_homedir(const struct samu *sampass);
3479 const char *pdb_get_dir_drive(const struct samu *sampass);
3480 const char *pdb_get_logon_script(const struct samu *sampass);
3481 const char *pdb_get_profile_path(const struct samu *sampass);
3482 const char *pdb_get_acct_desc(const struct samu *sampass);
3483 const char *pdb_get_workstations(const struct samu *sampass);
3484 const char *pdb_get_comment(const struct samu *sampass);
3485 const char *pdb_get_munged_dial(const struct samu *sampass);
3486 uint16_t pdb_get_bad_password_count(const struct samu *sampass);
3487 uint16_t pdb_get_logon_count(const struct samu *sampass);
3488 uint16_t pdb_get_country_code(const struct samu *sampass);
3489 uint16_t pdb_get_code_page(const struct samu *sampass);
3490 uint32_t pdb_get_unknown_6(const struct samu *sampass);
3491 void *pdb_get_backend_private_data(const struct samu *sampass, const struct pdb_methods *my_methods);
3492 bool pdb_set_acct_ctrl(struct samu *sampass, uint32_t acct_ctrl, enum pdb_value_state flag);
3493 bool pdb_set_logon_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
3494 bool pdb_set_logoff_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
3495 bool pdb_set_kickoff_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
3496 bool pdb_set_bad_password_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
3497 bool pdb_set_pass_can_change_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
3498 bool pdb_set_pass_must_change_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
3499 bool pdb_set_pass_last_set_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
3500 bool pdb_set_hours_len(struct samu *sampass, uint32_t len, enum pdb_value_state flag);
3501 bool pdb_set_logon_divs(struct samu *sampass, uint16_t hours, enum pdb_value_state flag);
3502 bool pdb_set_init_flags(struct samu *sampass, enum pdb_elements element, enum pdb_value_state value_flag);
3503 bool pdb_set_user_sid(struct samu *sampass, const struct dom_sid *u_sid, enum pdb_value_state flag);
3504 bool pdb_set_user_sid_from_string(struct samu *sampass, fstring u_sid, enum pdb_value_state flag);
3505 bool pdb_set_group_sid(struct samu *sampass, const struct dom_sid *g_sid, enum pdb_value_state flag);
3506 bool pdb_set_username(struct samu *sampass, const char *username, enum pdb_value_state flag);
3507 bool pdb_set_domain(struct samu *sampass, const char *domain, enum pdb_value_state flag);
3508 bool pdb_set_nt_username(struct samu *sampass, const char *nt_username, enum pdb_value_state flag);
3509 bool pdb_set_fullname(struct samu *sampass, const char *full_name, enum pdb_value_state flag);
3510 bool pdb_set_logon_script(struct samu *sampass, const char *logon_script, enum pdb_value_state flag);
3511 bool pdb_set_profile_path(struct samu *sampass, const char *profile_path, enum pdb_value_state flag);
3512 bool pdb_set_dir_drive(struct samu *sampass, const char *dir_drive, enum pdb_value_state flag);
3513 bool pdb_set_homedir(struct samu *sampass, const char *home_dir, enum pdb_value_state flag);
3514 bool pdb_set_acct_desc(struct samu *sampass, const char *acct_desc, enum pdb_value_state flag);
3515 bool pdb_set_workstations(struct samu *sampass, const char *workstations, enum pdb_value_state flag);
3516 bool pdb_set_comment(struct samu *sampass, const char *comment, enum pdb_value_state flag);
3517 bool pdb_set_munged_dial(struct samu *sampass, const char *munged_dial, enum pdb_value_state flag);
3518 bool pdb_set_nt_passwd(struct samu *sampass, const uint8_t pwd[NT_HASH_LEN], enum pdb_value_state flag);
3519 bool pdb_set_lanman_passwd(struct samu *sampass, const uint8_t pwd[LM_HASH_LEN], enum pdb_value_state flag);
3520 bool pdb_set_pw_history(struct samu *sampass, const uint8_t *pwd, uint32_t historyLen, enum pdb_value_state flag);
3521 bool pdb_set_plaintext_pw_only(struct samu *sampass, const char *password, enum pdb_value_state flag);
3522 bool pdb_set_bad_password_count(struct samu *sampass, uint16_t bad_password_count, enum pdb_value_state flag);
3523 bool pdb_set_logon_count(struct samu *sampass, uint16_t logon_count, enum pdb_value_state flag);
3524 bool pdb_set_country_code(struct samu *sampass, uint16_t country_code,
3525                           enum pdb_value_state flag);
3526 bool pdb_set_code_page(struct samu *sampass, uint16_t code_page,
3527                        enum pdb_value_state flag);
3528 bool pdb_set_unknown_6(struct samu *sampass, uint32_t unkn, enum pdb_value_state flag);
3529 bool pdb_set_hours(struct samu *sampass, const uint8 *hours, int hours_len,
3530                    enum pdb_value_state flag);
3531 bool pdb_set_backend_private_data(struct samu *sampass, void *private_data, 
3532                                    void (*free_fn)(void **), 
3533                                    const struct pdb_methods *my_methods, 
3534                                    enum pdb_value_state flag);
3535 bool pdb_set_pass_can_change(struct samu *sampass, bool canchange);
3536 bool pdb_set_plaintext_passwd(struct samu *sampass, const char *plaintext);
3537 uint32_t pdb_build_fields_present(struct samu *sampass);
3538
3539 /* The following definitions come from passdb/pdb_interface.c  */
3540
3541 NTSTATUS smb_register_passdb(int version, const char *name, pdb_init_function init) ;
3542 struct pdb_init_function_entry *pdb_find_backend_entry(const char *name);
3543 struct event_context *pdb_get_event_context(void);
3544 NTSTATUS make_pdb_method_name(struct pdb_methods **methods, const char *selected);
3545 struct pdb_domain_info *pdb_get_domain_info(TALLOC_CTX *mem_ctx);
3546 bool pdb_getsampwnam(struct samu *sam_acct, const char *username) ;
3547 bool pdb_getsampwsid(struct samu *sam_acct, const struct dom_sid *sid) ;
3548 NTSTATUS pdb_create_user(TALLOC_CTX *mem_ctx, const char *name, uint32_t flags,
3549                          uint32_t *rid);
3550 NTSTATUS pdb_delete_user(TALLOC_CTX *mem_ctx, struct samu *sam_acct);
3551 NTSTATUS pdb_add_sam_account(struct samu *sam_acct) ;
3552 NTSTATUS pdb_update_sam_account(struct samu *sam_acct) ;
3553 NTSTATUS pdb_delete_sam_account(struct samu *sam_acct) ;
3554 NTSTATUS pdb_rename_sam_account(struct samu *oldname, const char *newname);
3555 NTSTATUS pdb_update_login_attempts(struct samu *sam_acct, bool success);
3556 bool pdb_getgrsid(GROUP_MAP *map, struct dom_sid sid);
3557 bool pdb_getgrgid(GROUP_MAP *map, gid_t gid);
3558 bool pdb_getgrnam(GROUP_MAP *map, const char *name);
3559 NTSTATUS pdb_create_dom_group(TALLOC_CTX *mem_ctx, const char *name,
3560                               uint32_t *rid);
3561 NTSTATUS pdb_delete_dom_group(TALLOC_CTX *mem_ctx, uint32_t rid);
3562 NTSTATUS pdb_add_group_mapping_entry(GROUP_MAP *map);
3563 NTSTATUS pdb_update_group_mapping_entry(GROUP_MAP *map);
3564 NTSTATUS pdb_delete_group_mapping_entry(struct dom_sid sid);
3565 bool pdb_enum_group_mapping(const struct dom_sid *sid, enum lsa_SidType sid_name_use, GROUP_MAP **pp_rmap,
3566                             size_t *p_num_entries, bool unix_only);
3567 NTSTATUS pdb_enum_group_members(TALLOC_CTX *mem_ctx,
3568                                 const struct dom_sid *sid,
3569                                 uint32_t **pp_member_rids,
3570                                 size_t *p_num_members);
3571 NTSTATUS pdb_enum_group_memberships(TALLOC_CTX *mem_ctx, struct samu *user,
3572                                     struct dom_sid **pp_sids, gid_t **pp_gids,
3573                                     uint32_t *p_num_groups);
3574 NTSTATUS pdb_set_unix_primary_group(TALLOC_CTX *mem_ctx, struct samu *user);
3575 NTSTATUS pdb_add_groupmem(TALLOC_CTX *mem_ctx, uint32_t group_rid,
3576                           uint32_t member_rid);
3577 NTSTATUS pdb_del_groupmem(TALLOC_CTX *mem_ctx, uint32_t group_rid,
3578                           uint32_t member_rid);
3579 NTSTATUS pdb_create_alias(const char *name, uint32_t *rid);
3580 NTSTATUS pdb_delete_alias(const struct dom_sid *sid);
3581 NTSTATUS pdb_get_aliasinfo(const struct dom_sid *sid, struct acct_info *info);
3582 NTSTATUS pdb_set_aliasinfo(const struct dom_sid *sid, struct acct_info *info);
3583 NTSTATUS pdb_add_aliasmem(const struct dom_sid *alias, const struct dom_sid *member);
3584 NTSTATUS pdb_del_aliasmem(const struct dom_sid *alias, const struct dom_sid *member);
3585 NTSTATUS pdb_enum_aliasmem(const struct dom_sid *alias, TALLOC_CTX *mem_ctx,
3586                            struct dom_sid **pp_members, size_t *p_num_members);
3587 NTSTATUS pdb_enum_alias_memberships(TALLOC_CTX *mem_ctx,
3588                                     const struct dom_sid *domain_sid,
3589                                     const struct dom_sid *members, size_t num_members,
3590                                     uint32_t **pp_alias_rids,
3591                                     size_t *p_num_alias_rids);
3592 NTSTATUS pdb_lookup_rids(const struct dom_sid *domain_sid,
3593                          int num_rids,
3594                          uint32_t *rids,
3595                          const char **names,
3596                          enum lsa_SidType *attrs);
3597 NTSTATUS pdb_lookup_names(const struct dom_sid *domain_sid,
3598                           int num_names,
3599                           const char **names,
3600                           uint32_t *rids,
3601                           enum lsa_SidType *attrs);
3602 bool pdb_get_account_policy(enum pdb_policy_type type, uint32_t *value);
3603 bool pdb_set_account_policy(enum pdb_policy_type type, uint32_t value);
3604 bool pdb_get_seq_num(time_t *seq_num);
3605 bool pdb_uid_to_sid(uid_t uid, struct dom_sid *sid);
3606 bool pdb_gid_to_sid(gid_t gid, struct dom_sid *sid);
3607 bool pdb_sid_to_id(const struct dom_sid *sid, union unid_t *id,
3608                    enum lsa_SidType *type);
3609 uint32_t pdb_capabilities(void);
3610 bool pdb_new_rid(uint32_t *rid);
3611 bool initialize_password_db(bool reload, struct event_context *event_ctx);
3612 struct pdb_search *pdb_search_init(TALLOC_CTX *mem_ctx,
3613                                    enum pdb_search_type type);
3614 struct pdb_search *pdb_search_users(TALLOC_CTX *mem_ctx, uint32_t acct_flags);
3615 struct pdb_search *pdb_search_groups(TALLOC_CTX *mem_ctx);
3616 struct pdb_search *pdb_search_aliases(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
3617 uint32_t pdb_search_entries(struct pdb_search *search,
3618                           uint32_t start_idx, uint32_t max_entries,
3619                           struct samr_displayentry **result);
3620 bool pdb_get_trusteddom_pw(const char *domain, char** pwd, struct dom_sid *sid,
3621                            time_t *pass_last_set_time);
3622 bool pdb_set_trusteddom_pw(const char* domain, const char* pwd,
3623                            const struct dom_sid *sid);
3624 bool pdb_del_trusteddom_pw(const char *domain);
3625 NTSTATUS pdb_enum_trusteddoms(TALLOC_CTX *mem_ctx, uint32_t *num_domains,
3626                               struct trustdom_info ***domains);
3627 NTSTATUS pdb_get_trusted_domain(TALLOC_CTX *mem_ctx, const char *domain,
3628                                 struct pdb_trusted_domain **td);
3629 NTSTATUS pdb_get_trusted_domain_by_sid(TALLOC_CTX *mem_ctx, struct dom_sid *sid,
3630                                 struct pdb_trusted_domain **td);
3631 NTSTATUS pdb_set_trusted_domain(const char* domain,
3632                                 const struct pdb_trusted_domain *td);
3633 NTSTATUS pdb_del_trusted_domain(const char *domain);
3634 NTSTATUS pdb_enum_trusted_domains(TALLOC_CTX *mem_ctx, uint32_t *num_domains,
3635                                   struct pdb_trusted_domain ***domains);
3636 NTSTATUS make_pdb_method( struct pdb_methods **methods ) ;
3637
3638 /* The following definitions come from passdb/pdb_ldap.c  */
3639
3640 const char** get_userattr_list( TALLOC_CTX *mem_ctx, int schema_ver );
3641 NTSTATUS pdb_init_ldapsam_compat(struct pdb_methods **pdb_method, const char *location);
3642 NTSTATUS pdb_init_ldapsam(struct pdb_methods **pdb_method, const char *location);
3643 NTSTATUS pdb_ldap_init(void);
3644
3645 /* The following definitions come from passdb/pdb_nds.c  */
3646
3647 struct smbldap_state;
3648
3649 int pdb_nds_get_password(
3650         struct smbldap_state *ldap_state,
3651         char *object_dn,
3652         size_t *pwd_len,
3653         char *pwd );
3654 int pdb_nds_set_password(
3655         struct smbldap_state *ldap_state,
3656         char *object_dn,
3657         const char *pwd );
3658 NTSTATUS pdb_nds_init(void);
3659
3660 /* The following definitions come from passdb/pdb_nds.c  */
3661
3662 NTSTATUS pdb_ipa_init(void);
3663
3664 /* The following definitions come from passdb/pdb_smbpasswd.c  */
3665
3666 NTSTATUS pdb_smbpasswd_init(void) ;
3667
3668 /* The following definitions come from passdb/pdb_wbc_sam.c  */
3669
3670 NTSTATUS pdb_wbc_sam_init(void);
3671
3672 /* The following definitions come from passdb/pdb_tdb.c  */
3673
3674 NTSTATUS pdb_tdbsam_init(void);
3675
3676 /* The following definitions come from passdb/util_builtin.c  */
3677
3678 bool lookup_builtin_rid(TALLOC_CTX *mem_ctx, uint32 rid, const char **name);
3679 bool lookup_builtin_name(const char *name, uint32 *rid);
3680 const char *builtin_domain_name(void);
3681 bool sid_check_is_builtin(const struct dom_sid *sid);
3682 bool sid_check_is_in_builtin(const struct dom_sid *sid);
3683
3684 /* The following definitions come from passdb/util_unixsids.c  */
3685
3686 bool sid_check_is_unix_users(const struct dom_sid *sid);
3687 bool sid_check_is_in_unix_users(const struct dom_sid *sid);
3688 void uid_to_unix_users_sid(uid_t uid, struct dom_sid *sid);
3689 void gid_to_unix_groups_sid(gid_t gid, struct dom_sid *sid);
3690 const char *unix_users_domain_name(void);
3691 bool lookup_unix_user_name(const char *name, struct dom_sid *sid);
3692 bool sid_check_is_unix_groups(const struct dom_sid *sid);
3693 bool sid_check_is_in_unix_groups(const struct dom_sid *sid);
3694 const char *unix_groups_domain_name(void);
3695 bool lookup_unix_group_name(const char *name, struct dom_sid *sid);
3696
3697 /* The following definitions come from passdb/util_wellknown.c  */
3698
3699 bool sid_check_is_wellknown_domain(const struct dom_sid *sid, const char **name);
3700 bool sid_check_is_in_wellknown_domain(const struct dom_sid *sid);
3701 bool lookup_wellknown_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
3702                           const char **domain, const char **name);
3703 bool lookup_wellknown_name(TALLOC_CTX *mem_ctx, const char *name,
3704                            struct dom_sid *sid, const char **domain);
3705
3706 /* The following definitions come from profile/profile.c  */
3707
3708 void set_profile_level(int level, struct server_id src);
3709 bool profile_setup(struct messaging_context *msg_ctx, bool rdonly);
3710
3711 /* The following definitions come from librpc/rpc/rpc_common.c  */
3712
3713 bool smb_register_ndr_interface(const struct ndr_interface_table *interface);
3714 const struct ndr_interface_table *get_iface_from_syntax(
3715         const struct ndr_syntax_id *syntax);
3716 const char *get_pipe_name_from_syntax(TALLOC_CTX *mem_ctx,
3717                                      const struct ndr_syntax_id *syntax);
3718
3719 /* The following definitions come from rpc_server/rpc_ncacn_np.c  */
3720
3721 struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx,
3722                                               const struct ndr_syntax_id *syntax,
3723                                               struct client_address *client_id,
3724                                               const struct auth_serversupplied_info *session_info,
3725                                               struct messaging_context *msg_ctx);
3726 NTSTATUS rpcint_binding_handle(TALLOC_CTX *mem_ctx,
3727                                const struct ndr_interface_table *ndr_table,
3728                                struct client_address *client_id,
3729                                const struct auth_serversupplied_info *session_info,
3730                                struct messaging_context *msg_ctx,
3731                                struct dcerpc_binding_handle **binding_handle);
3732 NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx,
3733                                 const struct ndr_syntax_id *abstract_syntax,
3734                                 const struct auth_serversupplied_info *serversupplied_info,
3735                                 struct client_address *client_id,
3736                                 struct messaging_context *msg_ctx,
3737                                 struct rpc_pipe_client **presult);
3738 NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx,
3739                                  const struct ndr_syntax_id *syntax,
3740                                  const struct auth_serversupplied_info *session_info,
3741                                  struct client_address *client_id,
3742                                  struct messaging_context *msg_ctx,
3743                                  struct rpc_pipe_client **cli_pipe);
3744
3745 /* The following definitions come from rpc_client/cli_pipe_schannel.c  */
3746
3747 NTSTATUS get_schannel_session_key(struct cli_state *cli,
3748                                   const char *domain,
3749                                   uint32 *pneg_flags,
3750                                   struct rpc_pipe_client **presult);
3751
3752 /* The following definitions come from rpc_client/rpc_transport_np.c  */
3753
3754 struct tevent_req *rpc_transport_np_init_send(TALLOC_CTX *mem_ctx,
3755                                               struct event_context *ev,
3756                                               struct cli_state *cli,
3757                                               const struct ndr_syntax_id *abstract_syntax);
3758 NTSTATUS rpc_transport_np_init_recv(struct tevent_req *req,
3759                                     TALLOC_CTX *mem_ctx,
3760                                     struct rpc_cli_transport **presult);
3761 NTSTATUS rpc_transport_np_init(TALLOC_CTX *mem_ctx, struct cli_state *cli,
3762                                const struct ndr_syntax_id *abstract_syntax,
3763                                struct rpc_cli_transport **presult);
3764
3765 /* The following definitions come from rpc_client/rpc_transport_sock.c  */
3766
3767 NTSTATUS rpc_transport_sock_init(TALLOC_CTX *mem_ctx, int fd,
3768                                  struct rpc_cli_transport **presult);
3769
3770 /* The following definitions come from rpc_client/rpc_transport_tstream.c  */
3771
3772 NTSTATUS rpc_transport_tstream_init(TALLOC_CTX *mem_ctx,
3773                                 struct tstream_context **stream,
3774                                 struct rpc_cli_transport **presult);
3775 struct cli_state *rpc_pipe_np_smb_conn(struct rpc_pipe_client *p);
3776
3777 /* The following definitions come from rpc_server/srv_eventlog_nt.c  */
3778
3779 /* The following definitions come from rpc_server/rpc_handles.c  */
3780
3781 size_t num_pipe_handles(struct pipes_struct *p);
3782 bool init_pipe_handles(struct pipes_struct *p, const struct ndr_syntax_id *syntax);
3783 bool create_policy_hnd(struct pipes_struct *p, struct policy_handle *hnd, void *data_ptr);
3784 bool find_policy_by_hnd(struct pipes_struct *p, const struct policy_handle *hnd,
3785                         void **data_p);
3786 bool close_policy_hnd(struct pipes_struct *p, struct policy_handle *hnd);
3787 void close_policy_by_pipe(struct pipes_struct *p);
3788 bool pipe_access_check(struct pipes_struct *p);
3789
3790 void *_policy_handle_create(struct pipes_struct *p, struct policy_handle *hnd,
3791                             uint32_t access_granted, size_t data_size,
3792                             const char *type, NTSTATUS *pstatus);
3793 #define policy_handle_create(_p, _hnd, _access, _type, _pstatus) \
3794         (_type *)_policy_handle_create((_p), (_hnd), (_access), sizeof(_type), #_type, \
3795                                        (_pstatus))
3796
3797 void *_policy_handle_find(struct pipes_struct *p,
3798                           const struct policy_handle *hnd,
3799                           uint32_t access_required, uint32_t *paccess_granted,
3800                           const char *name, const char *location,
3801                           NTSTATUS *pstatus);
3802 #define policy_handle_find(_p, _hnd, _access_required, _access_granted, _type, _pstatus) \
3803         (_type *)_policy_handle_find((_p), (_hnd), (_access_required), \
3804                                      (_access_granted), #_type, __location__, (_pstatus))
3805
3806
3807 /* The following definitions come from rpc_server/srv_rpc_register.c  */
3808
3809 struct rpc_srv_callbacks {
3810         bool (*init)(void *private_data);
3811         bool (*shutdown)(void *private_data);
3812         void *private_data;
3813 };
3814
3815 NTSTATUS rpc_srv_register(int version, const char *clnt,
3816                           const char *srv,
3817                           const struct ndr_interface_table *iface,
3818                           const struct api_struct *cmds, int size,
3819                           const struct rpc_srv_callbacks *rpc_srv_cb);
3820
3821 NTSTATUS rpc_srv_unregister(const struct ndr_interface_table *iface);
3822
3823 /* The following definitions come from rpc_server/srv_pipe.c  */
3824
3825 bool create_next_pdu(struct pipes_struct *p);
3826 bool api_pipe_bind_auth3(struct pipes_struct *p, struct ncacn_packet *pkt);
3827 bool setup_fault_pdu(struct pipes_struct *p, NTSTATUS status);
3828 NTSTATUS rpc_pipe_register_commands(int version, const char *clnt,
3829                                     const char *srv,
3830                                     const struct ndr_syntax_id *interface,
3831                                     const struct api_struct *cmds, int size);
3832 bool is_known_pipename(const char *cli_filename, struct ndr_syntax_id *syntax);
3833
3834 /* The following definitions come from rpc_server/srv_pipe_hnd.c  */
3835
3836 struct pipes_struct *get_first_internal_pipe(void);
3837 struct pipes_struct *get_next_internal_pipe(struct pipes_struct *p);
3838 bool check_open_pipes(void);
3839 int close_internal_rpc_pipe_hnd(struct pipes_struct *p);
3840
3841 bool fsp_is_np(struct files_struct *fsp);
3842 struct tsocket_address;
3843 NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name,
3844                  const struct tsocket_address *local_address,
3845                  const struct tsocket_address *remote_address,
3846                  struct client_address *client_id,
3847                  struct auth_serversupplied_info *session_info,
3848                  struct messaging_context *msg_ctx,
3849                  struct fake_file_handle **phandle);
3850 bool np_read_in_progress(struct fake_file_handle *handle);
3851 struct tevent_req *np_write_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
3852                                  struct fake_file_handle *handle,
3853                                  const uint8_t *data, size_t len);
3854 NTSTATUS np_write_recv(struct tevent_req *req, ssize_t *pnwritten);
3855 struct tevent_req *np_read_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
3856                                 struct fake_file_handle *handle,
3857                                 uint8_t *data, size_t len);
3858 NTSTATUS np_read_recv(struct tevent_req *req, ssize_t *nread,
3859                       bool *is_data_outstanding);
3860
3861 ssize_t process_incoming_data(struct pipes_struct *p, char *data, size_t n);
3862
3863 /* The following definitions come from rpc_server/srv_spoolss_nt.c  */
3864 void srv_spoolss_cleanup(void);
3865
3866 void do_drv_upgrade_printer(struct messaging_context *msg,
3867                             void *private_data,
3868                             uint32_t msg_type,
3869                             struct server_id server_id,
3870                             DATA_BLOB *data);
3871 void update_monitored_printq_cache(struct messaging_context *msg_ctx);
3872
3873 /* The following definitions come from rpc_server/srv_srvsvc_nt.c  */
3874
3875 char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname);
3876
3877 /* The following definitions come from rpc_server/srv_svcctl_nt.c  */
3878
3879 bool init_service_op_table( void );
3880 bool shutdown_service_op_table(void);
3881
3882 /* The following definitions come from rpcclient/cmd_dfs.c  */
3883
3884
3885 /* The following definitions come from rpcclient/cmd_dssetup.c  */
3886
3887
3888 /* The following definitions come from rpcclient/cmd_echo.c  */
3889
3890
3891 /* The following definitions come from rpcclient/cmd_lsarpc.c  */
3892
3893
3894 /* The following definitions come from rpcclient/cmd_netlogon.c  */
3895
3896
3897 /* The following definitions come from rpcclient/cmd_ntsvcs.c  */
3898
3899
3900 /* The following definitions come from rpcclient/cmd_samr.c  */
3901
3902
3903 /* The following definitions come from rpcclient/cmd_shutdown.c  */
3904
3905
3906 /* The following definitions come from rpcclient/cmd_spoolss.c  */
3907
3908
3909 /* The following definitions come from rpcclient/cmd_srvsvc.c  */
3910
3911
3912 /* The following definitions come from rpcclient/cmd_test.c  */
3913
3914
3915 /* The following definitions come from rpcclient/cmd_wkssvc.c  */
3916
3917
3918 /* The following definitions come from rpcclient/rpcclient.c  */
3919
3920
3921 /* The following definitions come from services/svc_netlogon.c  */
3922
3923
3924 /* The following definitions come from services/svc_rcinit.c  */
3925
3926
3927 /* The following definitions come from services/svc_spoolss.c  */
3928
3929
3930 /* The following definitions come from services/svc_winreg.c  */
3931
3932
3933 /* The following definitions come from services/svc_wins.c  */
3934
3935
3936 /* The following definitions come from smbd/aio.c  */
3937
3938 NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
3939                              struct smb_request *req,
3940                              files_struct *fsp, SMB_OFF_T startpos,
3941                              size_t smb_maxcnt);
3942 NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
3943                               struct smb_request *req,
3944                               files_struct *fsp, char *data,
3945                               SMB_OFF_T startpos,
3946                               size_t numtowrite);
3947 NTSTATUS schedule_smb2_aio_read(connection_struct *conn,
3948                                 struct smb_request *smbreq,
3949                                 files_struct *fsp,
3950                                 TALLOC_CTX *ctx,
3951                                 DATA_BLOB *preadbuf,
3952                                 SMB_OFF_T startpos,
3953                                 size_t smb_maxcnt);
3954 NTSTATUS schedule_aio_smb2_write(connection_struct *conn,
3955                                 struct smb_request *smbreq,
3956                                 files_struct *fsp,
3957                                 uint64_t in_offset,
3958                                 DATA_BLOB in_data,
3959                                 bool write_through);
3960 int wait_for_aio_completion(files_struct *fsp);
3961 void cancel_aio_by_fsp(files_struct *fsp);
3962 void smbd_aio_complete_aio_ex(struct aio_extra *aio_ex);
3963
3964 /* The following definitions come from smbd/blocking.c  */
3965
3966 void brl_timeout_fn(struct event_context *event_ctx,
3967                 struct timed_event *te,
3968                 struct timeval now,
3969                 void *private_data);
3970 struct timeval timeval_brl_min(const struct timeval *tv1,
3971                         const struct timeval *tv2);
3972 void process_blocking_lock_queue(struct smbd_server_connection *sconn);
3973 bool push_blocking_lock_request( struct byte_range_lock *br_lck,
3974                 struct smb_request *req,
3975                 files_struct *fsp,
3976                 int lock_timeout,
3977                 int lock_num,
3978                 uint64_t smblctx,
3979                 enum brl_type lock_type,
3980                 enum brl_flavour lock_flav,
3981                 uint64_t offset,
3982                 uint64_t count,
3983                 uint64_t blocking_smblctx);
3984 void cancel_pending_lock_requests_by_fid(files_struct *fsp,
3985                         struct byte_range_lock *br_lck,
3986                         enum file_close_type close_type);
3987 void remove_pending_lock_requests_by_mid_smb1(
3988         struct smbd_server_connection *sconn, uint64_t mid);
3989 bool blocking_lock_was_deferred_smb1(
3990         struct smbd_server_connection *sconn, uint64_t mid);
3991 struct blocking_lock_record *blocking_lock_cancel_smb1(files_struct *fsp,
3992                         uint64_t smblctx,
3993                         uint64_t offset,
3994                         uint64_t count,
3995                         enum brl_flavour lock_flav,
3996                         unsigned char locktype,
3997                         NTSTATUS err);
3998
3999 /* The following definitions come from smbd/close.c  */
4000
4001 void set_close_write_time(struct files_struct *fsp, struct timespec ts);
4002 NTSTATUS close_file(struct smb_request *req, files_struct *fsp,
4003                     enum file_close_type close_type);
4004 void msg_close_file(struct messaging_context *msg_ctx,
4005                     void *private_data,
4006                     uint32_t msg_type,
4007                     struct server_id server_id,
4008                     DATA_BLOB *data);
4009 NTSTATUS delete_all_streams(connection_struct *conn, const char *fname);
4010
4011 /* The following definitions come from smbd/conn.c  */
4012
4013 void conn_init(struct smbd_server_connection *sconn);
4014 int conn_num_open(struct smbd_server_connection *sconn);
4015 bool conn_snum_used(int snum);
4016 connection_struct *conn_find(struct smbd_server_connection *sconn,
4017                              unsigned cnum);
4018 connection_struct *conn_new(struct smbd_server_connection *sconn);
4019 bool conn_close_all(struct smbd_server_connection *sconn);
4020 bool conn_idle_all(struct smbd_server_connection *sconn, time_t t);
4021 void conn_clear_vuid_caches(struct smbd_server_connection *sconn, uint16 vuid);
4022 void conn_free(connection_struct *conn);
4023 void msg_force_tdis(struct messaging_context *msg,
4024                     void *private_data,
4025                     uint32_t msg_type,
4026                     struct server_id server_id,
4027                     DATA_BLOB *data);
4028
4029 /* The following definitions come from smbd/connection.c  */
4030
4031 bool yield_connection(connection_struct *conn, const char *name);
4032 int count_current_connections( const char *sharename, bool clear  );
4033 bool claim_connection(connection_struct *conn, const char *name);
4034
4035 /* The following definitions come from smbd/dfree.c  */
4036
4037 uint64_t sys_disk_free(connection_struct *conn, const char *path, bool small_query, 
4038                               uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
4039 uint64_t get_dfree_info(connection_struct *conn,
4040                         const char *path,
4041                         bool small_query,
4042                         uint64_t *bsize,
4043                         uint64_t *dfree,
4044                         uint64_t *dsize);
4045
4046 /* The following definitions come from smbd/dir.c  */
4047
4048 bool make_dir_struct(TALLOC_CTX *ctx,
4049                         char *buf,
4050                         const char *mask,
4051                         const char *fname,
4052                         SMB_OFF_T size,
4053                         uint32 mode,
4054                         time_t date,
4055                         bool uc);
4056 bool init_dptrs(struct smbd_server_connection *sconn);
4057 char *dptr_path(struct smbd_server_connection *sconn, int key);
4058 char *dptr_wcard(struct smbd_server_connection *sconn, int key);
4059 uint16 dptr_attr(struct smbd_server_connection *sconn, int key);
4060 void dptr_close(struct smbd_server_connection *sconn, int *key);
4061 void dptr_closecnum(connection_struct *conn);
4062 void dptr_idlecnum(connection_struct *conn);
4063 void dptr_closepath(struct smbd_server_connection *sconn,
4064                     char *path,uint16 spid);
4065 NTSTATUS dptr_create(connection_struct *conn, files_struct *fsp,
4066                 const char *path, bool old_handle, bool expect_close,uint16 spid,
4067                 const char *wcard, bool wcard_has_wild, uint32 attr, struct dptr_struct **dptr_ret);
4068 void dptr_CloseDir(files_struct *fsp);
4069 void dptr_SeekDir(struct dptr_struct *dptr, long offset);
4070 long dptr_TellDir(struct dptr_struct *dptr);
4071 bool dptr_has_wild(struct dptr_struct *dptr);
4072 int dptr_dnum(struct dptr_struct *dptr);
4073 char *dptr_ReadDirName(TALLOC_CTX *ctx,
4074                         struct dptr_struct *dptr,
4075                         long *poffset,
4076                         SMB_STRUCT_STAT *pst);
4077 bool dptr_SearchDir(struct dptr_struct *dptr, const char *name, long *poffset, SMB_STRUCT_STAT *pst);
4078 void dptr_DirCacheAdd(struct dptr_struct *dptr, const char *name, long offset);
4079 void dptr_init_search_op(struct dptr_struct *dptr);
4080 bool dptr_fill(struct smbd_server_connection *sconn,
4081                char *buf1,unsigned int key);
4082 struct dptr_struct *dptr_fetch(struct smbd_server_connection *sconn,
4083                                char *buf,int *num);
4084 struct dptr_struct *dptr_fetch_lanman2(struct smbd_server_connection *sconn,
4085                                        int dptr_num);
4086 bool dir_check_ftype(connection_struct *conn, uint32 mode, uint32 dirtype);
4087 bool get_dir_entry(TALLOC_CTX *ctx,
4088                 struct dptr_struct *dirptr,
4089                 const char *mask,
4090                 uint32 dirtype,
4091                 char **pp_fname_out,
4092                 SMB_OFF_T *size,
4093                 uint32 *mode,
4094                 struct timespec *date,
4095                 bool check_descend,
4096                 bool ask_sharemode);
4097 bool is_visible_file(connection_struct *conn, const char *dir_path, const char *name, SMB_STRUCT_STAT *pst, bool use_veto);
4098 struct smb_Dir *OpenDir(TALLOC_CTX *mem_ctx, connection_struct *conn,
4099                         const char *name, const char *mask, uint32 attr);
4100 const char *ReadDirName(struct smb_Dir *dirp, long *poffset,
4101                         SMB_STRUCT_STAT *sbuf, char **talloced);
4102 void RewindDir(struct smb_Dir *dirp, long *poffset);
4103 void SeekDir(struct smb_Dir *dirp, long offset);
4104 long TellDir(struct smb_Dir *dirp);
4105 void DirCacheAdd(struct smb_Dir *dirp, const char *name, long offset);
4106 bool SearchDir(struct smb_Dir *dirp, const char *name, long *poffset);
4107 NTSTATUS can_delete_directory(struct connection_struct *conn,
4108                                 const char *dirname);
4109
4110 /* The following definitions come from smbd/dmapi.c  */
4111
4112 const void *dmapi_get_current_session(void);
4113 bool dmapi_have_session(void);
4114 bool dmapi_new_session(void);
4115 bool dmapi_destroy_session(void);
4116 uint32 dmapi_file_flags(const char * const path);
4117
4118 /* The following definitions come from smbd/dnsregister.c  */
4119
4120 bool smbd_setup_mdns_registration(struct tevent_context *ev,
4121                                   TALLOC_CTX *mem_ctx,
4122                                   uint16_t port);
4123
4124 /* The following definitions come from smbd/dosmode.c  */
4125
4126 mode_t unix_mode(connection_struct *conn, int dosmode,
4127                  const struct smb_filename *smb_fname,
4128                  const char *inherit_from_dir);
4129 uint32 dos_mode_msdfs(connection_struct *conn,
4130                       const struct smb_filename *smb_fname);
4131 int dos_attributes_to_stat_dos_flags(uint32_t dosmode);
4132 uint32 dos_mode(connection_struct *conn, struct smb_filename *smb_fname);
4133 int file_set_dosmode(connection_struct *conn, struct smb_filename *smb_fname,
4134                      uint32 dosmode, const char *parent_dir, bool newfile);
4135 NTSTATUS file_set_sparse(connection_struct *conn,
4136                          struct files_struct *fsp,
4137                          bool sparse);
4138 int file_ntimes(connection_struct *conn, const struct smb_filename *smb_fname,
4139                 struct smb_file_time *ft);
4140 bool set_sticky_write_time_path(struct file_id fileid, struct timespec mtime);
4141 bool set_sticky_write_time_fsp(struct files_struct *fsp,
4142                                struct timespec mtime);
4143
4144 NTSTATUS set_create_timespec_ea(connection_struct *conn,
4145                                 const struct smb_filename *smb_fname,
4146                                 struct timespec create_time);
4147
4148 struct timespec get_create_timespec(connection_struct *conn,
4149                                 struct files_struct *fsp,
4150                                 const struct smb_filename *smb_fname);
4151
4152 struct timespec get_change_timespec(connection_struct *conn,
4153                                 struct files_struct *fsp,
4154                                 const struct smb_filename *smb_fname);
4155
4156 /* The following definitions come from smbd/error.c  */
4157
4158 bool use_nt_status(void);
4159 void error_packet_set(char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatus, int line, const char *file);
4160 int error_packet(char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatus, int line, const char *file);
4161 void reply_nt_error(struct smb_request *req, NTSTATUS ntstatus,
4162                     int line, const char *file);
4163 void reply_force_dos_error(struct smb_request *req, uint8 eclass, uint32 ecode,
4164                     int line, const char *file);
4165 void reply_both_error(struct smb_request *req, uint8 eclass, uint32 ecode,
4166                       NTSTATUS status, int line, const char *file);
4167 void reply_openerror(struct smb_request *req, NTSTATUS status);
4168
4169 /* The following definitions come from smbd/file_access.c  */
4170
4171 bool can_access_file_acl(struct connection_struct *conn,
4172                          const struct smb_filename *smb_fname,
4173                          uint32_t access_mask);
4174 bool can_delete_file_in_directory(connection_struct *conn,
4175                                   struct smb_filename *smb_fname);
4176 bool can_access_file_data(connection_struct *conn,
4177                           const struct smb_filename *smb_fname,
4178                           uint32 access_mask);
4179 bool can_write_to_file(connection_struct *conn,
4180                        const struct smb_filename *smb_fname);
4181 bool directory_has_default_acl(connection_struct *conn, const char *fname);
4182
4183 /* The following definitions come from smbd/fileio.c  */
4184
4185 ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n);
4186 void update_write_time_handler(struct event_context *ctx,
4187                                       struct timed_event *te,
4188                                       struct timeval now,
4189                                       void *private_data);
4190 void trigger_write_time_update(struct files_struct *fsp);
4191 void trigger_write_time_update_immediate(struct files_struct *fsp);
4192 ssize_t write_file(struct smb_request *req,
4193                         files_struct *fsp,
4194                         const char *data,
4195                         SMB_OFF_T pos,
4196                         size_t n);
4197 void delete_write_cache(files_struct *fsp);
4198 void set_filelen_write_cache(files_struct *fsp, SMB_OFF_T file_size);
4199 ssize_t flush_write_cache(files_struct *fsp, enum flush_reason_enum reason);
4200 NTSTATUS sync_file(connection_struct *conn, files_struct *fsp, bool write_through);
4201 int fsp_stat(files_struct *fsp);
4202
4203 /* The following definitions come from smbd/filename.c  */
4204
4205 NTSTATUS unix_convert(TALLOC_CTX *ctx,
4206                       connection_struct *conn,
4207                       const char *orig_path,
4208                       struct smb_filename **smb_fname,
4209                       uint32_t ucf_flags);
4210 NTSTATUS check_name(connection_struct *conn, const char *name);
4211 int get_real_filename(connection_struct *conn, const char *path,
4212                       const char *name, TALLOC_CTX *mem_ctx,
4213                       char **found_name);
4214 NTSTATUS filename_convert(TALLOC_CTX *mem_ctx,
4215                         connection_struct *conn,
4216                         bool dfs_path,
4217                         const char *name_in,
4218                         uint32_t ucf_flags,
4219                         bool *ppath_contains_wcard,
4220                         struct smb_filename **pp_smb_fname);
4221
4222 /* The following definitions come from smbd/filename_utils.c */
4223
4224 NTSTATUS get_full_smb_filename(TALLOC_CTX *ctx, const struct smb_filename *smb_fname,
4225                               char **full_name);
4226 NTSTATUS create_synthetic_smb_fname(TALLOC_CTX *ctx, const char *base_name,
4227                                     const char *stream_name,
4228                                     const SMB_STRUCT_STAT *psbuf,
4229                                     struct smb_filename **smb_fname_out);
4230 NTSTATUS create_synthetic_smb_fname_split(TALLOC_CTX *ctx,
4231                                           const char *fname,
4232                                           const SMB_STRUCT_STAT *psbuf,
4233                                           struct smb_filename **smb_fname_out);
4234 const char *smb_fname_str_dbg(const struct smb_filename *smb_fname);
4235 const char *fsp_str_dbg(const struct files_struct *fsp);
4236 NTSTATUS copy_smb_filename(TALLOC_CTX *ctx,
4237                            const struct smb_filename *smb_fname_in,
4238                            struct smb_filename **smb_fname_out);
4239 bool is_ntfs_stream_smb_fname(const struct smb_filename *smb_fname);
4240 bool is_ntfs_default_stream_smb_fname(const struct smb_filename *smb_fname);
4241
4242 /* The following definitions come from smbd/files.c  */
4243
4244 NTSTATUS file_new(struct smb_request *req, connection_struct *conn,
4245                   files_struct **result);
4246 void file_close_conn(connection_struct *conn);
4247 void file_close_pid(struct smbd_server_connection *sconn, uint16 smbpid,
4248                     int vuid);
4249 bool file_init(struct smbd_server_connection *sconn);
4250 void file_close_user(struct smbd_server_connection *sconn, int vuid);
4251 struct files_struct *files_forall(
4252         struct smbd_server_connection *sconn,
4253         struct files_struct *(*fn)(struct files_struct *fsp,
4254                                    void *private_data),
4255         void *private_data);
4256 files_struct *file_find_fd(struct smbd_server_connection *sconn, int fd);
4257 files_struct *file_find_dif(struct smbd_server_connection *sconn,
4258                             struct file_id id, unsigned long gen_id);
4259 files_struct *file_find_di_first(struct smbd_server_connection *sconn,
4260                                  struct file_id id);
4261 files_struct *file_find_di_next(files_struct *start_fsp);
4262 bool file_find_subpath(files_struct *dir_fsp);
4263 void file_sync_all(connection_struct *conn);
4264 void file_free(struct smb_request *req, files_struct *fsp);
4265 files_struct *file_fsp(struct smb_request *req, uint16 fid);
4266 NTSTATUS dup_file_fsp(struct smb_request *req, files_struct *from,
4267                       uint32 access_mask, uint32 share_access,
4268                       uint32 create_options, files_struct *to);
4269 NTSTATUS file_name_hash(connection_struct *conn,
4270                         const char *name, uint32_t *p_name_hash);
4271 NTSTATUS fsp_set_smb_fname(struct files_struct *fsp,
4272                            const struct smb_filename *smb_fname_in);
4273
4274 /* The following definitions come from smbd/ipc.c  */
4275
4276 void send_trans_reply(connection_struct *conn,
4277                       struct smb_request *req,
4278                       char *rparam, int rparam_len,
4279                       char *rdata, int rdata_len,
4280                       bool buffer_too_large);
4281 void reply_trans(struct smb_request *req);
4282 void reply_transs(struct smb_request *req);
4283
4284 /* The following definitions come from smbd/lanman.c  */
4285
4286 void api_reply(connection_struct *conn, uint16 vuid,
4287                struct smb_request *req,
4288                char *data, char *params,
4289                int tdscnt, int tpscnt,
4290                int mdrcnt, int mprcnt);
4291
4292 /* The following definitions come from smbd/mangle.c  */
4293
4294 void mangle_reset_cache(void);
4295 void mangle_change_to_posix(void);
4296 bool mangle_is_mangled(const char *s, const struct share_params *p);
4297 bool mangle_is_8_3(const char *fname, bool check_case,
4298                    const struct share_params *p);
4299 bool mangle_is_8_3_wildcards(const char *fname, bool check_case,
4300                              const struct share_params *p);
4301 bool mangle_must_mangle(const char *fname,
4302                    const struct share_params *p);
4303 bool mangle_lookup_name_from_8_3(TALLOC_CTX *ctx,
4304                         const char *in,
4305                         char **out, /* talloced on the given context. */
4306                         const struct share_params *p);
4307 bool name_to_8_3(const char *in,
4308                 char out[13],
4309                 bool cache83,
4310                 const struct share_params *p);
4311
4312 /* The following definitions come from smbd/mangle_hash.c  */
4313
4314 const struct mangle_fns *mangle_hash_init(void);
4315
4316 /* The following definitions come from smbd/mangle_hash2.c  */
4317
4318 const struct mangle_fns *mangle_hash2_init(void);
4319 const struct mangle_fns *posix_mangle_init(void);
4320
4321 /* The following definitions come from auth/user_util.c  */
4322
4323 bool map_username(TALLOC_CTX *ctx, const char *user_in, char **p_user_out);
4324
4325 /* The following definitions come from auth/user_krb5.c  */
4326 struct PAC_LOGON_INFO;
4327 NTSTATUS get_user_from_kerberos_info(TALLOC_CTX *mem_ctx,
4328                                      const char *cli_name,
4329                                      const char *princ_name,
4330                                      struct PAC_LOGON_INFO *logon_info,
4331                                      bool *is_mapped,
4332                                      bool *mapped_to_guest,
4333                                      char **ntuser,
4334                                      char **ntdomain,
4335                                      char **username,
4336                                      struct passwd **_pw);
4337 NTSTATUS make_server_info_krb5(TALLOC_CTX *mem_ctx,
4338                                 char *ntuser,
4339                                 char *ntdomain,
4340                                 char *username,
4341                                 struct passwd *pw,
4342                                 struct PAC_LOGON_INFO *logon_info,
4343                                 bool mapped_to_guest,
4344                                 struct auth_serversupplied_info **server_info);
4345
4346 /* The following definitions come from smbd/message.c  */
4347
4348 void reply_sends(struct smb_request *req);
4349 void reply_sendstrt(struct smb_request *req);
4350 void reply_sendtxt(struct smb_request *req);
4351 void reply_sendend(struct smb_request *req);
4352
4353 /* The following definitions come from smbd/msdfs.c  */
4354
4355 bool is_msdfs_link(connection_struct *conn,
4356                 const char *path,
4357                 SMB_STRUCT_STAT *sbufp);
4358 struct junction_map;
4359 NTSTATUS get_referred_path(TALLOC_CTX *ctx,
4360                         const char *dfs_path,
4361                         struct junction_map *jucn,
4362                         int *consumedcntp,
4363                         bool *self_referralp);
4364 int setup_dfs_referral(connection_struct *orig_conn,
4365                         const char *dfs_path,
4366                         int max_referral_level,
4367                         char **ppdata, NTSTATUS *pstatus);
4368 bool create_junction(TALLOC_CTX *ctx,
4369                 const char *dfs_path,
4370                 struct junction_map *jucn);
4371 bool create_msdfs_link(const struct junction_map *jucn);
4372 bool remove_msdfs_link(const struct junction_map *jucn);
4373 struct junction_map *enum_msdfs_links(TALLOC_CTX *ctx, size_t *p_num_jn);
4374 NTSTATUS resolve_dfspath(TALLOC_CTX *ctx,
4375                         connection_struct *conn,
4376                         bool dfs_pathnames,
4377                         const char *name_in,
4378                         char **pp_name_out);
4379 NTSTATUS resolve_dfspath_wcard(TALLOC_CTX *ctx,
4380                                 connection_struct *conn,
4381                                 bool dfs_pathnames,
4382                                 const char *name_in,
4383                                 bool allow_wcards,
4384                                 char **pp_name_out,
4385                                 bool *ppath_contains_wcard);
4386 NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
4387                                 connection_struct **pconn,
4388                                 int snum,
4389                                 const char *path,
4390                                 const struct auth_serversupplied_info *session_info,
4391                                 char **poldcwd);
4392
4393 /* The following definitions come from smbd/negprot.c  */
4394
4395 void reply_negprot(struct smb_request *req);
4396
4397 /* The following definitions come from smbd/notify.c  */
4398
4399 void change_notify_reply(struct smb_request *req,
4400                          NTSTATUS error_code,
4401                          uint32_t max_param,
4402                          struct notify_change_buf *notify_buf,
4403                          void (*reply_fn)(struct smb_request *req,
4404                                           NTSTATUS error_code,
4405                                           uint8_t *buf, size_t len));
4406 NTSTATUS change_notify_create(struct files_struct *fsp, uint32 filter,
4407                               bool recursive);
4408 NTSTATUS change_notify_add_request(struct smb_request *req,
4409                                 uint32 max_param,
4410                                 uint32 filter, bool recursive,
4411                                 struct files_struct *fsp,
4412                                 void (*reply_fn)(struct smb_request *req,
4413                                         NTSTATUS error_code,
4414                                         uint8_t *buf, size_t len));
4415 void remove_pending_change_notify_requests_by_mid(
4416         struct smbd_server_connection *sconn, uint64_t mid);
4417 void remove_pending_change_notify_requests_by_fid(files_struct *fsp,
4418                                                   NTSTATUS status);
4419 void notify_fname(connection_struct *conn, uint32 action, uint32 filter,
4420                   const char *path);
4421 char *notify_filter_string(TALLOC_CTX *mem_ctx, uint32 filter);
4422 struct sys_notify_context *sys_notify_context_create(connection_struct *conn,
4423                                                      TALLOC_CTX *mem_ctx, 
4424                                                      struct event_context *ev);
4425 NTSTATUS sys_notify_watch(struct sys_notify_context *ctx,
4426                           struct notify_entry *e,
4427                           void (*callback)(struct sys_notify_context *ctx, 
4428                                            void *private_data,
4429                                            struct notify_event *ev),
4430                           void *private_data, void *handle);
4431
4432 /* The following definitions come from smbd/notify_inotify.c  */
4433
4434 NTSTATUS inotify_watch(struct sys_notify_context *ctx,
4435                        struct notify_entry *e,
4436                        void (*callback)(struct sys_notify_context *ctx, 
4437                                         void *private_data,
4438                                         struct notify_event *ev),
4439                        void *private_data, 
4440                        void *handle_p);
4441
4442 /* The following definitions come from smbd/notify_internal.c  */
4443
4444 struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server, 
4445                                    struct messaging_context *messaging_ctx,
4446                                    struct event_context *ev,
4447                                    connection_struct *conn);
4448 bool notify_internal_parent_init(TALLOC_CTX *mem_ctx);
4449 NTSTATUS notify_add(struct notify_context *notify, struct notify_entry *e0,
4450                     void (*callback)(void *, const struct notify_event *), 
4451                     void *private_data);
4452 NTSTATUS notify_remove(struct notify_context *notify, void *private_data);
4453 NTSTATUS notify_remove_onelevel(struct notify_context *notify,
4454                                 const struct file_id *fid,
4455                                 void *private_data);
4456 void notify_onelevel(struct notify_context *notify, uint32_t action,
4457                      uint32_t filter, struct file_id fid, const char *name);
4458 void notify_trigger(struct notify_context *notify,
4459                     uint32_t action, uint32_t filter, const char *path);
4460
4461 /* The following definitions come from smbd/ntquotas.c  */
4462
4463 int vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, struct dom_sid *psid, SMB_NTQUOTA_STRUCT *qt);
4464 int vfs_set_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, struct dom_sid *psid, SMB_NTQUOTA_STRUCT *qt);
4465 int vfs_get_user_ntquota_list(files_struct *fsp, SMB_NTQUOTA_LIST **qt_list);
4466 void *init_quota_handle(TALLOC_CTX *mem_ctx);
4467
4468 /* The following definitions come from smbd/nttrans.c  */
4469
4470 void send_nt_replies(connection_struct *conn,
4471                         struct smb_request *req, NTSTATUS nt_error,
4472                      char *params, int paramsize,
4473                      char *pdata, int datasize);
4474 void reply_ntcreate_and_X(struct smb_request *req);
4475 NTSTATUS set_sd(files_struct *fsp, uint8_t *data, uint32_t sd_len,
4476                        uint32_t security_info_sent);
4477 struct ea_list *read_nttrans_ea_list(TALLOC_CTX *ctx, const char *pdata, size_t data_size);
4478 void reply_ntcancel(struct smb_request *req);
4479 void reply_ntrename(struct smb_request *req);
4480 NTSTATUS smbd_do_query_security_desc(connection_struct *conn,
4481                                         TALLOC_CTX *mem_ctx,
4482                                         files_struct *fsp,
4483                                         uint32_t security_info_wanted,
4484                                         uint32_t max_data_count,
4485                                         uint8_t **ppmarshalled_sd,
4486                                         size_t *psd_size);
4487 void reply_nttrans(struct smb_request *req);
4488 void reply_nttranss(struct smb_request *req);
4489
4490 /* The following definitions come from smbd/open.c  */
4491
4492 NTSTATUS smb1_file_se_access_check(connection_struct *conn,
4493                                 const struct security_descriptor *sd,
4494                                 const struct security_token *token,
4495                                 uint32_t access_desired,
4496                                 uint32_t *access_granted);
4497 NTSTATUS fd_close(files_struct *fsp);
4498 void change_file_owner_to_parent(connection_struct *conn,
4499                                  const char *inherit_from_dir,
4500                                  files_struct *fsp);
4501 NTSTATUS change_dir_owner_to_parent(connection_struct *conn,
4502                                     const char *inherit_from_dir,
4503                                     const char *fname,
4504                                     SMB_STRUCT_STAT *psbuf);
4505 bool is_executable(const char *fname);
4506 bool is_stat_open(uint32 access_mask);
4507 bool request_timed_out(struct timeval request_time,
4508                        struct timeval timeout);
4509 bool open_match_attributes(connection_struct *conn,
4510                            uint32 old_dos_attr,
4511                            uint32 new_dos_attr,
4512                            mode_t existing_unx_mode,
4513                            mode_t new_unx_mode,
4514                            mode_t *returned_unx_mode);
4515 NTSTATUS fcb_or_dos_open(struct smb_request *req,
4516                          connection_struct *conn,
4517                          files_struct *fsp_to_dup_into,
4518                          const struct smb_filename *smb_fname,
4519                          struct file_id id,
4520                          uint16 file_pid,
4521                          uint16 vuid,
4522                          uint32 access_mask,
4523                          uint32 share_access,
4524                          uint32 create_options);
4525 bool map_open_params_to_ntcreate(const struct smb_filename *smb_fname,
4526                                  int deny_mode, int open_func,
4527                                  uint32 *paccess_mask,
4528                                  uint32 *pshare_mode,
4529                                  uint32 *pcreate_disposition,
4530                                  uint32 *pcreate_options,
4531                                  uint32_t *pprivate_flags);
4532 void remove_deferred_open_entry(struct file_id id, uint64_t mid,
4533                                 struct server_id pid);
4534 NTSTATUS open_file_fchmod(connection_struct *conn,
4535                           struct smb_filename *smb_fname,
4536                           files_struct **result);
4537 NTSTATUS create_directory(connection_struct *conn, struct smb_request *req,
4538                           struct smb_filename *smb_dname);
4539 void msg_file_was_renamed(struct messaging_context *msg,
4540                           void *private_data,
4541                           uint32_t msg_type,
4542                           struct server_id server_id,
4543                           DATA_BLOB *data);
4544 NTSTATUS open_streams_for_delete(connection_struct *conn,
4545                                  const char *fname);
4546 NTSTATUS create_file_default(connection_struct *conn,
4547                              struct smb_request *req,
4548                              uint16_t root_dir_fid,
4549                              struct smb_filename * smb_fname,
4550                              uint32_t access_mask,
4551                              uint32_t share_access,
4552                              uint32_t create_disposition,
4553                              uint32_t create_options,
4554                              uint32_t file_attributes,
4555                              uint32_t oplock_request,
4556                              uint64_t allocation_size,
4557                              uint32_t private_flags,
4558                              struct security_descriptor *sd,
4559                              struct ea_list *ea_list,
4560
4561                              files_struct **result,
4562                              int *pinfo);
4563 NTSTATUS get_relative_fid_filename(connection_struct *conn,
4564                                    struct smb_request *req,
4565                                    uint16_t root_dir_fid,
4566                                    const struct smb_filename *smb_fname,
4567                                    struct smb_filename **smb_fname_out);
4568
4569 /* The following definitions come from smbd/oplock.c  */
4570
4571 int32 get_number_of_exclusive_open_oplocks(void);
4572 void break_kernel_oplock(struct messaging_context *msg_ctx, files_struct *fsp);
4573 bool set_file_oplock(files_struct *fsp, int oplock_type);
4574 void release_file_oplock(files_struct *fsp);
4575 bool remove_oplock(files_struct *fsp);
4576 bool downgrade_oplock(files_struct *fsp);
4577 bool should_notify_deferred_opens(void);
4578 void break_level2_to_none_async(files_struct *fsp);
4579 void reply_to_oplock_break_requests(files_struct *fsp);
4580 void process_oplock_async_level2_break_message(struct messaging_context *msg_ctx,
4581                                                       void *private_data,
4582                                                       uint32_t msg_type,
4583                                                       struct server_id src,
4584                                                       DATA_BLOB *data);
4585 void contend_level2_oplocks_begin(files_struct *fsp,
4586                                   enum level2_contention_type type);
4587 void contend_level2_oplocks_end(files_struct *fsp,
4588                                 enum level2_contention_type type);
4589 void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e);
4590 void message_to_share_mode_entry(struct share_mode_entry *e, char *msg);
4591 bool init_oplocks(struct messaging_context *msg_ctx);
4592
4593 /* The following definitions come from smbd/oplock_irix.c  */
4594
4595 struct kernel_oplocks *irix_init_kernel_oplocks(TALLOC_CTX *mem_ctx) ;
4596
4597 /* The following definitions come from smbd/oplock_linux.c  */
4598
4599 void linux_set_lease_capability(void);
4600 int linux_set_lease_sighandler(int fd);
4601 int linux_setlease(int fd, int leasetype);
4602 struct kernel_oplocks *linux_init_kernel_oplocks(TALLOC_CTX *mem_ctx) ;
4603
4604 /* The following definitions come from smbd/oplock_onefs.c  */
4605
4606 struct kernel_oplocks *onefs_init_kernel_oplocks(TALLOC_CTX *mem_ctx);
4607
4608 /* The following definitions come from smbd/password.c  */
4609
4610 user_struct *get_valid_user_struct(struct smbd_server_connection *sconn,
4611                                    uint16 vuid);
4612 bool is_partial_auth_vuid(struct smbd_server_connection *sconn, uint16 vuid);
4613 user_struct *get_partial_auth_user_struct(struct smbd_server_connection *sconn,
4614                                           uint16 vuid);
4615 void invalidate_vuid(struct smbd_server_connection *sconn, uint16 vuid);
4616 void invalidate_all_vuids(struct smbd_server_connection *sconn);
4617 int register_initial_vuid(struct smbd_server_connection *sconn);
4618 int register_homes_share(const char *username);
4619 int register_existing_vuid(struct smbd_server_connection *sconn,
4620                         uint16 vuid,
4621                         struct auth_serversupplied_info *session_info,
4622                         DATA_BLOB response_blob,
4623                         const char *smb_name);
4624 void add_session_user(struct smbd_server_connection *sconn, const char *user);
4625 void add_session_workgroup(struct smbd_server_connection *sconn,
4626                            const char *workgroup);
4627 const char *get_session_workgroup(struct smbd_server_connection *sconn);
4628 bool user_in_netgroup(TALLOC_CTX *ctx, const char *user, const char *ngname);
4629 bool user_in_list(TALLOC_CTX *ctx, const char *user,const char **list);
4630 bool authorise_login(struct smbd_server_connection *sconn,
4631                      int snum, fstring user, DATA_BLOB password,
4632                      bool *guest);
4633
4634 /* The following definitions come from smbd/pipes.c  */
4635
4636 NTSTATUS open_np_file(struct smb_request *smb_req, const char *name,
4637                       struct files_struct **pfsp);
4638 void reply_open_pipe_and_X(connection_struct *conn, struct smb_request *req);
4639 void reply_pipe_write(struct smb_request *req);
4640 void reply_pipe_write_and_X(struct smb_request *req);
4641 void reply_pipe_read_and_X(struct smb_request *req);
4642
4643 /* The following definitions come from smbd/posix_acls.c  */
4644
4645 void create_file_sids(const SMB_STRUCT_STAT *psbuf, struct dom_sid *powner_sid, struct dom_sid *pgroup_sid);
4646 bool nt4_compatible_acls(void);
4647 uint32_t map_canon_ace_perms(int snum,
4648                                 enum security_ace_type *pacl_type,
4649                                 mode_t perms,
4650                                 bool directory_ace);
4651 NTSTATUS unpack_nt_owners(connection_struct *conn, uid_t *puser, gid_t *pgrp, uint32 security_info_sent, const struct security_descriptor *psd);
4652 SMB_ACL_T free_empty_sys_acl(connection_struct *conn, SMB_ACL_T the_acl);
4653 NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info,
4654                            struct security_descriptor **ppdesc);
4655 NTSTATUS posix_get_nt_acl(struct connection_struct *conn, const char *name,
4656                           uint32_t security_info, struct security_descriptor **ppdesc);
4657 NTSTATUS try_chown(files_struct *fsp, uid_t uid, gid_t gid);
4658 NTSTATUS append_parent_acl(files_struct *fsp,
4659                                 const struct security_descriptor *pcsd,
4660                                 struct security_descriptor **pp_new_sd);
4661 NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, const struct security_descriptor *psd);
4662 int get_acl_group_bits( connection_struct *conn, const char *fname, mode_t *mode );
4663 int chmod_acl(connection_struct *conn, const char *name, mode_t mode);
4664 int inherit_access_posix_acl(connection_struct *conn, const char *inherit_from_dir,
4665                        const char *name, mode_t mode);
4666 int fchmod_acl(files_struct *fsp, mode_t mode);
4667 bool set_unix_posix_default_acl(connection_struct *conn, const char *fname,
4668                                 const SMB_STRUCT_STAT *psbuf,
4669                                 uint16 num_def_acls, const char *pdata);
4670 bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp, const char *fname, uint16 num_acls, const char *pdata);
4671 struct security_descriptor *get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname);
4672 NTSTATUS make_default_filesystem_acl(TALLOC_CTX *ctx,
4673                                         const char *name,
4674                                         SMB_STRUCT_STAT *psbuf,
4675                                         struct security_descriptor **ppdesc);
4676
4677 /* The following definitions come from smbd/process.c  */
4678
4679 void smbd_setup_sig_term_handler(void);
4680 void smbd_setup_sig_hup_handler(struct tevent_context *ev,
4681                                 struct messaging_context *msg_ctx);
4682 bool srv_send_smb(struct smbd_server_connection *sconn, char *buffer,
4683                   bool no_signing, uint32_t seqnum,
4684                   bool do_encrypt,
4685                   struct smb_perfcount_data *pcd);
4686 int srv_set_message(char *buf,
4687                         int num_words,
4688                         int num_bytes,
4689                         bool zero);
4690 void remove_deferred_open_message_smb(uint64_t mid);
4691 void schedule_deferred_open_message_smb(uint64_t mid);
4692 bool open_was_deferred(uint64_t mid);
4693 bool get_deferred_open_message_state(struct smb_request *smbreq,
4694                                 struct timeval *p_request_time,
4695                                 void **pp_state);
4696 bool push_deferred_open_message_smb(struct smb_request *req,
4697                                 struct timeval request_time,
4698                                 struct timeval timeout,
4699                                 struct file_id id,
4700                                 char *private_data,
4701                                 size_t priv_len);
4702 struct idle_event *event_add_idle(struct event_context *event_ctx,
4703                                   TALLOC_CTX *mem_ctx,
4704                                   struct timeval interval,
4705                                   const char *name,
4706                                   bool (*handler)(const struct timeval *now,
4707                                                   void *private_data),
4708                                   void *private_data);
4709 NTSTATUS allow_new_trans(struct trans_state *list, uint64_t mid);
4710 void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes);
4711 const char *smb_fn_name(int type);
4712 void add_to_common_flags2(uint32 v);
4713 void remove_from_common_flags2(uint32 v);
4714 void construct_reply_common_req(struct smb_request *req, char *outbuf);
4715 size_t req_wct_ofs(struct smb_request *req);
4716 void chain_reply(struct smb_request *req);
4717 bool req_is_in_chain(struct smb_request *req);
4718 void smbd_process(struct smbd_server_connection *sconn);
4719
4720 /* The following definitions come from smbd/quotas.c  */
4721
4722 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
4723 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
4724 bool disk_quotas(const char *path,
4725                 uint64_t *bsize,
4726                 uint64_t *dfree,
4727                 uint64_t *dsize);
4728 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
4729 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
4730 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
4731 bool disk_quotas_vxfs(const char *name, char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
4732 bool disk_quotas(const char *path,uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
4733 bool disk_quotas(const char *path,uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
4734
4735 /* The following definitions come from smbd/reply.c  */
4736
4737 NTSTATUS check_path_syntax(char *path);
4738 NTSTATUS check_path_syntax_wcard(char *path, bool *p_contains_wcard);
4739 NTSTATUS check_path_syntax_posix(char *path);
4740 size_t srvstr_get_path_wcard(TALLOC_CTX *ctx,
4741                         const char *inbuf,
4742                         uint16 smb_flags2,
4743                         char **pp_dest,
4744                         const char *src,
4745                         size_t src_len,
4746                         int flags,
4747                         NTSTATUS *err,
4748                         bool *contains_wcard);
4749 size_t srvstr_get_path(TALLOC_CTX *ctx,
4750                         const char *inbuf,
4751                         uint16 smb_flags2,
4752                         char **pp_dest,
4753                         const char *src,
4754                         size_t src_len,
4755                         int flags,
4756                         NTSTATUS *err);
4757 size_t srvstr_get_path_req_wcard(TALLOC_CTX *mem_ctx, struct smb_request *req,
4758                                  char **pp_dest, const char *src, int flags,
4759                                  NTSTATUS *err, bool *contains_wcard);
4760 size_t srvstr_get_path_req(TALLOC_CTX *mem_ctx, struct smb_request *req,
4761                            char **pp_dest, const char *src, int flags,
4762                            NTSTATUS *err);
4763 bool check_fsp_open(connection_struct *conn, struct smb_request *req,
4764                     files_struct *fsp);
4765 bool check_fsp(connection_struct *conn, struct smb_request *req,
4766                files_struct *fsp);
4767 bool check_fsp_ntquota_handle(connection_struct *conn, struct smb_request *req,
4768                               files_struct *fsp);
4769 void reply_special(struct smbd_server_connection *sconn, char *inbuf, size_t inbuf_len);
4770 void reply_tcon(struct smb_request *req);
4771 void reply_tcon_and_X(struct smb_request *req);
4772 void reply_unknown_new(struct smb_request *req, uint8 type);
4773 void reply_ioctl(struct smb_request *req);
4774 void reply_checkpath(struct smb_request *req);
4775 void reply_getatr(struct smb_request *req);
4776 void reply_setatr(struct smb_request *req);
4777 void reply_dskattr(struct smb_request *req);
4778 void reply_search(struct smb_request *req);
4779 void reply_fclose(struct smb_request *req);
4780 void reply_open(struct smb_request *req);
4781 void reply_open_and_X(struct smb_request *req);
4782 void reply_ulogoffX(struct smb_request *req);
4783 void reply_mknew(struct smb_request *req);
4784 void reply_ctemp(struct smb_request *req);
4785 NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req,
4786                           uint32 dirtype, struct smb_filename *smb_fname,
4787                           bool has_wild);
4788 void reply_unlink(struct smb_request *req);
4789 ssize_t fake_sendfile(files_struct *fsp, SMB_OFF_T startpos, size_t nread);
4790 void sendfile_short_send(files_struct *fsp,
4791                                 ssize_t nread,
4792                                 size_t headersize,
4793                                 size_t smb_maxcnt);
4794 void reply_readbraw(struct smb_request *req);
4795 void reply_lockread(struct smb_request *req);
4796 void reply_read(struct smb_request *req);
4797 void reply_read_and_X(struct smb_request *req);
4798 void error_to_writebrawerr(struct smb_request *req);
4799 void reply_writebraw(struct smb_request *req);
4800 void reply_writeunlock(struct smb_request *req);
4801 void reply_write(struct smb_request *req);
4802 bool is_valid_writeX_buffer(struct smbd_server_connection *sconn,
4803                             const uint8_t *inbuf);
4804 void reply_write_and_X(struct smb_request *req);
4805 void reply_lseek(struct smb_request *req);
4806 void reply_flush(struct smb_request *req);
4807 void reply_exit(struct smb_request *req);
4808 void reply_close(struct smb_request *req);
4809 void reply_writeclose(struct smb_request *req);
4810 void reply_lock(struct smb_request *req);
4811 void reply_unlock(struct smb_request *req);
4812 void reply_tdis(struct smb_request *req);
4813 void reply_echo(struct smb_request *req);
4814 void reply_printopen(struct smb_request *req);
4815 void reply_printclose(struct smb_request *req);
4816 void reply_printqueue(struct smb_request *req);
4817 void reply_printwrite(struct smb_request *req);
4818 void reply_mkdir(struct smb_request *req);
4819 void reply_rmdir(struct smb_request *req);
4820 NTSTATUS rename_internals_fsp(connection_struct *conn,
4821                         files_struct *fsp,
4822                         const struct smb_filename *smb_fname_dst_in,
4823                         uint32 attrs,
4824                         bool replace_if_exists);
4825 NTSTATUS rename_internals(TALLOC_CTX *ctx,
4826                         connection_struct *conn,
4827                         struct smb_request *req,
4828                         struct smb_filename *smb_fname_src,
4829                         struct smb_filename *smb_fname_dst,
4830                         uint32 attrs,
4831                         bool replace_if_exists,
4832                         bool src_has_wild,
4833                         bool dest_has_wild,
4834                         uint32_t access_mask);
4835 void reply_mv(struct smb_request *req);
4836 NTSTATUS copy_file(TALLOC_CTX *ctx,
4837                         connection_struct *conn,
4838                         struct smb_filename *smb_fname_src,
4839                         struct smb_filename *smb_fname_dst,
4840                         int ofun,
4841                         int count,
4842                         bool target_is_directory);
4843 void reply_copy(struct smb_request *req);
4844 uint64_t get_lock_pid(const uint8_t *data, int data_offset,
4845                     bool large_file_format);
4846 uint64_t get_lock_count(const uint8_t *data, int data_offset,
4847                         bool large_file_format);
4848 uint64_t get_lock_offset(const uint8_t *data, int data_offset,
4849                          bool large_file_format, bool *err);
4850 void reply_lockingX(struct smb_request *req);
4851 void reply_readbmpx(struct smb_request *req);
4852 void reply_readbs(struct smb_request *req);
4853 void reply_setattrE(struct smb_request *req);
4854 void reply_writebmpx(struct smb_request *req);
4855 void reply_writebs(struct smb_request *req);
4856 void reply_getattrE(struct smb_request *req);
4857
4858 /* The following definitions come from smbd/seal.c  */
4859
4860 uint16_t srv_enc_ctx(void);
4861 bool is_encrypted_packet(const uint8_t *inbuf);
4862 void srv_free_enc_buffer(char *buf);
4863 NTSTATUS srv_decrypt_buffer(char *buf);
4864 NTSTATUS srv_encrypt_buffer(char *buf, char **buf_out);
4865 NTSTATUS srv_request_encryption_setup(connection_struct *conn,
4866                                         unsigned char **ppdata,
4867                                         size_t *p_data_size,
4868                                         unsigned char **pparam,
4869                                         size_t *p_param_size);
4870 NTSTATUS srv_encryption_start(connection_struct *conn);
4871 void server_encryption_shutdown(void);
4872
4873 /* The following definitions come from smbd/sec_ctx.c  */
4874
4875 bool unix_token_equal(const struct security_unix_token *t1, const struct security_unix_token *t2);
4876 bool push_sec_ctx(void);
4877 void set_sec_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups, struct security_token *token);
4878 void set_root_sec_ctx(void);
4879 bool pop_sec_ctx(void);
4880 void init_sec_ctx(void);
4881
4882 /* The following definitions come from lib/server_contexts.c  */
4883 struct tevent_context *server_event_context(void);
4884 void server_event_context_free(void);
4885 struct messaging_context *server_messaging_context(void);
4886 void server_messaging_context_free(void);
4887
4888 /* The following definitions come from smbd/server.c  */
4889
4890 struct event_context *smbd_event_context(void);
4891 struct messaging_context *smbd_messaging_context(void);
4892 struct memcache *smbd_memcache(void);
4893 void reload_printers(struct tevent_context *ev,
4894                      struct messaging_context *msg_ctx);
4895 bool reload_services(struct messaging_context *msg_ctx, int smb_sock,
4896                      bool test);
4897 void reload_pcap_change_notify(struct tevent_context *ev,
4898                                struct messaging_context *msg_ctx);
4899 void exit_server(const char *const explanation);
4900 void exit_server_cleanly(const char *const explanation);
4901 void exit_server_fault(void);
4902
4903 /* The following definitions come from smbd/service.c  */
4904
4905 bool set_conn_connectpath(connection_struct *conn, const char *connectpath);
4906 NTSTATUS set_conn_force_user_group(connection_struct *conn, int snum);
4907 bool set_current_service(connection_struct *conn, uint16 flags, bool do_chdir);
4908 void load_registry_shares(void);
4909 int add_home_service(const char *service, const char *username, const char *homedir);
4910 int find_service(TALLOC_CTX *ctx, const char *service, char **p_service_out);
4911 connection_struct *make_connection_snum(struct smbd_server_connection *sconn,
4912                                         int snum, user_struct *vuser,
4913                                         DATA_BLOB password,
4914                                         const char *pdev,
4915                                         NTSTATUS *pstatus);
4916 connection_struct *make_connection(struct smbd_server_connection *sconn,
4917                                    const char *service_in, DATA_BLOB password,
4918                                    const char *pdev, uint16 vuid,
4919                                    NTSTATUS *status);
4920 void close_cnum(connection_struct *conn, uint16 vuid);
4921
4922 /* The following definitions come from smbd/session.c  */
4923 struct sessionid;
4924 bool session_init(void);
4925 bool session_claim(struct smbd_server_connection *sconn, user_struct *vuser);
4926 void session_yield(user_struct *vuser);
4927 int list_sessions(TALLOC_CTX *mem_ctx, struct sessionid **session_list);
4928
4929 /* The following definitions come from lib/sessionid_tdb.c  */
4930
4931 bool sessionid_init(void);
4932 struct db_record *sessionid_fetch_record(TALLOC_CTX *mem_ctx, const char *key);
4933 int sessionid_traverse(int (*fn)(struct db_record *rec, const char *key,
4934                                  struct sessionid *session,
4935                                  void *private_data),
4936                        void *private_data);
4937 int sessionid_traverse_read(int (*fn)(const char *key,
4938                                       struct sessionid *session,
4939                                       void *private_data),
4940                             void *private_data);
4941
4942 /* The following definitions come from smbd/sesssetup.c  */
4943
4944 NTSTATUS do_map_to_guest(NTSTATUS status,
4945                 struct auth_serversupplied_info **session_info,
4946                 const char *user, const char *domain);
4947
4948 NTSTATUS parse_spnego_mechanisms(TALLOC_CTX *ctx,
4949                 DATA_BLOB blob_in,
4950                 DATA_BLOB *pblob_out,
4951                 char **kerb_mechOID);
4952 void reply_sesssetup_and_X(struct smb_request *req);
4953
4954 /* The following definitions come from smbd/share_access.c  */
4955
4956 bool token_contains_name_in_list(const char *username,
4957                                  const char *domain,
4958                                  const char *sharename,
4959                                  const struct security_token *token,
4960                                  const char **list);
4961 bool user_ok_token(const char *username, const char *domain,
4962                    const struct security_token *token, int snum);
4963 bool is_share_read_only_for_token(const char *username,
4964                                   const char *domain,
4965                                   const struct security_token *token,
4966                                   connection_struct *conn);
4967
4968 /* The following definitions come from smbd/srvstr.c  */
4969
4970 size_t srvstr_push_fn(const char *base_ptr, uint16 smb_flags2, void *dest,
4971                       const char *src, int dest_len, int flags);
4972 ssize_t message_push_string(uint8 **outbuf, const char *str, int flags);
4973
4974 /* The following definitions come from smbd/statcache.c  */
4975
4976 void stat_cache_add( const char *full_orig_name,
4977                 char *translated_path,
4978                 bool case_sensitive);
4979 bool stat_cache_lookup(connection_struct *conn,
4980                         char **pp_name,
4981                         char **pp_dirpath,
4982                         char **pp_start,
4983                         SMB_STRUCT_STAT *pst);
4984 void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
4985                                     const char *name);
4986 void stat_cache_delete(const char *name);
4987 unsigned int fast_string_hash(TDB_DATA *key);
4988 bool reset_stat_cache( void );
4989
4990 /* The following definitions come from smbd/statvfs.c  */
4991
4992 int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf);
4993
4994 /* The following definitions come from smbd/trans2.c  */
4995
4996 uint64_t smb_roundup(connection_struct *conn, uint64_t val);
4997 uint64_t get_FileIndex(connection_struct *conn, const SMB_STRUCT_STAT *psbuf);
4998 NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn,
4999                       files_struct *fsp, const char *fname,
5000                       const char *ea_name, struct ea_struct *pea);
5001 NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn,
5002                                 files_struct *fsp, const char *fname,
5003                                 char ***pnames, size_t *pnum_names);
5004 NTSTATUS set_ea(connection_struct *conn, files_struct *fsp,
5005                 const struct smb_filename *smb_fname, struct ea_list *ea_list);
5006 struct ea_list *read_ea_list_entry(TALLOC_CTX *ctx, const char *pdata, size_t data_size, size_t *pbytes_used);
5007 void send_trans2_replies(connection_struct *conn,
5008                         struct smb_request *req,
5009                          const char *params,
5010                          int paramsize,
5011                          const char *pdata,
5012                          int datasize,
5013                          int max_data_bytes);
5014 unsigned char *create_volume_objectid(connection_struct *conn, unsigned char objid[16]);
5015 NTSTATUS hardlink_internals(TALLOC_CTX *ctx,
5016                 connection_struct *conn,
5017                 struct smb_request *req,
5018                 bool overwrite_if_exists,
5019                 const struct smb_filename *smb_fname_old,
5020                 struct smb_filename *smb_fname_new);
5021 NTSTATUS smb_set_file_time(connection_struct *conn,
5022                            files_struct *fsp,
5023                            const struct smb_filename *smb_fname,
5024                            struct smb_file_time *ft,
5025                            bool setting_write_time);
5026 void reply_findclose(struct smb_request *req);
5027 void reply_findnclose(struct smb_request *req);
5028 void reply_trans2(struct smb_request *req);
5029 void reply_transs2(struct smb_request *req);
5030
5031 /* The following definitions come from smbd/uid.c  */
5032
5033 bool change_to_guest(void);
5034 void conn_clear_vuid_cache(connection_struct *conn, uint16_t vuid);
5035 bool change_to_user(connection_struct *conn, uint16 vuid);
5036 bool change_to_root_user(void);
5037 bool become_authenticated_pipe_user(struct pipes_struct *p);
5038 bool unbecome_authenticated_pipe_user(void);
5039 void become_root(void);
5040 void unbecome_root(void);
5041 bool become_user(connection_struct *conn, uint16 vuid);
5042 bool unbecome_user(void);
5043 uid_t get_current_uid(connection_struct *conn);
5044 gid_t get_current_gid(connection_struct *conn);
5045 const struct security_unix_token *get_current_utok(connection_struct *conn);
5046 const struct security_token *get_current_nttok(connection_struct *conn);
5047 uint16_t get_current_vuid(connection_struct *conn);
5048
5049 /* The following definitions come from smbd/utmp.c  */
5050
5051 void sys_utmp_claim(const char *username, const char *hostname,
5052                         const char *ip_addr_str,
5053                         const char *id_str, int id_num);
5054 void sys_utmp_yield(const char *username, const char *hostname,
5055                         const char *ip_addr_str,
5056                         const char *id_str, int id_num);
5057 void sys_utmp_yield(const char *username, const char *hostname,
5058                         const char *ip_addr_str,
5059                         const char *id_str, int id_num);
5060 void sys_utmp_claim(const char *username, const char *hostname,
5061                         const char *ip_addr_str,
5062                         const char *id_str, int id_num);
5063
5064 /* The following definitions come from smbd/vfs.c  */
5065
5066 NTSTATUS smb_register_vfs(int version, const char *name,
5067                           const struct vfs_fn_pointers *fns);
5068 bool vfs_init_custom(connection_struct *conn, const char *vfs_object);
5069 void *vfs_add_fsp_extension_notype(vfs_handle_struct *handle,
5070                                    files_struct *fsp, size_t ext_size,
5071                                    void (*destroy_fn)(void *p_data));
5072 void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
5073 void *vfs_memctx_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
5074 void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
5075 bool smbd_vfs_init(connection_struct *conn);
5076 NTSTATUS vfs_file_exist(connection_struct *conn, struct smb_filename *smb_fname);
5077 ssize_t vfs_read_data(files_struct *fsp, char *buf, size_t byte_count);
5078 ssize_t vfs_pread_data(files_struct *fsp, char *buf,
5079                 size_t byte_count, SMB_OFF_T offset);
5080 ssize_t vfs_write_data(struct smb_request *req,
5081                         files_struct *fsp,
5082                         const char *buffer,
5083                         size_t N);
5084 ssize_t vfs_pwrite_data(struct smb_request *req,
5085                         files_struct *fsp,
5086                         const char *buffer,
5087                         size_t N,
5088                         SMB_OFF_T offset);
5089 int vfs_allocate_file_space(files_struct *fsp, uint64_t len);
5090 int vfs_set_filelen(files_struct *fsp, SMB_OFF_T len);
5091 int vfs_slow_fallocate(files_struct *fsp, SMB_OFF_T offset, SMB_OFF_T len);
5092 int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len);
5093 SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n);
5094 const char *vfs_readdirname(connection_struct *conn, void *p,
5095                             SMB_STRUCT_STAT *sbuf, char **talloced);
5096 int vfs_ChDir(connection_struct *conn, const char *path);
5097 char *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn);
5098 NTSTATUS check_reduced_name(connection_struct *conn, const char *fname);
5099 int vfs_stat_smb_fname(struct connection_struct *conn, const char *fname,
5100                        SMB_STRUCT_STAT *psbuf);
5101 int vfs_lstat_smb_fname(struct connection_struct *conn, const char *fname,
5102                         SMB_STRUCT_STAT *psbuf);
5103 NTSTATUS vfs_stat_fsp(files_struct *fsp);
5104 NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid);
5105
5106 /* The following definitions come from utils/passwd_util.c  */
5107
5108 char *stdin_new_passwd( void);
5109 char *get_pass( const char *prompt, bool stdin_get);
5110
5111 /* The following definitions come from winbindd/nss_info.c  */
5112
5113
5114 /* The following definitions come from winbindd/nss_info_template.c  */
5115
5116 NTSTATUS nss_info_template_init( void );
5117
5118 /* The following definitions come from lib/avahi.c */
5119
5120 struct AvahiPoll *tevent_avahi_poll(TALLOC_CTX *mem_ctx,
5121                                     struct tevent_context *ev);
5122
5123 /* The following definitions come from smbd/avahi_register.c */
5124
5125 void *avahi_start_register(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
5126                            uint16_t port);
5127
5128 /* The following definitions come from smbd/msg_idmap.c */
5129
5130 void msg_idmap_register_msgs(struct messaging_context *ctx);
5131
5132 /* The following definitions come from lib/fncall.c */
5133
5134 struct fncall_context *fncall_context_init(TALLOC_CTX *mem_ctx,
5135                                            int max_threads);
5136 struct tevent_req *fncall_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
5137                                struct fncall_context *ctx,
5138                                void (*fn)(void *private_data),
5139                                void *private_data);
5140 int fncall_recv(struct tevent_req *req, int *perr);
5141
5142 /* The following definitions come from libsmb/smbsock_connect.c */
5143
5144 struct tevent_req *smbsock_connect_send(TALLOC_CTX *mem_ctx,
5145                                         struct tevent_context *ev,
5146                                         const struct sockaddr_storage *addr,
5147                                         uint16_t port,
5148                                         const char *called_name,
5149                                         int called_type,
5150                                         const char *calling_name,
5151                                         int calling_type);
5152 NTSTATUS smbsock_connect_recv(struct tevent_req *req, int *sock,
5153                               uint16_t *ret_port);
5154 NTSTATUS smbsock_connect(const struct sockaddr_storage *addr, uint16_t port,
5155                          const char *called_name, int called_type,
5156                          const char *calling_name, int calling_type,
5157                          int *pfd, uint16_t *ret_port);
5158
5159 struct tevent_req *smbsock_any_connect_send(TALLOC_CTX *mem_ctx,
5160                                             struct tevent_context *ev,
5161                                             const struct sockaddr_storage *addrs,
5162                                             const char **called_names,
5163                                             int *called_types,
5164                                             const char **calling_names,
5165                                             int *calling_types,
5166                                             size_t num_addrs, uint16_t port);
5167 NTSTATUS smbsock_any_connect_recv(struct tevent_req *req, int *pfd,
5168                                   size_t *chosen_index, uint16_t *chosen_port);
5169 NTSTATUS smbsock_any_connect(const struct sockaddr_storage *addrs,
5170                              const char **called_names,
5171                              int *called_types,
5172                              const char **calling_names,
5173                              int *calling_types,
5174                              size_t num_addrs,
5175                              uint16_t port,
5176                              int *pfd, size_t *chosen_index,
5177                              uint16_t *chosen_port);
5178
5179 /* The following definitions come from rpc_server/srv_samr_nt.c */
5180 NTSTATUS access_check_object( struct security_descriptor *psd, struct security_token *token,
5181                               enum sec_privilege needed_priv_1, enum sec_privilege needed_priv_2,
5182                               uint32 rights_mask,
5183                               uint32 des_access, uint32 *acc_granted,
5184                               const char *debug );
5185 void map_max_allowed_access(const struct security_token *nt_token,
5186                             const struct security_unix_token *unix_token,
5187                             uint32_t *pacc_requested);
5188
5189 #endif /*  _PROTO_H_  */