drsuapi.idl: fix source_dsa spelling
[samba4-gss.git] / source3 / smbd / proto.h
blobf53b6a7bbfb3492034ec6fa1d529025617819cb6
1 /*
2 * Unix SMB/CIFS implementation.
3 * Main SMB server routines
5 * Copyright (C) Andrew Tridgell 1992-2002,2006
6 * Copyright (C) Jeremy Allison 1992-2010
7 * Copyright (C) Volker Lendecke 1993-2009
8 * Copyright (C) John H Terpstra 1995-1998
9 * Copyright (C) Luke Kenneth Casson Leighton 1996-1998
10 * Copyright (C) Paul Ashton 1997-1998
11 * Copyright (C) Tim Potter 1999-2000
12 * Copyright (C) T.D.Lee@durham.ac.uk 1999
13 * Copyright (C) Ying Chen 2000
14 * Copyright (C) Shirish Kalele 2000
15 * Copyright (C) Andrew Bartlett 2001-2003
16 * Copyright (C) Alexander Bokovoy 2002,2005
17 * Copyright (C) Simo Sorce 2001-2002,2009
18 * Copyright (C) Andreas Gruenbacher 2002
19 * Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2002
20 * Copyright (C) Martin Pool 2002
21 * Copyright (C) Luke Howard 2003
22 * Copyright (C) Stefan (metze) Metzmacher 2003,2009
23 * Copyright (C) Steve French 2005
24 * Copyright (C) Gerald (Jerry) Carter 2006
25 * Copyright (C) James Peach 2006-2007
26 * Copyright (C) Jelmer Vernooij 2002-2003
27 * Copyright (C) Michael Adam 2007
28 * Copyright (C) Rishi Srivatsavai 2007
29 * Copyright (C) Tim Prouty 2009
30 * Copyright (C) Gregor Beck 2011
32 * This program is free software; you can redistribute it and/or modify
33 * it under the terms of the GNU General Public License as published by
34 * the Free Software Foundation; either version 3 of the License, or
35 * (at your option) any later version.
37 * This program is distributed in the hope that it will be useful,
38 * but WITHOUT ANY WARRANTY; without even the implied warranty of
39 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40 * GNU General Public License for more details.
42 * You should have received a copy of the GNU General Public License
43 * along with this program. If not, see <http://www.gnu.org/licenses/>.
46 #ifndef _SMBD_PROTO_H_
47 #define _SMBD_PROTO_H_
49 struct smbXsrv_client;
50 struct smbXsrv_connection;
51 struct dcesrv_context;
53 /* The following definitions come from smbd/smb2_signing.c */
55 bool srv_init_signing(struct smbXsrv_connection *conn);
57 /* The following definitions come from smbd/aio.c */
59 struct aio_extra;
60 bool aio_write_through_requested(struct aio_extra *aio_ex);
61 NTSTATUS schedule_smb2_aio_read(connection_struct *conn,
62 struct smb_request *smbreq,
63 files_struct *fsp,
64 TALLOC_CTX *ctx,
65 DATA_BLOB *preadbuf,
66 off_t startpos,
67 size_t smb_maxcnt);
68 NTSTATUS schedule_aio_smb2_write(connection_struct *conn,
69 struct smb_request *smbreq,
70 files_struct *fsp,
71 uint64_t in_offset,
72 DATA_BLOB in_data,
73 bool write_through);
74 bool cancel_smb2_aio(struct smb_request *smbreq);
75 struct aio_req_fsp_link;
76 struct aio_req_fsp_link *aio_add_req_to_fsp(files_struct *fsp, struct tevent_req *req);
77 struct aio_extra *create_aio_extra(TALLOC_CTX *mem_ctx,
78 files_struct *fsp,
79 size_t buflen);
80 struct tevent_req *pwrite_fsync_send(TALLOC_CTX *mem_ctx,
81 struct tevent_context *ev,
82 struct files_struct *fsp,
83 const void *data,
84 size_t n, off_t offset,
85 bool write_through);
86 ssize_t pwrite_fsync_recv(struct tevent_req *req, int *perr);
88 /* The following definitions come from smbd/blocking.c */
90 NTSTATUS smbd_do_locks_try(
91 struct files_struct *fsp,
92 uint16_t num_locks,
93 struct smbd_lock_element *locks,
94 uint16_t *blocker_idx,
95 struct server_id *blocking_pid,
96 uint64_t *blocking_smblctx);
97 struct tevent_req *smbd_smb1_do_locks_send(
98 TALLOC_CTX *mem_ctx,
99 struct tevent_context *ev,
100 struct smb_request **smbreq, /* talloc_move()d into our state */
101 struct files_struct *fsp,
102 uint32_t lock_timeout,
103 bool large_offset,
104 uint16_t num_locks,
105 struct smbd_lock_element *locks);
106 NTSTATUS smbd_smb1_do_locks_recv(struct tevent_req *req);
107 bool smbd_smb1_do_locks_extract_smbreq(
108 struct tevent_req *req,
109 TALLOC_CTX *mem_ctx,
110 struct smb_request **psmbreq);
111 void smbd_smb1_brl_finish_by_req(struct tevent_req *req, NTSTATUS status);
112 bool smbd_smb1_brl_finish_by_lock(
113 struct files_struct *fsp,
114 bool large_offset,
115 struct smbd_lock_element lock,
116 NTSTATUS finish_status);
117 bool smbd_smb1_brl_finish_by_mid(
118 struct smbd_server_connection *sconn, uint64_t mid);
120 /* The following definitions come from smbd/close.c */
122 void set_close_write_time(struct files_struct *fsp, struct timespec ts);
123 NTSTATUS close_file_smb(struct smb_request *req,
124 struct files_struct *fsp,
125 enum file_close_type close_type);
126 NTSTATUS close_file_free(struct smb_request *req,
127 struct files_struct **_fsp,
128 enum file_close_type close_type);
129 void msg_close_file(struct messaging_context *msg_ctx,
130 void *private_data,
131 uint32_t msg_type,
132 struct server_id server_id,
133 DATA_BLOB *data);
134 NTSTATUS delete_all_streams(struct files_struct *fsp,
135 struct files_struct *dirfsp,
136 struct smb_filename *fsp_atname);
137 NTSTATUS recursive_rmdir(TALLOC_CTX *ctx,
138 connection_struct *conn,
139 struct smb_filename *smb_dname);
140 bool has_other_nonposix_opens(struct share_mode_lock *lck,
141 struct files_struct *fsp);
142 bool has_nonposix_opens(struct share_mode_lock *lck);
144 /* The following definitions come from smbd/conn.c */
146 int conn_num_open(struct smbd_server_connection *sconn);
147 bool conn_snum_used(struct smbd_server_connection *sconn, int snum);
148 enum protocol_types conn_protocol(struct smbd_server_connection *sconn);
149 bool conn_using_smb2(struct smbd_server_connection *sconn);
150 connection_struct *conn_new(struct smbd_server_connection *sconn);
151 bool conn_idle_all(struct smbd_server_connection *sconn, time_t t);
152 void conn_clear_vuid_caches(struct smbd_server_connection *sconn, uint64_t vuid);
153 void conn_free(connection_struct *conn);
154 void conn_setup_case_options(connection_struct *conn);
155 void conn_force_tdis(
156 struct smbd_server_connection *sconn,
157 bool (*check_fn)(struct connection_struct *conn,
158 void *private_data),
159 void *private_data);
160 void msg_force_tdis(struct messaging_context *msg,
161 void *private_data,
162 uint32_t msg_type,
163 struct server_id server_id,
164 DATA_BLOB *data);
165 void msg_force_tdis_denied(
166 struct messaging_context *msg,
167 void *private_data,
168 uint32_t msg_type,
169 struct server_id server_id,
170 DATA_BLOB *data);
172 /* The following definitions come from smbd/connection.c */
174 int count_current_connections(const char *sharename, bool verify);
175 bool connections_snum_used(struct smbd_server_connection *unused, int snum);
177 /* The following definitions come from smbd/dfree.c */
179 uint64_t get_dfree_info(connection_struct *conn, struct smb_filename *fname,
180 uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
181 void flush_dfree_cache(void);
183 /* The following definitions come from smbd/dmapi.c */
185 const void *dmapi_get_current_session(void);
186 bool dmapi_have_session(void);
187 bool dmapi_new_session(void);
188 bool dmapi_destroy_session(void);
189 uint32_t dmapi_file_flags(const char * const path);
191 /* The following definitions come from smbd/dnsregister.c */
193 bool smbd_setup_mdns_registration(struct tevent_context *ev,
194 TALLOC_CTX *mem_ctx,
195 uint16_t port);
197 /* The following definitions come from smbd/dosmode.c */
199 mode_t apply_conf_file_mask(struct connection_struct *conn, mode_t mode);
200 mode_t apply_conf_dir_mask(struct connection_struct *conn, mode_t mode);
202 mode_t unix_mode(connection_struct *conn, int dosmode,
203 const struct smb_filename *smb_fname,
204 struct files_struct *parent_dirfsp);
205 uint32_t dos_mode_msdfs(connection_struct *conn,
206 const char *name,
207 const struct stat_ex *st);
208 uint32_t fdos_mode(struct files_struct *fsp);
209 struct tevent_req *dos_mode_at_send(TALLOC_CTX *mem_ctx,
210 struct tevent_context *ev,
211 files_struct *dir_fsp,
212 struct smb_filename *smb_fname);
213 NTSTATUS dos_mode_at_recv(struct tevent_req *req, uint32_t *dosmode);
214 int file_set_dosmode(connection_struct *conn,
215 struct smb_filename *smb_fname,
216 uint32_t dosmode,
217 struct smb_filename *parent_dir,
218 bool newfile);
219 NTSTATUS file_set_sparse(connection_struct *conn,
220 struct files_struct *fsp,
221 bool sparse);
222 int file_ntimes(connection_struct *conn,
223 files_struct *fsp,
224 struct smb_file_time *ft);
225 bool set_sticky_write_time_fsp(struct files_struct *fsp,
226 struct timespec mtime);
228 NTSTATUS fget_ea_dos_attribute(struct files_struct *fsp,
229 uint32_t *pattr);
230 NTSTATUS set_ea_dos_attribute(connection_struct *conn,
231 struct smb_filename *smb_fname,
232 uint32_t dosmode);
234 NTSTATUS set_create_timespec_ea(struct files_struct *fsp,
235 struct timespec create_time);
237 struct timespec get_create_timespec(connection_struct *conn,
238 struct files_struct *fsp,
239 const struct smb_filename *smb_fname);
241 struct timespec get_change_timespec(connection_struct *conn,
242 struct files_struct *fsp,
243 const struct smb_filename *smb_fname);
245 NTSTATUS parse_dos_attribute_blob(struct smb_filename *smb_fname,
246 DATA_BLOB blob,
247 uint32_t *pattr);
249 /* The following definitions come from smbd/error.c */
251 bool use_nt_status(void);
252 void error_packet_set(char *outbuf, uint8_t eclass, uint32_t ecode, NTSTATUS ntstatus, int line, const char *file);
253 size_t error_packet(char *outbuf,
254 uint8_t eclass,
255 uint32_t ecode,
256 NTSTATUS ntstatus,
257 int line,
258 const char *file);
259 void reply_nt_error(struct smb_request *req, NTSTATUS ntstatus,
260 int line, const char *file);
261 void reply_force_dos_error(struct smb_request *req, uint8_t eclass, uint32_t ecode,
262 int line, const char *file);
263 void reply_both_error(struct smb_request *req, uint8_t eclass, uint32_t ecode,
264 NTSTATUS status, int line, const char *file);
265 void reply_openerror(struct smb_request *req, NTSTATUS status);
267 /* The following definitions come from smbd/file_access.c */
269 bool can_delete_file_in_directory(connection_struct *conn,
270 struct files_struct *dirfsp,
271 const struct smb_filename *smb_fname);
272 bool can_write_to_fsp(struct files_struct *fsp);
273 bool directory_has_default_acl_fsp(struct files_struct *fsp);
274 NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32_t dosmode);
276 /* The following definitions come from smbd/fileio.c */
278 ssize_t read_file(files_struct *fsp,char *data,off_t pos,size_t n);
279 void fsp_flush_write_time_update(struct files_struct *fsp);
280 void trigger_write_time_update(struct files_struct *fsp);
281 void trigger_write_time_update_immediate(struct files_struct *fsp);
282 void mark_file_modified(files_struct *fsp);
283 ssize_t write_file(struct smb_request *req,
284 files_struct *fsp,
285 const char *data,
286 off_t pos,
287 size_t n);
288 NTSTATUS sync_file(connection_struct *conn, files_struct *fsp, bool write_through);
290 /* The following definitions come from smbd/filename.c */
292 uint32_t ucf_flags_from_smb_request(struct smb_request *req);
293 uint32_t filename_create_ucf_flags(struct smb_request *req,
294 uint32_t create_disposition,
295 uint32_t create_options);
296 NTSTATUS canonicalize_snapshot_path(struct smb_filename *smb_fname,
297 uint32_t ucf_flags,
298 NTTIME twrp);
299 NTSTATUS get_real_filename_full_scan_at(struct files_struct *dirfsp,
300 const char *name,
301 bool mangled,
302 TALLOC_CTX *mem_ctx,
303 char **found_name);
304 char *get_original_lcomp(TALLOC_CTX *ctx,
305 connection_struct *conn,
306 const char *filename_in,
307 uint32_t ucf_flags);
308 NTSTATUS get_real_filename_at(struct files_struct *dirfsp,
309 const char *name,
310 TALLOC_CTX *mem_ctx,
311 char **found_name);
313 /* The following definitions come from smbd/files.c */
315 NTSTATUS fsp_new(struct connection_struct *conn, TALLOC_CTX *mem_ctx,
316 files_struct **result);
317 void fsp_set_gen_id(files_struct *fsp);
318 NTSTATUS file_new(struct smb_request *req, connection_struct *conn,
319 files_struct **result);
320 NTSTATUS fsp_bind_smb(struct files_struct *fsp, struct smb_request *req);
321 void file_close_conn(connection_struct *conn, enum file_close_type close_type);
322 bool file_init_global(void);
323 bool file_init(struct smbd_server_connection *sconn);
324 void file_close_user(struct smbd_server_connection *sconn, uint64_t vuid);
325 struct files_struct *files_forall(
326 struct smbd_server_connection *sconn,
327 struct files_struct *(*fn)(struct files_struct *fsp,
328 void *private_data),
329 void *private_data);
330 files_struct *file_find_fd(struct smbd_server_connection *sconn, int fd);
331 files_struct *file_find_dif(struct smbd_server_connection *sconn,
332 struct file_id id, unsigned long gen_id);
333 files_struct *file_find_di_first(struct smbd_server_connection *sconn,
334 struct file_id id,
335 bool need_fsa);
336 files_struct *file_find_di_next(files_struct *start_fsp,
337 bool need_fsa);
338 struct files_struct *file_find_one_fsp_from_lease_key(
339 struct smbd_server_connection *sconn,
340 const struct smb2_lease_key *lease_key);
341 bool file_find_subpath(files_struct *dir_fsp);
342 void fsp_unbind_smb(struct smb_request *req, files_struct *fsp);
343 void file_free(struct smb_request *req, files_struct *fsp);
344 files_struct *file_fsp(struct smb_request *req, uint16_t fid);
345 struct files_struct *file_fsp_get(struct smbd_smb2_request *smb2req,
346 uint64_t persistent_id,
347 uint64_t volatile_id);
348 struct files_struct *file_fsp_smb2(struct smbd_smb2_request *smb2req,
349 uint64_t persistent_id,
350 uint64_t volatile_id);
351 NTSTATUS file_name_hash(connection_struct *conn,
352 const char *name, uint32_t *p_name_hash);
353 NTSTATUS fsp_set_smb_fname(struct files_struct *fsp,
354 const struct smb_filename *smb_fname_in);
355 size_t fsp_fullbasepath(struct files_struct *fsp, char *buf, size_t buflen);
356 void fsp_set_base_fsp(struct files_struct *fsp, struct files_struct *base_fsp);
357 bool fsp_is_alternate_stream(const struct files_struct *fsp);
358 struct files_struct *metadata_fsp(struct files_struct *fsp);
359 bool fsp_search_ask_sharemode(struct files_struct *fsp);
360 bool fsp_getinfo_ask_sharemode(struct files_struct *fsp);
362 NTSTATUS create_internal_fsp(connection_struct *conn,
363 const struct smb_filename *smb_fname,
364 struct files_struct **_fsp);
365 NTSTATUS create_internal_dirfsp(connection_struct *conn,
366 const struct smb_filename *smb_dname,
367 struct files_struct **_fsp);
369 NTSTATUS open_internal_dirfsp(connection_struct *conn,
370 const struct smb_filename *smb_dname,
371 int open_flags,
372 struct files_struct **_fsp);
374 NTSTATUS open_rootdir_pathref_fsp(connection_struct *conn,
375 struct files_struct **_fsp);
376 NTSTATUS openat_pathref_fsp(const struct files_struct *dirfsp,
377 struct smb_filename *smb_fname);
378 NTSTATUS open_stream_pathref_fsp(
379 struct files_struct **_base_fsp,
380 struct smb_filename *smb_fname);
382 struct reparse_data_buffer;
384 NTSTATUS openat_pathref_fsp_nosymlink(
385 TALLOC_CTX *mem_ctx,
386 struct connection_struct *conn,
387 struct files_struct *dirfsp,
388 const char *path_in,
389 NTTIME twrp,
390 bool posix,
391 struct smb_filename **_smb_fname,
392 struct reparse_data_buffer **_symlink_err);
393 NTSTATUS openat_pathref_fsp_lcomp(struct files_struct *dirfsp,
394 struct smb_filename *smb_fname_rel,
395 uint32_t ucf_flags);
396 NTSTATUS readlink_talloc(
397 TALLOC_CTX *mem_ctx,
398 struct files_struct *dirfsp,
399 struct smb_filename *smb_relname,
400 char **_substitute);
402 NTSTATUS read_symlink_reparse(TALLOC_CTX *mem_ctx,
403 struct files_struct *dirfsp,
404 struct smb_filename *smb_relname,
405 struct reparse_data_buffer **_reparse);
407 void smb_fname_fsp_unlink(struct smb_filename *smb_fname);
409 NTSTATUS move_smb_fname_fsp_link(struct smb_filename *smb_fname_dst,
410 struct smb_filename *smb_fname_src);
412 NTSTATUS reference_smb_fname_fsp_link(struct smb_filename *smb_fname_dst,
413 const struct smb_filename *smb_fname_src);
415 NTSTATUS synthetic_pathref(TALLOC_CTX *mem_ctx,
416 const struct files_struct *dirfsp,
417 const char *base_name,
418 const char *stream_name,
419 const SMB_STRUCT_STAT *psbuf,
420 NTTIME twrp,
421 uint32_t flags,
422 struct smb_filename **_smb_fname);
424 NTSTATUS parent_pathref(TALLOC_CTX *mem_ctx,
425 struct files_struct *dirfsp,
426 const struct smb_filename *smb_fname,
427 struct smb_filename **_parent,
428 struct smb_filename **_atname);
430 /* The following definitions come from smbd/smb2_ipc.c */
432 NTSTATUS nt_status_np_pipe(NTSTATUS status);
434 /* The following definitions come from smbd/mangle.c */
436 void mangle_reset_cache(void);
437 void mangle_change_to_posix(void);
438 bool mangle_is_mangled(const char *s, const struct share_params *p);
439 bool mangle_is_8_3(const char *fname, bool check_case,
440 const struct share_params *p);
441 bool mangle_is_8_3_wildcards(const char *fname, bool check_case,
442 const struct share_params *p);
443 bool mangle_must_mangle(const char *fname,
444 const struct share_params *p);
445 bool mangle_lookup_name_from_8_3(TALLOC_CTX *ctx,
446 const char *in,
447 char **out, /* talloced on the given context. */
448 const struct share_params *p);
449 bool name_to_8_3(const char *in,
450 char out[13],
451 bool cache83,
452 const struct share_params *p);
454 /* The following definitions come from smbd/mangle_hash.c */
456 const struct mangle_fns *mangle_hash_init(void);
458 /* The following definitions come from smbd/mangle_hash2.c */
460 const struct mangle_fns *mangle_hash2_init(void);
461 const struct mangle_fns *posix_mangle_init(void);
463 /* The following definitions come from smbd/msdfs.c */
465 bool parse_msdfs_symlink(TALLOC_CTX *ctx,
466 bool shuffle_referrals,
467 const char *target,
468 struct referral **preflist,
469 size_t *refcount);
470 bool is_msdfs_link(struct files_struct *dirfsp,
471 struct smb_filename *smb_fname);
472 struct junction_map;
473 NTSTATUS get_referred_path(TALLOC_CTX *ctx,
474 struct auth_session_info *session_info,
475 const char *dfs_path,
476 const struct tsocket_address *remote_address,
477 const struct tsocket_address *local_address,
478 struct junction_map *jucn,
479 size_t *consumedcntp,
480 bool *self_referralp);
481 int setup_dfs_referral(connection_struct *orig_conn,
482 const char *dfs_path,
483 int max_referral_level,
484 char **ppdata, NTSTATUS *pstatus);
485 bool create_junction(TALLOC_CTX *ctx,
486 const char *dfs_path,
487 struct junction_map *jucn);
488 struct referral;
489 char *msdfs_link_string(TALLOC_CTX *ctx,
490 const struct referral *reflist,
491 size_t referral_count);
492 bool create_msdfs_link(const struct junction_map *jucn,
493 struct auth_session_info *session_info);
494 bool remove_msdfs_link(const struct junction_map *jucn,
495 struct auth_session_info *session_info);
497 struct junction_map *enum_msdfs_links(TALLOC_CTX *ctx,
498 struct auth_session_info *session_info,
499 size_t *p_num_jn);
500 struct connection_struct;
501 struct smb_filename;
503 NTSTATUS create_conn_struct_cwd(TALLOC_CTX *mem_ctx,
504 struct tevent_context *ev,
505 struct messaging_context *msg,
506 const struct auth_session_info *session_info,
507 int snum,
508 const char *path,
509 struct connection_struct **c);
510 struct conn_struct_tos {
511 struct connection_struct *conn;
512 struct smb_filename *oldcwd_fname;
514 NTSTATUS create_conn_struct_tos(struct messaging_context *msg,
515 int snum,
516 const char *path,
517 const struct auth_session_info *session_info,
518 struct conn_struct_tos **_c);
519 NTSTATUS create_conn_struct_tos_cwd(struct messaging_context *msg,
520 int snum,
521 const char *path,
522 const struct auth_session_info *session_info,
523 struct conn_struct_tos **_c);
525 /* The following definitions come from smbd/notify.c */
527 bool change_notify_fsp_has_changes(struct files_struct *fsp);
528 void change_notify_reply(struct smb_request *req,
529 NTSTATUS error_code,
530 uint32_t max_param,
531 struct notify_change_buf *notify_buf,
532 void (*reply_fn)(struct smb_request *req,
533 NTSTATUS error_code,
534 uint8_t *buf, size_t len));
535 void notify_callback(struct smbd_server_connection *sconn,
536 void *private_data, struct timespec when,
537 const struct notify_event *e);
538 NTSTATUS change_notify_create(struct files_struct *fsp,
539 uint32_t max_buffer_size,
540 uint32_t filter,
541 bool recursive);
542 NTSTATUS change_notify_add_request(struct smb_request *req,
543 uint32_t max_param,
544 uint32_t filter, bool recursive,
545 struct files_struct *fsp,
546 void (*reply_fn)(struct smb_request *req,
547 NTSTATUS error_code,
548 uint8_t *buf, size_t len));
549 void smbd_notify_cancel_deleted(struct messaging_context *msg,
550 void *private_data, uint32_t msg_type,
551 struct server_id server_id, DATA_BLOB *data);
552 void smbd_notifyd_restarted(struct messaging_context *msg,
553 void *private_data, uint32_t msg_type,
554 struct server_id server_id, DATA_BLOB *data);
555 bool remove_pending_change_notify_requests_by_mid(
556 struct smbd_server_connection *sconn, uint64_t mid);
557 void remove_pending_change_notify_requests_by_fid(files_struct *fsp,
558 NTSTATUS status);
559 void notify_fname(struct connection_struct *conn,
560 uint32_t action,
561 uint32_t filter,
562 const struct smb_filename *smb_fname,
563 const struct smb2_lease *lease);
564 char *notify_filter_string(TALLOC_CTX *mem_ctx, uint32_t filter);
565 struct sys_notify_context *sys_notify_context_create(TALLOC_CTX *mem_ctx,
566 struct tevent_context *ev);
568 /* The following definitions come from smbd/notify_inotify.c */
570 int inotify_watch(TALLOC_CTX *mem_ctx,
571 struct sys_notify_context *ctx,
572 const char *path,
573 uint32_t *filter,
574 uint32_t *subdir_filter,
575 void (*callback)(struct sys_notify_context *ctx,
576 void *private_data,
577 struct notify_event *ev,
578 uint32_t filter),
579 void *private_data,
580 void *handle_p);
582 int fam_watch(TALLOC_CTX *mem_ctx,
583 struct sys_notify_context *ctx,
584 const char *path,
585 uint32_t *filter,
586 uint32_t *subdir_filter,
587 void (*callback)(struct sys_notify_context *ctx,
588 void *private_data,
589 struct notify_event *ev,
590 uint32_t filter),
591 void *private_data,
592 void *handle_p);
595 /* The following definitions come from smbd/notify_internal.c */
597 struct notify_context *notify_init(
598 TALLOC_CTX *mem_ctx, struct messaging_context *msg,
599 struct smbd_server_connection *sconn,
600 void (*callback)(struct smbd_server_connection *sconn,
601 void *, struct timespec,
602 const struct notify_event *));
603 NTSTATUS notify_add(struct notify_context *ctx,
604 const char *path, uint32_t filter, uint32_t subdir_filter,
605 void *private_data);
606 NTSTATUS notify_remove(struct notify_context *ctx, void *private_data,
607 char *path);
608 void notify_trigger(struct notify_context *notify,
609 uint32_t action, uint32_t filter,
610 const char *dir, const char *path);
612 /* The following definitions come from smbd/ntquotas.c */
614 NTSTATUS vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype,
615 struct dom_sid *psid, SMB_NTQUOTA_STRUCT *qt);
616 int vfs_set_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, struct dom_sid *psid, SMB_NTQUOTA_STRUCT *qt);
617 int vfs_get_user_ntquota_list(files_struct *fsp, SMB_NTQUOTA_LIST **qt_list);
618 void *init_quota_handle(TALLOC_CTX *mem_ctx);
620 /* The following definitions come from smbd/smb2_nttrans.c */
622 NTSTATUS set_sd(files_struct *fsp, struct security_descriptor *psd,
623 uint32_t security_info_sent);
624 NTSTATUS set_sd_blob(files_struct *fsp, uint8_t *data, uint32_t sd_len,
625 uint32_t security_info_sent);
626 NTSTATUS copy_internals(TALLOC_CTX *ctx,
627 connection_struct *conn,
628 struct smb_request *req,
629 struct files_struct *src_dirfsp,
630 struct smb_filename *smb_fname_src,
631 struct files_struct *dst_dirfsp,
632 struct smb_filename *smb_fname_dst,
633 uint32_t attrs);
634 NTSTATUS smbd_do_query_security_desc(connection_struct *conn,
635 TALLOC_CTX *mem_ctx,
636 files_struct *fsp,
637 uint32_t security_info_wanted,
638 uint32_t max_data_count,
639 uint8_t **ppmarshalled_sd,
640 size_t *psd_size);
641 #ifdef HAVE_SYS_QUOTAS
643 struct smb2_query_quota_info;
645 NTSTATUS smbd_do_query_getinfo_quota(TALLOC_CTX *mem_ctx,
646 files_struct *fsp,
647 bool restart_scan,
648 bool return_single,
649 uint32_t sid_list_length,
650 DATA_BLOB *sidbuffer,
651 uint32_t max_data_count,
652 uint8_t **p_data,
653 uint32_t *p_data_size);
654 #endif
656 /* The following definitions come from smbd/open.c */
658 NTSTATUS smbd_check_access_rights_fsp(struct files_struct *dirfsp,
659 struct files_struct *fsp,
660 bool use_privs,
661 uint32_t access_mask);
662 NTSTATUS check_parent_access_fsp(struct files_struct *fsp,
663 uint32_t access_mask);
664 bool smbd_is_tmpname(const char *n, int *_unlink_flags);
665 NTSTATUS fd_openat(const struct files_struct *dirfsp,
666 struct smb_filename *smb_fname,
667 files_struct *fsp,
668 const struct vfs_open_how *how);
669 NTSTATUS fd_close(files_struct *fsp);
670 NTSTATUS reopen_from_fsp(struct files_struct *dirfsp,
671 struct smb_filename *smb_fname,
672 struct files_struct *fsp,
673 const struct vfs_open_how *how,
674 bool *p_file_created);
675 bool is_oplock_stat_open(uint32_t access_mask);
676 bool is_lease_stat_open(uint32_t access_mask);
677 NTSTATUS send_break_message(struct messaging_context *msg_ctx,
678 const struct file_id *id,
679 const struct share_mode_entry *exclusive,
680 uint16_t break_to);
681 struct deferred_open_record;
682 bool is_deferred_open_async(const struct deferred_open_record *rec);
683 bool defer_smb1_sharing_violation(struct smb_request *req);
684 NTSTATUS create_directory(connection_struct *conn,
685 struct smb_request *req,
686 struct files_struct *dirfsp,
687 struct smb_filename *smb_dname);
688 void msg_file_was_renamed(struct messaging_context *msg,
689 void *private_data,
690 uint32_t msg_type,
691 struct server_id server_id,
692 DATA_BLOB *data);
693 struct fsp_lease *find_fsp_lease(struct files_struct *new_fsp,
694 const struct smb2_lease_key *key,
695 uint32_t current_state,
696 uint16_t lease_version,
697 uint16_t lease_epoch);
698 NTSTATUS create_file_default(connection_struct *conn,
699 struct smb_request *req,
700 struct files_struct *dirfsp,
701 struct smb_filename * smb_fname,
702 uint32_t access_mask,
703 uint32_t share_access,
704 uint32_t create_disposition,
705 uint32_t create_options,
706 uint32_t file_attributes,
707 uint32_t oplock_request,
708 const struct smb2_lease *lease,
709 uint64_t allocation_size,
710 uint32_t private_flags,
711 struct security_descriptor *sd,
712 struct ea_list *ea_list,
713 files_struct **result,
714 int *pinfo,
715 const struct smb2_create_blobs *in_context_blobs,
716 struct smb2_create_blobs *out_context_blobs);
718 /* The following definitions come from smbd/oplock.c */
720 uint32_t get_lease_type(struct share_mode_entry *e, struct file_id id);
722 void break_kernel_oplock(struct messaging_context *msg_ctx, files_struct *fsp);
723 NTSTATUS set_file_oplock(files_struct *fsp);
724 void release_file_oplock(files_struct *fsp);
725 bool remove_oplock(files_struct *fsp);
726 bool downgrade_oplock(files_struct *fsp);
727 bool fsp_lease_update(struct files_struct *fsp);
728 const struct smb2_lease *fsp_get_smb2_lease(const struct files_struct *fsp);
729 NTSTATUS downgrade_lease(struct smbXsrv_client *client,
730 uint32_t num_file_ids,
731 const struct file_id *ids,
732 const struct smb2_lease_key *key,
733 uint32_t lease_state);
734 void contend_level2_oplocks_begin(files_struct *fsp,
735 enum level2_contention_type type);
736 void contend_level2_oplocks_end(files_struct *fsp,
737 enum level2_contention_type type);
738 void smbd_contend_level2_oplocks_begin(files_struct *fsp,
739 enum level2_contention_type type);
740 void smbd_contend_level2_oplocks_end(files_struct *fsp,
741 enum level2_contention_type type);
742 void contend_dirleases(struct connection_struct *conn,
743 const struct smb_filename *smb_fname,
744 const struct smb2_lease *lease);
745 bool init_oplocks(struct smbd_server_connection *sconn);
746 void init_kernel_oplocks(struct smbd_server_connection *sconn);
748 /* The following definitions come from smbd/oplock_linux.c */
750 int linux_set_lease_sighandler(int fd);
751 int linux_setlease(int fd, int leasetype);
752 struct kernel_oplocks *linux_init_kernel_oplocks(struct smbd_server_connection *sconn);
754 /* The following definitions come from smbd/password.c */
756 void invalidate_vuid(struct smbd_server_connection *sconn, uint64_t vuid);
757 int register_homes_share(const char *username);
759 /* The following definitions come from smbd/pipes.c */
761 NTSTATUS open_np_file(struct smb_request *smb_req, const char *name,
762 struct files_struct **pfsp);
764 /* The following definitions come from smbd/posix_acls.c */
766 mode_t unix_perms_to_acl_perms(mode_t mode, int r_mask, int w_mask, int x_mask);
767 int map_acl_perms_to_permset(mode_t mode, SMB_ACL_PERMSET_T *p_permset);
768 uint32_t map_canon_ace_perms(int snum,
769 enum security_ace_type *pacl_type,
770 mode_t perms,
771 bool directory_ace);
772 bool current_user_in_group(connection_struct *conn, gid_t gid);
773 SMB_ACL_T free_empty_sys_acl(connection_struct *conn, SMB_ACL_T the_acl);
774 NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info,
775 TALLOC_CTX *mem_ctx,
776 struct security_descriptor **ppdesc);
777 NTSTATUS chown_if_needed(files_struct *fsp, uint32_t security_info_sent,
778 const struct security_descriptor *psd,
779 bool *did_chown);
780 NTSTATUS set_nt_acl(files_struct *fsp, uint32_t security_info_sent, const struct security_descriptor *psd);
781 int get_acl_group_bits(connection_struct *conn,
782 struct files_struct *fsp,
783 mode_t *mode);
784 int inherit_access_posix_acl(connection_struct *conn,
785 struct files_struct *inherit_from_dirfsp,
786 const struct smb_filename *smb_fname,
787 mode_t mode);
788 NTSTATUS set_unix_posix_default_acl(connection_struct *conn,
789 files_struct *fsp,
790 uint16_t num_def_acls, const char *pdata);
791 NTSTATUS set_unix_posix_acl(connection_struct *conn, files_struct *fsp,
792 uint16_t num_acls,
793 const char *pdata);
794 int posix_sys_acl_blob_get_file(vfs_handle_struct *handle,
795 const struct smb_filename *smb_fname,
796 TALLOC_CTX *mem_ctx,
797 char **blob_description,
798 DATA_BLOB *blob);
799 int posix_sys_acl_blob_get_fd(vfs_handle_struct *handle,
800 files_struct *fsp,
801 TALLOC_CTX *mem_ctx,
802 char **blob_description,
803 DATA_BLOB *blob);
805 enum default_acl_style {DEFAULT_ACL_POSIX, DEFAULT_ACL_WINDOWS, DEFAULT_ACL_EVERYONE};
807 const struct enum_list *get_default_acl_style_list(void);
809 NTSTATUS make_default_filesystem_acl(
810 TALLOC_CTX *ctx,
811 enum default_acl_style acl_style,
812 const char *name,
813 const SMB_STRUCT_STAT *psbuf,
814 struct security_descriptor **ppdesc);
816 /* The following definitions come from smbd/smb2_process.c */
818 #if !defined(WITH_SMB1SERVER)
819 bool smb1_srv_send(struct smbXsrv_connection *xconn,
820 char *buffer,
821 bool do_signing,
822 uint32_t seqnum,
823 bool do_encrypt);
824 #endif
825 size_t srv_smb1_set_message(char *buf,
826 size_t num_words,
827 size_t num_bytes,
828 bool zero);
829 NTSTATUS read_packet_remainder(int fd, char *buffer,
830 unsigned int timeout, ssize_t len);
831 NTSTATUS receive_smb_talloc(TALLOC_CTX *mem_ctx,
832 struct smbXsrv_connection *xconn,
833 int sock,
834 char **buffer, unsigned int timeout,
835 size_t *p_unread, bool *p_encrypted,
836 size_t *p_len,
837 uint32_t *seqnum,
838 bool trusted_channel);
839 void remove_deferred_open_message_smb(struct smbXsrv_connection *xconn,
840 uint64_t mid);
841 bool schedule_deferred_open_message_smb(struct smbXsrv_connection *xconn,
842 uint64_t mid);
843 bool open_was_deferred(struct smbXsrv_connection *xconn, uint64_t mid);
844 bool get_deferred_open_message_state(struct smb_request *smbreq,
845 struct timeval *p_request_time,
846 struct deferred_open_record **open_rec);
847 bool push_deferred_open_message_smb(struct smb_request *req,
848 struct timeval timeout,
849 struct file_id id,
850 struct deferred_open_record *open_rec);
851 bool create_smb1_outbuf(TALLOC_CTX *mem_ctx, struct smb_request *req,
852 const uint8_t *inbuf, char **outbuf,
853 uint8_t num_words, uint32_t num_bytes);
854 void construct_smb1_reply_common_req(struct smb_request *req, char *outbuf);
855 void reply_smb1_outbuf(struct smb_request *req, uint8_t num_words, uint32_t num_bytes);
856 void process_smb(struct smbXsrv_connection *xconn,
857 uint8_t *inbuf,
858 size_t nread,
859 size_t unread_bytes,
860 uint32_t seqnum,
861 bool encrypted);
862 void smbd_process(struct tevent_context *ev_ctx,
863 struct messaging_context *msg_ctx,
864 int sock_fd,
865 bool interactive);
866 bool valid_smb1_header(const uint8_t *inbuf);
867 bool init_smb1_request(struct smb_request *req,
868 struct smbd_server_connection *sconn,
869 struct smbXsrv_connection *xconn,
870 const uint8_t *inbuf,
871 size_t unread_bytes, bool encrypted,
872 uint32_t seqnum);
874 /* The following definitions come from smbd/quotas.c */
876 bool disk_quotas(connection_struct *conn, struct smb_filename *fname,
877 uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
879 /* The following definitions come from smbd/smb2_reply.c */
881 NTSTATUS check_path_syntax(char *path, bool posix);
882 NTSTATUS smb1_strip_dfs_path(TALLOC_CTX *mem_ctx,
883 uint32_t *ucf_flags,
884 char **in_path);
885 NTSTATUS smb2_strip_dfs_path(const char *in_path, const char **out_path);
886 size_t srvstr_get_path(TALLOC_CTX *ctx,
887 const char *inbuf,
888 uint16_t smb_flags2,
889 char **pp_dest,
890 const char *src,
891 size_t src_len,
892 int flags,
893 NTSTATUS *err);
894 size_t srvstr_get_path_posix(TALLOC_CTX *ctx,
895 const char *inbuf,
896 uint16_t smb_flags2,
897 char **pp_dest,
898 const char *src,
899 size_t src_len,
900 int flags,
901 NTSTATUS *err);
902 size_t srvstr_get_path_req(TALLOC_CTX *mem_ctx, struct smb_request *req,
903 char **pp_dest, const char *src, int flags,
904 NTSTATUS *err);
905 size_t srvstr_pull_req_talloc(TALLOC_CTX *ctx, struct smb_request *req,
906 char **dest, const uint8_t *src, int flags);
907 bool check_fsp_open(connection_struct *conn, struct smb_request *req,
908 files_struct *fsp);
909 bool check_fsp(connection_struct *conn, struct smb_request *req,
910 files_struct *fsp);
911 bool check_fsp_ntquota_handle(connection_struct *conn, struct smb_request *req,
912 files_struct *fsp);
913 void reply_special(struct smbXsrv_connection *xconn, char *inbuf, size_t inbuf_size);
914 NTSTATUS unlink_internals(connection_struct *conn,
915 struct smb_request *req,
916 uint32_t dirtype,
917 struct files_struct *dirfsp,
918 struct smb_filename *smb_fname);
919 ssize_t fake_sendfile(struct smbXsrv_connection *xconn, files_struct *fsp,
920 off_t startpos, size_t nread);
921 ssize_t sendfile_short_send(struct smbXsrv_connection *xconn,
922 files_struct *fsp,
923 ssize_t nread,
924 size_t headersize,
925 size_t smb_maxcnt);
926 NTSTATUS rename_internals_fsp(connection_struct *conn,
927 files_struct *fsp,
928 struct share_mode_lock **lck,
929 struct smb_filename *smb_fname_dst_in,
930 const char *dst_original_lcomp,
931 uint32_t attrs,
932 bool replace_if_exists);
933 NTSTATUS rename_internals(TALLOC_CTX *ctx,
934 connection_struct *conn,
935 struct smb_request *req,
936 struct files_struct *src_dirfsp,
937 struct smb_filename *smb_fname_src,
938 struct smb_filename *smb_fname_dst,
939 const char *dst_original_lcomp,
940 uint32_t attrs,
941 bool replace_if_exists,
942 uint32_t access_mask);
943 NTSTATUS copy_file(TALLOC_CTX *ctx,
944 connection_struct *conn,
945 struct smb_filename *smb_fname_src,
946 struct smb_filename *smb_fname_dst,
947 uint32_t new_create_disposition);
948 uint64_t get_lock_offset(const uint8_t *data, int data_offset,
949 bool large_file_format);
951 /* The following definitions come from smbd/seal.c */
953 bool is_encrypted_packet(const uint8_t *inbuf);
954 void srv_free_enc_buffer(struct smbXsrv_connection *xconn, char *buf);
955 NTSTATUS srv_decrypt_buffer(struct smbXsrv_connection *xconn, char *buf);
956 NTSTATUS srv_encrypt_buffer(struct smbXsrv_connection *xconn, char *buf,
957 char **buf_out);
958 NTSTATUS srv_request_encryption_setup(connection_struct *conn,
959 unsigned char **ppdata,
960 size_t *p_data_size,
961 unsigned char **pparam,
962 size_t *p_param_size);
963 NTSTATUS srv_encryption_start(connection_struct *conn);
964 void server_encryption_shutdown(struct smbXsrv_connection *xconn);
966 /* The following definitions come from smbd/sec_ctx.c */
968 bool unix_token_equal(const struct security_unix_token *t1, const struct security_unix_token *t2);
969 bool push_sec_ctx(void);
970 void set_sec_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups, const struct security_token *token);
971 void set_root_sec_ctx(void);
972 bool pop_sec_ctx(void);
973 void init_sec_ctx(void);
974 const struct security_token *sec_ctx_active_token(void);
976 /* The following definitions come from smbd/server.c */
978 struct memcache *smbd_memcache(void);
979 bool snum_is_shared_printer(int snum);
980 void delete_and_reload_printers(void);
981 bool reload_services(struct smbd_server_connection *sconn,
982 bool (*snumused) (struct smbd_server_connection *, int),
983 bool test);
985 /* The following definitions come from smbd/server_exit.c */
987 void smbd_exit_server(const char *reason) _NORETURN_;
988 void smbd_exit_server_cleanly(const char *const reason) _NORETURN_;
990 /* The following definitions come from smbd/smb2_service.c */
992 bool set_conn_connectpath(connection_struct *conn, const char *connectpath);
993 bool canonicalize_connect_path(connection_struct *conn);
994 NTSTATUS set_conn_force_user_group(connection_struct *conn, int snum);
995 bool chdir_current_service(connection_struct *conn);
996 void load_registry_shares(void);
997 int add_home_service(const char *service, const char *username, const char *homedir);
998 int find_service(TALLOC_CTX *ctx, const char *service, char **p_service_out);
999 connection_struct *make_connection_smb2(struct smbd_smb2_request *req,
1000 struct smbXsrv_tcon *tcon,
1001 int snum,
1002 const char *pdev,
1003 NTSTATUS *pstatus);
1004 NTSTATUS make_connection_snum(struct smbXsrv_connection *xconn,
1005 connection_struct *conn,
1006 int snum,
1007 struct smbXsrv_session *session,
1008 const char *pdev);
1009 void close_cnum(connection_struct *conn,
1010 uint64_t vuid,
1011 enum file_close_type close_type);
1013 /* The following definitions come from smbd/session.c */
1014 struct sessionid;
1015 struct smbXsrv_session;
1016 bool session_init(void);
1017 bool session_claim(struct smbXsrv_session *session);
1018 void session_yield(struct smbXsrv_session *session);
1019 int list_sessions(TALLOC_CTX *mem_ctx, struct sessionid **session_list);
1020 int find_sessions(TALLOC_CTX *mem_ctx, const char *username,
1021 const char *machine, struct sessionid **session_list);
1023 /* The following definitions come from smbd/share_access.c */
1025 bool token_contains_name_in_list(const char *username,
1026 const char *domain,
1027 const char *sharename,
1028 const struct security_token *token,
1029 const char **list,
1030 bool *match);
1031 bool user_ok_token(const char *username, const char *domain,
1032 const struct security_token *token, int snum);
1033 bool is_share_read_only_for_token(const char *username,
1034 const char *domain,
1035 const struct security_token *token,
1036 connection_struct *conn,
1037 bool *_read_only);
1039 /* The following definitions come from smbd/srvstr.c */
1041 NTSTATUS srvstr_push_fn(const char *base_ptr, uint16_t smb_flags2, void *dest,
1042 const char *src, int dest_len, int flags, size_t *ret_len);
1044 /* The following definitions come from smbd/statvfs.c */
1046 int sys_statvfs(const char *path, struct vfs_statvfs_struct *statbuf);
1048 /* The following definitions come from smbd/trans2.c */
1050 char *store_file_unix_basic(connection_struct *conn,
1051 char *pdata,
1052 files_struct *fsp,
1053 const SMB_STRUCT_STAT *psbuf);
1054 char *store_file_unix_basic_info2(connection_struct *conn,
1055 char *pdata,
1056 files_struct *fsp,
1057 const SMB_STRUCT_STAT *psbuf);
1058 NTSTATUS smb_check_file_disposition_info(struct files_struct *fsp,
1059 const char *data,
1060 int total_data,
1061 bool *_delete_on_close);
1062 NTSTATUS smb_set_file_disposition_info(connection_struct *conn,
1063 const char *pdata,
1064 int total_data,
1065 files_struct *fsp,
1066 struct smb_filename *smb_fname);
1067 bool refuse_symlink_fsp(const struct files_struct *fsp);
1068 NTSTATUS check_any_access_fsp(struct files_struct *fsp,
1069 uint32_t access_requested);
1070 uint64_t smb_roundup(connection_struct *conn, uint64_t val);
1071 bool samba_private_attr_name(const char *unix_ea_name);
1072 int get_ea_value_fsp(TALLOC_CTX *mem_ctx,
1073 files_struct *fsp,
1074 const char *ea_name,
1075 struct ea_struct *pea);
1076 NTSTATUS get_ea_names_from_fsp(TALLOC_CTX *mem_ctx,
1077 files_struct *fsp,
1078 char ***pnames,
1079 size_t *pnum_names);
1080 NTSTATUS set_ea(connection_struct *conn, files_struct *fsp,
1081 struct ea_list *ea_list);
1082 unsigned char *create_volume_objectid(connection_struct *conn, unsigned char objid[16]);
1083 NTSTATUS hardlink_internals(TALLOC_CTX *ctx,
1084 connection_struct *conn,
1085 struct smb_request *req,
1086 bool overwrite_if_exists,
1087 const struct smb_filename *smb_fname_old,
1088 struct smb_filename *smb_fname_new);
1089 NTSTATUS smb_set_file_time(connection_struct *conn,
1090 files_struct *fsp,
1091 struct smb_filename *smb_fname,
1092 struct smb_file_time *ft,
1093 bool setting_write_time);
1094 NTSTATUS smb_set_file_size(connection_struct *conn,
1095 struct smb_request *req,
1096 files_struct *fsp,
1097 struct smb_filename *smb_fname,
1098 const SMB_STRUCT_STAT *psbuf,
1099 off_t size,
1100 bool fail_after_createfile);
1102 bool map_info2_flags_to_sbuf(const SMB_STRUCT_STAT *psbuf,
1103 const uint32_t smb_fflags,
1104 const uint32_t smb_fmask,
1105 int *stat_fflags);
1107 NTSTATUS unix_perms_from_wire(connection_struct *conn,
1108 const SMB_STRUCT_STAT *psbuf,
1109 uint32_t perms,
1110 mode_t *ret_perms);
1111 struct ea_list *read_ea_list(TALLOC_CTX *ctx, const char *pdata,
1112 size_t data_size);
1113 unsigned int estimate_ea_size(files_struct *fsp);
1114 NTSTATUS smb_set_fsquota(connection_struct *conn,
1115 struct smb_request *req,
1116 files_struct *fsp,
1117 const DATA_BLOB *qdata);
1119 NTSTATUS smb2_parse_file_rename_information(TALLOC_CTX *ctx,
1120 struct connection_struct *conn,
1121 struct smb_request *req,
1122 const char *pdata,
1123 int total_data,
1124 files_struct *fsp,
1125 struct smb_filename *smb_fname_src,
1126 bool *overwrite,
1127 struct files_struct **_dst_dirfsp,
1128 struct smb_filename **_smb_fname_dst,
1129 char **_dst_original_lcomp);
1131 /* The following definitions come from smbd/uid.c */
1133 bool change_to_guest(void);
1134 NTSTATUS check_user_share_access(connection_struct *conn,
1135 const struct auth_session_info *session_info,
1136 uint32_t *p_share_access,
1137 bool *p_readonly_share);
1138 bool change_to_user_and_service(connection_struct *conn, uint64_t vuid);
1139 bool change_to_user_and_service_by_fsp(struct files_struct *fsp);
1140 bool smbd_change_to_root_user(void);
1141 bool smbd_become_authenticated_pipe_user(struct auth_session_info *session_info);
1142 bool smbd_unbecome_authenticated_pipe_user(void);
1143 void become_root(void);
1144 void unbecome_root(void);
1145 void smbd_become_root(void);
1146 void smbd_unbecome_root(void);
1147 bool become_user_without_service(connection_struct *conn, uint64_t vuid);
1148 bool become_user_without_service_by_fsp(struct files_struct *fsp);
1149 bool become_user_without_service_by_session(connection_struct *conn,
1150 const struct auth_session_info *session_info);
1151 bool unbecome_user_without_service(void);
1152 uid_t get_current_uid(connection_struct *conn);
1153 gid_t get_current_gid(connection_struct *conn);
1154 const struct security_unix_token *get_current_utok(connection_struct *conn);
1155 const struct security_token *get_current_nttok(connection_struct *conn);
1157 /* The following definitions come from smbd/utmp.c */
1159 void sys_utmp_claim(const char *username, const char *hostname,
1160 const char *id_str, int id_num);
1161 void sys_utmp_yield(const char *username, const char *hostname,
1162 const char *id_str, int id_num);
1164 /* The following definitions come from smbd/vfs.c */
1166 bool vfs_init_custom(connection_struct *conn, const char *vfs_object);
1167 bool smbd_vfs_init(connection_struct *conn);
1168 bool vfs_valid_pread_range(off_t offset, size_t length);
1169 bool vfs_valid_pwrite_range(const struct files_struct *fsp,
1170 off_t offset,
1171 size_t length);
1172 bool vfs_valid_allocation_range(off_t offset, size_t length);
1173 ssize_t vfs_pwrite_data(struct smb_request *req,
1174 files_struct *fsp,
1175 const char *buffer,
1176 size_t N,
1177 off_t offset);
1178 int vfs_allocate_file_space(files_struct *fsp, uint64_t len);
1179 int vfs_set_filelen(files_struct *fsp, off_t len);
1180 int vfs_slow_fallocate(files_struct *fsp, off_t offset, off_t len);
1181 int vfs_fill_sparse(files_struct *fsp, off_t len);
1182 int vfs_set_blocking(files_struct *fsp, bool set);
1183 off_t vfs_transfer_file(files_struct *in, files_struct *out, off_t n);
1184 const char *vfs_readdirname(connection_struct *conn,
1185 struct files_struct *dirfsp,
1186 DIR *d,
1187 char **talloced);
1188 int vfs_ChDir(connection_struct *conn,
1189 const struct smb_filename *smb_fname);
1190 struct smb_filename *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn);
1191 int vfs_stat(struct connection_struct *conn,
1192 struct smb_filename *smb_fname);
1193 int vfs_stat_smb_basename(struct connection_struct *conn,
1194 const struct smb_filename *smb_fname_in,
1195 SMB_STRUCT_STAT *psbuf);
1196 NTSTATUS vfs_stat_fsp(files_struct *fsp);
1197 NTSTATUS vfs_fstreaminfo(struct files_struct *fsp,
1198 TALLOC_CTX *mem_ctx,
1199 unsigned int *num_streams,
1200 struct stream_struct **streams);
1201 void init_smb_file_time(struct smb_file_time *ft);
1202 int vfs_fake_fd(void);
1203 int vfs_fake_fd_close(int fd);
1204 uint32_t vfs_get_fs_capabilities(struct connection_struct *conn,
1205 enum timestamp_set_resolution *ts_res);
1207 /* The following definitions come from smbd/avahi_register.c */
1209 void *avahi_start_register(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
1210 uint16_t port);
1212 /* The following definitions come from smbd/smb2_create.c */
1214 NTSTATUS vfs_default_durable_cookie(struct files_struct *fsp,
1215 TALLOC_CTX *mem_ctx,
1216 DATA_BLOB *cookie_blob);
1217 NTSTATUS vfs_default_durable_disconnect(struct files_struct *fsp,
1218 const DATA_BLOB old_cookie,
1219 TALLOC_CTX *mem_ctx,
1220 DATA_BLOB *new_cookie);
1221 NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn,
1222 struct smb_request *smb1req,
1223 struct smbXsrv_open *op,
1224 const DATA_BLOB old_cookie,
1225 TALLOC_CTX *mem_ctx,
1226 files_struct **result,
1227 DATA_BLOB *new_cookie);
1229 struct smb3_file_posix_information;
1230 NTSTATUS smb3_file_posix_information_init(
1231 connection_struct *conn,
1232 const struct smb_filename *smb_fname,
1233 uint32_t dos_attributes,
1234 struct smb3_file_posix_information *dst);
1236 struct tevent_req *delay_for_handle_lease_break_send(
1237 TALLOC_CTX *mem_ctx,
1238 struct tevent_context *ev,
1239 struct timeval timeout,
1240 struct files_struct *fsp,
1241 bool recursive,
1242 struct share_mode_lock **lck);
1244 NTSTATUS delay_for_handle_lease_break_recv(struct tevent_req *req,
1245 TALLOC_CTX *mem_ctx,
1246 struct share_mode_lock **lck);
1248 #endif /* _SMBD_PROTO_H_ */