deb836579704750b7980a11a333ebf7e9dc3a87c
[idra/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(struct auth_context **auth_context) ;
33 NTSTATUS make_auth_context_fixed(struct auth_context **auth_context, uchar chal[8]) ;
34
35 /* The following definitions come from auth/auth_builtin.c  */
36
37 NTSTATUS auth_builtin_init(void);
38
39 /* The following definitions come from auth/auth_compat.c  */
40
41 NTSTATUS check_plaintext_password(const char *smb_name,
42                                   DATA_BLOB plaintext_password,
43                                   struct auth_serversupplied_info **server_info);
44 bool password_ok(struct auth_context *actx, bool global_encrypted,
45                  const char *session_workgroup,
46                  const char *smb_name, DATA_BLOB password_blob);
47
48 /* The following definitions come from auth/auth_domain.c  */
49
50 void attempt_machine_password_change(void);
51 NTSTATUS auth_domain_init(void);
52
53 NTSTATUS auth_netlogond_init(void);
54
55 /* The following definitions come from auth/auth_ntlmssp.c  */
56
57 struct auth_serversupplied_info *auth_ntlmssp_server_info(TALLOC_CTX *mem_ctx,
58                                                           struct auth_ntlmssp_state *auth_ntlmssp_state);
59 struct ntlmssp_state *auth_ntlmssp_get_ntlmssp_state(struct auth_ntlmssp_state *auth_ntlmssp_state);
60 const char *auth_ntlmssp_get_username(struct auth_ntlmssp_state *auth_ntlmssp_state);
61 const char *auth_ntlmssp_get_domain(struct auth_ntlmssp_state *auth_ntlmssp_state);
62 const char *auth_ntlmssp_get_client(struct auth_ntlmssp_state *auth_ntlmssp_state);
63 bool auth_ntlmssp_negotiated_sign(struct auth_ntlmssp_state *auth_ntlmssp_state);
64 bool auth_ntlmssp_negotiated_seal(struct auth_ntlmssp_state *auth_ntlmssp_state);
65 NTSTATUS auth_ntlmssp_start(struct auth_ntlmssp_state **auth_ntlmssp_state);
66 void auth_ntlmssp_end(struct auth_ntlmssp_state **auth_ntlmssp_state);
67 NTSTATUS auth_ntlmssp_update(struct auth_ntlmssp_state *auth_ntlmssp_state,
68                              const DATA_BLOB request, DATA_BLOB *reply) ;
69 NTSTATUS auth_ntlmssp_sign_packet(struct auth_ntlmssp_state *auth_ntlmssp_state,
70                                   TALLOC_CTX *sig_mem_ctx,
71                                   const uint8_t *data, size_t length,
72                                   const uint8_t *whole_pdu, size_t pdu_length,
73                                   DATA_BLOB *sig);
74 NTSTATUS auth_ntlmssp_check_packet(struct auth_ntlmssp_state *auth_ntlmssp_state,
75                                    const uint8_t *data, size_t length,
76                                    const uint8_t *whole_pdu, size_t pdu_length,
77                                    const DATA_BLOB *sig) ;
78 NTSTATUS auth_ntlmssp_seal_packet(struct auth_ntlmssp_state *auth_ntlmssp_state,
79                                   TALLOC_CTX *sig_mem_ctx,
80                                   uint8_t *data, size_t length,
81                                   const uint8_t *whole_pdu, size_t pdu_length,
82                                   DATA_BLOB *sig);
83 NTSTATUS auth_ntlmssp_unseal_packet(struct auth_ntlmssp_state *auth_ntlmssp_state,
84                                     uint8_t *data, size_t length,
85                                     const uint8_t *whole_pdu, size_t pdu_length,
86                                     const DATA_BLOB *sig);
87
88 /* The following definitions come from auth/auth_sam.c  */
89
90 NTSTATUS check_sam_security(const DATA_BLOB *challenge,
91                             TALLOC_CTX *mem_ctx,
92                             const struct auth_usersupplied_info *user_info,
93                             struct auth_serversupplied_info **server_info);
94 NTSTATUS auth_sam_init(void);
95
96 /* The following definitions come from auth/auth_server.c  */
97
98 NTSTATUS auth_server_init(void);
99
100 /* The following definitions come from auth/auth_unix.c  */
101
102 NTSTATUS auth_unix_init(void);
103
104 /* The following definitions come from auth/auth_util.c  */
105
106 NTSTATUS make_user_info_map(struct auth_usersupplied_info **user_info,
107                             const char *smb_name, 
108                             const char *client_domain, 
109                             const char *wksta_name, 
110                             DATA_BLOB *lm_pwd, DATA_BLOB *nt_pwd,
111                             DATA_BLOB *lm_interactive_pwd, DATA_BLOB *nt_interactive_pwd,
112                             DATA_BLOB *plaintext, 
113                             bool encrypted);
114 bool make_user_info_netlogon_network(struct auth_usersupplied_info **user_info,
115                                      const char *smb_name, 
116                                      const char *client_domain, 
117                                      const char *wksta_name, 
118                                      uint32 logon_parameters,
119                                      const uchar *lm_network_pwd,
120                                      int lm_pwd_len,
121                                      const uchar *nt_network_pwd,
122                                      int nt_pwd_len);
123 bool make_user_info_netlogon_interactive(struct auth_usersupplied_info **user_info,
124                                          const char *smb_name, 
125                                          const char *client_domain, 
126                                          const char *wksta_name, 
127                                          uint32 logon_parameters,
128                                          const uchar chal[8], 
129                                          const uchar lm_interactive_pwd[16], 
130                                          const uchar nt_interactive_pwd[16], 
131                                          const uchar *dc_sess_key);
132 bool make_user_info_for_reply(struct auth_usersupplied_info **user_info,
133                               const char *smb_name, 
134                               const char *client_domain,
135                               const uint8 chal[8],
136                               DATA_BLOB plaintext_password);
137 NTSTATUS make_user_info_for_reply_enc(struct auth_usersupplied_info **user_info,
138                                       const char *smb_name,
139                                       const char *client_domain, 
140                                       DATA_BLOB lm_resp, DATA_BLOB nt_resp);
141 bool make_user_info_guest(struct auth_usersupplied_info **user_info) ;
142 NTSTATUS make_server_info_sam(struct auth_serversupplied_info **server_info,
143                               struct samu *sampass);
144 NTSTATUS create_local_token(struct auth_serversupplied_info *server_info);
145 NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
146                                     bool is_guest,
147                                     uid_t *uid, gid_t *gid,
148                                     char **found_username,
149                                     struct nt_user_token **token);
150 bool user_in_group_sid(const char *username, const struct dom_sid *group_sid);
151 bool user_in_group(const char *username, const char *groupname);
152 NTSTATUS make_server_info_pw(struct auth_serversupplied_info **server_info,
153                              char *unix_username,
154                              struct passwd *pwd);
155 NTSTATUS make_serverinfo_from_username(TALLOC_CTX *mem_ctx,
156                                        const char *username,
157                                        bool is_guest,
158                                        struct auth_serversupplied_info **presult);
159 struct auth_serversupplied_info *copy_serverinfo(TALLOC_CTX *mem_ctx,
160                                                  const struct auth_serversupplied_info *src);
161 bool init_guest_info(void);
162 bool init_system_info(void);
163 bool server_info_set_session_key(struct auth_serversupplied_info *info,
164                                  DATA_BLOB session_key);
165 NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx,
166                                 struct auth_serversupplied_info **server_info);
167 NTSTATUS make_server_info_system(TALLOC_CTX *mem_ctx,
168                                  struct auth_serversupplied_info **server_info);
169 bool copy_current_user(struct current_user *dst, struct current_user *src);
170 struct passwd *smb_getpwnam( TALLOC_CTX *mem_ctx, char *domuser,
171                              fstring save_username, bool create );
172 NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx, 
173                                 const char *sent_nt_username,
174                                 const char *domain,
175                                 struct auth_serversupplied_info **server_info,
176                                 struct netr_SamInfo3 *info3);
177 NTSTATUS make_server_info_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
178                                           const char *sent_nt_username,
179                                           const char *domain,
180                                           const struct wbcAuthUserInfo *info,
181                                           struct auth_serversupplied_info **server_info);
182 void free_user_info(struct auth_usersupplied_info **user_info);
183 bool make_auth_methods(struct auth_context *auth_context, auth_methods **auth_method) ;
184 bool is_trusted_domain(const char* dom_name);
185
186 /* The following definitions come from auth/user_info.c  */
187
188 NTSTATUS make_user_info(struct auth_usersupplied_info **user_info,
189                         const char *smb_name,
190                         const char *internal_username,
191                         const char *client_domain,
192                         const char *domain,
193                         const char *wksta_name,
194                         const DATA_BLOB *lm_pwd,
195                         const DATA_BLOB *nt_pwd,
196                         const DATA_BLOB *lm_interactive_pwd,
197                         const DATA_BLOB *nt_interactive_pwd,
198                         const DATA_BLOB *plaintext,
199                         bool encrypted);
200 void free_user_info(struct auth_usersupplied_info **user_info);
201
202 /* The following definitions come from auth/auth_winbind.c  */
203
204 NTSTATUS auth_winbind_init(void);
205
206 /* The following definitions come from auth/server_info.c  */
207
208 struct auth_serversupplied_info *make_server_info(TALLOC_CTX *mem_ctx);
209 NTSTATUS serverinfo_to_SamInfo2(struct auth_serversupplied_info *server_info,
210                                 uint8_t *pipe_session_key,
211                                 size_t pipe_session_key_len,
212                                 struct netr_SamInfo2 *sam2);
213 NTSTATUS serverinfo_to_SamInfo3(struct auth_serversupplied_info *server_info,
214                                 uint8_t *pipe_session_key,
215                                 size_t pipe_session_key_len,
216                                 struct netr_SamInfo3 *sam3);
217 NTSTATUS serverinfo_to_SamInfo6(struct auth_serversupplied_info *server_info,
218                                 uint8_t *pipe_session_key,
219                                 size_t pipe_session_key_len,
220                                 struct netr_SamInfo6 *sam6);
221 NTSTATUS samu_to_SamInfo3(TALLOC_CTX *mem_ctx,
222                           struct samu *samu,
223                           const char *login_server,
224                           struct netr_SamInfo3 **_info3);
225 struct netr_SamInfo3 *copy_netr_SamInfo3(TALLOC_CTX *mem_ctx,
226                                          struct netr_SamInfo3 *orig);
227 struct netr_SamInfo3 *wbcAuthUserInfo_to_netr_SamInfo3(TALLOC_CTX *mem_ctx,
228                                         const struct wbcAuthUserInfo *info);
229
230 /* The following definitions come from auth/auth_wbc.c  */
231
232 NTSTATUS auth_wbc_init(void);
233
234 /* The following definitions come from auth/pampass.c  */
235
236 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
237 bool smb_pam_close_session(char *user, char *tty, char *rhost);
238 NTSTATUS smb_pam_accountcheck(const char * user);
239 NTSTATUS smb_pam_passcheck(const char * user, const char * password);
240 bool smb_pam_passchange(const char * user, const char * oldpassword, const char * newpassword);
241 NTSTATUS smb_pam_accountcheck(const char * user);
242 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
243 bool smb_pam_close_session(char *in_user, char *tty, char *rhost);
244
245 /* The following definitions come from auth/pass_check.c  */
246
247 void dfs_unlogin(void);
248 NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *password, 
249                     int pwlen, bool (*fn) (const char *, const char *), bool run_cracker);
250
251 /* The following definitions come from auth/token_util.c  */
252
253 bool nt_token_check_sid ( const struct dom_sid *sid, const NT_USER_TOKEN *token );
254 bool nt_token_check_domain_rid( NT_USER_TOKEN *token, uint32 rid );
255 NT_USER_TOKEN *get_root_nt_token( void );
256 NTSTATUS add_aliases(const struct dom_sid *domain_sid,
257                      struct nt_user_token *token);
258 NTSTATUS create_builtin_users(const struct dom_sid *sid);
259 NTSTATUS create_builtin_administrators(const struct dom_sid *sid);
260 struct nt_user_token *create_local_nt_token(TALLOC_CTX *mem_ctx,
261                                             const struct dom_sid *user_sid,
262                                             bool is_guest,
263                                             int num_groupsids,
264                                             const struct dom_sid *groupsids);
265 NTSTATUS create_local_nt_token_from_info3(TALLOC_CTX *mem_ctx,
266                                           bool is_guest,
267                                           struct netr_SamInfo3 *info3,
268                                           struct nt_user_token **ntok);
269 void debug_nt_user_token(int dbg_class, int dbg_lev, NT_USER_TOKEN *token);
270 void debug_unix_user_token(int dbg_class, int dbg_lev, uid_t uid, gid_t gid,
271                            int n_groups, gid_t *groups);
272
273 /* The following definitions come from groupdb/mapping.c  */
274
275 NTSTATUS add_initial_entry(gid_t gid, const char *sid, enum lsa_SidType sid_name_use, const char *nt_name, const char *comment);
276 bool get_domain_group_from_sid(struct dom_sid sid, GROUP_MAP *map);
277 int smb_create_group(const char *unix_group, gid_t *new_gid);
278 int smb_delete_group(const char *unix_group);
279 int smb_set_primary_group(const char *unix_group, const char* unix_user);
280 int smb_add_user_group(const char *unix_group, const char *unix_user);
281 int smb_delete_user_group(const char *unix_group, const char *unix_user);
282 NTSTATUS pdb_default_getgrsid(struct pdb_methods *methods, GROUP_MAP *map,
283                                  struct dom_sid sid);
284 NTSTATUS pdb_default_getgrgid(struct pdb_methods *methods, GROUP_MAP *map,
285                                  gid_t gid);
286 NTSTATUS pdb_default_getgrnam(struct pdb_methods *methods, GROUP_MAP *map,
287                                  const char *name);
288 NTSTATUS pdb_default_add_group_mapping_entry(struct pdb_methods *methods,
289                                                 GROUP_MAP *map);
290 NTSTATUS pdb_default_update_group_mapping_entry(struct pdb_methods *methods,
291                                                    GROUP_MAP *map);
292 NTSTATUS pdb_default_delete_group_mapping_entry(struct pdb_methods *methods,
293                                                    struct dom_sid sid);
294 NTSTATUS pdb_default_enum_group_mapping(struct pdb_methods *methods,
295                                            const struct dom_sid *sid, enum lsa_SidType sid_name_use,
296                                            GROUP_MAP **pp_rmap, size_t *p_num_entries,
297                                            bool unix_only);
298 NTSTATUS pdb_default_create_alias(struct pdb_methods *methods,
299                                   const char *name, uint32 *rid);
300 NTSTATUS pdb_default_delete_alias(struct pdb_methods *methods,
301                                   const struct dom_sid *sid);
302 NTSTATUS pdb_default_get_aliasinfo(struct pdb_methods *methods,
303                                    const struct dom_sid *sid,
304                                    struct acct_info *info);
305 NTSTATUS pdb_default_set_aliasinfo(struct pdb_methods *methods,
306                                    const struct dom_sid *sid,
307                                    struct acct_info *info);
308 NTSTATUS pdb_default_add_aliasmem(struct pdb_methods *methods,
309                                   const struct dom_sid *alias, const struct dom_sid *member);
310 NTSTATUS pdb_default_del_aliasmem(struct pdb_methods *methods,
311                                   const struct dom_sid *alias, const struct dom_sid *member);
312 NTSTATUS pdb_default_enum_aliasmem(struct pdb_methods *methods,
313                                    const struct dom_sid *alias, TALLOC_CTX *mem_ctx,
314                                    struct dom_sid **pp_members,
315                                    size_t *p_num_members);
316 NTSTATUS pdb_default_alias_memberships(struct pdb_methods *methods,
317                                        TALLOC_CTX *mem_ctx,
318                                        const struct dom_sid *domain_sid,
319                                        const struct dom_sid *members,
320                                        size_t num_members,
321                                        uint32 **pp_alias_rids,
322                                        size_t *p_num_alias_rids);
323 NTSTATUS pdb_nop_getgrsid(struct pdb_methods *methods, GROUP_MAP *map,
324                                  struct dom_sid sid);
325 NTSTATUS pdb_nop_getgrgid(struct pdb_methods *methods, GROUP_MAP *map,
326                                  gid_t gid);
327 NTSTATUS pdb_nop_getgrnam(struct pdb_methods *methods, GROUP_MAP *map,
328                                  const char *name);
329 NTSTATUS pdb_nop_add_group_mapping_entry(struct pdb_methods *methods,
330                                                 GROUP_MAP *map);
331 NTSTATUS pdb_nop_update_group_mapping_entry(struct pdb_methods *methods,
332                                                    GROUP_MAP *map);
333 NTSTATUS pdb_nop_delete_group_mapping_entry(struct pdb_methods *methods,
334                                                    struct dom_sid sid);
335 NTSTATUS pdb_nop_enum_group_mapping(struct pdb_methods *methods,
336                                            enum lsa_SidType sid_name_use,
337                                            GROUP_MAP **rmap, size_t *num_entries,
338                                            bool unix_only);
339 bool pdb_get_dom_grp_info(const struct dom_sid *sid, struct acct_info *info);
340 bool pdb_set_dom_grp_info(const struct dom_sid *sid, const struct acct_info *info);
341 NTSTATUS pdb_create_builtin_alias(uint32 rid);
342
343 /* The following definitions come from groupdb/mapping_ldb.c  */
344
345 const struct mapping_backend *groupdb_ldb_init(void);
346
347 /* The following definitions come from groupdb/mapping_tdb.c  */
348
349 const struct mapping_backend *groupdb_tdb_init(void);
350
351 /* The following definitions come from intl/lang_tdb.c  */
352
353 bool lang_tdb_init(const char *lang);
354 const char *lang_msg(const char *msgid);
355 void lang_msg_free(const char *msgstr);
356 char *lang_tdb_current(void);
357
358 /* The following definitions come from lib/access.c  */
359
360 bool client_match(const char *tok, const void *item);
361 bool list_match(const char **list,const void *item,
362                 bool (*match_fn)(const char *, const void *));
363 bool allow_access(const char **deny_list,
364                 const char **allow_list,
365                 const char *cname,
366                 const char *caddr);
367 bool check_access(int sock, const char **allow_list, const char **deny_list);
368
369 /* The following definitions come from passdb/account_pol.c  */
370
371 void account_policy_names_list(const char ***names, int *num_names);
372 const char *decode_account_policy_name(enum pdb_policy_type type);
373 const char *get_account_policy_attr(enum pdb_policy_type type);
374 const char *account_policy_get_desc(enum pdb_policy_type type);
375 enum pdb_policy_type account_policy_name_to_typenum(const char *name);
376 bool account_policy_get_default(enum pdb_policy_type type, uint32_t *val);
377 bool init_account_policy(void);
378 bool account_policy_get(enum pdb_policy_type type, uint32_t *value);
379 bool account_policy_set(enum pdb_policy_type type, uint32_t value);
380 bool cache_account_policy_set(enum pdb_policy_type type, uint32_t value);
381 bool cache_account_policy_get(enum pdb_policy_type type, uint32_t *value);
382 struct db_context *get_account_pol_db( void );
383
384 /* The following definitions come from lib/adt_tree.c  */
385
386
387 /* The following definitions come from lib/afs.c  */
388
389 char *afs_createtoken_str(const char *username, const char *cell);
390 bool afs_login(connection_struct *conn);
391 bool afs_login(connection_struct *conn);
392 char *afs_createtoken_str(const char *username, const char *cell);
393
394 /* The following definitions come from lib/afs_settoken.c  */
395
396 int afs_syscall( int subcall,
397           char * path,
398           int cmd,
399           char * cmarg,
400           int follow);
401 bool afs_settoken_str(const char *token_string);
402 bool afs_settoken_str(const char *token_string);
403
404 /* The following definitions come from lib/audit.c  */
405
406 const char *audit_category_str(uint32 category);
407 const char *audit_param_str(uint32 category);
408 const char *audit_description_str(uint32 category);
409 bool get_audit_category_from_param(const char *param, uint32 *audit_category);
410 const char *audit_policy_str(TALLOC_CTX *mem_ctx, uint32 policy);
411
412 /* The following definitions come from lib/bitmap.c  */
413
414 struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n);
415 int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src);
416 bool bitmap_set(struct bitmap *bm, unsigned i);
417 bool bitmap_clear(struct bitmap *bm, unsigned i);
418 bool bitmap_query(struct bitmap *bm, unsigned i);
419 int bitmap_find(struct bitmap *bm, unsigned ofs);
420
421 /* The following definitions come from lib/charcnv.c  */
422
423 NTSTATUS smb_register_charset(struct charset_functions *funcs);
424 char lp_failed_convert_char(void);
425 void lazy_initialize_conv(void);
426 void gfree_charcnv(void);
427 void init_iconv(void);
428 size_t convert_string(charset_t from, charset_t to,
429                       void const *src, size_t srclen, 
430                       void *dest, size_t destlen, bool allow_bad_conv);
431 size_t unix_strupper(const char *src, size_t srclen, char *dest, size_t destlen);
432 char *talloc_strdup_upper(TALLOC_CTX *ctx, const char *s);
433 char *strupper_talloc(TALLOC_CTX *ctx, const char *s);
434 size_t unix_strlower(const char *src, size_t srclen, char *dest, size_t destlen);
435 char *talloc_strdup_lower(TALLOC_CTX *ctx, const char *s);
436 char *strlower_talloc(TALLOC_CTX *ctx, const char *s);
437 size_t ucs2_align(const void *base_ptr, const void *p, int flags);
438 size_t push_ascii(void *dest, const char *src, size_t dest_len, int flags);
439 size_t push_ascii_fstring(void *dest, const char *src);
440 size_t push_ascii_nstring(void *dest, const char *src);
441 size_t pull_ascii(char *dest, const void *src, size_t dest_len, size_t src_len, int flags);
442 size_t pull_ascii_fstring(char *dest, const void *src);
443 size_t pull_ascii_nstring(char *dest, size_t dest_len, const void *src);
444 size_t push_ucs2(const void *base_ptr, void *dest, const char *src, size_t dest_len, int flags);
445 size_t push_utf8_fstring(void *dest, const char *src);
446 bool push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
447                       size_t *converted_size);
448 size_t pull_ucs2(const void *base_ptr, char *dest, const void *src, size_t dest_len, size_t src_len, int flags);
449 size_t pull_ucs2_base_talloc(TALLOC_CTX *ctx,
450                         const void *base_ptr,
451                         char **ppdest,
452                         const void *src,
453                         size_t src_len,
454                         int flags);
455 size_t pull_ucs2_fstring(char *dest, const void *src);
456 bool push_ucs2_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src,
457                       size_t *converted_size);
458 bool pull_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
459                       size_t *converted_size);
460 bool pull_ucs2_talloc(TALLOC_CTX *ctx, char **dest, const smb_ucs2_t *src,
461                       size_t *converted_size);
462 bool pull_ascii_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
463                        size_t *converted_size);
464 size_t push_string_check_fn(const char *function, unsigned int line,
465                             void *dest, const char *src,
466                             size_t dest_len, int flags);
467 size_t push_string_base(const char *function, unsigned int line,
468                         const char *base, uint16 flags2, 
469                         void *dest, const char *src,
470                         size_t dest_len, int flags);
471 size_t pull_string_fn(const char *function,
472                         unsigned int line,
473                         const void *base_ptr,
474                         uint16 smb_flags2,
475                         char *dest,
476                         const void *src,
477                         size_t dest_len,
478                         size_t src_len,
479                         int flags);
480 size_t pull_string_talloc_fn(const char *function,
481                         unsigned int line,
482                         TALLOC_CTX *ctx,
483                         const void *base_ptr,
484                         uint16 smb_flags2,
485                         char **ppdest,
486                         const void *src,
487                         size_t src_len,
488                         int flags);
489 size_t align_string(const void *base_ptr, const char *p, int flags);
490 codepoint_t next_codepoint(const char *str, size_t *size);
491
492 /* The following definitions come from lib/clobber.c  */
493
494 void clobber_region(const char *fn, unsigned int line, char *dest, size_t len);
495
496 /* The following definitions come from lib/conn_tdb.c  */
497
498 struct db_record *connections_fetch_entry(TALLOC_CTX *mem_ctx,
499                                           connection_struct *conn,
500                                           const char *name);
501 int connections_traverse(int (*fn)(struct db_record *rec,
502                                    void *private_data),
503                          void *private_data);
504 int connections_forall(int (*fn)(struct db_record *rec,
505                                  const struct connections_key *key,
506                                  const struct connections_data *data,
507                                  void *private_data),
508                        void *private_data);
509 int connections_forall_read(int (*fn)(const struct connections_key *key,
510                                       const struct connections_data *data,
511                                       void *private_data),
512                             void *private_data);
513 bool connections_init(bool rw);
514
515 /* The following definitions come from lib/dbwrap_util.c  */
516
517 int32_t dbwrap_fetch_int32(struct db_context *db, const char *keystr);
518 int dbwrap_store_int32(struct db_context *db, const char *keystr, int32_t v);
519 bool dbwrap_fetch_uint32(struct db_context *db, const char *keystr,
520                          uint32_t *val);
521 int dbwrap_store_uint32(struct db_context *db, const char *keystr, uint32_t v);
522 NTSTATUS dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr,
523                                      uint32_t *oldval, uint32_t change_val);
524 NTSTATUS dbwrap_trans_change_uint32_atomic(struct db_context *db,
525                                            const char *keystr,
526                                            uint32_t *oldval,
527                                            uint32_t change_val);
528 NTSTATUS dbwrap_change_int32_atomic(struct db_context *db, const char *keystr,
529                                     int32_t *oldval, int32_t change_val);
530 NTSTATUS dbwrap_trans_change_int32_atomic(struct db_context *db,
531                                           const char *keystr,
532                                           int32_t *oldval,
533                                           int32_t change_val);
534 NTSTATUS dbwrap_trans_store(struct db_context *db, TDB_DATA key, TDB_DATA dbuf,
535                             int flag);
536 NTSTATUS dbwrap_trans_delete(struct db_context *db, TDB_DATA key);
537 NTSTATUS dbwrap_trans_store_int32(struct db_context *db, const char *keystr,
538                                   int32_t v);
539 NTSTATUS dbwrap_trans_store_uint32(struct db_context *db, const char *keystr,
540                                    uint32_t v);
541 NTSTATUS dbwrap_trans_store_bystring(struct db_context *db, const char *key,
542                                      TDB_DATA data, int flags);
543 NTSTATUS dbwrap_trans_delete_bystring(struct db_context *db, const char *key);
544 NTSTATUS dbwrap_trans_do(struct db_context *db,
545                          NTSTATUS (*action)(struct db_context *, void *),
546                          void *private_data);
547 NTSTATUS dbwrap_delete_bystring_upper(struct db_context *db, const char *key);
548 NTSTATUS dbwrap_store_bystring_upper(struct db_context *db, const char *key,
549                                      TDB_DATA data, int flags);
550 TDB_DATA dbwrap_fetch_bystring_upper(struct db_context *db, TALLOC_CTX *mem_ctx,
551                                      const char *key);
552
553 /* The following definitions come from lib/debug.c  */
554
555 void gfree_debugsyms(void);
556 const char *debug_classname_from_index(int ndx);
557 int debug_add_class(const char *classname);
558 int debug_lookup_classname(const char *classname);
559 bool debug_parse_levels(const char *params_str);
560 void debug_message(struct messaging_context *msg_ctx, void *private_data, uint32_t msg_type, struct server_id src, DATA_BLOB *data);
561 void debug_init(void);
562 void debug_register_msgs(struct messaging_context *msg_ctx);
563 void setup_logging(const char *pname, bool interactive);
564 void setup_logging_stdout( void );
565 void debug_set_logfile(const char *name);
566 bool reopen_logs( void );
567 void force_check_log_size( void );
568 bool need_to_check_log_size( void );
569 void check_log_size( void );
570 void dbgflush( void );
571 bool dbghdrclass(int level, int cls, const char *location, const char *func);
572 bool dbghdr(int level, const char *location, const char *func);
573
574 /* The following definitions come from lib/display_sec.c  */
575
576 char *get_sec_mask_str(TALLOC_CTX *ctx, uint32 type);
577 void display_sec_access(uint32_t *info);
578 void display_sec_ace_flags(uint8_t flags);
579 void display_sec_ace(struct security_ace *ace);
580 void display_sec_acl(struct security_acl *sec_acl);
581 void display_acl_type(uint16 type);
582 void display_sec_desc(struct security_descriptor *sec);
583
584 /* The following definitions come from lib/dmallocmsg.c  */
585
586 void register_dmalloc_msgs(struct messaging_context *msg_ctx);
587
588 /* The following definitions come from lib/dprintf.c  */
589
590 void display_set_stderr(void);
591
592 /* The following definitions come from lib/errmap_unix.c  */
593
594 NTSTATUS map_nt_error_from_unix(int unix_error);
595 int map_errno_from_nt_status(NTSTATUS status);
596
597 /* The following definitions come from lib/fault.c  */
598 void fault_setup(void (*fn)(void *));
599 void dump_core_setup(const char *progname);
600
601 /* The following definitions come from lib/file_id.c  */
602
603 struct file_id vfs_file_id_from_sbuf(connection_struct *conn, const SMB_STRUCT_STAT *sbuf);
604 bool file_id_equal(const struct file_id *id1, const struct file_id *id2);
605 const char *file_id_string_tos(const struct file_id *id);
606 void push_file_id_16(char *buf, const struct file_id *id);
607 void push_file_id_24(char *buf, const struct file_id *id);
608 void pull_file_id_24(char *buf, struct file_id *id);
609
610 /* The following definitions come from lib/gencache.c  */
611
612 bool gencache_set(const char *keystr, const char *value, time_t timeout);
613 bool gencache_del(const char *keystr);
614 bool gencache_get(const char *keystr, char **valstr, time_t *timeout);
615 bool gencache_get_data_blob(const char *keystr, DATA_BLOB *blob,
616                             time_t *timeout, bool *was_expired);
617 bool gencache_stabilize(void);
618 bool gencache_set_data_blob(const char *keystr, const DATA_BLOB *blob, time_t timeout);
619 void gencache_iterate(void (*fn)(const char* key, const char *value, time_t timeout, void* dptr),
620                       void* data, const char* keystr_pattern);
621
622 /* The following definitions come from lib/interface.c  */
623
624 bool ismyaddr(const struct sockaddr *ip);
625 bool ismyip_v4(struct in_addr ip);
626 bool is_local_net(const struct sockaddr *from);
627 void setup_linklocal_scope_id(struct sockaddr *pss);
628 bool is_local_net_v4(struct in_addr from);
629 int iface_count(void);
630 int iface_count_v4_nl(void);
631 const struct in_addr *first_ipv4_iface(void);
632 struct interface *get_interface(int n);
633 const struct sockaddr_storage *iface_n_sockaddr_storage(int n);
634 const struct in_addr *iface_n_ip_v4(int n);
635 const struct in_addr *iface_n_bcast_v4(int n);
636 const struct sockaddr_storage *iface_n_bcast(int n);
637 const struct sockaddr_storage *iface_ip(const struct sockaddr *ip);
638 bool iface_local(const struct sockaddr *ip);
639 void load_interfaces(void);
640 void gfree_interfaces(void);
641 bool interfaces_changed(void);
642
643 /* The following definitions come from lib/ldap_debug_handler.c  */
644
645 void init_ldap_debugging(void);
646
647 /* The following definitions come from lib/ldap_escape.c  */
648
649 char *escape_ldap_string(TALLOC_CTX *mem_ctx, const char *s);
650 char *escape_rdn_val_string_alloc(const char *s);
651
652 /* The following definitions come from lib/module.c  */
653
654 NTSTATUS smb_load_module(const char *module_name);
655 int smb_load_modules(const char **modules);
656 NTSTATUS smb_probe_module(const char *subsystem, const char *module);
657 NTSTATUS smb_load_module(const char *module_name);
658 int smb_load_modules(const char **modules);
659 NTSTATUS smb_probe_module(const char *subsystem, const char *module);
660 void init_modules(void);
661
662 /* The following definitions come from lib/ms_fnmatch.c  */
663
664 int ms_fnmatch(const char *pattern, const char *string, bool translate_pattern,
665                bool is_case_sensitive);
666 int gen_fnmatch(const char *pattern, const char *string);
667
668 /* The following definitions come from lib/pam_errors.c  */
669
670 NTSTATUS pam_to_nt_status(int pam_error);
671 int nt_status_to_pam(NTSTATUS nt_status);
672 NTSTATUS pam_to_nt_status(int pam_error);
673 int nt_status_to_pam(NTSTATUS nt_status);
674
675 /* The following definitions come from lib/pidfile.c  */
676
677 pid_t pidfile_pid(const char *name);
678 void pidfile_create(const char *program_name);
679 void pidfile_unlink(void);
680
681 /* The following definitions come from lib/popt_common.c  */
682
683 void popt_common_set_auth_info(struct user_auth_info *auth_info);
684
685 /* The following definitions come from lib/privileges.c  */
686
687 bool get_privileges_for_sids(SE_PRIV *privileges, struct dom_sid *slist, int scount);
688 NTSTATUS privilege_enumerate_accounts(struct dom_sid **sids, int *num_sids);
689 NTSTATUS privilege_enum_sids(const SE_PRIV *mask, TALLOC_CTX *mem_ctx,
690                              struct dom_sid **sids, int *num_sids);
691 bool grant_privilege(const struct dom_sid *sid, const SE_PRIV *priv_mask);
692 bool grant_privilege_by_name(struct dom_sid *sid, const char *name);
693 bool revoke_privilege(const struct dom_sid *sid, const SE_PRIV *priv_mask);
694 bool revoke_all_privileges( struct dom_sid *sid );
695 bool revoke_privilege_by_name(struct dom_sid *sid, const char *name);
696 NTSTATUS privilege_create_account(const struct dom_sid *sid );
697 NTSTATUS privilege_delete_account(const struct dom_sid *sid);
698 NTSTATUS privilege_set_init(PRIVILEGE_SET *priv_set);
699 NTSTATUS privilege_set_init_by_ctx(TALLOC_CTX *mem_ctx, PRIVILEGE_SET *priv_set);
700 void privilege_set_free(PRIVILEGE_SET *priv_set);
701 NTSTATUS dup_luid_attr(TALLOC_CTX *mem_ctx, LUID_ATTR **new_la, LUID_ATTR *old_la, int count);
702 bool is_privileged_sid( const struct dom_sid *sid );
703 bool grant_all_privileges( const struct dom_sid *sid );
704
705 /* The following definitions come from lib/privileges_basic.c  */
706
707 bool se_priv_copy( SE_PRIV *dst, const SE_PRIV *src );
708 bool se_priv_put_all_privileges(SE_PRIV *mask);
709 void se_priv_add( SE_PRIV *mask, const SE_PRIV *addpriv );
710 void se_priv_remove( SE_PRIV *mask, const SE_PRIV *removepriv );
711 bool se_priv_equal( const SE_PRIV *mask1, const SE_PRIV *mask2 );
712 bool se_priv_from_name( const char *name, SE_PRIV *mask );
713 void dump_se_priv( int dbg_cl, int dbg_lvl, const SE_PRIV *mask );
714 bool is_privilege_assigned(const SE_PRIV *privileges,
715                            const SE_PRIV *check);
716 const char* get_privilege_dispname( const char *name );
717 bool user_has_privileges(const NT_USER_TOKEN *token, const SE_PRIV *privilege);
718 bool user_has_any_privilege(NT_USER_TOKEN *token, const SE_PRIV *privilege);
719 int count_all_privileges( void );
720 LUID_ATTR get_privilege_luid( SE_PRIV *mask );
721 const char *luid_to_privilege_name(const LUID *set);
722 bool se_priv_to_privilege_set( PRIVILEGE_SET *set, SE_PRIV *mask );
723 bool privilege_set_to_se_priv( SE_PRIV *mask, struct lsa_PrivilegeSet *privset );
724
725 /* The following definitions come from lib/readline.c  */
726
727 void smb_readline_done(void);
728 char *smb_readline(const char *prompt, void (*callback)(void),
729                    char **(completion_fn)(const char *text, int start, int end));
730 const char *smb_readline_get_line_buffer(void);
731 void smb_readline_ca_char(char c);
732 int cmd_history(void);
733
734 /* The following definitions come from lib/recvfile.c  */
735
736 ssize_t sys_recvfile(int fromfd,
737                         int tofd,
738                         SMB_OFF_T offset,
739                         size_t count);
740 ssize_t sys_recvfile(int fromfd,
741                         int tofd,
742                         SMB_OFF_T offset,
743                         size_t count);
744 ssize_t drain_socket(int sockfd, size_t count);
745
746 /* The following definitions come from lib/secdesc.c  */
747
748 uint32_t get_sec_info(const struct security_descriptor *sd);
749 struct security_descriptor *sec_desc_merge(TALLOC_CTX *ctx, struct security_descriptor *new_sdb, struct security_descriptor *old_sdb);
750 struct sec_desc_buf *sec_desc_merge_buf(TALLOC_CTX *ctx, struct sec_desc_buf *new_sdb, struct sec_desc_buf *old_sdb);
751 struct security_descriptor *make_sec_desc(TALLOC_CTX *ctx,
752                         enum security_descriptor_revision revision,
753                         uint16 type,
754                         const struct dom_sid *owner_sid, const struct dom_sid *grp_sid,
755                         struct security_acl *sacl, struct security_acl *dacl, size_t *sd_size);
756 struct security_descriptor *dup_sec_desc(TALLOC_CTX *ctx, const struct security_descriptor *src);
757 NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx,
758                            struct security_descriptor *secdesc,
759                            uint8 **data, size_t *len);
760 NTSTATUS marshall_sec_desc_buf(TALLOC_CTX *mem_ctx,
761                                struct sec_desc_buf *secdesc_buf,
762                                uint8_t **data, size_t *len);
763 NTSTATUS unmarshall_sec_desc(TALLOC_CTX *mem_ctx, uint8 *data, size_t len,
764                              struct security_descriptor **psecdesc);
765 NTSTATUS unmarshall_sec_desc_buf(TALLOC_CTX *mem_ctx, uint8_t *data, size_t len,
766                                  struct sec_desc_buf **psecdesc_buf);
767 struct security_descriptor *make_standard_sec_desc(TALLOC_CTX *ctx, const struct dom_sid *owner_sid, const struct dom_sid *grp_sid,
768                                  struct security_acl *dacl, size_t *sd_size);
769 struct sec_desc_buf *make_sec_desc_buf(TALLOC_CTX *ctx, size_t len, struct security_descriptor *sec_desc);
770 struct sec_desc_buf *dup_sec_desc_buf(TALLOC_CTX *ctx, struct sec_desc_buf *src);
771 NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, struct security_descriptor **psd, struct dom_sid *sid, uint32 mask, size_t *sd_size);
772 NTSTATUS sec_desc_mod_sid(struct security_descriptor *sd, struct dom_sid *sid, uint32 mask);
773 NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, struct security_descriptor **psd, struct dom_sid *sid, size_t *sd_size);
774 bool sd_has_inheritable_components(const struct security_descriptor *parent_ctr, bool container);
775 NTSTATUS se_create_child_secdesc(TALLOC_CTX *ctx,
776                                         struct security_descriptor **ppsd,
777                                         size_t *psize,
778                                         const struct security_descriptor *parent_ctr,
779                                         const struct dom_sid *owner_sid,
780                                         const struct dom_sid *group_sid,
781                                         bool container);
782 NTSTATUS se_create_child_secdesc_buf(TALLOC_CTX *ctx,
783                                         struct sec_desc_buf **ppsdb,
784                                         const struct security_descriptor *parent_ctr,
785                                         bool container);
786
787 /* The following definitions come from lib/select.c  */
788
789 void sys_select_signal(char c);
790 int sys_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *tval);
791 int sys_select_intr(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *tval);
792
793 /* The following definitions come from lib/sendfile.c  */
794
795 ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
796
797 /* The following definitions come from lib/server_mutex.c  */
798
799 struct named_mutex *grab_named_mutex(TALLOC_CTX *mem_ctx, const char *name,
800                                      int timeout);
801
802 /* The following definitions come from lib/sharesec.c  */
803
804 bool share_info_db_init(void);
805 struct security_descriptor *get_share_security_default( TALLOC_CTX *ctx, size_t *psize, uint32 def_access);
806 struct security_descriptor *get_share_security( TALLOC_CTX *ctx, const char *servicename,
807                               size_t *psize);
808 bool set_share_security(const char *share_name, struct security_descriptor *psd);
809 bool delete_share_security(const char *servicename);
810 bool share_access_check(const NT_USER_TOKEN *token, const char *sharename,
811                         uint32 desired_access);
812 bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, struct security_descriptor **ppsd);
813
814 /* The following definitions come from lib/smbldap.c  */
815
816 int smb_ldap_start_tls(LDAP *ldap_struct, int version);
817 int smb_ldap_setup_conn(LDAP **ldap_struct, const char *uri);
818 int smb_ldap_upgrade_conn(LDAP *ldap_struct, int *new_version) ;
819 int smb_ldap_setup_full_conn(LDAP **ldap_struct, const char *uri);
820 int smbldap_search(struct smbldap_state *ldap_state, 
821                    const char *base, int scope, const char *filter, 
822                    const char *attrs[], int attrsonly, 
823                    LDAPMessage **res);
824 int smbldap_search_paged(struct smbldap_state *ldap_state, 
825                          const char *base, int scope, const char *filter, 
826                          const char **attrs, int attrsonly, int pagesize,
827                          LDAPMessage **res, void **cookie);
828 int smbldap_modify(struct smbldap_state *ldap_state, const char *dn, LDAPMod *attrs[]);
829 int smbldap_add(struct smbldap_state *ldap_state, const char *dn, LDAPMod *attrs[]);
830 int smbldap_delete(struct smbldap_state *ldap_state, const char *dn);
831 int smbldap_extended_operation(struct smbldap_state *ldap_state, 
832                                LDAP_CONST char *reqoid, struct berval *reqdata, 
833                                LDAPControl **serverctrls, LDAPControl **clientctrls, 
834                                char **retoidp, struct berval **retdatap);
835 int smbldap_search_suffix (struct smbldap_state *ldap_state,
836                            const char *filter, const char **search_attr,
837                            LDAPMessage ** result);
838 void smbldap_free_struct(struct smbldap_state **ldap_state) ;
839 NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx, struct event_context *event_ctx,
840                       const char *location,
841                       struct smbldap_state **smbldap_state);
842 bool smbldap_has_control(LDAP *ld, const char *control);
843 bool smbldap_has_extension(LDAP *ld, const char *extension);
844 bool smbldap_has_naming_context(LDAP *ld, const char *naming_context);
845 bool smbldap_set_creds(struct smbldap_state *ldap_state, bool anon, const char *dn, const char *secret);
846
847 /* The following definitions come from lib/smbldap_util.c  */
848
849 NTSTATUS smbldap_search_domain_info(struct smbldap_state *ldap_state,
850                                     LDAPMessage ** result, const char *domain_name,
851                                     bool try_add);
852
853 /* The following definitions come from lib/smbrun.c  */
854
855 int smbrun_no_sanitize(const char *cmd, int *outfd);
856 int smbrun(const char *cmd, int *outfd);
857 int smbrunsecret(const char *cmd, const char *secret);
858
859 /* The following definitions come from lib/sock_exec.c  */
860
861 int sock_exec(const char *prog);
862
863 /* The following definitions come from lib/substitute.c  */
864
865 void free_local_machine_name(void);
866 bool set_local_machine_name(const char *local_name, bool perm);
867 const char *get_local_machine_name(void);
868 bool set_remote_machine_name(const char *remote_name, bool perm);
869 const char *get_remote_machine_name(void);
870 void sub_set_smb_name(const char *name);
871 void set_current_user_info(const char *smb_name, const char *unix_name,
872                            const char *domain);
873 const char *get_current_username(void);
874 void standard_sub_basic(const char *smb_name, const char *domain_name,
875                         char *str, size_t len);
876 char *talloc_sub_basic(TALLOC_CTX *mem_ctx, const char *smb_name,
877                        const char *domain_name, const char *str);
878 char *talloc_sub_specified(TALLOC_CTX *mem_ctx,
879                         const char *input_string,
880                         const char *username,
881                         const char *domain,
882                         uid_t uid,
883                         gid_t gid);
884 char *talloc_sub_advanced(TALLOC_CTX *mem_ctx,
885                           const char *servicename, const char *user,
886                           const char *connectpath, gid_t gid,
887                           const char *smb_name, const char *domain_name,
888                           const char *str);
889 void standard_sub_advanced(const char *servicename, const char *user,
890                            const char *connectpath, gid_t gid,
891                            const char *smb_name, const char *domain_name,
892                            char *str, size_t len);
893 char *standard_sub_conn(TALLOC_CTX *ctx, connection_struct *conn, const char *str);
894
895 /* The following definitions come from lib/sysacls.c  */
896
897 int sys_acl_get_entry(SMB_ACL_T acl_d, int entry_id, SMB_ACL_ENTRY_T *entry_p);
898 int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *type_p);
899 int sys_acl_get_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
900 void *sys_acl_get_qualifier(SMB_ACL_ENTRY_T entry_d);
901 int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset_d);
902 int sys_acl_add_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
903 int sys_acl_get_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
904 char *sys_acl_to_text(SMB_ACL_T acl_d, ssize_t *len_p);
905 SMB_ACL_T sys_acl_init(int count);
906 int sys_acl_create_entry(SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p);
907 int sys_acl_set_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type);
908 int sys_acl_set_qualifier(SMB_ACL_ENTRY_T entry_d, void *qual_p);
909 int sys_acl_set_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d);
910 int sys_acl_free_text(char *text);
911 int sys_acl_free_acl(SMB_ACL_T acl_d) ;
912 int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype);
913 int sys_acl_valid(SMB_ACL_T acl_d);
914 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle, 
915                            const char *path_p, SMB_ACL_TYPE_T type);
916 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
917 int sys_acl_set_file(vfs_handle_struct *handle,
918                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
919 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
920                    SMB_ACL_T acl_d);
921 int sys_acl_delete_def_file(vfs_handle_struct *handle,
922                             const char *path);
923 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
924                            const char *path_p, SMB_ACL_TYPE_T type);
925 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
926 int sys_acl_set_file(vfs_handle_struct *handle,
927                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
928 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
929                    SMB_ACL_T acl_d);
930 int sys_acl_delete_def_file(vfs_handle_struct *handle,
931                             const char *path);
932 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
933                            const char *path_p, SMB_ACL_TYPE_T type);
934 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
935 int sys_acl_set_file(vfs_handle_struct *handle,
936                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
937 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
938                    SMB_ACL_T acl_d);
939 int sys_acl_delete_def_file(vfs_handle_struct *handle,
940                             const char *path);
941 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
942                            const char *path_p, SMB_ACL_TYPE_T type);
943 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
944 int sys_acl_set_file(vfs_handle_struct *handle,
945                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
946 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
947                    SMB_ACL_T acl_d);
948 int sys_acl_delete_def_file(vfs_handle_struct *handle,
949                             const char *path);
950 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
951                            const char *path_p, SMB_ACL_TYPE_T type);
952 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
953 int sys_acl_set_file(vfs_handle_struct *handle,
954                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
955 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
956                    SMB_ACL_T acl_d);
957 int sys_acl_delete_def_file(vfs_handle_struct *handle,
958                             const char *path);
959 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
960                            const char *path_p, SMB_ACL_TYPE_T type);
961 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
962 int sys_acl_set_file(vfs_handle_struct *handle,
963                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
964 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
965                    SMB_ACL_T acl_d);
966 int sys_acl_delete_def_file(vfs_handle_struct *handle,
967                             const char *path);
968 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
969                            const char *path_p, SMB_ACL_TYPE_T type);
970 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
971 int sys_acl_set_file(vfs_handle_struct *handle,
972                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
973 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
974                    SMB_ACL_T acl_d);
975 int sys_acl_delete_def_file(vfs_handle_struct *handle,
976                             const char *path);
977 int no_acl_syscall_error(int err);
978
979 /* The following definitions come from lib/sysquotas.c  */
980
981 int sys_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
982 int sys_set_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
983
984 /* The following definitions come from lib/sysquotas_*.c  */
985
986 int sys_get_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
987 int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
988
989 int sys_get_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
990 int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
991
992 /* The following definitions come from lib/system.c  */
993
994 void *sys_memalign( size_t align, size_t size );
995 int sys_usleep(long usecs);
996 ssize_t sys_read(int fd, void *buf, size_t count);
997 ssize_t sys_write(int fd, const void *buf, size_t count);
998 ssize_t sys_writev(int fd, const struct iovec *iov, int iovcnt);
999 ssize_t sys_pread(int fd, void *buf, size_t count, SMB_OFF_T off);
1000 ssize_t sys_pwrite(int fd, const void *buf, size_t count, SMB_OFF_T off);
1001 ssize_t sys_send(int s, const void *msg, size_t len, int flags);
1002 ssize_t sys_sendto(int s,  const void *msg, size_t len, int flags, const struct sockaddr *to, socklen_t tolen);
1003 ssize_t sys_recv(int fd, void *buf, size_t count, int flags);
1004 ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen);
1005 int sys_fcntl_ptr(int fd, int cmd, void *arg);
1006 int sys_fcntl_long(int fd, int cmd, long arg);
1007 void update_stat_ex_mtime(struct stat_ex *dst, struct timespec write_ts);
1008 void update_stat_ex_create_time(struct stat_ex *dst, struct timespec create_time);
1009 int sys_stat(const char *fname, SMB_STRUCT_STAT *sbuf,
1010              bool fake_dir_create_times);
1011 int sys_fstat(int fd, SMB_STRUCT_STAT *sbuf,
1012               bool fake_dir_create_times);
1013 int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf,
1014               bool fake_dir_create_times);
1015 int sys_ftruncate(int fd, SMB_OFF_T offset);
1016 int sys_posix_fallocate(int fd, SMB_OFF_T offset, SMB_OFF_T len);
1017 SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence);
1018 int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence);
1019 SMB_OFF_T sys_ftell(FILE *fp);
1020 int sys_creat(const char *path, mode_t mode);
1021 int sys_open(const char *path, int oflag, mode_t mode);
1022 FILE *sys_fopen(const char *path, const char *type);
1023 void kernel_flock(int fd, uint32 share_mode, uint32 access_mask);
1024 SMB_STRUCT_DIR *sys_opendir(const char *name);
1025 SMB_STRUCT_DIRENT *sys_readdir(SMB_STRUCT_DIR *dirp);
1026 void sys_seekdir(SMB_STRUCT_DIR *dirp, long offset);
1027 long sys_telldir(SMB_STRUCT_DIR *dirp);
1028 void sys_rewinddir(SMB_STRUCT_DIR *dirp);
1029 int sys_closedir(SMB_STRUCT_DIR *dirp);
1030 int sys_mknod(const char *path, mode_t mode, SMB_DEV_T dev);
1031 int sys_waitpid(pid_t pid,int *status,int options);
1032 char *sys_getwd(char *s);
1033 void set_effective_capability(enum smbd_capability capability);
1034 void drop_effective_capability(enum smbd_capability capability);
1035 long sys_random(void);
1036 void sys_srandom(unsigned int seed);
1037 int groups_max(void);
1038 int sys_getgroups(int setlen, gid_t *gidset);
1039 int sys_setgroups(gid_t UNUSED(primary_gid), int setlen, gid_t *gidset);
1040 void sys_setpwent(void);
1041 struct passwd *sys_getpwent(void);
1042 void sys_endpwent(void);
1043 struct passwd *sys_getpwnam(const char *name);
1044 struct passwd *sys_getpwuid(uid_t uid);
1045 struct group *sys_getgrnam(const char *name);
1046 struct group *sys_getgrgid(gid_t gid);
1047 int sys_popen(const char *command);
1048 int sys_pclose(int fd);
1049 ssize_t sys_getxattr (const char *path, const char *name, void *value, size_t size);
1050 ssize_t sys_lgetxattr (const char *path, const char *name, void *value, size_t size);
1051 ssize_t sys_fgetxattr (int filedes, const char *name, void *value, size_t size);
1052 ssize_t sys_listxattr (const char *path, char *list, size_t size);
1053 ssize_t sys_llistxattr (const char *path, char *list, size_t size);
1054 ssize_t sys_flistxattr (int filedes, char *list, size_t size);
1055 int sys_removexattr (const char *path, const char *name);
1056 int sys_lremovexattr (const char *path, const char *name);
1057 int sys_fremovexattr (int filedes, const char *name);
1058 int sys_setxattr (const char *path, const char *name, const void *value, size_t size, int flags);
1059 int sys_lsetxattr (const char *path, const char *name, const void *value, size_t size, int flags);
1060 int sys_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags);
1061 uint32 unix_dev_major(SMB_DEV_T dev);
1062 uint32 unix_dev_minor(SMB_DEV_T dev);
1063 int sys_aio_read(SMB_STRUCT_AIOCB *aiocb);
1064 int sys_aio_write(SMB_STRUCT_AIOCB *aiocb);
1065 ssize_t sys_aio_return(SMB_STRUCT_AIOCB *aiocb);
1066 int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb);
1067 int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb);
1068 int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb);
1069 int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout);
1070 int sys_aio_read(SMB_STRUCT_AIOCB *aiocb);
1071 int sys_aio_write(SMB_STRUCT_AIOCB *aiocb);
1072 ssize_t sys_aio_return(SMB_STRUCT_AIOCB *aiocb);
1073 int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb);
1074 int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb);
1075 int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb);
1076 int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout);
1077 int sys_getpeereid( int s, uid_t *uid);
1078 int sys_getnameinfo(const struct sockaddr *psa,
1079                         socklen_t salen,
1080                         char *host,
1081                         size_t hostlen,
1082                         char *service,
1083                         size_t servlen,
1084                         int flags);
1085 int sys_connect(int fd, const struct sockaddr * addr);
1086
1087 /* The following definitions come from lib/system_smbd.c  */
1088
1089 bool getgroups_unix_user(TALLOC_CTX *mem_ctx, const char *user,
1090                          gid_t primary_gid,
1091                          gid_t **ret_groups, size_t *p_ngroups);
1092
1093 /* The following definitions come from lib/tallocmsg.c  */
1094
1095 void register_msg_pool_usage(struct messaging_context *msg_ctx);
1096
1097 /* The following definitions come from lib/time.c  */
1098
1099 void push_dos_date(uint8_t *buf, int offset, time_t unixdate, int zone_offset);
1100 void push_dos_date2(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
1101 void push_dos_date3(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
1102 time_t pull_dos_date(const uint8_t *date_ptr, int zone_offset);
1103 time_t pull_dos_date2(const uint8_t *date_ptr, int zone_offset);
1104 time_t pull_dos_date3(const uint8_t *date_ptr, int zone_offset);
1105 uint32_t convert_time_t_to_uint32_t(time_t t);
1106 time_t convert_uint32_t_to_time_t(uint32_t u);
1107 bool nt_time_is_zero(const NTTIME *nt);
1108 time_t generalized_to_unix_time(const char *str);
1109 int get_server_zone_offset(void);
1110 int set_server_zone_offset(time_t t);
1111 char *timeval_string(TALLOC_CTX *ctx, const struct timeval *tp, bool hires);
1112 char *current_timestring(TALLOC_CTX *ctx, bool hires);
1113 void srv_put_dos_date(char *buf,int offset,time_t unixdate);
1114 void srv_put_dos_date2(char *buf,int offset, time_t unixdate);
1115 void srv_put_dos_date3(char *buf,int offset,time_t unixdate);
1116 void round_timespec(enum timestamp_set_resolution res, struct timespec *ts);
1117 void put_long_date_timespec(enum timestamp_set_resolution res, char *p, struct timespec ts);
1118 void put_long_date(char *p, time_t t);
1119 void dos_filetime_timespec(struct timespec *tsp);
1120 time_t make_unix_date2(const void *date_ptr, int zone_offset);
1121 time_t make_unix_date3(const void *date_ptr, int zone_offset);
1122 time_t srv_make_unix_date(const void *date_ptr);
1123 time_t srv_make_unix_date2(const void *date_ptr);
1124 time_t srv_make_unix_date3(const void *date_ptr);
1125 time_t convert_timespec_to_time_t(struct timespec ts);
1126 struct timespec convert_time_t_to_timespec(time_t t);
1127 struct timespec convert_timeval_to_timespec(const struct timeval tv);
1128 struct timeval convert_timespec_to_timeval(const struct timespec ts);
1129 struct timespec timespec_current(void);
1130 struct timespec timespec_min(const struct timespec *ts1,
1131                            const struct timespec *ts2);
1132 int timespec_compare(const struct timespec *ts1, const struct timespec *ts2);
1133 void round_timespec_to_sec(struct timespec *ts);
1134 void round_timespec_to_usec(struct timespec *ts);
1135 struct timespec interpret_long_date(const char *p);
1136 void cli_put_dos_date(struct cli_state *cli, char *buf, int offset, time_t unixdate);
1137 void cli_put_dos_date2(struct cli_state *cli, char *buf, int offset, time_t unixdate);
1138 void cli_put_dos_date3(struct cli_state *cli, char *buf, int offset, time_t unixdate);
1139 time_t cli_make_unix_date(struct cli_state *cli, const void *date_ptr);
1140 time_t cli_make_unix_date2(struct cli_state *cli, const void *date_ptr);
1141 time_t cli_make_unix_date3(struct cli_state *cli, const void *date_ptr);
1142 void TimeInit(void);
1143 void get_process_uptime(struct timeval *ret_time);
1144 void get_startup_time(struct timeval *ret_time);
1145 time_t nt_time_to_unix_abs(const NTTIME *nt);
1146 time_t uint64s_nt_time_to_unix_abs(const uint64_t *src);
1147 void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts);
1148 void unix_to_nt_time_abs(NTTIME *nt, time_t t);
1149 const char *time_to_asc(const time_t t);
1150 const char *display_time(NTTIME nttime);
1151 bool nt_time_is_set(const NTTIME *nt);
1152
1153 /* The following definitions come from lib/username.c  */
1154
1155 char *get_user_home_dir(TALLOC_CTX *mem_ctx, const char *user);
1156 struct passwd *Get_Pwnam_alloc(TALLOC_CTX *mem_ctx, const char *user);
1157
1158 /* The following definitions come from lib/util_names.c  */
1159 void gfree_netbios_names(void);
1160 bool set_global_myname(const char *myname);
1161 const char *global_myname(void);
1162 bool set_global_myworkgroup(const char *myworkgroup);
1163 const char *lp_workgroup(void);
1164 const char *get_global_sam_name(void);
1165
1166 /* The following definitions come from lib/util.c  */
1167
1168 enum protocol_types get_Protocol(void);
1169 void set_Protocol(enum protocol_types  p);
1170 bool all_zero(const uint8_t *ptr, size_t size);
1171 bool set_global_scope(const char *scope);
1172 const char *global_scope(void);
1173 void gfree_names(void);
1174 void gfree_all( void );
1175 const char *my_netbios_names(int i);
1176 bool set_netbios_aliases(const char **str_array);
1177 bool init_names(void);
1178 struct user_auth_info *user_auth_info_init(TALLOC_CTX *mem_ctx);
1179 const char *get_cmdline_auth_info_username(const struct user_auth_info *auth_info);
1180 void set_cmdline_auth_info_username(struct user_auth_info *auth_info,
1181                                     const char *username);
1182 const char *get_cmdline_auth_info_domain(const struct user_auth_info *auth_info);
1183 void set_cmdline_auth_info_domain(struct user_auth_info *auth_info,
1184                                   const char *domain);
1185 void set_cmdline_auth_info_password(struct user_auth_info *auth_info,
1186                                     const char *password);
1187 const char *get_cmdline_auth_info_password(const struct user_auth_info *auth_info);
1188 bool set_cmdline_auth_info_signing_state(struct user_auth_info *auth_info,
1189                                          const char *arg);
1190 int get_cmdline_auth_info_signing_state(const struct user_auth_info *auth_info);
1191 void set_cmdline_auth_info_use_ccache(struct user_auth_info *auth_info,
1192                                       bool b);
1193 bool get_cmdline_auth_info_use_ccache(const struct user_auth_info *auth_info);
1194 void set_cmdline_auth_info_use_kerberos(struct user_auth_info *auth_info,
1195                                         bool b);
1196 bool get_cmdline_auth_info_use_kerberos(const struct user_auth_info *auth_info);
1197 void set_cmdline_auth_info_fallback_after_kerberos(struct user_auth_info *auth_info,
1198                                         bool b);
1199 bool get_cmdline_auth_info_fallback_after_kerberos(const struct user_auth_info *auth_info);
1200 void set_cmdline_auth_info_use_krb5_ticket(struct user_auth_info *auth_info);
1201 void set_cmdline_auth_info_smb_encrypt(struct user_auth_info *auth_info);
1202 void set_cmdline_auth_info_use_machine_account(struct user_auth_info *auth_info);
1203 bool get_cmdline_auth_info_got_pass(const struct user_auth_info *auth_info);
1204 bool get_cmdline_auth_info_smb_encrypt(const struct user_auth_info *auth_info);
1205 bool get_cmdline_auth_info_use_machine_account(const struct user_auth_info *auth_info);
1206 struct user_auth_info *get_cmdline_auth_info_copy(TALLOC_CTX *mem_ctx,
1207                                                  const struct user_auth_info *info);
1208 bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_info);
1209 void set_cmdline_auth_info_getpass(struct user_auth_info *auth_info);
1210 bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf,
1211                      bool fake_dir_create_times);
1212 bool socket_exist(const char *fname);
1213 uint64_t get_file_size_stat(const SMB_STRUCT_STAT *sbuf);
1214 SMB_OFF_T get_file_size(char *file_name);
1215 char *attrib_string(uint16 mode);
1216 void show_msg(char *buf);
1217 void smb_set_enclen(char *buf,int len,uint16 enc_ctx_num);
1218 void smb_setlen(char *buf,int len);
1219 int set_message_bcc(char *buf,int num_bytes);
1220 ssize_t message_push_blob(uint8 **outbuf, DATA_BLOB blob);
1221 char *unix_clean_name(TALLOC_CTX *ctx, const char *s);
1222 char *clean_name(TALLOC_CTX *ctx, const char *s);
1223 ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, SMB_OFF_T pos);
1224 int set_blocking(int fd, bool set);
1225 void smb_msleep(unsigned int t);
1226 NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
1227                        struct event_context *ev_ctx,
1228                        bool parent_longlived);
1229 void *malloc_(size_t size);
1230 void *memalign_array(size_t el_size, size_t align, unsigned int count);
1231 void *calloc_array(size_t size, size_t nmemb);
1232 void *Realloc(void *p, size_t size, bool free_old_on_error);
1233 void add_to_large_array(TALLOC_CTX *mem_ctx, size_t element_size,
1234                         void *element, void *_array, uint32 *num_elements,
1235                         ssize_t *array_size);
1236 char *get_myname(TALLOC_CTX *ctx);
1237 char *get_mydnsdomname(TALLOC_CTX *ctx);
1238 int interpret_protocol(const char *str,int def);
1239 char *automount_lookup(TALLOC_CTX *ctx, const char *user_name);
1240 char *automount_lookup(TALLOC_CTX *ctx, const char *user_name);
1241 bool process_exists(const struct server_id pid);
1242 const char *uidtoname(uid_t uid);
1243 char *gidtoname(gid_t gid);
1244 uid_t nametouid(const char *name);
1245 gid_t nametogid(const char *name);
1246 void smb_panic(const char *const why);
1247 void log_stack_trace(void);
1248 const char *readdirname(SMB_STRUCT_DIR *p);
1249 bool is_in_path(const char *name, name_compare_entry *namelist, bool case_sensitive);
1250 void set_namearray(name_compare_entry **ppname_array, const char *namelist);
1251 void free_namearray(name_compare_entry *name_array);
1252 bool fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
1253 bool fcntl_getlock(int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid);
1254 bool is_myname(const char *s);
1255 bool is_myworkgroup(const char *s);
1256 void ra_lanman_string( const char *native_lanman );
1257 const char *get_remote_arch_str(void);
1258 void set_remote_arch(enum remote_arch_types type);
1259 enum remote_arch_types get_remote_arch(void);
1260 const char *tab_depth(int level, int depth);
1261 int str_checksum(const char *s);
1262 void zero_free(void *p, size_t size);
1263 int set_maxfiles(int requested_max);
1264 int smb_mkstemp(char *name_template);
1265 void *smb_xmalloc_array(size_t size, unsigned int count);
1266 char *myhostname(void);
1267 char *lock_path(const char *name);
1268 char *pid_path(const char *name);
1269 char *lib_path(const char *name);
1270 char *modules_path(const char *name);
1271 char *data_path(const char *name);
1272 char *state_path(const char *name);
1273 char *cache_path(const char *name);
1274 const char *shlib_ext(void);
1275 bool parent_dirname(TALLOC_CTX *mem_ctx, const char *dir, char **parent,
1276                     const char **name);
1277 bool ms_has_wild(const char *s);
1278 bool ms_has_wild_w(const smb_ucs2_t *s);
1279 bool mask_match(const char *string, const char *pattern, bool is_case_sensitive);
1280 bool mask_match_search(const char *string, const char *pattern, bool is_case_sensitive);
1281 bool mask_match_list(const char *string, char **list, int listLen, bool is_case_sensitive);
1282 bool unix_wild_match(const char *pattern, const char *string);
1283 bool name_to_fqdn(fstring fqdn, const char *name);
1284 void *talloc_append_blob(TALLOC_CTX *mem_ctx, void *buf, DATA_BLOB blob);
1285 uint32 map_share_mode_to_deny_mode(uint32 share_access, uint32 private_options);
1286 pid_t procid_to_pid(const struct server_id *proc);
1287 void set_my_vnn(uint32 vnn);
1288 uint32 get_my_vnn(void);
1289 void set_my_unique_id(uint64_t unique_id);
1290 struct server_id pid_to_procid(pid_t pid);
1291 struct server_id procid_self(void);
1292 bool procid_equal(const struct server_id *p1, const struct server_id *p2);
1293 bool cluster_id_equal(const struct server_id *id1,
1294                       const struct server_id *id2);
1295 bool procid_is_me(const struct server_id *pid);
1296 struct server_id interpret_pid(const char *pid_string);
1297 char *procid_str(TALLOC_CTX *mem_ctx, const struct server_id *pid);
1298 char *procid_str_static(const struct server_id *pid);
1299 bool procid_valid(const struct server_id *pid);
1300 bool procid_is_local(const struct server_id *pid);
1301 int this_is_smp(void);
1302 bool trans_oob(uint32_t bufsize, uint32_t offset, uint32_t length);
1303 bool is_offset_safe(const char *buf_base, size_t buf_len, char *ptr, size_t off);
1304 char *get_safe_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
1305 char *get_safe_str_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
1306 int get_safe_SVAL(const char *buf_base, size_t buf_len, char *ptr, size_t off, int failval);
1307 int get_safe_IVAL(const char *buf_base, size_t buf_len, char *ptr, size_t off, int failval);
1308 void split_domain_user(TALLOC_CTX *mem_ctx,
1309                        const char *full_name,
1310                        char **domain,
1311                        char **user);
1312 void *_talloc_zero_zeronull(const void *ctx, size_t size, const char *name);
1313 void *_talloc_memdup_zeronull(const void *t, const void *p, size_t size, const char *name);
1314 void *_talloc_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
1315 void *_talloc_zero_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
1316 void *talloc_zeronull(const void *context, size_t size, const char *name);
1317 bool is_valid_policy_hnd(const struct policy_handle *hnd);
1318 bool policy_hnd_equal(const struct policy_handle *hnd1,
1319                       const struct policy_handle *hnd2);
1320 const char *strip_hostname(const char *s);
1321 bool tevent_req_poll_ntstatus(struct tevent_req *req,
1322                               struct tevent_context *ev,
1323                               NTSTATUS *status);
1324
1325 /* The following definitions come from lib/util_file.c  */
1326
1327 char **file_lines_pload(const char *syscmd, int *numlines);
1328 void file_lines_free(char **lines);
1329
1330 /* The following definitions come from lib/util_nscd.c  */
1331
1332 void smb_nscd_flush_user_cache(void);
1333 void smb_nscd_flush_group_cache(void);
1334
1335 /* The following definitions come from lib/util_nttoken.c  */
1336
1337 NT_USER_TOKEN *dup_nt_token(TALLOC_CTX *mem_ctx, const NT_USER_TOKEN *ptoken);
1338 NTSTATUS merge_nt_token(TALLOC_CTX *mem_ctx,
1339                         const struct nt_user_token *token_1,
1340                         const struct nt_user_token *token_2,
1341                         struct nt_user_token **token_out);
1342 bool token_sid_in_ace(const NT_USER_TOKEN *token, const struct security_ace *ace);
1343
1344 /* The following definitions come from lib/util_pw.c  */
1345
1346 struct passwd *tcopy_passwd(TALLOC_CTX *mem_ctx, const struct passwd *from) ;
1347 void flush_pwnam_cache(void);
1348 struct passwd *getpwnam_alloc(TALLOC_CTX *mem_ctx, const char *name);
1349 struct passwd *getpwuid_alloc(TALLOC_CTX *mem_ctx, uid_t uid) ;
1350
1351 /* The following definitions come from ..libcli/registry/util_reg.c  */
1352
1353 const char *str_regtype(int type);
1354 int regtype_by_string(const char *str);
1355 bool push_reg_sz(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char *s);
1356 bool push_reg_multi_sz(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char **a);
1357 bool pull_reg_sz(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, const char **s);
1358 bool pull_reg_multi_sz(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, const char ***a);
1359
1360 /* The following definitions come from lib/util_seaccess.c  */
1361
1362 void se_map_generic(uint32 *access_mask, const struct generic_mapping *mapping);
1363 void security_acl_map_generic(struct security_acl *sa, const struct generic_mapping *mapping);
1364 void se_map_standard(uint32 *access_mask, struct standard_mapping *mapping);
1365 NTSTATUS se_access_check(const struct security_descriptor *sd, const NT_USER_TOKEN *token,
1366                      uint32 acc_desired, uint32 *acc_granted);
1367
1368 /* The following definitions come from lib/util_sec.c  */
1369
1370 void sec_init(void);
1371 uid_t sec_initial_uid(void);
1372 gid_t sec_initial_gid(void);
1373 bool non_root_mode(void);
1374 void gain_root_privilege(void);
1375 void gain_root_group_privilege(void);
1376 void set_effective_uid(uid_t uid);
1377 void set_effective_gid(gid_t gid);
1378 void save_re_uid(void);
1379 void restore_re_uid_fromroot(void);
1380 void restore_re_uid(void);
1381 void save_re_gid(void);
1382 void restore_re_gid(void);
1383 int set_re_uid(void);
1384 void become_user_permanently(uid_t uid, gid_t gid);
1385 bool is_setuid_root(void) ;
1386
1387 /* The following definitions come from lib/util_sid.c  */
1388
1389 const char *sid_type_lookup(uint32 sid_type) ;
1390 NT_USER_TOKEN *get_system_token(void) ;
1391 char *sid_to_fstring(fstring sidstr_out, const struct dom_sid *sid);
1392 char *sid_string_talloc(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
1393 char *sid_string_dbg(const struct dom_sid *sid);
1394 char *sid_string_tos(const struct dom_sid *sid);
1395 bool string_to_sid(struct dom_sid *sidout, const char *sidstr);
1396 bool sid_append_rid(struct dom_sid *sid, uint32 rid);
1397 bool sid_compose(struct dom_sid *dst, const struct dom_sid *domain_sid, uint32 rid);
1398 bool sid_split_rid(struct dom_sid *sid, uint32 *rid);
1399 bool sid_peek_rid(const struct dom_sid *sid, uint32 *rid);
1400 bool sid_peek_check_rid(const struct dom_sid *exp_dom_sid, const struct dom_sid *sid, uint32 *rid);
1401 void sid_copy(struct dom_sid *dst, const struct dom_sid *src);
1402 bool sid_linearize(char *outbuf, size_t len, const struct dom_sid *sid);
1403 bool sid_parse(const char *inbuf, size_t len, struct dom_sid *sid);
1404 int sid_compare(const struct dom_sid *sid1, const struct dom_sid *sid2);
1405 int sid_compare_domain(const struct dom_sid *sid1, const struct dom_sid *sid2);
1406 bool sid_equal(const struct dom_sid *sid1, const struct dom_sid *sid2);
1407 bool non_mappable_sid(struct dom_sid *sid);
1408 char *sid_binstring(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
1409 char *sid_binstring_hex(const struct dom_sid *sid);
1410 struct dom_sid *sid_dup_talloc(TALLOC_CTX *ctx, const struct dom_sid *src);
1411 NTSTATUS add_sid_to_array(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
1412                           struct dom_sid **sids, size_t *num);
1413 NTSTATUS add_sid_to_array_unique(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
1414                                  struct dom_sid **sids, size_t *num_sids);
1415 void del_sid_from_array(const struct dom_sid *sid, struct dom_sid **sids, size_t *num);
1416 bool add_rid_to_array_unique(TALLOC_CTX *mem_ctx,
1417                                     uint32 rid, uint32 **pp_rids, size_t *p_num);
1418 bool is_null_sid(const struct dom_sid *sid);
1419 bool is_sid_in_token(const NT_USER_TOKEN *token, const struct dom_sid *sid);
1420 NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx,
1421                               const struct netr_SamInfo3 *info3,
1422                               struct dom_sid **user_sids,
1423                               size_t *num_user_sids,
1424                               bool include_user_group_rid,
1425                               bool skip_ressource_groups);
1426
1427 /* The following definitions come from lib/util_sock.c  */
1428
1429 bool is_broadcast_addr(const struct sockaddr *pss);
1430 bool is_loopback_ip_v4(struct in_addr ip);
1431 bool is_loopback_addr(const struct sockaddr *pss);
1432 bool is_zero_addr(const struct sockaddr *pss);
1433 void zero_ip_v4(struct in_addr *ip);
1434 void in_addr_to_sockaddr_storage(struct sockaddr_storage *ss,
1435                 struct in_addr ip);
1436 bool same_net(const struct sockaddr *ip1,
1437                 const struct sockaddr *ip2,
1438                 const struct sockaddr *mask);
1439 bool sockaddr_equal(const struct sockaddr *ip1,
1440                 const struct sockaddr *ip2);
1441 bool is_address_any(const struct sockaddr *psa);
1442 uint16_t get_sockaddr_port(const struct sockaddr_storage *pss);
1443 char *print_sockaddr(char *dest,
1444                         size_t destlen,
1445                         const struct sockaddr_storage *psa);
1446 char *print_canonical_sockaddr(TALLOC_CTX *ctx,
1447                         const struct sockaddr_storage *pss);
1448 const char *client_name(int fd);
1449 int get_socket_port(int fd);
1450 const char *client_addr(int fd, char *addr, size_t addrlen);
1451 const char *client_socket_addr(int fd, char *addr, size_t addr_len);
1452 int client_socket_port(int fd);
1453 void set_smb_read_error(enum smb_read_errors *pre,
1454                         enum smb_read_errors newerr);
1455 void cond_set_smb_read_error(enum smb_read_errors *pre,
1456                         enum smb_read_errors newerr);
1457 bool is_a_socket(int fd);
1458 void set_socket_options(int fd, const char *options);
1459 ssize_t read_udp_v4_socket(int fd,
1460                         char *buf,
1461                         size_t len,
1462                         struct sockaddr_storage *psa);
1463 NTSTATUS read_fd_with_timeout(int fd, char *buf,
1464                                   size_t mincnt, size_t maxcnt,
1465                                   unsigned int time_out,
1466                                   size_t *size_ret);
1467 NTSTATUS read_data(int fd, char *buffer, size_t N);
1468 ssize_t write_data(int fd, const char *buffer, size_t N);
1469 ssize_t write_data_iov(int fd, const struct iovec *orig_iov, int iovcnt);
1470 bool send_keepalive(int client);
1471 NTSTATUS read_smb_length_return_keepalive(int fd, char *inbuf,
1472                                           unsigned int timeout,
1473                                           size_t *len);
1474 NTSTATUS read_smb_length(int fd, char *inbuf, unsigned int timeout,
1475                          size_t *len);
1476 NTSTATUS receive_smb_raw(int fd,
1477                         char *buffer,
1478                         size_t buflen,
1479                         unsigned int timeout,
1480                         size_t maxlen,
1481                         size_t *p_len);
1482 int open_socket_in(int type,
1483                 uint16_t port,
1484                 int dlevel,
1485                 const struct sockaddr_storage *psock,
1486                 bool rebind);
1487 NTSTATUS open_socket_out(const struct sockaddr_storage *pss, uint16_t port,
1488                          int timeout, int *pfd);
1489 struct tevent_req *open_socket_out_send(TALLOC_CTX *mem_ctx,
1490                                         struct event_context *ev,
1491                                         const struct sockaddr_storage *pss,
1492                                         uint16_t port,
1493                                         int timeout);
1494 NTSTATUS open_socket_out_recv(struct tevent_req *req, int *pfd);
1495 struct tevent_req *open_socket_out_defer_send(TALLOC_CTX *mem_ctx,
1496                                               struct event_context *ev,
1497                                               struct timeval wait_time,
1498                                               const struct sockaddr_storage *pss,
1499                                               uint16_t port,
1500                                               int timeout);
1501 NTSTATUS open_socket_out_defer_recv(struct tevent_req *req, int *pfd);
1502 bool open_any_socket_out(struct sockaddr_storage *addrs, int num_addrs,
1503                          int timeout, int *fd_index, int *fd);
1504 int open_udp_socket(const char *host, int port);
1505 const char *get_peer_name(int fd, bool force_lookup);
1506 const char *get_peer_addr(int fd, char *addr, size_t addr_len);
1507 int create_pipe_sock(const char *socket_dir,
1508                      const char *socket_name,
1509                      mode_t dir_perms);
1510 const char *get_mydnsfullname(void);
1511 bool is_myname_or_ipaddr(const char *s);
1512 struct tevent_req *getaddrinfo_send(TALLOC_CTX *mem_ctx,
1513                                     struct tevent_context *ev,
1514                                     struct fncall_context *ctx,
1515                                     const char *node,
1516                                     const char *service,
1517                                     const struct addrinfo *hints);
1518 int getaddrinfo_recv(struct tevent_req *req, struct addrinfo **res);
1519 struct tevent_req *tstream_read_packet_send(TALLOC_CTX *mem_ctx,
1520                                             struct tevent_context *ev,
1521                                             struct tstream_context *stream,
1522                                             size_t initial,
1523                                             ssize_t (*more)(uint8_t *buf,
1524                                                             size_t buflen,
1525                                                             void *private_data),
1526                                             void *private_data);
1527 ssize_t tstream_read_packet_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1528                                  uint8_t **pbuf, int *perrno);
1529
1530 /* The following definitions come from lib/util_str.c  */
1531
1532 bool next_token(const char **ptr, char *buff, const char *sep, size_t bufsize);
1533 bool next_token_talloc(TALLOC_CTX *ctx,
1534                         const char **ptr,
1535                         char **pp_buff,
1536                         const char *sep);
1537 bool next_token_no_ltrim_talloc(TALLOC_CTX *ctx,
1538                         const char **ptr,
1539                         char **pp_buff,
1540                         const char *sep);
1541 int StrCaseCmp(const char *s, const char *t);
1542 int StrnCaseCmp(const char *s, const char *t, size_t len);
1543 bool strnequal(const char *s1,const char *s2,size_t n);
1544 bool strcsequal(const char *s1,const char *s2);
1545 void strnorm(char *s, int case_default);
1546 bool strisnormal(const char *s, int case_default);
1547 char *push_skip_string(char *buf);
1548 char *skip_string(const char *base, size_t len, char *buf);
1549 size_t str_charnum(const char *s);
1550 size_t str_ascii_charnum(const char *s);
1551 bool trim_char(char *s,char cfront,char cback);
1552 bool strhasupper(const char *s);
1553 bool strhaslower(const char *s);
1554 char *safe_strcpy_fn(const char *fn,
1555                 int line,
1556                 char *dest,
1557                 const char *src,
1558                 size_t maxlength);
1559 char *safe_strcat_fn(const char *fn,
1560                 int line,
1561                 char *dest,
1562                 const char *src,
1563                 size_t maxlength);
1564 char *alpha_strcpy_fn(const char *fn,
1565                 int line,
1566                 char *dest,
1567                 const char *src,
1568                 const char *other_safe_chars,
1569                 size_t maxlength);
1570 char *StrnCpy_fn(const char *fn, int line,char *dest,const char *src,size_t n);
1571 bool in_list(const char *s, const char *list, bool casesensitive);
1572 void string_free(char **s);
1573 bool string_set(char **dest,const char *src);
1574 void string_sub2(char *s,const char *pattern, const char *insert, size_t len,
1575                  bool remove_unsafe_characters, bool replace_once,
1576                  bool allow_trailing_dollar);
1577 void string_sub_once(char *s, const char *pattern,
1578                 const char *insert, size_t len);
1579 void string_sub(char *s,const char *pattern, const char *insert, size_t len);
1580 void fstring_sub(char *s,const char *pattern,const char *insert);
1581 char *realloc_string_sub2(char *string,
1582                         const char *pattern,
1583                         const char *insert,
1584                         bool remove_unsafe_characters,
1585                         bool allow_trailing_dollar);
1586 char *realloc_string_sub(char *string,
1587                         const char *pattern,
1588                         const char *insert);
1589 char *talloc_string_sub2(TALLOC_CTX *mem_ctx, const char *src,
1590                         const char *pattern,
1591                         const char *insert,
1592                         bool remove_unsafe_characters,
1593                         bool replace_once,
1594                         bool allow_trailing_dollar);
1595 char *talloc_string_sub(TALLOC_CTX *mem_ctx,
1596                         const char *src,
1597                         const char *pattern,
1598                         const char *insert);
1599 void all_string_sub(char *s,const char *pattern,const char *insert, size_t len);
1600 char *talloc_all_string_sub(TALLOC_CTX *ctx,
1601                                 const char *src,
1602                                 const char *pattern,
1603                                 const char *insert);
1604 char *octal_string(int i);
1605 char *string_truncate(char *s, unsigned int length);
1606 char *strchr_m(const char *src, char c);
1607 char *strrchr_m(const char *s, char c);
1608 char *strnrchr_m(const char *s, char c, unsigned int n);
1609 char *strstr_m(const char *src, const char *findstr);
1610 void strlower_m(char *s);
1611 void strupper_m(char *s);
1612 size_t strlen_m(const char *s);
1613 size_t strlen_m_term(const char *s);
1614 size_t strlen_m_term_null(const char *s);
1615 char *binary_string_rfc2254(TALLOC_CTX *mem_ctx, const uint8_t *buf, int len);
1616 char *binary_string(char *buf, int len);
1617 int fstr_sprintf(fstring s, const char *fmt, ...);
1618 bool str_list_sub_basic( char **list, const char *smb_name,
1619                          const char *domain_name );
1620 bool str_list_substitute(char **list, const char *pattern, const char *insert);
1621 bool str_list_check(const char **list, const char *s);
1622 bool str_list_check_ci(const char **list, const char *s);
1623
1624 char *ipstr_list_make(char **ipstr_list,
1625                         const struct ip_service *ip_list,
1626                         int ip_count);
1627 int ipstr_list_parse(const char *ipstr_list, struct ip_service **ip_list);
1628 void ipstr_list_free(char* ipstr_list);
1629 void rfc1738_unescape(char *buf);
1630 DATA_BLOB base64_decode_data_blob(const char *s);
1631 void base64_decode_inplace(char *s);
1632 char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data);
1633 uint64_t STR_TO_SMB_BIG_UINT(const char *nptr, const char **entptr);
1634 SMB_OFF_T conv_str_size(const char * str);
1635 void string_append(char **left, const char *right);
1636 bool add_string_to_array(TALLOC_CTX *mem_ctx,
1637                          const char *str, const char ***strings,
1638                          int *num);
1639 void sprintf_append(TALLOC_CTX *mem_ctx, char **string, ssize_t *len,
1640                     size_t *bufsize, const char *fmt, ...);
1641 int asprintf_strupper_m(char **strp, const char *fmt, ...);
1642 char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...);
1643 char *talloc_asprintf_strlower_m(TALLOC_CTX *t, const char *fmt, ...);
1644 char *sstring_sub(const char *src, char front, char back);
1645 bool validate_net_name( const char *name,
1646                 const char *invalid_chars,
1647                 int max_len);
1648 char *escape_shell_string(const char *src);
1649 char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep);
1650 char *sanitize_username(TALLOC_CTX *mem_ctx, const char *username);
1651
1652 /* The following definitions come from lib/util_unistr.c  */
1653
1654 void gfree_case_tables(void);
1655 void load_case_tables(void);
1656 void init_valid_table(void);
1657 size_t dos_PutUniCode(char *dst,const char *src, size_t len, bool null_terminate);
1658 char *skip_unibuf(char *src, size_t len);
1659 int rpcstr_push(void *dest, const char *src, size_t dest_len, int flags);
1660 int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src);
1661 smb_ucs2_t toupper_w(smb_ucs2_t val);
1662 smb_ucs2_t tolower_w( smb_ucs2_t val );
1663 bool islower_w(smb_ucs2_t c);
1664 bool isupper_w(smb_ucs2_t c);
1665 bool isvalid83_w(smb_ucs2_t c);
1666 size_t strlen_w(const smb_ucs2_t *src);
1667 size_t strnlen_w(const smb_ucs2_t *src, size_t max);
1668 smb_ucs2_t *strchr_w(const smb_ucs2_t *s, smb_ucs2_t c);
1669 smb_ucs2_t *strchr_wa(const smb_ucs2_t *s, char c);
1670 smb_ucs2_t *strrchr_w(const smb_ucs2_t *s, smb_ucs2_t c);
1671 smb_ucs2_t *strnrchr_w(const smb_ucs2_t *s, smb_ucs2_t c, unsigned int n);
1672 smb_ucs2_t *strstr_w(const smb_ucs2_t *s, const smb_ucs2_t *ins);
1673 bool strlower_w(smb_ucs2_t *s);
1674 bool strupper_w(smb_ucs2_t *s);
1675 void strnorm_w(smb_ucs2_t *s, int case_default);
1676 int strcmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b);
1677 int strncmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len);
1678 int strcasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b);
1679 int strncasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len);
1680 bool strequal_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2);
1681 bool strnequal_w(const smb_ucs2_t *s1,const smb_ucs2_t *s2,size_t n);
1682 smb_ucs2_t *strdup_w(const smb_ucs2_t *src);
1683 smb_ucs2_t *strndup_w(const smb_ucs2_t *src, size_t len);
1684 smb_ucs2_t *strncpy_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const size_t max);
1685 smb_ucs2_t *strncat_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const size_t max);
1686 smb_ucs2_t *strcat_w(smb_ucs2_t *dest, const smb_ucs2_t *src);
1687 void string_replace_w(smb_ucs2_t *s, smb_ucs2_t oldc, smb_ucs2_t newc);
1688 bool trim_string_w(smb_ucs2_t *s, const smb_ucs2_t *front,
1689                                   const smb_ucs2_t *back);
1690 int strcmp_wa(const smb_ucs2_t *a, const char *b);
1691 int strncmp_wa(const smb_ucs2_t *a, const char *b, size_t len);
1692 smb_ucs2_t *strpbrk_wa(const smb_ucs2_t *s, const char *p);
1693 smb_ucs2_t *strstr_wa(const smb_ucs2_t *s, const char *ins);
1694 int toupper_ascii(int c);
1695 int tolower_ascii(int c);
1696 int isupper_ascii(int c);
1697 int islower_ascii(int c);
1698
1699 /* The following definitions come from lib/util_uuid.c  */
1700
1701 void smb_uuid_pack(const struct GUID uu, UUID_FLAT *ptr);
1702 void smb_uuid_unpack(const UUID_FLAT in, struct GUID *uu);
1703 char *guid_binstring(TALLOC_CTX *mem_ctx, const struct GUID *guid);
1704
1705 /* The following definitions come from lib/version.c  */
1706
1707 const char *samba_version_string(void);
1708
1709 /* The following definitions come from lib/winbind_util.c  */
1710
1711 bool winbind_lookup_name(const char *dom_name, const char *name, struct dom_sid *sid,
1712                          enum lsa_SidType *name_type);
1713 bool winbind_lookup_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
1714                         const char **domain, const char **name,
1715                         enum lsa_SidType *name_type);
1716 bool winbind_ping(void);
1717 bool winbind_sid_to_uid(uid_t *puid, const struct dom_sid *sid);
1718 bool winbind_uid_to_sid(struct dom_sid *sid, uid_t uid);
1719 bool winbind_sid_to_gid(gid_t *pgid, const struct dom_sid *sid);
1720 bool winbind_gid_to_sid(struct dom_sid *sid, gid_t gid);
1721 struct passwd * winbind_getpwnam(const char * sname);
1722 struct passwd * winbind_getpwsid(const struct dom_sid *sid);
1723 wbcErr wb_is_trusted_domain(const char *domain);
1724 bool winbind_lookup_rids(TALLOC_CTX *mem_ctx,
1725                          const struct dom_sid *domain_sid,
1726                          int num_rids, uint32 *rids,
1727                          const char **domain_name,
1728                          const char ***names, enum lsa_SidType **types);
1729 bool winbind_allocate_uid(uid_t *uid);
1730 bool winbind_allocate_gid(gid_t *gid);
1731 bool winbind_get_groups(TALLOC_CTX *mem_ctx,
1732                         const char *account,
1733                         uint32_t *num_groups,
1734                         gid_t ** _groups);
1735 bool winbind_get_sid_aliases(TALLOC_CTX *mem_ctx,
1736                              const struct dom_sid *dom_sid,
1737                              const struct dom_sid *members,
1738                              size_t num_members,
1739                              uint32_t **pp_alias_rids,
1740                              size_t *p_num_alias_rids);
1741
1742
1743 /* The following definitions come from lib/wins_srv.c  */
1744
1745 bool wins_srv_is_dead(struct in_addr wins_ip, struct in_addr src_ip);
1746 void wins_srv_alive(struct in_addr wins_ip, struct in_addr src_ip);
1747 void wins_srv_died(struct in_addr wins_ip, struct in_addr src_ip);
1748 unsigned wins_srv_count(void);
1749 char **wins_srv_tags(void);
1750 void wins_srv_tags_free(char **list);
1751 struct in_addr wins_srv_ip_tag(const char *tag, struct in_addr src_ip);
1752 unsigned wins_srv_count_tag(const char *tag);
1753
1754 /* The following definitions come from libads/ads_status.c  */
1755
1756 ADS_STATUS ads_build_error(enum ads_error_type etype, 
1757                            int rc, int minor_status);
1758 ADS_STATUS ads_build_nt_error(enum ads_error_type etype, 
1759                            NTSTATUS nt_status);
1760 NTSTATUS ads_ntstatus(ADS_STATUS status);
1761 const char *ads_errstr(ADS_STATUS status);
1762 NTSTATUS gss_err_to_ntstatus(uint32 maj, uint32 min);
1763
1764 /* The following definitions come from libads/ads_struct.c  */
1765
1766 char *ads_build_path(const char *realm, const char *sep, const char *field, int reverse);
1767 char *ads_build_dn(const char *realm);
1768 char *ads_build_domain(const char *dn);
1769 ADS_STRUCT *ads_init(const char *realm, 
1770                      const char *workgroup,
1771                      const char *ldap_server);
1772 bool ads_set_sasl_wrap_flags(ADS_STRUCT *ads, int flags);
1773 void ads_destroy(ADS_STRUCT **ads);
1774
1775 const char *ads_get_ldap_server_name(ADS_STRUCT *ads);
1776
1777 /* The following definitions come from libads/authdata.c  */
1778
1779 NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
1780                              const char *name,
1781                              const char *pass,
1782                              time_t time_offset,
1783                              time_t *expire_time,
1784                              time_t *renew_till_time,
1785                              const char *cache_name,
1786                              bool request_pac,
1787                              bool add_netbios_addr,
1788                              time_t renewable_time,
1789                              const char *impersonate_princ_s,
1790                              struct PAC_LOGON_INFO **logon_info);
1791
1792 /* The following definitions come from libads/disp_sec.c  */
1793
1794 void ads_disp_sd(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, struct security_descriptor *sd);
1795
1796 /* The following definitions come from libads/dns.c  */
1797
1798 NTSTATUS ads_dns_lookup_ns(TALLOC_CTX *ctx,
1799                                 const char *dnsdomain,
1800                                 struct dns_rr_ns **nslist,
1801                                 int *numns);
1802 NTSTATUS ads_dns_query_dcs(TALLOC_CTX *ctx,
1803                            const char *realm,
1804                            const char *sitename,
1805                            struct dns_rr_srv **dclist,
1806                            int *numdcs );
1807 NTSTATUS ads_dns_query_gcs(TALLOC_CTX *ctx,
1808                            const char *realm,
1809                            const char *sitename,
1810                            struct dns_rr_srv **dclist,
1811                            int *numdcs );
1812 NTSTATUS ads_dns_query_kdcs(TALLOC_CTX *ctx,
1813                             const char *dns_forest_name,
1814                             const char *sitename,
1815                             struct dns_rr_srv **dclist,
1816                             int *numdcs );
1817 NTSTATUS ads_dns_query_pdc(TALLOC_CTX *ctx,
1818                            const char *dns_domain_name,
1819                            struct dns_rr_srv **dclist,
1820                            int *numdcs );
1821 NTSTATUS ads_dns_query_dcs_guid(TALLOC_CTX *ctx,
1822                                 const char *dns_forest_name,
1823                                 const struct GUID *domain_guid,
1824                                 struct dns_rr_srv **dclist,
1825                                 int *numdcs );
1826
1827 /* The following definitions come from libads/kerberos.c  */
1828
1829 int kerberos_kinit_password_ext(const char *principal,
1830                                 const char *password,
1831                                 int time_offset,
1832                                 time_t *expire_time,
1833                                 time_t *renew_till_time,
1834                                 const char *cache_name,
1835                                 bool request_pac,
1836                                 bool add_netbios_addr,
1837                                 time_t renewable_time,
1838                                 NTSTATUS *ntstatus);
1839 int ads_kinit_password(ADS_STRUCT *ads);
1840 int ads_kdestroy(const char *cc_name);
1841 char* kerberos_standard_des_salt( void );
1842 bool kerberos_secrets_store_des_salt( const char* salt );
1843 char* kerberos_secrets_fetch_des_salt( void );
1844 char *kerberos_get_default_realm_from_ccache( void );
1845 char *kerberos_get_realm_from_hostname(const char *hostname);
1846
1847 bool kerberos_secrets_store_salting_principal(const char *service,
1848                                               int enctype,
1849                                               const char *principal);
1850 int kerberos_kinit_password(const char *principal,
1851                             const char *password,
1852                             int time_offset,
1853                             const char *cache_name);
1854 bool create_local_private_krb5_conf_for_domain(const char *realm,
1855                                                 const char *domain,
1856                                                 const char *sitename,
1857                                                 struct sockaddr_storage *pss,
1858                                                 const char *kdc_name);
1859
1860 /* The following definitions come from libads/kerberos_keytab.c  */
1861
1862 int ads_keytab_add_entry(ADS_STRUCT *ads, const char *srvPrinc);
1863 int ads_keytab_flush(ADS_STRUCT *ads);
1864 int ads_keytab_create_default(ADS_STRUCT *ads);
1865 int ads_keytab_list(const char *keytab_name);
1866
1867 /* The following definitions come from libads/kerberos_verify.c  */
1868
1869 NTSTATUS ads_verify_ticket(TALLOC_CTX *mem_ctx,
1870                            const char *realm,
1871                            time_t time_offset,
1872                            const DATA_BLOB *ticket,
1873                            char **principal,
1874                            struct PAC_LOGON_INFO **logon_info,
1875                            DATA_BLOB *ap_rep,
1876                            DATA_BLOB *session_key,
1877                            bool use_replay_cache);
1878
1879 /* The following definitions come from libads/krb5_errs.c  */
1880
1881
1882 /* The following definitions come from libads/krb5_setpw.c  */
1883
1884 ADS_STATUS ads_krb5_set_password(const char *kdc_host, const char *princ, 
1885                                  const char *newpw, int time_offset);
1886 ADS_STATUS kerberos_set_password(const char *kpasswd_server, 
1887                                  const char *auth_principal, const char *auth_password,
1888                                  const char *target_principal, const char *new_password,
1889                                  int time_offset);
1890 ADS_STATUS ads_set_machine_password(ADS_STRUCT *ads,
1891                                     const char *machine_account,
1892                                     const char *password);
1893
1894 /* The following definitions come from libads/ldap.c  */
1895
1896 bool ads_sitename_match(ADS_STRUCT *ads);
1897 bool ads_closest_dc(ADS_STRUCT *ads);
1898 ADS_STATUS ads_connect(ADS_STRUCT *ads);
1899 ADS_STATUS ads_connect_user_creds(ADS_STRUCT *ads);
1900 ADS_STATUS ads_connect_gc(ADS_STRUCT *ads);
1901 void ads_disconnect(ADS_STRUCT *ads);
1902 ADS_STATUS ads_do_search_all_fn(ADS_STRUCT *ads, const char *bind_path,
1903                                 int scope, const char *expr, const char **attrs,
1904                                 bool (*fn)(ADS_STRUCT *, char *, void **, void *), 
1905                                 void *data_area);
1906 char *ads_parent_dn(const char *dn);
1907 ADS_MODLIST ads_init_mods(TALLOC_CTX *ctx);
1908 ADS_STATUS ads_mod_str(TALLOC_CTX *ctx, ADS_MODLIST *mods, 
1909                        const char *name, const char *val);
1910 ADS_STATUS ads_mod_strlist(TALLOC_CTX *ctx, ADS_MODLIST *mods,
1911                            const char *name, const char **vals);
1912 ADS_STATUS ads_gen_mod(ADS_STRUCT *ads, const char *mod_dn, ADS_MODLIST mods);
1913 ADS_STATUS ads_gen_add(ADS_STRUCT *ads, const char *new_dn, ADS_MODLIST mods);
1914 ADS_STATUS ads_del_dn(ADS_STRUCT *ads, char *del_dn);
1915 char *ads_ou_string(ADS_STRUCT *ads, const char *org_unit);
1916 char *ads_default_ou_string(ADS_STRUCT *ads, const char *wknguid);
1917 ADS_STATUS ads_add_strlist(TALLOC_CTX *ctx, ADS_MODLIST *mods,
1918                                 const char *name, const char **vals);
1919 uint32 ads_get_kvno(ADS_STRUCT *ads, const char *account_name);
1920 uint32_t ads_get_machine_kvno(ADS_STRUCT *ads, const char *machine_name);
1921 ADS_STATUS ads_clear_service_principal_names(ADS_STRUCT *ads, const char *machine_name);
1922 ADS_STATUS ads_add_service_principal_name(ADS_STRUCT *ads, const char *machine_name, 
1923                                           const char *my_fqdn, const char *spn);
1924 ADS_STATUS ads_create_machine_acct(ADS_STRUCT *ads, const char *machine_name, 
1925                                    const char *org_unit);
1926 ADS_STATUS ads_move_machine_acct(ADS_STRUCT *ads, const char *machine_name, 
1927                                  const char *org_unit, bool *moved);
1928 int ads_count_replies(ADS_STRUCT *ads, void *res);
1929 ADS_STATUS ads_USN(ADS_STRUCT *ads, uint32 *usn);
1930 ADS_STATUS ads_current_time(ADS_STRUCT *ads);
1931 ADS_STATUS ads_domain_func_level(ADS_STRUCT *ads, uint32 *val);
1932 ADS_STATUS ads_domain_sid(ADS_STRUCT *ads, struct dom_sid *sid);
1933 ADS_STATUS ads_site_dn(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const char **site_name);
1934 ADS_STATUS ads_site_dn_for_machine(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const char *computer_name, const char **site_dn);
1935 ADS_STATUS ads_upn_suffixes(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char ***suffixes, size_t *num_suffixes);
1936 ADS_STATUS ads_get_joinable_ous(ADS_STRUCT *ads,
1937                                 TALLOC_CTX *mem_ctx,
1938                                 char ***ous,
1939                                 size_t *num_ous);
1940 ADS_STATUS ads_get_sid_from_extended_dn(TALLOC_CTX *mem_ctx,
1941                                         const char *extended_dn,
1942                                         enum ads_extended_dn_flags flags,
1943                                         struct dom_sid *sid);
1944 char* ads_get_dnshostname( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name );
1945 char* ads_get_upn( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name );
1946 char* ads_get_samaccountname( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name );
1947 ADS_STATUS ads_join_realm(ADS_STRUCT *ads, const char *machine_name,
1948                         uint32 account_type, const char *org_unit);
1949 ADS_STATUS ads_leave_realm(ADS_STRUCT *ads, const char *hostname);
1950 ADS_STATUS ads_find_samaccount(ADS_STRUCT *ads,
1951                                TALLOC_CTX *mem_ctx,
1952                                const char *samaccountname,
1953                                uint32 *uac_ret,
1954                                const char **dn_ret);
1955 ADS_STATUS ads_config_path(ADS_STRUCT *ads, 
1956                            TALLOC_CTX *mem_ctx, 
1957                            char **config_path);
1958 const char *ads_get_extended_right_name_by_guid(ADS_STRUCT *ads, 
1959                                                 const char *config_path, 
1960                                                 TALLOC_CTX *mem_ctx, 
1961                                                 const struct GUID *rights_guid);
1962 ADS_STATUS ads_check_ou_dn(TALLOC_CTX *mem_ctx,
1963                            ADS_STRUCT *ads,
1964                            const char **account_ou);
1965
1966 /* The following definitions come from libads/ldap_printer.c  */
1967
1968 ADS_STATUS ads_mod_printer_entry(ADS_STRUCT *ads, char *prt_dn,
1969                                  TALLOC_CTX *ctx, const ADS_MODLIST *mods);
1970 ADS_STATUS ads_add_printer_entry(ADS_STRUCT *ads, char *prt_dn,
1971                                         TALLOC_CTX *ctx, ADS_MODLIST *mods);
1972 WERROR get_remote_printer_publishing_data(struct rpc_pipe_client *cli, 
1973                                           TALLOC_CTX *mem_ctx,
1974                                           ADS_MODLIST *mods,
1975                                           const char *printer);
1976 bool get_local_printer_publishing_data(TALLOC_CTX *mem_ctx,
1977                                        ADS_MODLIST *mods,
1978                                        NT_PRINTER_DATA *data);
1979
1980 /* The following definitions come from libads/ldap_schema.c  */
1981
1982 ADS_STATUS ads_get_attrnames_by_oids(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
1983                                      const char *schema_path,
1984                                      const char **OIDs, size_t num_OIDs, 
1985                                      char ***OIDs_out, char ***names, size_t *count);
1986 const char *ads_get_attrname_by_guid(ADS_STRUCT *ads, 
1987                                      const char *schema_path, 
1988                                      TALLOC_CTX *mem_ctx, 
1989                                      const struct GUID *schema_guid);
1990 const char *ads_get_attrname_by_oid(ADS_STRUCT *ads, const char *schema_path, TALLOC_CTX *mem_ctx, const char * OID);
1991 ADS_STATUS ads_schema_path(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char **schema_path);
1992 ADS_STATUS ads_check_posix_schema_mapping(TALLOC_CTX *mem_ctx,
1993                                           ADS_STRUCT *ads,
1994                                           enum wb_posix_mapping map_type,
1995                                           struct posix_schema **s ) ;
1996
1997 /* The following definitions come from libads/ldap_user.c  */
1998
1999 ADS_STATUS ads_add_user_acct(ADS_STRUCT *ads, const char *user, 
2000                              const char *container, const char *fullname);
2001 ADS_STATUS ads_add_group_acct(ADS_STRUCT *ads, const char *group, 
2002                               const char *container, const char *comment);
2003
2004 /* The following definitions come from libads/ldap_utils.c  */
2005
2006 ADS_STATUS ads_ranged_search(ADS_STRUCT *ads, 
2007                              TALLOC_CTX *mem_ctx,
2008                              int scope,
2009                              const char *base,
2010                              const char *filter,
2011                              void *args,
2012                              const char *range_attr,
2013                              char ***strings,
2014                              size_t *num_strings);
2015 ADS_STATUS ads_ranged_search_internal(ADS_STRUCT *ads, 
2016                                       TALLOC_CTX *mem_ctx,
2017                                       int scope,
2018                                       const char *base,
2019                                       const char *filter,
2020                                       const char **attrs,
2021                                       void *args,
2022                                       const char *range_attr,
2023                                       char ***strings,
2024                                       size_t *num_strings,
2025                                       uint32 *first_usn,
2026                                       int *num_retries,
2027                                       bool *more_values);
2028
2029 /* The following definitions come from libads/ndr.c  */
2030
2031 void ndr_print_ads_auth_flags(struct ndr_print *ndr, const char *name, uint32_t r);
2032 void ndr_print_ads_struct(struct ndr_print *ndr, const char *name, const struct ads_struct *r);
2033
2034 /* The following definitions come from libads/sasl.c  */
2035
2036 ADS_STATUS ads_sasl_bind(ADS_STRUCT *ads);
2037
2038 /* The following definitions come from libads/sasl_wrapping.c  */
2039
2040 ADS_STATUS ads_setup_sasl_wrapping(ADS_STRUCT *ads,
2041                                    const struct ads_saslwrap_ops *ops,
2042                                    void *private_data);
2043 ADS_STATUS ads_setup_sasl_wrapping(ADS_STRUCT *ads,
2044                                    const struct ads_saslwrap_ops *ops,
2045                                    void *private_data);
2046
2047 /* The following definitions come from libads/util.c  */
2048
2049 ADS_STATUS ads_change_trust_account_password(ADS_STRUCT *ads, char *host_principal);
2050 ADS_STATUS ads_guess_service_principal(ADS_STRUCT *ads,
2051                                        char **returned_principal);
2052
2053 #include "librpc/gen_ndr/ndr_spoolss.h"
2054
2055 /* The following definitions come from librpc/ndr/util.c  */
2056
2057 enum ndr_err_code ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct server_id *r);
2058 enum ndr_err_code ndr_pull_server_id(struct ndr_pull *ndr, int ndr_flags, struct server_id *r);
2059 void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct server_id *r);
2060 enum ndr_err_code ndr_push_file_id(struct ndr_push *ndr, int ndr_flags, const struct file_id *r);
2061 enum ndr_err_code ndr_pull_file_id(struct ndr_pull *ndr, int ndr_flags, struct file_id *r);
2062 void ndr_print_file_id(struct ndr_print *ndr, const char *name, const struct file_id *r);
2063 _PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const bool b);
2064 _PUBLIC_ void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss);
2065 const char *ndr_errstr(enum ndr_err_code err);
2066 extern const struct ndr_syntax_id null_ndr_syntax_id;
2067
2068 /* The following definitions come from librpc/ndr/sid.c  */
2069
2070 char *dom_sid_string(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
2071
2072 /* The following definitions come from libsmb/cliconnect.c  */
2073
2074 ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user, 
2075                               const char *pass, const char *user_domain,
2076                                     const char * dest_realm);
2077
2078 NTSTATUS cli_session_setup(struct cli_state *cli,
2079                            const char *user,
2080                            const char *pass, int passlen,
2081                            const char *ntpass, int ntpasslen,
2082                            const char *workgroup);
2083 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
2084                                                   struct event_context *ev,
2085                                                   struct cli_state *cli,
2086                                                   struct tevent_req **psmbreq);
2087 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
2088                                                 struct event_context *ev,
2089                                                 struct cli_state *cli);
2090 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
2091 struct tevent_req *cli_ulogoff_send(TALLOC_CTX *mem_ctx,
2092                                     struct tevent_context *ev,
2093                                     struct cli_state *cli);
2094 NTSTATUS cli_ulogoff_recv(struct tevent_req *req);
2095 NTSTATUS cli_ulogoff(struct cli_state *cli);
2096 struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
2097                                         struct event_context *ev,
2098                                         struct cli_state *cli,
2099                                         const char *share, const char *dev,
2100                                         const char *pass, int passlen,
2101                                         struct tevent_req **psmbreq);
2102 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
2103                                       struct event_context *ev,
2104                                       struct cli_state *cli,
2105                                       const char *share, const char *dev,
2106                                       const char *pass, int passlen);
2107 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
2108 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
2109                        const char *dev, const char *pass, int passlen);
2110 struct tevent_req *cli_tdis_send(TALLOC_CTX *mem_ctx,
2111                                  struct tevent_context *ev,
2112                                  struct cli_state *cli);
2113 NTSTATUS cli_tdis_recv(struct tevent_req *req);
2114 NTSTATUS cli_tdis(struct cli_state *cli);
2115 void cli_negprot_sendsync(struct cli_state *cli);
2116 NTSTATUS cli_negprot(struct cli_state *cli);
2117 struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
2118                                     struct event_context *ev,
2119                                     struct cli_state *cli);
2120 NTSTATUS cli_negprot_recv(struct tevent_req *req);
2121 bool cli_session_request(struct cli_state *cli,
2122                          struct nmb_name *calling, struct nmb_name *called);
2123 NTSTATUS cli_connect(struct cli_state *cli,
2124                 const char *host,
2125                 struct sockaddr_storage *dest_ss);
2126 NTSTATUS cli_start_connection(struct cli_state **output_cli, 
2127                               const char *my_name, 
2128                               const char *dest_host, 
2129                               struct sockaddr_storage *dest_ss, int port,
2130                               int signing_state, int flags,
2131                               bool *retry) ;
2132 NTSTATUS cli_full_connection(struct cli_state **output_cli, 
2133                              const char *my_name, 
2134                              const char *dest_host, 
2135                              struct sockaddr_storage *dest_ss, int port,
2136                              const char *service, const char *service_type,
2137                              const char *user, const char *domain, 
2138                              const char *password, int flags,
2139                              int signing_state,
2140                              bool *retry) ;
2141 bool attempt_netbios_session_request(struct cli_state **ppcli, const char *srchost, const char *desthost,
2142                                      struct sockaddr_storage *pdest_ss);
2143 NTSTATUS cli_raw_tcon(struct cli_state *cli, 
2144                       const char *service, const char *pass, const char *dev,
2145                       uint16 *max_xmit, uint16 *tid);
2146 struct cli_state *get_ipc_connect(char *server,
2147                                 struct sockaddr_storage *server_ss,
2148                                 const struct user_auth_info *user_info);
2149 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
2150                                 struct ip_service *mb_ip,
2151                                 const struct user_auth_info *user_info,
2152                                 char **pp_workgroup_out);
2153 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
2154                                         const struct user_auth_info *user_info,
2155                                         char **pp_workgroup_out);
2156
2157 /* The following definitions come from libsmb/clidfs.c  */
2158
2159 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
2160                         const char *username,
2161                         const char *password,
2162                         const char *domain,
2163                         const char *sharename);
2164 struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
2165                                 struct cli_state *referring_cli,
2166                                 const char *server,
2167                                 const char *share,
2168                                 const struct user_auth_info *auth_info,
2169                                 bool show_hdr,
2170                                 bool force_encrypt,
2171                                 int max_protocol,
2172                                 int port,
2173                                 int name_type);
2174 void cli_cm_display(const struct cli_state *c);
2175 bool cli_dfs_get_referral(TALLOC_CTX *ctx,
2176                         struct cli_state *cli,
2177                         const char *path,
2178                         struct client_dfs_referral **refs,
2179                         size_t *num_refs,
2180                         size_t *consumed);
2181 bool cli_resolve_path(TALLOC_CTX *ctx,
2182                         const char *mountpt,
2183                         const struct user_auth_info *dfs_auth_info,
2184                         struct cli_state *rootcli,
2185                         const char *path,
2186                         struct cli_state **targetcli,
2187                         char **pp_targetpath);
2188
2189 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
2190                         struct cli_state *cli,
2191                         const char *sharename,
2192                         char **pp_newserver,
2193                         char **pp_newshare,
2194                         bool force_encrypt,
2195                         const char *username,
2196                         const char *password,
2197                         const char *domain);
2198
2199 /* The following definitions come from libsmb/clientgen.c  */
2200
2201 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
2202 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
2203 void cli_set_port(struct cli_state *cli, int port);
2204 bool cli_state_seqnum_persistent(struct cli_state *cli,
2205                                  uint16_t mid);
2206 bool cli_state_seqnum_remove(struct cli_state *cli,
2207                              uint16_t mid);
2208 bool cli_receive_smb(struct cli_state *cli);
2209 ssize_t cli_receive_smb_data(struct cli_state *cli, char *buffer, size_t len);
2210 bool cli_receive_smb_readX_header(struct cli_state *cli);
2211 bool cli_send_smb(struct cli_state *cli);
2212 bool cli_send_smb_direct_writeX(struct cli_state *cli,
2213                                 const char *p,
2214                                 size_t extradata);
2215 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
2216 void cli_setup_packet(struct cli_state *cli);
2217 void cli_setup_bcc(struct cli_state *cli, void *p);
2218 NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
2219 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);
2220 NTSTATUS cli_set_password(struct cli_state *cli, const char *password);
2221 NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password);
2222 struct cli_state *cli_initialise(void);
2223 struct cli_state *cli_initialise_ex(int signing_state);
2224 void cli_nt_pipes_close(struct cli_state *cli);
2225 void cli_shutdown(struct cli_state *cli);
2226 void cli_sockopt(struct cli_state *cli, const char *options);
2227 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
2228 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
2229 bool cli_send_keepalive(struct cli_state *cli);
2230 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
2231                                  struct cli_state *cli, uint16_t num_echos,
2232                                  DATA_BLOB data);
2233 NTSTATUS cli_echo_recv(struct tevent_req *req);
2234 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
2235 bool cli_ucs2(struct cli_state *cli);
2236 bool is_andx_req(uint8_t cmd);
2237 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
2238                  uint8_t smb_command, uint8_t additional_flags,
2239                  uint8_t wct, uint16_t *vwv,
2240                  uint32_t num_bytes, const uint8_t *bytes,
2241                  struct tevent_req **result_parent,
2242                  uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
2243                  uint32_t *pnum_bytes, uint8_t **pbytes);
2244
2245 /* The following definitions come from libsmb/clierror.c  */
2246
2247 const char *cli_errstr(struct cli_state *cli);
2248 NTSTATUS cli_nt_error(struct cli_state *cli);
2249 void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode);
2250 int cli_errno(struct cli_state *cli);
2251 bool cli_is_error(struct cli_state *cli);
2252 bool cli_is_nt_error(struct cli_state *cli);
2253 bool cli_is_dos_error(struct cli_state *cli);
2254 NTSTATUS cli_get_nt_error(struct cli_state *cli);
2255 void cli_set_nt_error(struct cli_state *cli, NTSTATUS status);
2256 void cli_reset_error(struct cli_state *cli);
2257 bool cli_state_is_connected(struct cli_state *cli);
2258
2259 /* The following definitions come from libsmb/clifile.c  */
2260
2261 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
2262                                         struct event_context *ev,
2263                                         struct cli_state *cli,
2264                                         const char *oldname,
2265                                         const char *newname);
2266 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
2267 NTSTATUS cli_posix_symlink(struct cli_state *cli,
2268                         const char *oldname,
2269                         const char *newname);
2270 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
2271                                         struct event_context *ev,
2272                                         struct cli_state *cli,
2273                                         const char *fname,
2274                                         size_t len);
2275 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
2276                                 char *retpath, size_t len);
2277 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
2278                         char *linkpath, size_t len);
2279 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
2280                                         struct event_context *ev,
2281                                         struct cli_state *cli,
2282                                         const char *oldname,
2283                                         const char *newname);
2284 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
2285 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
2286                         const char *oldname,
2287                         const char *newname);
2288 uint32_t unix_perms_to_wire(mode_t perms);
2289 mode_t wire_perms_to_unix(uint32_t perms);
2290 struct tevent_req *cli_posix_getfacl_send(TALLOC_CTX *mem_ctx,
2291                                         struct event_context *ev,
2292                                         struct cli_state *cli,
2293                                         const char *fname);
2294 NTSTATUS cli_posix_getfacl_recv(struct tevent_req *req,
2295                                 TALLOC_CTX *mem_ctx,
2296                                 size_t *prb_size,
2297                                 char **retbuf);
2298 NTSTATUS cli_posix_getfacl(struct cli_state *cli,
2299                         const char *fname,
2300                         TALLOC_CTX *mem_ctx,
2301                         size_t *prb_size,
2302                         char **retbuf);
2303 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
2304                                         struct event_context *ev,
2305                                         struct cli_state *cli,
2306                                         const char *fname);
2307 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
2308                                 SMB_STRUCT_STAT *sbuf);
2309 NTSTATUS cli_posix_stat(struct cli_state *cli,
2310                         const char *fname,
2311                         SMB_STRUCT_STAT *sbuf);
2312 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
2313                                         struct event_context *ev,
2314                                         struct cli_state *cli,
2315                                         const char *fname,
2316                                         mode_t mode);
2317 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
2318 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
2319 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
2320                                         struct event_context *ev,
2321                                         struct cli_state *cli,
2322                                         const char *fname,
2323                                         uid_t uid,
2324                                         gid_t gid);
2325 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
2326 NTSTATUS cli_posix_chown(struct cli_state *cli,
2327                         const char *fname,
2328                         uid_t uid,
2329                         gid_t gid);
2330 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
2331                                 struct event_context *ev,
2332                                 struct cli_state *cli,
2333                                 const char *fname_src,
2334                                 const char *fname_dst);
2335 NTSTATUS cli_rename_recv(struct tevent_req *req);
2336 NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
2337 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
2338                                 struct event_context *ev,
2339                                 struct cli_state *cli,
2340                                 const char *fname_src,
2341                                 const char *fname_dst);
2342 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
2343 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
2344
2345 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
2346                                 struct event_context *ev,
2347                                 struct cli_state *cli,
2348                                 const char *fname_src,
2349                                 const char *fname_dst);
2350 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
2351 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
2352
2353 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
2354                                 struct event_context *ev,
2355                                 struct cli_state *cli,
2356                                 const char *fname,
2357                                 uint16_t mayhave_attrs);
2358 NTSTATUS cli_unlink_recv(struct tevent_req *req);
2359 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
2360
2361 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
2362                                   struct event_context *ev,
2363                                   struct cli_state *cli,
2364                                   const char *dname);
2365 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
2366 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
2367 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
2368                                   struct event_context *ev,
2369                                   struct cli_state *cli,
2370                                   const char *dname);
2371 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
2372 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
2373 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
2374                                         struct event_context *ev,
2375                                         struct cli_state *cli,
2376                                         uint16_t fnum,
2377                                         bool flag);
2378 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
2379 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
2380 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
2381                                      struct event_context *ev,
2382                                      struct cli_state *cli,
2383                                      const char *fname,
2384                                      uint32_t CreatFlags,
2385                                      uint32_t DesiredAccess,
2386                                      uint32_t FileAttributes,
2387                                      uint32_t ShareAccess,
2388                                      uint32_t CreateDisposition,
2389                                      uint32_t CreateOptions,
2390                                      uint8_t SecurityFlags);
2391 NTSTATUS cli_ntcreate_recv(struct tevent_req *req, uint16_t *pfnum);
2392 NTSTATUS cli_ntcreate(struct cli_state *cli,
2393                       const char *fname,
2394                       uint32_t CreatFlags,
2395                       uint32_t DesiredAccess,
2396                       uint32_t FileAttributes,
2397                       uint32_t ShareAccess,
2398                       uint32_t CreateDisposition,
2399                       uint32_t CreateOptions,
2400                       uint8_t SecurityFlags,
2401                       uint16_t *pfid);
2402 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
2403                             size_t str_len, size_t *pconverted_size);
2404 struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx,
2405                                    struct event_context *ev,
2406                                    struct cli_state *cli, const char *fname,
2407                                    int flags, int share_mode,
2408                                    struct tevent_req **psmbreq);
2409 struct tevent_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
2410                                  struct cli_state *cli, const char *fname,
2411                                  int flags, int share_mode);
2412 NTSTATUS cli_open_recv(struct tevent_req *req, uint16_t *fnum);
2413 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
2414 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
2415                                     struct event_context *ev,
2416                                     struct cli_state *cli, uint16_t fnum,
2417                                     struct tevent_req **psubreq);
2418 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
2419                                   struct event_context *ev,
2420                                   struct cli_state *cli, uint16_t fnum);
2421 NTSTATUS cli_close_recv(struct tevent_req *req);
2422 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
2423 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
2424                                         struct event_context *ev,
2425                                         struct cli_state *cli,
2426                                         uint16_t fnum,
2427                                         uint64_t size);
2428 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
2429 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
2430 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
2431                       uint32_t offset, uint32_t len,
2432                       int timeout, unsigned char locktype);
2433 bool cli_lock(struct cli_state *cli, uint16_t fnum,
2434               uint32_t offset, uint32_t len, int timeout, enum brl_type lock_type);
2435 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
2436                                 struct event_context *ev,
2437                                 struct cli_state *cli,
2438                                 uint16_t fnum,
2439                                 uint64_t offset,
2440                                 uint64_t len);
2441 NTSTATUS cli_unlock_recv(struct tevent_req *req);
2442 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
2443 bool cli_lock64(struct cli_state *cli, uint16_t fnum,
2444                 uint64_t offset, uint64_t len, int timeout, enum brl_type lock_type);
2445 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
2446                                 struct event_context *ev,
2447                                 struct cli_state *cli,
2448                                 uint16_t fnum,
2449                                 uint64_t offset,
2450                                 uint64_t len);
2451 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
2452 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
2453 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
2454                                         struct event_context *ev,
2455                                         struct cli_state *cli,
2456                                         uint16_t fnum,
2457                                         uint64_t offset,
2458                                         uint64_t len,
2459                                         bool wait_lock,
2460                                         enum brl_type lock_type);
2461 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
2462 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
2463                         uint64_t offset, uint64_t len,
2464                         bool wait_lock, enum brl_type lock_type);
2465 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
2466                                         struct event_context *ev,
2467                                         struct cli_state *cli,
2468                                         uint16_t fnum,
2469                                         uint64_t offset,
2470                                         uint64_t len);
2471 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
2472 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
2473 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
2474                                 struct event_context *ev,
2475                                 struct cli_state *cli,
2476                                 uint16_t fnum);
2477 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
2478                         uint16_t *attr,
2479                         SMB_OFF_T *size,
2480                         time_t *change_time,
2481                         time_t *access_time,
2482                         time_t *write_time);
2483 NTSTATUS cli_getattrE(struct cli_state *cli,
2484                         uint16_t fnum,
2485                         uint16_t *attr,
2486                         SMB_OFF_T *size,
2487                         time_t *change_time,
2488                         time_t *access_time,
2489                         time_t *write_time);
2490 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
2491                                 struct event_context *ev,
2492                                 struct cli_state *cli,
2493                                 uint16_t fnum,
2494                                 time_t change_time,
2495                                 time_t access_time,
2496                                 time_t write_time);
2497 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
2498 NTSTATUS cli_setattrE(struct cli_state *cli,
2499                         uint16_t fnum,
2500                         time_t change_time,
2501                         time_t access_time,
2502                         time_t write_time);
2503 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
2504                                 struct event_context *ev,
2505                                 struct cli_state *cli,
2506                                 const char *fname);
2507 NTSTATUS cli_getatr_recv(struct tevent_req *req,
2508                                 uint16_t *attr,
2509                                 SMB_OFF_T *size,
2510                                 time_t *write_time);
2511 NTSTATUS cli_getatr(struct cli_state *cli,
2512                         const char *fname,
2513                         uint16_t *attr,
2514                         SMB_OFF_T *size,
2515                         time_t *write_time);
2516 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
2517                                 struct event_context *ev,
2518                                 struct cli_state *cli,
2519                                 const char *fname,
2520                                 uint16_t attr,
2521                                 time_t mtime);
2522 NTSTATUS cli_setatr_recv(struct tevent_req *req);
2523 NTSTATUS cli_setatr(struct cli_state *cli,
2524                 const char *fname,
2525                 uint16_t attr,
2526                 time_t mtime);
2527 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
2528                                   struct event_context *ev,
2529                                   struct cli_state *cli,
2530                                   const char *fname);
2531 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
2532 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
2533 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
2534                                   struct event_context *ev,
2535                                   struct cli_state *cli);
2536 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
2537                           int *avail);
2538 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
2539 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
2540                                 struct event_context *ev,
2541                                 struct cli_state *cli,
2542                                 const char *path);
2543 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
2544                         TALLOC_CTX *ctx,
2545                         uint16_t *pfnum,
2546                         char **outfile);
2547 NTSTATUS cli_ctemp(struct cli_state *cli,
2548                         TALLOC_CTX *ctx,
2549                         const char *path,
2550                         uint16_t *pfnum,
2551                         char **out_path);
2552 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
2553 bool cli_set_ea_path(struct cli_state *cli, const char *path, const char *ea_name, const char *ea_val, size_t ea_len);
2554 bool cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum, const char *ea_name, const char *ea_val, size_t ea_len);
2555 bool cli_get_ea_list_path(struct cli_state *cli, const char *path,
2556                 TALLOC_CTX *ctx,
2557                 size_t *pnum_eas,
2558                 struct ea_struct **pea_list);
2559 bool cli_get_ea_list_fnum(struct cli_state *cli, uint16_t fnum,
2560                 TALLOC_CTX *ctx,
2561                 size_t *pnum_eas,
2562                 struct ea_struct **pea_list);
2563 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
2564                                         struct event_context *ev,
2565                                         struct cli_state *cli,
2566                                         const char *fname,
2567                                         int flags,
2568                                         mode_t mode);
2569 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
2570 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
2571                         int flags, mode_t mode, uint16_t *fnum);
2572 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
2573                                         struct event_context *ev,
2574                                         struct cli_state *cli,
2575                                         const char *fname,
2576                                         mode_t mode);
2577 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
2578 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
2579
2580 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
2581                                         struct event_context *ev,
2582                                         struct cli_state *cli,
2583                                         const char *fname);
2584 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
2585 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
2586
2587 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
2588                                         struct event_context *ev,
2589                                         struct cli_state *cli,
2590                                         const char *fname);
2591 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2592 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
2593 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
2594                                    struct tevent_context *ev,
2595                                    struct cli_state *cli, uint16_t fnum,
2596                                    uint32_t buffer_size,
2597                                    uint32_t completion_filter, bool recursive);
2598 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
2599                          uint32_t *pnum_changes,
2600                          struct notify_change **pchanges);
2601
2602 /* The following definitions come from libsmb/clifsinfo.c  */
2603
2604 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
2605                                                     struct tevent_context *ev,
2606                                                     struct cli_state *cli);
2607 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
2608                                           uint16_t *pmajor, uint16_t *pminor,
2609                                           uint32_t *pcaplow,
2610                                           uint32_t *pcaphigh);
2611 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor,
2612                                      uint16 *pminor, uint32 *pcaplow,
2613                                      uint32 *pcaphigh);
2614 struct tevent_req *cli_set_unix_extensions_capabilities_send(
2615         TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
2616         uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
2617 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
2618 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
2619                                               uint16 major, uint16 minor,
2620                                               uint32 caplow, uint32 caphigh);
2621 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
2622                                              struct tevent_context *ev,
2623                                              struct cli_state *cli);
2624 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
2625 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
2626 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name,
2627                                 uint32 *pserial_number, time_t *pdate);
2628 bool cli_get_fs_full_size_info(struct cli_state *cli,
2629                                uint64_t *total_allocation_units,
2630                                uint64_t *caller_allocation_units,
2631                                uint64_t *actual_allocation_units,
2632                                uint64_t *sectors_per_allocation_unit,
2633                                uint64_t *bytes_per_sector);
2634 bool cli_get_posix_fs_info(struct cli_state *cli,
2635                            uint32 *optimal_transfer_size,
2636                            uint32 *block_size,
2637                            uint64_t *total_blocks,
2638                            uint64_t *blocks_available,
2639                            uint64_t *user_blocks_available,
2640                            uint64_t *total_file_nodes,
2641                            uint64_t *free_file_nodes,
2642                            uint64_t *fs_identifier);
2643 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli, 
2644                                 const char *user,
2645                                 const char *pass,
2646                                 const char *domain);
2647 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
2648 NTSTATUS cli_force_encryption(struct cli_state *c,
2649                         const char *username,
2650                         const char *password,
2651                         const char *domain);
2652
2653 /* The following definitions come from libsmb/clikrb5.c  */
2654
2655 bool unwrap_edata_ntstatus(TALLOC_CTX *mem_ctx, 
2656                            DATA_BLOB *edata, 
2657                            DATA_BLOB *edata_out);
2658 bool unwrap_pac(TALLOC_CTX *mem_ctx, DATA_BLOB *auth_data, DATA_BLOB *unwrapped_pac_data);
2659
2660 /* The following definitions come from libsmb/clilist.c  */
2661
2662 int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute,
2663                  void (*fn)(const char *, file_info *, const char *, void *), void *state);
2664 int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
2665                  void (*fn)(const char *, file_info *, const char *, void *), void *state);
2666 int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
2667              void (*fn)(const char *, file_info *, const char *, void *), void *state);
2668
2669 /* The following definitions come from libsmb/climessage.c  */
2670
2671 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
2672                                     struct tevent_context *ev,
2673                                     struct cli_state *cli,
2674                                     const char *host, const char *username,
2675                                     const char *message);
2676 NTSTATUS cli_message_recv(struct tevent_req *req);
2677 NTSTATUS cli_message(struct cli_state *cli, const char *host,
2678                      const char *username, const char *message);
2679
2680 /* The following definitions come from libsmb/clioplock.c  */
2681
2682 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
2683                                        struct tevent_context *ev,
2684                                        struct cli_state *cli,
2685                                        uint16_t fnum, uint8_t level);
2686 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
2687 NTSTATUS cli_oplock_ack(struct cli_state *cli, uint16_t fnum, unsigned char level);
2688 void cli_oplock_handler(struct cli_state *cli, 
2689                         NTSTATUS (*handler)(struct cli_state *, uint16_t, unsigned char));
2690
2691 /* The following definitions come from libsmb/cliprint.c  */
2692
2693 int cli_print_queue(struct cli_state *cli,
2694                     void (*fn)(struct print_job_info *));
2695 int cli_printjob_del(struct cli_state *cli, int job);
2696 int cli_spl_open(struct cli_state *cli, const char *fname, int flags, int share_mode);
2697 bool cli_spl_close(struct cli_state *cli, uint16_t fnum);
2698
2699 /* The following definitions come from libsmb/cliquota.c  */
2700
2701 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
2702 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
2703 bool cli_get_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
2704 bool cli_set_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
2705 bool cli_list_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_LIST **pqt_list);
2706 bool cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
2707 bool cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
2708 void dump_ntquota(SMB_NTQUOTA_STRUCT *qt, bool _verbose, bool _numeric, void (*_sidtostring)(fstring str, struct dom_sid *sid, bool _numeric));
2709 void dump_ntquota_list(SMB_NTQUOTA_LIST **qtl, bool _verbose, bool _numeric, void (*_sidtostring)(fstring str, struct dom_sid *sid, bool _numeric));
2710
2711 /* The following definitions come from libsmb/clirap.c  */
2712
2713 bool cli_api(struct cli_state *cli,
2714              char *param, int prcnt, int mprcnt,
2715              char *data, int drcnt, int mdrcnt,
2716              char **rparam, unsigned int *rprcnt,
2717              char **rdata, unsigned int *rdrcnt);
2718 bool cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation);
2719 int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *, void *), void *state);
2720 bool cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
2721                        void (*fn)(const char *, uint32, const char *, void *),
2722                        void *state);
2723 bool cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
2724                              const char *old_password);
2725 bool cli_qpathinfo(struct cli_state *cli,
2726                         const char *fname,
2727                         time_t *change_time,
2728                         time_t *access_time,
2729                         time_t *write_time,
2730                         SMB_OFF_T *size,
2731                         uint16 *mode);
2732 bool cli_setpathinfo(struct cli_state *cli, const char *fname,
2733                      time_t create_time,
2734                      time_t access_time,
2735                      time_t write_time,
2736                      time_t change_time,
2737                      uint16 mode);
2738 bool cli_qpathinfo2(struct cli_state *cli, const char *fname,
2739                     struct timespec *create_time,
2740                     struct timespec *access_time,
2741                     struct timespec *write_time,
2742                     struct timespec *change_time,
2743                     SMB_OFF_T *size, uint16 *mode,
2744                     SMB_INO_T *ino);
2745 bool cli_qpathinfo_streams(struct cli_state *cli, const char *fname,
2746                            TALLOC_CTX *mem_ctx,
2747                            unsigned int *pnum_streams,
2748                            struct stream_struct **pstreams);
2749 bool cli_qfilename(struct cli_state *cli, uint16_t fnum, char *name, size_t namelen);
2750 bool cli_qfileinfo(struct cli_state *cli, uint16_t fnum,
2751                    uint16 *mode, SMB_OFF_T *size,
2752                    struct timespec *create_time,
2753                    struct timespec *access_time,
2754                    struct timespec *write_time,
2755                    struct timespec *change_time,
2756                    SMB_INO_T *ino);
2757 NTSTATUS cli_qpathinfo_basic(struct cli_state *cli, const char *name,
2758                              SMB_STRUCT_STAT *sbuf, uint32 *attributes);
2759 bool cli_qfileinfo_test(struct cli_state *cli, uint16_t fnum, int level, char **poutdata, uint32 *poutlen);
2760 NTSTATUS cli_qpathinfo_alt_name(struct cli_state *cli, const char *fname, fstring alt_name);
2761
2762 /* The following definitions come from libsmb/clirap2.c  */
2763 struct rap_group_info_1;
2764 struct rap_user_info_1;
2765 struct rap_share_info_2;
2766
2767 int cli_NetGroupDelete(struct cli_state *cli, const char *group_name);
2768 int cli_NetGroupAdd(struct cli_state *cli, struct rap_group_info_1 *grinfo);
2769 int cli_RNetGroupEnum(struct cli_state *cli, void (*fn)(const char *, const char *, void *), void *state);
2770 int cli_RNetGroupEnum0(struct cli_state *cli,
2771                        void (*fn)(const char *, void *),
2772                        void *state);
2773 int cli_NetGroupDelUser(struct cli_state * cli, const char *group_name, const char *user_name);
2774 int cli_NetGroupAddUser(struct cli_state * cli, const char *group_name, const char *user_name);
2775 int cli_NetGroupGetUsers(struct cli_state * cli, const char *group_name, void (*fn)(const char *, void *), void *state );
2776 int cli_NetUserGetGroups(struct cli_state * cli, const char *user_name, void (*fn)(const char *, void *), void *state );
2777 int cli_NetUserDelete(struct cli_state *cli, const char * user_name );
2778 int cli_NetUserAdd(struct cli_state *cli, struct rap_user_info_1 * userinfo );
2779 int cli_RNetUserEnum(struct cli_state *cli, void (*fn)(const char *, const char *, const char *, const char *, void *), void *state);
2780 int cli_RNetUserEnum0(struct cli_state *cli,
2781                       void (*fn)(const char *, void *),
2782                       void *state);
2783 int cli_NetFileClose(struct cli_state *cli, uint32 file_id );
2784 int cli_NetFileGetInfo(struct cli_state *cli, uint32 file_id, void (*fn)(const char *, const char *, uint16, uint16, uint32));
2785 int cli_NetFileEnum(struct cli_state *cli, const char * user,
2786                     const char * base_path,
2787                     void (*fn)(const char *, const char *, uint16, uint16,
2788                                uint32));
2789 int cli_NetShareAdd(struct cli_state *cli, struct rap_share_info_2 * sinfo );
2790 int cli_NetShareDelete(struct cli_state *cli, const char * share_name );
2791 bool cli_get_pdc_name(struct cli_state *cli, const char *workgroup, char **pdc_name);
2792 bool cli_get_server_domain(struct cli_state *cli);
2793 bool cli_get_server_type(struct cli_state *cli, uint32 *pstype);
2794 bool cli_get_server_name(TALLOC_CTX *mem_ctx, struct cli_state *cli,
2795                          char **servername);
2796 bool cli_ns_check_server_type(struct cli_state *cli, char *workgroup, uint32 stype);
2797 bool cli_NetWkstaUserLogoff(struct cli_state *cli, const char *user, const char *workstation);
2798 int cli_NetPrintQEnum(struct cli_state *cli,
2799                 void (*qfn)(const char*,uint16,uint16,uint16,const char*,const char*,const char*,const char*,const char*,uint16,uint16),
2800                 void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,unsigned int,unsigned int,const char*));
2801 int cli_NetPrintQGetInfo(struct cli_state *cli, const char *printer,
2802         void (*qfn)(const char*,uint16,uint16,uint16,const char*,const char*,const char*,const char*,const char*,uint16,uint16),
2803         void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,unsigned int,unsigned int,const char*));
2804 int cli_RNetServiceEnum(struct cli_state *cli, void (*fn)(const char *, const char *, void *), void *state);
2805 int cli_NetSessionEnum(struct cli_state *cli, void (*fn)(char *, char *, uint16, uint16, uint16, unsigned int, unsigned int, unsigned int, char *));
2806 int cli_NetSessionGetInfo(struct cli_state *cli, const char *workstation,
2807                 void (*fn)(const char *, const char *, uint16, uint16, uint16, unsigned int, unsigned int, unsigned int, const char *));
2808 int cli_NetSessionDel(struct cli_state *cli, const char *workstation);
2809 int cli_NetConnectionEnum(struct cli_state *cli, const char *qualifier,
2810                         void (*fn)(uint16_t conid, uint16_t contype,
2811                                 uint16_t numopens, uint16_t numusers,
2812                                 uint32_t contime, const char *username,
2813                                 const char *netname));
2814
2815 /* The following definitions come from libsmb/clireadwrite.c  */
2816
2817 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
2818                                         struct event_context *ev,
2819                                         struct cli_state *cli, uint16_t fnum,
2820                                         off_t offset, size_t size,
2821                                         struct tevent_req **psmbreq);
2822 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
2823                                       struct event_context *ev,
2824                                       struct cli_state *cli, uint16_t fnum,
2825                                       off_t offset, size_t size);
2826 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
2827                             uint8_t **rcvbuf);
2828 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
2829                                  struct event_context *ev,
2830                                  struct cli_state *cli,
2831                                  uint16_t fnum, off_t start_offset,
2832                                  SMB_OFF_T size, size_t window_size,
2833                                  NTSTATUS (*sink)(char *buf, size_t n,
2834                                                   void *priv),
2835                                  void *priv);
2836 NTSTATUS cli_pull_recv(struct tevent_req *req, SMB_OFF_T *received);
2837 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
2838                   off_t start_offset, SMB_OFF_T size, size_t window_size,
2839                   NTSTATUS (*sink)(char *buf, size_t n, void *priv),
2840                   void *priv, SMB_OFF_T *received);
2841 ssize_t cli_read(struct cli_state *cli, uint16_t fnum, char *buf,
2842                  off_t offset, size_t size);
2843 ssize_t cli_readraw(struct cli_state *cli, uint16_t fnum, char *buf, off_t offset, size_t size);
2844 ssize_t cli_write(struct cli_state *cli,
2845                  uint16_t fnum, uint16 write_mode,
2846                  const char *buf, off_t offset, size_t size);
2847 ssize_t cli_smbwrite(struct cli_state *cli,
2848                      uint16_t fnum, char *buf, off_t offset, size_t size1);
2849 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
2850                                          struct event_context *ev,
2851                                          struct cli_state *cli, uint16_t fnum,
2852                                          uint16_t mode, const uint8_t *buf,
2853                                          off_t offset, size_t size,
2854                                          struct tevent_req **reqs_before,
2855                                          int num_reqs_before,
2856                                          struct tevent_req **psmbreq);
2857 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
2858                                        struct event_context *ev,
2859                                        struct cli_state *cli, uint16_t fnum,
2860                                        uint16_t mode, const uint8_t *buf,
2861                                        off_t offset, size_t size);
2862 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
2863
2864 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
2865                                  struct cli_state *cli,
2866                                  uint16_t fnum, uint16_t mode,
2867                                  off_t start_offset, size_t window_size,
2868                                  size_t (*source)(uint8_t *buf, size_t n,
2869                                                   void *priv),
2870                                  void *priv);
2871 NTSTATUS cli_push_recv(struct tevent_req *req);
2872 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
2873                   off_t start_offset, size_t window_size,
2874                   size_t (*source)(uint8_t *buf, size_t n, void *priv),
2875                   void *priv);
2876
2877 /* The following definitions come from libsmb/clisecdesc.c  */
2878
2879 struct security_descriptor *cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
2880                             TALLOC_CTX *mem_ctx);
2881 bool cli_set_secdesc(struct cli_state *cli, uint16_t fnum, struct security_descriptor *sd);
2882
2883 /* The following definitions come from libsmb/clispnego.c  */
2884
2885 DATA_BLOB spnego_gen_negTokenInit(char guid[16], 
2886                                   const char *OIDs[], 
2887                                   const char *principal);
2888 DATA_BLOB gen_negTokenInit(const char *OID, DATA_BLOB blob);
2889 bool spnego_parse_negTokenInit(DATA_BLOB blob,
2890                                char *OIDs[ASN1_MAX_OIDS],
2891                                char **principal);
2892 DATA_BLOB gen_negTokenTarg(const char *OIDs[], DATA_BLOB blob);
2893 bool parse_negTokenTarg(DATA_BLOB blob, char *OIDs[ASN1_MAX_OIDS], DATA_BLOB *secblob);
2894 DATA_BLOB spnego_gen_krb5_wrap(const DATA_BLOB ticket, const uint8 tok_id[2]);
2895 bool spnego_parse_krb5_wrap(DATA_BLOB blob, DATA_BLOB *ticket, uint8 tok_id[2]);
2896 int spnego_gen_negTokenTarg(const char *principal, int time_offset, 
2897                             DATA_BLOB *targ, 
2898                             DATA_BLOB *session_key_krb5, uint32 extra_ap_opts,
2899                             time_t *expire_time);
2900 bool spnego_parse_challenge(const DATA_BLOB blob,
2901                             DATA_BLOB *chal1, DATA_BLOB *chal2);
2902 DATA_BLOB spnego_gen_auth(DATA_BLOB blob);
2903 bool spnego_parse_auth(DATA_BLOB blob, DATA_BLOB *auth);
2904 DATA_BLOB spnego_gen_auth_response(DATA_BLOB *reply, NTSTATUS nt_status,
2905                                    const char *mechOID);
2906 bool spnego_parse_auth_response(DATA_BLOB blob, NTSTATUS nt_status,
2907                                 const char *mechOID,
2908                                 DATA_BLOB *auth);
2909
2910 /* The following definitions come from libsmb/clistr.c  */
2911
2912 size_t clistr_push_fn(const char *function,
2913                         unsigned int line,
2914                         struct cli_state *cli,
2915                         void *dest,
2916                         const char *src,
2917                         int dest_len,
2918                         int flags);
2919 size_t clistr_pull_fn(const char *function,
2920                         unsigned int line,
2921                         const char *inbuf,
2922                         char *dest,
2923                         const void *src,
2924                         int dest_len,
2925                         int src_len,
2926                         int flags);
2927 size_t clistr_pull_talloc_fn(const char *function,
2928                                 unsigned int line,
2929                                 TALLOC_CTX *ctx,
2930                                 const char *inbuf,
2931                                 char **pp_dest,
2932                                 const void *src,
2933                                 int src_len,
2934                                 int flags);
2935 size_t clistr_align_out(struct cli_state *cli, const void *p, int flags);
2936 size_t clistr_align_in(struct cli_state *cli, const void *p, int flags);
2937
2938 /* The following definitions come from libsmb/clitrans.c  */
2939
2940 bool cli_send_trans(struct cli_state *cli, int trans,
2941                     const char *pipe_name,
2942                     int fid, int flags,
2943                     uint16 *setup, unsigned int lsetup, unsigned int msetup,
2944                     const char *param, unsigned int lparam, unsigned int mparam,
2945                     const char *data, unsigned int ldata, unsigned int mdata);
2946 bool cli_receive_trans(struct cli_state *cli,int trans,
2947                               char **param, unsigned int *param_len,
2948                               char **data, unsigned int *data_len);
2949 bool cli_send_nt_trans(struct cli_state *cli,
2950                        int function,
2951                        int flags,
2952                        uint16 *setup, unsigned int lsetup, unsigned int msetup,
2953                        char *param, unsigned int lparam, unsigned int mparam,
2954                        char *data, unsigned int ldata, unsigned int mdata);
2955 bool cli_receive_nt_trans(struct cli_state *cli,
2956                           char **param, unsigned int *param_len,
2957                           char **data, unsigned int *data_len);
2958 struct tevent_req *cli_trans_send(
2959         TALLOC_CTX *mem_ctx, struct event_context *ev,
2960         struct cli_state *cli, uint8_t cmd,
2961         const char *pipe_name, uint16_t fid, uint16_t function, int flags,
2962         uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
2963         uint8_t *param, uint32_t num_param, uint32_t max_param,
2964         uint8_t *data, uint32_t num_data, uint32_t max_data);
2965 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
2966                         uint16_t **setup, uint8_t min_setup,
2967                         uint8_t *num_setup,
2968                         uint8_t **param, uint32_t min_param,
2969                         uint32_t *num_param,
2970                         uint8_t **data, uint32_t min_data,
2971                         uint32_t *num_data);
2972 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
2973                    uint8_t trans_cmd,
2974                    const char *pipe_name, uint16_t fid, uint16_t function,
2975                    int flags,
2976                    uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
2977                    uint8_t *param, uint32_t num_param, uint32_t max_param,
2978                    uint8_t *data, uint32_t num_data, uint32_t max_data,
2979                    uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
2980                    uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
2981                    uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
2982
2983 /* The following definitions come from libsmb/conncache.c  */
2984
2985 NTSTATUS check_negative_conn_cache_timeout( const char *domain, const char *server, unsigned int failed_cache_timeout );
2986 NTSTATUS check_negative_conn_cache( const char *domain, const char *server);
2987 void add_failed_connection_entry(const char *domain, const char *server, NTSTATUS result) ;
2988 void flush_negative_conn_cache_for_domain(const char *domain);
2989
2990 /* The following definitions come from ../librpc/rpc/dcerpc_error.c  */
2991
2992 const char *dcerpc_errstr(TALLOC_CTX *mem_ctx, uint32_t fault_code);
2993 NTSTATUS dcerpc_fault_to_nt_status(uint32_t fault_code);
2994
2995 /* The following definitions come from libsmb/dsgetdcname.c  */
2996
2997 void debug_dsdcinfo_flags(int lvl, uint32_t flags);
2998 NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx,
2999                      struct messaging_context *msg_ctx,
3000                      const char *domain_name,
3001                      const struct GUID *domain_guid,
3002                      const char *site_name,
3003                      uint32_t flags,
3004                      struct netr_DsRGetDCNameInfo **info);
3005
3006 /* The following definitions come from libsmb/errormap.c  */
3007
3008 NTSTATUS dos_to_ntstatus(uint8 eclass, uint32 ecode);
3009 void ntstatus_to_dos(NTSTATUS ntstatus, uint8 *eclass, uint32 *ecode);
3010 NTSTATUS werror_to_ntstatus(WERROR error);
3011 WERROR ntstatus_to_werror(NTSTATUS error);
3012 NTSTATUS map_nt_error_from_wbcErr(wbcErr wbc_err);
3013 NTSTATUS map_nt_error_from_gss(uint32 gss_maj, uint32 minor);
3014
3015 /* The following definitions come from libsmb/namecache.c  */
3016
3017 bool namecache_enable(void);
3018 bool namecache_store(const char *name,
3019                         int name_type,
3020                         int num_names,
3021                         struct ip_service *ip_list);
3022 bool namecache_fetch(const char *name,
3023                         int name_type,
3024                         struct ip_service **ip_list,
3025                         int *num_names);
3026 bool namecache_delete(const char *name, int name_type);
3027 void namecache_flush(void);
3028 bool namecache_status_store(const char *keyname, int keyname_type,
3029                 int name_type, const struct sockaddr_storage *keyip,
3030                 const char *srvname);
3031 bool namecache_status_fetch(const char *keyname,
3032                                 int keyname_type,
3033                                 int name_type,
3034                                 const struct sockaddr_storage *keyip,
3035                                 char *srvname_out);
3036
3037 /* The following definitions come from libsmb/namequery.c  */
3038
3039 bool saf_store( const char *domain, const char *servername );
3040 bool saf_join_store( const char *domain, const char *servername );
3041 bool saf_delete( const char *domain );
3042 char *saf_fetch( const char *domain );
3043 NODE_STATUS_STRUCT *node_status_query(int fd,
3044                                         struct nmb_name *name,
3045                                         const struct sockaddr_storage *to_ss,
3046                                         int *num_names,
3047                                         struct node_status_extra *extra);
3048 bool name_status_find(const char *q_name,
3049                         int q_type,
3050                         int type,
3051                         const struct sockaddr_storage *to_ss,
3052                         fstring name);
3053 int ip_service_compare(struct ip_service *ss1, struct ip_service *ss2);
3054 struct sockaddr_storage *name_query(int fd,
3055                         const char *name,
3056                         int name_type,
3057                         bool bcast,
3058                         bool recurse,
3059                         const struct sockaddr_storage *to_ss,
3060                         int *count,
3061                         int *flags,
3062                         bool *timed_out);
3063 NTSTATUS name_resolve_bcast(const char *name,
3064                         int name_type,
3065                         struct ip_service **return_iplist,
3066                         int *return_count);
3067 NTSTATUS resolve_wins(const char *name,
3068                 int name_type,
3069                 struct ip_service **return_iplist,
3070                 int *return_count);
3071 NTSTATUS internal_resolve_name(const char *name,
3072                                 int name_type,
3073                                 const char *sitename,
3074                                 struct ip_service **return_iplist,
3075                                 int *return_count,
3076                                 const char *resolve_order);
3077 bool resolve_name(const char *name,
3078                 struct sockaddr_storage *return_ss,
3079                 int name_type,
3080                 bool prefer_ipv4);
3081 NTSTATUS resolve_name_list(TALLOC_CTX *ctx,
3082                 const char *name,
3083                 int name_type,
3084                 struct sockaddr_storage **return_ss_arr,
3085                 unsigned int *p_num_entries);
3086 bool find_master_ip(const char *group, struct sockaddr_storage *master_ss);
3087 bool get_pdc_ip(const char *domain, struct sockaddr_storage *pss);
3088 NTSTATUS get_sorted_dc_list( const char *domain,
3089                         const char *sitename,
3090                         struct ip_service **ip_list,
3091                         int *count,
3092                         bool ads_only );
3093 NTSTATUS get_kdc_list( const char *realm,
3094                         const char *sitename,
3095                         struct ip_service **ip_list,
3096                         int *count);
3097
3098 /* The following definitions come from libsmb/namequery_dc.c  */
3099
3100 bool get_dc_name(const char *domain,
3101                 const char *realm,
3102                 fstring srv_name,
3103                 struct sockaddr_storage *ss_out);
3104
3105 /* The following definitions come from libsmb/nmblib.c  */
3106
3107 void debug_nmb_packet(struct packet_struct *p);
3108 void put_name(char *dest, const char *name, int pad, unsigned int name_type);
3109 char *nmb_namestr(const struct nmb_name *n);
3110 struct packet_struct *copy_packet(struct packet_struct *packet);
3111 void free_packet(struct packet_struct *packet);
3112 struct packet_struct *parse_packet(char *buf,int length,
3113                                    enum packet_type packet_type,
3114                                    struct in_addr ip,
3115                                    int port);
3116 struct packet_struct *read_packet(int fd,enum packet_type packet_type);
3117 void make_nmb_name( struct nmb_name *n, const char *name, int type);
3118 bool nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2);
3119 int build_packet(char *buf, size_t buflen, struct packet_struct *p);
3120 bool send_packet(struct packet_struct *p);
3121 struct packet_struct *receive_packet(int fd,enum packet_type type,int t);
3122 struct packet_struct *receive_nmb_packet(int fd, int t, int trn_id);
3123 struct packet_struct *receive_dgram_packet(int fd, int t,
3124                 const char *mailslot_name);
3125 bool match_mailslot_name(struct packet_struct *p, const char *mailslot_name);
3126 int matching_len_bits(unsigned char *p1, unsigned char *p2, size_t len);
3127 void sort_query_replies(char *data, int n, struct in_addr ip);
3128 char *name_mangle(TALLOC_CTX *mem_ctx, char *In, char name_type);
3129 int name_extract(char *buf,int ofs, fstring name);
3130 int name_len(char *s1);
3131
3132 /* The following definitions come from libsmb/nterr.c  */
3133
3134 const char *nt_errstr(NTSTATUS nt_code);
3135 const char *get_friendly_nt_error_msg(NTSTATUS nt_code);
3136 const char *get_nt_error_c_code(NTSTATUS nt_code);
3137 NTSTATUS nt_status_string_to_code(const char *nt_status_str);
3138 NTSTATUS nt_status_squash(NTSTATUS nt_status);
3139
3140 /* The following definitions come from libsmb/ntlmssp.c  */
3141
3142 NTSTATUS ntlmssp_set_username(struct ntlmssp_state *ntlmssp_state, const char *user) ;
3143 NTSTATUS ntlmssp_set_hashes(struct ntlmssp_state *ntlmssp_state,
3144                             const uint8_t lm_hash[16],
3145                             const uint8_t nt_hash[16]) ;
3146 NTSTATUS ntlmssp_set_password(struct ntlmssp_state *ntlmssp_state, const char *password) ;
3147 NTSTATUS ntlmssp_set_domain(struct ntlmssp_state *ntlmssp_state, const char *domain) ;
3148 void ntlmssp_want_feature_list(struct ntlmssp_state *ntlmssp_state, char *feature_list);
3149 void ntlmssp_want_feature(struct ntlmssp_state *ntlmssp_state, uint32_t feature);
3150 NTSTATUS ntlmssp_update(struct ntlmssp_state *ntlmssp_state,
3151                         const DATA_BLOB in, DATA_BLOB *out) ;
3152 void ntlmssp_end(struct ntlmssp_state **ntlmssp_state);
3153 DATA_BLOB ntlmssp_weaken_keys(struct ntlmssp_state *ntlmssp_state, TALLOC_CTX *mem_ctx);
3154 NTSTATUS ntlmssp_server_start(TALLOC_CTX *mem_ctx,
3155                               bool is_standalone,
3156                               const char *netbios_name,
3157                               const char *netbios_domain,
3158                               const char *dns_name,
3159                               const char *dns_domain,
3160                               struct ntlmssp_state **ntlmssp_state);
3161 NTSTATUS ntlmssp_client_start(TALLOC_CTX *mem_ctx,
3162                               const char *netbios_name,
3163                               const char *netbios_domain,
3164                               bool use_ntlmv2,
3165                               struct ntlmssp_state **_ntlmssp_state);
3166
3167 /* The following definitions come from libsmb/passchange.c  */
3168
3169 NTSTATUS remote_password_change(const char *remote_machine, const char *user_name, 
3170                                 const char *old_passwd, const char *new_passwd,
3171                                 char **err_str);
3172
3173 /* The following definitions come from libsmb/samlogon_cache.c  */
3174
3175 bool netsamlogon_cache_init(void);
3176 bool netsamlogon_cache_shutdown(void);
3177 void netsamlogon_clear_cached_user(struct netr_SamInfo3 *info3);
3178 bool netsamlogon_cache_store(const char *username, struct netr_SamInfo3 *info3);
3179 struct netr_SamInfo3 *netsamlogon_cache_get(TALLOC_CTX *mem_ctx, const struct dom_sid *user_sid);
3180 bool netsamlogon_cache_have(const struct dom_sid *user_sid);
3181
3182 /* The following definitions come from libsmb/smb_seal.c  */
3183
3184 NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16 *p_enc_ctx_num);
3185 bool common_encryption_on(struct smb_trans_enc_state *es);
3186 NTSTATUS common_ntlm_decrypt_buffer(struct ntlmssp_state *ntlmssp_state, char *buf);
3187 NTSTATUS common_ntlm_encrypt_buffer(struct ntlmssp_state *ntlmssp_state,
3188                                 uint16 enc_ctx_num,
3189                                 char *buf,
3190                                 char **ppbuf_out);
3191 NTSTATUS common_encrypt_buffer(struct smb_trans_enc_state *es, char *buffer, char **buf_out);
3192 NTSTATUS common_decrypt_buffer(struct smb_trans_enc_state *es, char *buf);
3193 void common_free_encryption_state(struct smb_trans_enc_state **pp_es);
3194 void common_free_enc_buffer(struct smb_trans_enc_state *es, char *buf);
3195 bool cli_encryption_on(struct cli_state *cli);
3196 void cli_free_encryption_context(struct cli_state *cli);
3197 void cli_free_enc_buffer(struct cli_state *cli, char *buf);
3198 NTSTATUS cli_decrypt_message(struct cli_state *cli);
3199 NTSTATUS cli_encrypt_message(struct cli_state *cli, char *buf, char **buf_out);
3200
3201 /* The following definitions come from libsmb/clisigning.c  */
3202
3203 bool cli_simple_set_signing(struct cli_state *cli,
3204                             const DATA_BLOB user_session_key,
3205                             const DATA_BLOB response);
3206 bool cli_temp_set_signing(struct cli_state *cli);
3207 void cli_calculate_sign_mac(struct cli_state *cli, char *buf, uint32_t *seqnum);
3208 bool cli_check_sign_mac(struct cli_state *cli, const char *buf, uint32_t seqnum);
3209 bool client_is_signing_on(struct cli_state *cli);
3210 bool client_is_signing_allowed(struct cli_state *cli);
3211 bool client_is_signing_mandatory(struct cli_state *cli);
3212 void cli_set_signing_negotiated(struct cli_state *cli);
3213
3214 /* The following definitions come from smbd/signing.c  */
3215
3216 struct smbd_server_connection;
3217 bool srv_check_sign_mac(struct smbd_server_connection *conn,
3218                         const char *inbuf, uint32_t *seqnum, bool trusted_channel);
3219 void srv_calculate_sign_mac(struct smbd_server_connection *conn,
3220                             char *outbuf, uint32_t seqnum);
3221 void srv_cancel_sign_response(struct smbd_server_connection *conn);
3222 bool srv_init_signing(struct smbd_server_connection *conn);
3223 void srv_set_signing_negotiated(struct smbd_server_connection *conn);
3224 bool srv_is_signing_active(struct smbd_server_connection *conn);
3225 bool srv_is_signing_negotiated(struct smbd_server_connection *conn);
3226 void srv_set_signing(struct smbd_server_connection *conn,
3227                      const DATA_BLOB user_session_key,
3228                      const DATA_BLOB response);
3229
3230 /* The following definitions come from libsmb/smberr.c  */
3231
3232 const char *smb_dos_err_name(uint8 e_class, uint16 num);
3233 const char *get_dos_error_msg(WERROR result);
3234 const char *smb_dos_err_class(uint8 e_class);
3235 char *smb_dos_errstr(char *inbuf);
3236 WERROR map_werror_from_unix(int error);
3237
3238 /* The following definitions come from libsmb/trustdom_cache.c  */
3239
3240 bool trustdom_cache_enable(void);
3241 bool trustdom_cache_shutdown(void);
3242 bool trustdom_cache_store(char* name, char* alt_name, const struct dom_sid *sid,
3243                           time_t timeout);
3244 bool trustdom_cache_fetch(const char* name, struct dom_sid* sid);
3245 uint32 trustdom_cache_fetch_timestamp( void );
3246 bool trustdom_cache_store_timestamp( uint32 t, time_t timeout );
3247 void trustdom_cache_flush(void);
3248 void update_trustdom_cache( void );
3249
3250 /* The following definitions come from libsmb/trusts_util.c  */
3251
3252 NTSTATUS trust_pw_change_and_store_it(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, 
3253                                       const char *domain,
3254                                       const char *account_name,
3255                                       unsigned char orig_trust_passwd_hash[16],
3256                                       enum netr_SchannelType sec_channel_type);
3257 NTSTATUS trust_pw_find_change_and_store_it(struct rpc_pipe_client *cli, 
3258                                            TALLOC_CTX *mem_ctx, 
3259                                            const char *domain) ;
3260 bool enumerate_domain_trusts( TALLOC_CTX *mem_ctx, const char *domain,
3261                                      char ***domain_names, uint32 *num_domains,
3262                                      struct dom_sid **sids );
3263
3264 /* The following definitions come from libsmb/unexpected.c  */
3265
3266 void unexpected_packet(struct packet_struct *p);
3267 void clear_unexpected(time_t t);
3268 struct packet_struct *receive_unexpected(enum packet_type packet_type, int id,
3269                                          const char *mailslot_name);
3270
3271 /* The following definitions come from locking/brlock.c  */
3272
3273 bool brl_same_context(const struct lock_context *ctx1, 
3274                              const struct lock_context *ctx2);
3275 NTSTATUS brl_lock_failed(files_struct *fsp, const struct lock_struct *lock, bool blocking_lock);
3276 void brl_init(bool read_only);
3277 void brl_shutdown(void);
3278
3279 NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck,
3280                 struct lock_struct *plock,
3281                 bool blocking_lock);
3282
3283 NTSTATUS brl_lock(struct messaging_context *msg_ctx,
3284                 struct byte_range_lock *br_lck,
3285                 uint64_t smblctx,
3286                 struct server_id pid,
3287                 br_off start,
3288                 br_off size, 
3289                 enum brl_type lock_type,
3290                 enum brl_flavour lock_flav,
3291                 bool blocking_lock,
3292                 uint64_t *psmblctx,
3293                 struct blocking_lock_record *blr);
3294 bool brl_unlock(struct messaging_context *msg_ctx,
3295                 struct byte_range_lock *br_lck,
3296                 uint64_t smblctx,
3297                 struct server_id pid,
3298                 br_off start,
3299                 br_off size,
3300                 enum brl_flavour lock_flav);
3301 bool brl_unlock_windows_default(struct messaging_context *msg_ctx,
3302                                struct byte_range_lock *br_lck,
3303                                const struct lock_struct *plock);
3304 bool brl_locktest(struct byte_range_lock *br_lck,
3305                 uint64_t smblctx,
3306                 struct server_id pid,
3307                 br_off start,
3308                 br_off size, 
3309                 enum brl_type lock_type,
3310                 enum brl_flavour lock_flav);
3311 NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
3312                 uint64_t *psmblctx,
3313                 struct server_id pid,
3314                 br_off *pstart,
3315                 br_off *psize, 
3316                 enum brl_type *plock_type,
3317                 enum brl_flavour lock_flav);
3318 bool brl_lock_cancel(struct byte_range_lock *br_lck,
3319                 uint64_t smblctx,
3320                 struct server_id pid,
3321                 br_off start,
3322                 br_off size,
3323                 enum brl_flavour lock_flav,
3324                 struct blocking_lock_record *blr);
3325 bool brl_lock_cancel_default(struct byte_range_lock *br_lck,
3326                 struct lock_struct *plock);
3327 void brl_close_fnum(struct messaging_context *msg_ctx,
3328                     struct byte_range_lock *br_lck);
3329 int brl_forall(void (*fn)(struct file_id id, struct server_id pid,
3330                           enum brl_type lock_type,
3331                           enum brl_flavour lock_flav,
3332                           br_off start, br_off size,
3333                           void *private_data),
3334                void *private_data);
3335 struct byte_range_lock *brl_get_locks(TALLOC_CTX *mem_ctx,
3336                                         files_struct *fsp);
3337 struct byte_range_lock *brl_get_locks_readonly(files_struct *fsp);
3338 void brl_register_msgs(struct messaging_context *msg_ctx);
3339
3340 /* The following definitions come from locking/locking.c  */
3341
3342 const char *lock_type_name(enum brl_type lock_type);
3343 const char *lock_flav_name(enum brl_flavour lock_flav);
3344 void init_strict_lock_struct(files_struct *fsp,
3345                                 uint64_t smblctx,
3346                                 br_off start,
3347                                 br_off size,
3348                                 enum brl_type lock_type,
3349                                 struct lock_struct *plock);
3350 bool strict_lock_default(files_struct *fsp,
3351                                 struct lock_struct *plock);
3352 void strict_unlock_default(files_struct *fsp,
3353                                 struct lock_struct *plock);
3354 NTSTATUS query_lock(files_struct *fsp,
3355                         uint64_t *psmblctx,
3356                         uint64_t *pcount,
3357                         uint64_t *poffset,
3358                         enum brl_type *plock_type,
3359                         enum brl_flavour lock_flav);
3360 struct byte_range_lock *do_lock(struct messaging_context *msg_ctx,
3361                         files_struct *fsp,
3362                         uint64_t smblctx,
3363                         uint64_t count,
3364                         uint64_t offset,
3365                         enum brl_type lock_type,
3366                         enum brl_flavour lock_flav,
3367                         bool blocking_lock,
3368                         NTSTATUS *perr,
3369                         uint64_t *psmblctx,
3370                         struct blocking_lock_record *blr);
3371 NTSTATUS do_unlock(struct messaging_context *msg_ctx,
3372                         files_struct *fsp,
3373                         uint64_t smblctx,
3374                         uint64_t count,
3375                         uint64_t offset,
3376                         enum brl_flavour lock_flav);
3377 NTSTATUS do_lock_cancel(files_struct *fsp,
3378                         uint64 smblctx,
3379                         uint64_t count,
3380                         uint64_t offset,
3381                         enum brl_flavour lock_flav,
3382                         struct blocking_lock_record *blr);
3383 void locking_close_file(struct messaging_context *msg_ctx,
3384                         files_struct *fsp,
3385                         enum file_close_type close_type);
3386 bool locking_init(void);
3387 bool locking_init_readonly(void);
3388 bool locking_end(void);
3389 char *share_mode_str(TALLOC_CTX *ctx, int num, const struct share_mode_entry *e);
3390 struct share_mode_lock *get_share_mode_lock(TALLOC_CTX *mem_ctx,
3391                                             const struct file_id id,
3392                                             const char *servicepath,
3393                                             const struct smb_filename *smb_fname,
3394                                             const struct timespec *old_write_time);
3395 struct share_mode_lock *fetch_share_mode_unlocked(TALLOC_CTX *mem_ctx,
3396                                                   const struct file_id id);
3397 bool rename_share_filename(struct messaging_context *msg_ctx,
3398                         struct share_mode_lock *lck,
3399                         const char *servicepath,
3400                         const struct smb_filename *smb_fname);
3401 void get_file_infos(struct file_id id,
3402                     bool *delete_on_close,
3403                     struct timespec *write_time);
3404 bool is_valid_share_mode_entry(const struct share_mode_entry *e);
3405 bool is_deferred_open_entry(const struct share_mode_entry *e);
3406 bool is_unused_share_mode_entry(const struct share_mode_entry *e);
3407 void set_share_mode(struct share_mode_lock *lck, files_struct *fsp,
3408                     uid_t uid, uint64_t mid, uint16 op_type);
3409 void add_deferred_open(struct share_mode_lock *lck, uint64_t mid,
3410                        struct timeval request_time,
3411                        struct file_id id);
3412 bool del_share_mode(struct share_mode_lock *lck, files_struct *fsp);
3413 void del_deferred_open_entry(struct share_mode_lock *lck, uint64_t mid);
3414 bool remove_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
3415 bool downgrade_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
3416 NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32 dosmode);
3417 void set_delete_on_close_token(struct share_mode_lock *lck, const UNIX_USER_TOKEN *tok);
3418 void set_delete_on_close_lck(struct share_mode_lock *lck, bool delete_on_close, const UNIX_USER_TOKEN *tok);
3419 bool set_delete_on_close(files_struct *fsp, bool delete_on_close, const UNIX_USER_TOKEN *tok);
3420 bool set_sticky_write_time(struct file_id fileid, struct timespec write_time);
3421 bool set_write_time(struct file_id fileid, struct timespec write_time);
3422 int share_mode_forall(void (*fn)(const struct share_mode_entry *, const char *,
3423                                  const char *, void *),
3424                       void *private_data);
3425
3426 /* The following definitions come from locking/posix.c  */
3427
3428 bool is_posix_locked(files_struct *fsp,
3429                         uint64_t *pu_offset,
3430                         uint64_t *pu_count,
3431                         enum brl_type *plock_type,
3432                         enum brl_flavour lock_flav);
3433 bool posix_locking_init(bool read_only);
3434 bool posix_locking_end(void);
3435 void reduce_windows_lock_ref_count(files_struct *fsp, unsigned int dcount);
3436 int fd_close_posix(struct files_struct *fsp);
3437 bool set_posix_lock_windows_flavour(files_struct *fsp,
3438                         uint64_t u_offset,
3439                         uint64_t u_count,
3440                         enum brl_type lock_type,
3441                         const struct lock_context *lock_ctx,
3442                         const struct lock_struct *plocks,
3443                         int num_locks,
3444                         int *errno_ret);
3445 bool release_posix_lock_windows_flavour(files_struct *fsp,
3446                                 uint64_t u_offset,
3447                                 uint64_t u_count,
3448                                 enum brl_type deleted_lock_type,
3449                                 const struct lock_context *lock_ctx,
3450                                 const struct lock_struct *plocks,
3451                                 int num_locks);
3452 bool set_posix_lock_posix_flavour(files_struct *fsp,
3453                         uint64_t u_offset,
3454                         uint64_t u_count,
3455                         enum brl_type lock_type,
3456                         int *errno_ret);
3457 bool release_posix_lock_posix_flavour(files_struct *fsp,
3458                                 uint64_t u_offset,
3459                                 uint64_t u_count,
3460                                 const struct lock_context *lock_ctx,
3461                                 const struct lock_struct *plocks,
3462                                 int num_locks);
3463
3464 /* The following definitions come from modules/vfs_default.c  */
3465
3466 ssize_t vfswrap_llistxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size);
3467 ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size);
3468 NTSTATUS vfs_default_init(void);
3469
3470 /* The following definitions come from nmbd/asyncdns.c  */
3471
3472 int asyncdns_fd(void);
3473 void kill_async_dns_child(void);
3474 void start_async_dns(void);
3475 void run_dns_queue(void);
3476 bool queue_dns_query(struct packet_struct *p,struct nmb_name *question);
3477 bool queue_dns_query(struct packet_struct *p,struct nmb_name *question);
3478 void kill_async_dns_child(void);
3479
3480 /* The following definitions come from nmbd/nmbd.c  */
3481
3482 struct event_context *nmbd_event_context(void);
3483 struct messaging_context *nmbd_messaging_context(void);
3484
3485 /* The following definitions come from nmbd/nmbd_become_dmb.c  */
3486
3487 void add_domain_names(time_t t);
3488
3489 /* The following definitions come from nmbd/nmbd_become_lmb.c  */
3490
3491 void insert_permanent_name_into_unicast( struct subnet_record *subrec, 
3492                                                 struct nmb_name *nmbname, uint16 nb_type );
3493 void unbecome_local_master_browser(struct subnet_record *subrec, struct work_record *work,
3494                                    bool force_new_election);
3495 void become_local_master_browser(struct subnet_record *subrec, struct work_record *work);
3496 void set_workgroup_local_master_browser_name( struct work_record *work, const char *newname);
3497
3498 /* The following definitions come from nmbd/nmbd_browserdb.c  */
3499
3500 void update_browser_death_time( struct browse_cache_record *browc );
3501 struct browse_cache_record *create_browser_in_lmb_cache( const char *work_name, 
3502                                                          const char *browser_name, 
3503                                                          struct in_addr ip );
3504 struct browse_cache_record *find_browser_in_lmb_cache( const char *browser_name );
3505 void expire_lmb_browsers( time_t t );
3506
3507 /* The following definitions come from nmbd/nmbd_browsesync.c  */
3508
3509 void dmb_expire_and_sync_browser_lists(time_t t);
3510 void announce_and_sync_with_domain_master_browser( struct subnet_record *subrec,
3511                                                    struct work_record *work);
3512 void collect_all_workgroup_names_from_wins_server(time_t t);
3513 void sync_all_dmbs(time_t t);
3514
3515 /* The following definitions come from nmbd/nmbd_elections.c  */
3516
3517 void check_master_browser_exists(time_t t);
3518 void run_elections(time_t t);
3519 void process_election(struct subnet_record *subrec, struct packet_struct *p, char *buf);
3520 bool check_elections(void);
3521 void nmbd_message_election(struct messaging_context *msg,
3522                            void *private_data,
3523                            uint32_t msg_type,
3524                            struct server_id server_id,
3525                            DATA_BLOB *data);
3526
3527 /* The following definitions come from nmbd/nmbd_incomingdgrams.c  */
3528
3529 void tell_become_backup(void);
3530 void process_host_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf);
3531 void process_workgroup_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf);
3532 void process_local_master_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf);
3533 void process_master_browser_announce(struct subnet_record *subrec, 
3534                                      struct packet_struct *p,char *buf);
3535 void process_lm_host_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf, int len);
3536 void process_get_backup_list_request(struct subnet_record *subrec,
3537                                      struct packet_struct *p,char *buf);
3538 void process_reset_browser(struct subnet_record *subrec,
3539                                   struct packet_struct *p,char *buf);
3540 void process_announce_request(struct subnet_record *subrec, struct packet_struct *p, char *buf);
3541 void process_lm_announce_request(struct subnet_record *subrec, struct packet_struct *p, char *buf, int len);
3542
3543 /* The following definitions come from nmbd/nmbd_incomingrequests.c  */
3544
3545 void process_name_release_request(struct subnet_record *subrec, 
3546                                   struct packet_struct *p);
3547 void process_name_refresh_request(struct subnet_record *subrec,
3548                                   struct packet_struct *p);
3549 void process_name_registration_request(struct subnet_record *subrec, 
3550                                        struct packet_struct *p);
3551 void process_node_status_request(struct subnet_record *subrec, struct packet_struct *p);
3552 void process_name_qu