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