source: vendor/current/source3/smbd/proto.h

Last change on this file was 989, checked in by Silvan Scherrer, 9 years ago

Samba Server: update vendor to version 4.4.7

File size: 48.9 KB
Line 
1/*
2 * Unix SMB/CIFS implementation.
3 * Main SMB server routines
4 *
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
31 *
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.
36 *
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.
41 *
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/>.
44 */
45
46#ifndef _SMBD_PROTO_H_
47#define _SMBD_PROTO_H_
48
49/* The following definitions come from smbd/signing.c */
50
51struct smbXsrv_connection;
52
53bool srv_check_sign_mac(struct smbXsrv_connection *conn,
54 const char *inbuf, uint32_t *seqnum, bool trusted_channel);
55void srv_calculate_sign_mac(struct smbXsrv_connection *conn,
56 char *outbuf, uint32_t seqnum);
57void srv_cancel_sign_response(struct smbXsrv_connection *conn);
58bool srv_init_signing(struct smbXsrv_connection *conn);
59void srv_set_signing_negotiated(struct smbXsrv_connection *conn,
60 bool allowed, bool mandatory);
61bool srv_is_signing_active(struct smbXsrv_connection *conn);
62bool srv_is_signing_negotiated(struct smbXsrv_connection *conn);
63void srv_set_signing(struct smbXsrv_connection *conn,
64 const DATA_BLOB user_session_key,
65 const DATA_BLOB response);
66
67/* The following definitions come from smbd/aio.c */
68
69int get_outstanding_aio_calls(void);
70void increment_outstanding_aio_calls(void);
71void decrement_outstanding_aio_calls(void);
72struct aio_extra;
73bool aio_write_through_requested(struct aio_extra *aio_ex);
74NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
75 struct smb_request *req,
76 files_struct *fsp, off_t startpos,
77 size_t smb_maxcnt);
78NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
79 struct smb_request *req,
80 files_struct *fsp, const char *data,
81 off_t startpos,
82 size_t numtowrite);
83NTSTATUS schedule_smb2_aio_read(connection_struct *conn,
84 struct smb_request *smbreq,
85 files_struct *fsp,
86 TALLOC_CTX *ctx,
87 DATA_BLOB *preadbuf,
88 off_t startpos,
89 size_t smb_maxcnt);
90NTSTATUS schedule_aio_smb2_write(connection_struct *conn,
91 struct smb_request *smbreq,
92 files_struct *fsp,
93 uint64_t in_offset,
94 DATA_BLOB in_data,
95 bool write_through);
96bool cancel_smb2_aio(struct smb_request *smbreq);
97bool aio_add_req_to_fsp(files_struct *fsp, struct tevent_req *req);
98
99/* The following definitions come from smbd/blocking.c */
100
101void brl_timeout_fn(struct tevent_context *event_ctx,
102 struct tevent_timer *te,
103 struct timeval now,
104 void *private_data);
105struct timeval timeval_brl_min(const struct timeval *tv1,
106 const struct timeval *tv2);
107void process_blocking_lock_queue(struct smbd_server_connection *sconn);
108bool push_blocking_lock_request( struct byte_range_lock *br_lck,
109 struct smb_request *req,
110 files_struct *fsp,
111 int lock_timeout,
112 int lock_num,
113 uint64_t smblctx,
114 enum brl_type lock_type,
115 enum brl_flavour lock_flav,
116 uint64_t offset,
117 uint64_t count,
118 uint64_t blocking_smblctx);
119void smbd_cancel_pending_lock_requests_by_fid(files_struct *fsp,
120 struct byte_range_lock *br_lck,
121 enum file_close_type close_type);
122void cancel_pending_lock_requests_by_fid(files_struct *fsp,
123 struct byte_range_lock *br_lck,
124 enum file_close_type close_type);
125void remove_pending_lock_requests_by_mid_smb1(
126 struct smbd_server_connection *sconn, uint64_t mid);
127bool blocking_lock_was_deferred_smb1(
128 struct smbd_server_connection *sconn, uint64_t mid);
129struct blocking_lock_record *blocking_lock_cancel_smb1(files_struct *fsp,
130 uint64_t smblctx,
131 uint64_t offset,
132 uint64_t count,
133 enum brl_flavour lock_flav,
134 unsigned char locktype,
135 NTSTATUS err);
136
137/* The following definitions come from smbd/close.c */
138
139void set_close_write_time(struct files_struct *fsp, struct timespec ts);
140NTSTATUS close_file(struct smb_request *req, files_struct *fsp,
141 enum file_close_type close_type);
142void msg_close_file(struct messaging_context *msg_ctx,
143 void *private_data,
144 uint32_t msg_type,
145 struct server_id server_id,
146 DATA_BLOB *data);
147NTSTATUS delete_all_streams(connection_struct *conn, const char *fname);
148bool recursive_rmdir(TALLOC_CTX *ctx,
149 connection_struct *conn,
150 struct smb_filename *smb_dname);
151
152/* The following definitions come from smbd/conn.c */
153
154int conn_num_open(struct smbd_server_connection *sconn);
155bool conn_snum_used(struct smbd_server_connection *sconn, int snum);
156connection_struct *conn_new(struct smbd_server_connection *sconn);
157bool conn_idle_all(struct smbd_server_connection *sconn, time_t t);
158void conn_clear_vuid_caches(struct smbd_server_connection *sconn, uint64_t vuid);
159void conn_free(connection_struct *conn);
160void conn_force_tdis(struct smbd_server_connection *sconn, const char *sharename);
161void msg_force_tdis(struct messaging_context *msg,
162 void *private_data,
163 uint32_t msg_type,
164 struct server_id server_id,
165 DATA_BLOB *data);
166
167/* The following definitions come from smbd/connection.c */
168
169int count_current_connections(const char *sharename, bool verify);
170bool connections_snum_used(struct smbd_server_connection *unused, int snum);
171
172/* The following definitions come from smbd/dfree.c */
173
174uint64_t sys_disk_free(connection_struct *conn, struct smb_filename *fname,
175 uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
176uint64_t get_dfree_info(connection_struct *conn, struct smb_filename *fname,
177 uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
178
179/* The following definitions come from smbd/dir.c */
180
181bool init_dptrs(struct smbd_server_connection *sconn);
182const char *dptr_path(struct smbd_server_connection *sconn, int key);
183const char *dptr_wcard(struct smbd_server_connection *sconn, int key);
184uint16_t dptr_attr(struct smbd_server_connection *sconn, int key);
185void dptr_close(struct smbd_server_connection *sconn, int *key);
186void dptr_closecnum(connection_struct *conn);
187void dptr_idlecnum(connection_struct *conn);
188void dptr_closepath(struct smbd_server_connection *sconn,
189 char *path,uint16_t spid);
190NTSTATUS dptr_create(connection_struct *conn,
191 struct smb_request *req,
192 files_struct *fsp,
193 const char *path, bool old_handle, bool expect_close,uint16_t spid,
194 const char *wcard, bool wcard_has_wild, uint32_t attr, struct dptr_struct **dptr_ret);
195void dptr_CloseDir(files_struct *fsp);
196void dptr_SeekDir(struct dptr_struct *dptr, long offset);
197long dptr_TellDir(struct dptr_struct *dptr);
198bool dptr_has_wild(struct dptr_struct *dptr);
199int dptr_dnum(struct dptr_struct *dptr);
200bool dptr_get_priv(struct dptr_struct *dptr);
201void dptr_set_priv(struct dptr_struct *dptr);
202bool dptr_SearchDir(struct dptr_struct *dptr, const char *name, long *poffset, SMB_STRUCT_STAT *pst);
203void dptr_init_search_op(struct dptr_struct *dptr);
204bool dptr_fill(struct smbd_server_connection *sconn,
205 char *buf1,unsigned int key);
206struct dptr_struct *dptr_fetch(struct smbd_server_connection *sconn,
207 char *buf,int *num);
208struct dptr_struct *dptr_fetch_lanman2(struct smbd_server_connection *sconn,
209 int dptr_num);
210bool get_dir_entry(TALLOC_CTX *ctx,
211 struct dptr_struct *dirptr,
212 const char *mask,
213 uint32_t dirtype,
214 char **pp_fname_out,
215 off_t *size,
216 uint32_t *mode,
217 struct timespec *date,
218 bool check_descend,
219 bool ask_sharemode);
220bool is_visible_file(connection_struct *conn, const char *dir_path, const char *name, SMB_STRUCT_STAT *pst, bool use_veto);
221struct smb_Dir *OpenDir(TALLOC_CTX *mem_ctx, connection_struct *conn,
222 const char *name, const char *mask, uint32_t attr);
223const char *ReadDirName(struct smb_Dir *dirp, long *poffset,
224 SMB_STRUCT_STAT *sbuf, char **talloced);
225void RewindDir(struct smb_Dir *dirp, long *poffset);
226void SeekDir(struct smb_Dir *dirp, long offset);
227long TellDir(struct smb_Dir *dirp);
228bool SearchDir(struct smb_Dir *dirp, const char *name, long *poffset);
229NTSTATUS can_delete_directory(struct connection_struct *conn,
230 const char *dirname);
231bool have_file_open_below(connection_struct *conn,
232 const struct smb_filename *name);
233
234/* The following definitions come from smbd/dmapi.c */
235
236const void *dmapi_get_current_session(void);
237bool dmapi_have_session(void);
238bool dmapi_new_session(void);
239bool dmapi_destroy_session(void);
240uint32_t dmapi_file_flags(const char * const path);
241
242/* The following definitions come from smbd/dnsregister.c */
243
244bool smbd_setup_mdns_registration(struct tevent_context *ev,
245 TALLOC_CTX *mem_ctx,
246 uint16_t port);
247
248/* The following definitions come from smbd/dosmode.c */
249
250mode_t unix_mode(connection_struct *conn, int dosmode,
251 const struct smb_filename *smb_fname,
252 const char *inherit_from_dir);
253uint32_t dos_mode_msdfs(connection_struct *conn,
254 const struct smb_filename *smb_fname);
255int dos_attributes_to_stat_dos_flags(uint32_t dosmode);
256uint32_t dos_mode(connection_struct *conn, struct smb_filename *smb_fname);
257int file_set_dosmode(connection_struct *conn, struct smb_filename *smb_fname,
258 uint32_t dosmode, const char *parent_dir, bool newfile);
259bool get_ea_dos_attribute(connection_struct *conn,
260 struct smb_filename *smb_fname,
261 uint32_t *pattr);
262NTSTATUS file_set_sparse(connection_struct *conn,
263 struct files_struct *fsp,
264 bool sparse);
265int file_ntimes(connection_struct *conn, const struct smb_filename *smb_fname,
266 struct smb_file_time *ft);
267bool set_sticky_write_time_path(struct file_id fileid, struct timespec mtime);
268bool set_sticky_write_time_fsp(struct files_struct *fsp,
269 struct timespec mtime);
270
271NTSTATUS set_create_timespec_ea(connection_struct *conn,
272 const struct smb_filename *smb_fname,
273 struct timespec create_time);
274
275struct timespec get_create_timespec(connection_struct *conn,
276 struct files_struct *fsp,
277 const struct smb_filename *smb_fname);
278
279struct timespec get_change_timespec(connection_struct *conn,
280 struct files_struct *fsp,
281 const struct smb_filename *smb_fname);
282
283/* The following definitions come from smbd/error.c */
284
285bool use_nt_status(void);
286void error_packet_set(char *outbuf, uint8_t eclass, uint32_t ecode, NTSTATUS ntstatus, int line, const char *file);
287int error_packet(char *outbuf, uint8_t eclass, uint32_t ecode, NTSTATUS ntstatus, int line, const char *file);
288void reply_nt_error(struct smb_request *req, NTSTATUS ntstatus,
289 int line, const char *file);
290void reply_force_dos_error(struct smb_request *req, uint8_t eclass, uint32_t ecode,
291 int line, const char *file);
292void reply_both_error(struct smb_request *req, uint8_t eclass, uint32_t ecode,
293 NTSTATUS status, int line, const char *file);
294void reply_openerror(struct smb_request *req, NTSTATUS status);
295
296/* The following definitions come from smbd/file_access.c */
297
298bool can_delete_file_in_directory(connection_struct *conn,
299 const struct smb_filename *smb_fname);
300bool can_write_to_file(connection_struct *conn,
301 const struct smb_filename *smb_fname);
302bool directory_has_default_acl(connection_struct *conn, const char *fname);
303NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32_t dosmode);
304
305/* The following definitions come from smbd/fileio.c */
306
307ssize_t read_file(files_struct *fsp,char *data,off_t pos,size_t n);
308void update_write_time_handler(struct tevent_context *ctx,
309 struct tevent_timer *te,
310 struct timeval now,
311 void *private_data);
312void trigger_write_time_update(struct files_struct *fsp);
313void trigger_write_time_update_immediate(struct files_struct *fsp);
314void mark_file_modified(files_struct *fsp);
315ssize_t write_file(struct smb_request *req,
316 files_struct *fsp,
317 const char *data,
318 off_t pos,
319 size_t n);
320void delete_write_cache(files_struct *fsp);
321void set_filelen_write_cache(files_struct *fsp, off_t file_size);
322ssize_t flush_write_cache(files_struct *fsp, enum flush_reason_enum reason);
323NTSTATUS sync_file(connection_struct *conn, files_struct *fsp, bool write_through);
324int fsp_stat(files_struct *fsp);
325
326/* The following definitions come from smbd/filename.c */
327
328NTSTATUS unix_convert(TALLOC_CTX *ctx,
329 connection_struct *conn,
330 const char *orig_path,
331 struct smb_filename **smb_fname,
332 uint32_t ucf_flags);
333NTSTATUS check_name(connection_struct *conn, const char *name);
334int get_real_filename(connection_struct *conn, const char *path,
335 const char *name, TALLOC_CTX *mem_ctx,
336 char **found_name);
337NTSTATUS filename_convert(TALLOC_CTX *mem_ctx,
338 connection_struct *conn,
339 bool dfs_path,
340 const char *name_in,
341 uint32_t ucf_flags,
342 bool *ppath_contains_wcard,
343 struct smb_filename **pp_smb_fname);
344NTSTATUS filename_convert_with_privilege(TALLOC_CTX *mem_ctx,
345 connection_struct *conn,
346 struct smb_request *smbreq,
347 const char *name_in,
348 uint32_t ucf_flags,
349 bool *ppath_contains_wcard,
350 struct smb_filename **pp_smb_fname);
351
352/* The following definitions come from smbd/files.c */
353
354NTSTATUS fsp_new(struct connection_struct *conn, TALLOC_CTX *mem_ctx,
355 files_struct **result);
356NTSTATUS file_new(struct smb_request *req, connection_struct *conn,
357 files_struct **result);
358void file_close_conn(connection_struct *conn);
359void file_close_pid(struct smbd_server_connection *sconn, uint16_t smbpid,
360 uint64_t vuid);
361bool file_init_global(void);
362bool file_init(struct smbd_server_connection *sconn);
363void file_close_user(struct smbd_server_connection *sconn, uint64_t vuid);
364struct files_struct *files_forall(
365 struct smbd_server_connection *sconn,
366 struct files_struct *(*fn)(struct files_struct *fsp,
367 void *private_data),
368 void *private_data);
369files_struct *file_find_fd(struct smbd_server_connection *sconn, int fd);
370files_struct *file_find_dif(struct smbd_server_connection *sconn,
371 struct file_id id, unsigned long gen_id);
372files_struct *file_find_di_first(struct smbd_server_connection *sconn,
373 struct file_id id);
374files_struct *file_find_di_next(files_struct *start_fsp);
375struct files_struct *file_find_one_fsp_from_lease_key(
376 struct smbd_server_connection *sconn,
377 const struct smb2_lease_key *lease_key);
378bool file_find_subpath(files_struct *dir_fsp);
379void file_sync_all(connection_struct *conn);
380void fsp_free(files_struct *fsp);
381void file_free(struct smb_request *req, files_struct *fsp);
382files_struct *file_fsp(struct smb_request *req, uint16_t fid);
383struct files_struct *file_fsp_get(struct smbd_smb2_request *smb2req,
384 uint64_t persistent_id,
385 uint64_t volatile_id);
386struct files_struct *file_fsp_smb2(struct smbd_smb2_request *smb2req,
387 uint64_t persistent_id,
388 uint64_t volatile_id);
389NTSTATUS dup_file_fsp(struct smb_request *req, files_struct *from,
390 uint32_t access_mask, uint32_t share_access,
391 uint32_t create_options, files_struct *to);
392NTSTATUS file_name_hash(connection_struct *conn,
393 const char *name, uint32_t *p_name_hash);
394NTSTATUS fsp_set_smb_fname(struct files_struct *fsp,
395 const struct smb_filename *smb_fname_in);
396const struct GUID *fsp_client_guid(const files_struct *fsp);
397uint32_t fsp_lease_type(struct files_struct *fsp);
398
399/* The following definitions come from smbd/ipc.c */
400
401NTSTATUS nt_status_np_pipe(NTSTATUS status);
402void send_trans_reply(connection_struct *conn,
403 struct smb_request *req,
404 char *rparam, int rparam_len,
405 char *rdata, int rdata_len,
406 bool buffer_too_large);
407void reply_trans(struct smb_request *req);
408void reply_transs(struct smb_request *req);
409
410/* The following definitions come from smbd/lanman.c */
411
412void api_reply(connection_struct *conn, uint64_t vuid,
413 struct smb_request *req,
414 char *data, char *params,
415 int tdscnt, int tpscnt,
416 int mdrcnt, int mprcnt);
417
418/* The following definitions come from smbd/mangle.c */
419
420void mangle_reset_cache(void);
421void mangle_change_to_posix(void);
422bool mangle_is_mangled(const char *s, const struct share_params *p);
423bool mangle_is_8_3(const char *fname, bool check_case,
424 const struct share_params *p);
425bool mangle_is_8_3_wildcards(const char *fname, bool check_case,
426 const struct share_params *p);
427bool mangle_must_mangle(const char *fname,
428 const struct share_params *p);
429bool mangle_lookup_name_from_8_3(TALLOC_CTX *ctx,
430 const char *in,
431 char **out, /* talloced on the given context. */
432 const struct share_params *p);
433bool name_to_8_3(const char *in,
434 char out[13],
435 bool cache83,
436 const struct share_params *p);
437
438/* The following definitions come from smbd/mangle_hash.c */
439
440const struct mangle_fns *mangle_hash_init(void);
441
442/* The following definitions come from smbd/mangle_hash2.c */
443
444const struct mangle_fns *mangle_hash2_init(void);
445const struct mangle_fns *posix_mangle_init(void);
446
447/* The following definitions come from smbd/message.c */
448
449void reply_sends(struct smb_request *req);
450void reply_sendstrt(struct smb_request *req);
451void reply_sendtxt(struct smb_request *req);
452void reply_sendend(struct smb_request *req);
453
454/* The following definitions come from smbd/msdfs.c */
455
456bool is_msdfs_link(connection_struct *conn,
457 const char *path,
458 SMB_STRUCT_STAT *sbufp);
459struct junction_map;
460NTSTATUS get_referred_path(TALLOC_CTX *ctx,
461 const char *dfs_path,
462 bool allow_broken_path,
463 struct junction_map *jucn,
464 int *consumedcntp,
465 bool *self_referralp);
466int setup_dfs_referral(connection_struct *orig_conn,
467 const char *dfs_path,
468 int max_referral_level,
469 char **ppdata, NTSTATUS *pstatus);
470bool create_junction(TALLOC_CTX *ctx,
471 const char *dfs_path,
472 bool allow_broken_path,
473 struct junction_map *jucn);
474bool create_msdfs_link(const struct junction_map *jucn);
475bool remove_msdfs_link(const struct junction_map *jucn);
476struct junction_map *enum_msdfs_links(TALLOC_CTX *ctx, size_t *p_num_jn);
477NTSTATUS resolve_dfspath_wcard(TALLOC_CTX *ctx,
478 connection_struct *conn,
479 bool dfs_pathnames,
480 const char *name_in,
481 bool allow_wcards,
482 bool allow_broken_path,
483 char **pp_name_out,
484 bool *ppath_contains_wcard);
485NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
486 struct tevent_context *ev,
487 struct messaging_context *msg,
488 connection_struct **pconn,
489 int snum,
490 const char *path,
491 const struct auth_session_info *session_info);
492NTSTATUS create_conn_struct_cwd(TALLOC_CTX *ctx,
493 struct tevent_context *ev,
494 struct messaging_context *msg,
495 connection_struct **pconn,
496 int snum,
497 const char *path,
498 const struct auth_session_info *session_info,
499 char **poldcwd);
500
501/* The following definitions come from smbd/negprot.c */
502
503void reply_negprot(struct smb_request *req);
504
505/* The following definitions come from smbd/notify.c */
506
507bool change_notify_fsp_has_changes(struct files_struct *fsp);
508void change_notify_reply(struct smb_request *req,
509 NTSTATUS error_code,
510 uint32_t max_param,
511 struct notify_change_buf *notify_buf,
512 void (*reply_fn)(struct smb_request *req,
513 NTSTATUS error_code,
514 uint8_t *buf, size_t len));
515NTSTATUS change_notify_create(struct files_struct *fsp, uint32_t filter,
516 bool recursive);
517NTSTATUS change_notify_add_request(struct smb_request *req,
518 uint32_t max_param,
519 uint32_t filter, bool recursive,
520 struct files_struct *fsp,
521 void (*reply_fn)(struct smb_request *req,
522 NTSTATUS error_code,
523 uint8_t *buf, size_t len));
524void smbd_notify_cancel_deleted(struct messaging_context *msg,
525 void *private_data, uint32_t msg_type,
526 struct server_id server_id, DATA_BLOB *data);
527void remove_pending_change_notify_requests_by_mid(
528 struct smbd_server_connection *sconn, uint64_t mid);
529void remove_pending_change_notify_requests_by_fid(files_struct *fsp,
530 NTSTATUS status);
531void notify_fname(connection_struct *conn, uint32_t action, uint32_t filter,
532 const char *path);
533char *notify_filter_string(TALLOC_CTX *mem_ctx, uint32_t filter);
534struct sys_notify_context *sys_notify_context_create(TALLOC_CTX *mem_ctx,
535 struct tevent_context *ev);
536
537/* The following definitions come from smbd/notify_inotify.c */
538
539int inotify_watch(TALLOC_CTX *mem_ctx,
540 struct sys_notify_context *ctx,
541 const char *path,
542 uint32_t *filter,
543 uint32_t *subdir_filter,
544 void (*callback)(struct sys_notify_context *ctx,
545 void *private_data,
546 struct notify_event *ev),
547 void *private_data,
548 void *handle_p);
549
550int _fam_watch(TALLOC_CTX *mem_ctx,
551 struct sys_notify_context *ctx,
552 const char *path,
553 uint32_t *filter,
554 uint32_t *subdir_filter,
555 void (*callback)(struct sys_notify_context *ctx,
556 void *private_data,
557 struct notify_event *ev),
558 void *private_data,
559 void *handle_p);
560
561
562/* The following definitions come from smbd/notify_internal.c */
563
564struct notify_context *notify_init(TALLOC_CTX *mem_ctx,
565 struct messaging_context *messaging_ctx,
566 struct tevent_context *ev);
567NTSTATUS notify_add(struct notify_context *notify,
568 const char *path, uint32_t filter, uint32_t subdir_filter,
569 void (*callback)(void *, struct timespec,
570 const struct notify_event *),
571 void *private_data);
572NTSTATUS notify_remove(struct notify_context *notify, void *private_data);
573void notify_trigger(struct notify_context *notify,
574 uint32_t action, uint32_t filter,
575 const char *dir, const char *path);
576
577struct notify_instance;
578NTSTATUS notify_walk(struct notify_context *notify,
579 bool (*fn)(const char *path, struct server_id server,
580 const struct notify_instance *instance,
581 void *private_data),
582 void *private_data);
583
584/* The following definitions come from smbd/ntquotas.c */
585
586int vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, struct dom_sid *psid, SMB_NTQUOTA_STRUCT *qt);
587int vfs_set_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, struct dom_sid *psid, SMB_NTQUOTA_STRUCT *qt);
588int vfs_get_user_ntquota_list(files_struct *fsp, SMB_NTQUOTA_LIST **qt_list);
589void *init_quota_handle(TALLOC_CTX *mem_ctx);
590
591/* The following definitions come from smbd/nttrans.c */
592
593void reply_ntcreate_and_X(struct smb_request *req);
594NTSTATUS set_sd(files_struct *fsp, struct security_descriptor *psd,
595 uint32_t security_info_sent);
596NTSTATUS set_sd_blob(files_struct *fsp, uint8_t *data, uint32_t sd_len,
597 uint32_t security_info_sent);
598struct ea_list *read_nttrans_ea_list(TALLOC_CTX *ctx, const char *pdata, size_t data_size);
599void reply_ntcancel(struct smb_request *req);
600void reply_ntrename(struct smb_request *req);
601NTSTATUS smbd_do_query_security_desc(connection_struct *conn,
602 TALLOC_CTX *mem_ctx,
603 files_struct *fsp,
604 uint32_t security_info_wanted,
605 uint32_t max_data_count,
606 uint8_t **ppmarshalled_sd,
607 size_t *psd_size);
608void reply_nttrans(struct smb_request *req);
609void reply_nttranss(struct smb_request *req);
610
611/* The following definitions come from smbd/open.c */
612
613NTSTATUS smbd_check_access_rights(struct connection_struct *conn,
614 const struct smb_filename *smb_fname,
615 bool use_privs,
616 uint32_t access_mask);
617NTSTATUS fd_open(struct connection_struct *conn, files_struct *fsp,
618 int flags, mode_t mode);
619NTSTATUS fd_close(files_struct *fsp);
620void change_file_owner_to_parent(connection_struct *conn,
621 const char *inherit_from_dir,
622 files_struct *fsp);
623NTSTATUS change_dir_owner_to_parent(connection_struct *conn,
624 const char *inherit_from_dir,
625 const char *fname,
626 SMB_STRUCT_STAT *psbuf);
627bool is_stat_open(uint32_t access_mask);
628NTSTATUS send_break_message(struct messaging_context *msg_ctx,
629 const struct share_mode_entry *exclusive,
630 uint16_t break_to);
631struct deferred_open_record;
632bool is_deferred_open_async(const struct deferred_open_record *rec);
633NTSTATUS create_directory(connection_struct *conn, struct smb_request *req,
634 struct smb_filename *smb_dname);
635void msg_file_was_renamed(struct messaging_context *msg,
636 void *private_data,
637 uint32_t msg_type,
638 struct server_id server_id,
639 DATA_BLOB *data);
640NTSTATUS open_streams_for_delete(connection_struct *conn,
641 const char *fname);
642int find_share_mode_lease(struct share_mode_data *d,
643 const struct GUID *client_guid,
644 const struct smb2_lease_key *key);
645struct share_mode_lease;
646struct fsp_lease *find_fsp_lease(files_struct *new_fsp,
647 const struct smb2_lease_key *key,
648 const struct share_mode_lease *l);
649NTSTATUS create_file_default(connection_struct *conn,
650 struct smb_request *req,
651 uint16_t root_dir_fid,
652 struct smb_filename * smb_fname,
653 uint32_t access_mask,
654 uint32_t share_access,
655 uint32_t create_disposition,
656 uint32_t create_options,
657 uint32_t file_attributes,
658 uint32_t oplock_request,
659 struct smb2_lease *lease,
660 uint64_t allocation_size,
661 uint32_t private_flags,
662 struct security_descriptor *sd,
663 struct ea_list *ea_list,
664 files_struct **result,
665 int *pinfo,
666 const struct smb2_create_blobs *in_context_blobs,
667 struct smb2_create_blobs *out_context_blobs);
668
669NTSTATUS get_relative_fid_filename(connection_struct *conn,
670 struct smb_request *req,
671 uint16_t root_dir_fid,
672 const struct smb_filename *smb_fname,
673 struct smb_filename **smb_fname_out);
674
675/* The following definitions come from smbd/oplock.c */
676
677uint32_t map_oplock_to_lease_type(uint16_t op_type);
678uint32_t get_lease_type(struct share_mode_data *d, struct share_mode_entry *e);
679bool update_num_read_oplocks(files_struct *fsp, struct share_mode_lock *lck);
680
681void break_kernel_oplock(struct messaging_context *msg_ctx, files_struct *fsp);
682NTSTATUS set_file_oplock(files_struct *fsp);
683bool remove_oplock_under_lock(files_struct *fsp, struct share_mode_lock *lck);
684bool remove_oplock(files_struct *fsp);
685bool downgrade_oplock(files_struct *fsp);
686bool fsp_lease_update(struct share_mode_lock *lck,
687 const struct GUID *client_guid,
688 struct fsp_lease *lease);
689NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
690 uint32_t num_file_ids,
691 const struct file_id *ids,
692 const struct smb2_lease_key *key,
693 uint32_t lease_state);
694void contend_level2_oplocks_begin(files_struct *fsp,
695 enum level2_contention_type type);
696void contend_level2_oplocks_end(files_struct *fsp,
697 enum level2_contention_type type);
698void smbd_contend_level2_oplocks_begin(files_struct *fsp,
699 enum level2_contention_type type);
700void smbd_contend_level2_oplocks_end(files_struct *fsp,
701 enum level2_contention_type type);
702void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e);
703void message_to_share_mode_entry(struct share_mode_entry *e, const char *msg);
704bool init_oplocks(struct smbd_server_connection *sconn);
705void init_kernel_oplocks(struct smbd_server_connection *sconn);
706
707/* The following definitions come from smbd/oplock_irix.c */
708
709struct kernel_oplocks *irix_init_kernel_oplocks(struct smbd_server_connection *sconn);
710
711/* The following definitions come from smbd/oplock_linux.c */
712
713void linux_set_lease_capability(void);
714int linux_set_lease_sighandler(int fd);
715int linux_setlease(int fd, int leasetype);
716struct kernel_oplocks *linux_init_kernel_oplocks(struct smbd_server_connection *sconn);
717
718/* The following definitions come from smbd/password.c */
719
720struct user_struct *get_valid_user_struct(struct smbd_server_connection *sconn,
721 uint64_t vuid);
722void invalidate_vuid(struct smbd_server_connection *sconn, uint64_t vuid);
723int register_homes_share(const char *username);
724
725/* The following definitions come from smbd/pipes.c */
726
727NTSTATUS open_np_file(struct smb_request *smb_req, const char *name,
728 struct files_struct **pfsp);
729void reply_open_pipe_and_X(connection_struct *conn, struct smb_request *req);
730void reply_pipe_write(struct smb_request *req);
731void reply_pipe_write_and_X(struct smb_request *req);
732void reply_pipe_read_and_X(struct smb_request *req);
733
734/* The following definitions come from smbd/posix_acls.c */
735
736void create_file_sids(const SMB_STRUCT_STAT *psbuf, struct dom_sid *powner_sid, struct dom_sid *pgroup_sid);
737uint32_t map_canon_ace_perms(int snum,
738 enum security_ace_type *pacl_type,
739 mode_t perms,
740 bool directory_ace);
741NTSTATUS unpack_nt_owners(connection_struct *conn, uid_t *puser, gid_t *pgrp, uint32_t security_info_sent, const struct security_descriptor *psd);
742bool current_user_in_group(connection_struct *conn, gid_t gid);
743SMB_ACL_T free_empty_sys_acl(connection_struct *conn, SMB_ACL_T the_acl);
744NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info,
745 TALLOC_CTX *mem_ctx,
746 struct security_descriptor **ppdesc);
747NTSTATUS posix_get_nt_acl(struct connection_struct *conn, const char *name,
748 uint32_t security_info,
749 TALLOC_CTX *mem_ctx,
750 struct security_descriptor **ppdesc);
751NTSTATUS try_chown(files_struct *fsp, uid_t uid, gid_t gid);
752NTSTATUS set_nt_acl(files_struct *fsp, uint32_t security_info_sent, const struct security_descriptor *psd);
753int get_acl_group_bits( connection_struct *conn, const char *fname, mode_t *mode );
754int chmod_acl(connection_struct *conn, const char *name, mode_t mode);
755int inherit_access_posix_acl(connection_struct *conn, const char *inherit_from_dir,
756 const char *name, mode_t mode);
757int fchmod_acl(files_struct *fsp, mode_t mode);
758bool set_unix_posix_default_acl(connection_struct *conn, const char *fname,
759 const SMB_STRUCT_STAT *psbuf,
760 uint16_t num_def_acls, const char *pdata);
761bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp, const char *fname, uint16_t num_acls, const char *pdata);
762NTSTATUS get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname,
763 uint32_t security_info_wanted,
764 struct security_descriptor **sd);
765int posix_sys_acl_blob_get_file(vfs_handle_struct *handle,
766 const char *path_p,
767 TALLOC_CTX *mem_ctx,
768 char **blob_description,
769 DATA_BLOB *blob);
770int posix_sys_acl_blob_get_fd(vfs_handle_struct *handle,
771 files_struct *fsp,
772 TALLOC_CTX *mem_ctx,
773 char **blob_description,
774 DATA_BLOB *blob);
775
776/* The following definitions come from smbd/process.c */
777
778void smbd_setup_sig_term_handler(struct smbd_server_connection *sconn);
779void smbd_setup_sig_hup_handler(struct smbd_server_connection *sconn);
780bool srv_send_smb(struct smbXsrv_connection *xconn, char *buffer,
781 bool no_signing, uint32_t seqnum,
782 bool do_encrypt,
783 struct smb_perfcount_data *pcd);
784int srv_set_message(char *buf,
785 int num_words,
786 int num_bytes,
787 bool zero);
788void remove_deferred_open_message_smb(struct smbXsrv_connection *xconn,
789 uint64_t mid);
790bool schedule_deferred_open_message_smb(struct smbXsrv_connection *xconn,
791 uint64_t mid);
792bool open_was_deferred(struct smbXsrv_connection *xconn, uint64_t mid);
793bool get_deferred_open_message_state(struct smb_request *smbreq,
794 struct timeval *p_request_time,
795 struct deferred_open_record **open_rec);
796bool push_deferred_open_message_smb(struct smb_request *req,
797 struct timeval request_time,
798 struct timeval timeout,
799 struct file_id id,
800 struct deferred_open_record *open_rec);
801NTSTATUS allow_new_trans(struct trans_state *list, uint64_t mid);
802void reply_outbuf(struct smb_request *req, uint8_t num_words, uint32_t num_bytes);
803void smb_request_done(struct smb_request *req);
804const char *smb_fn_name(int type);
805void add_to_common_flags2(uint32_t v);
806void remove_from_common_flags2(uint32_t v);
807void construct_reply_common_req(struct smb_request *req, char *outbuf);
808bool smb1_is_chain(const uint8_t *buf);
809bool smb1_walk_chain(const uint8_t *buf,
810 bool (*fn)(uint8_t cmd,
811 uint8_t wct, const uint16_t *vwv,
812 uint16_t num_bytes, const uint8_t *bytes,
813 void *private_data),
814 void *private_data);
815unsigned smb1_chain_length(const uint8_t *buf);
816bool smb1_parse_chain(TALLOC_CTX *mem_ctx, const uint8_t *buf,
817 struct smbXsrv_connection *xconn,
818 bool encrypted, uint32_t seqnum,
819 struct smb_request ***reqs, unsigned *num_reqs);
820bool req_is_in_chain(const struct smb_request *req);
821void smbd_process(struct tevent_context *ev_ctx,
822 struct messaging_context *msg_ctx,
823 int sock_fd,
824 bool interactive);
825bool fork_echo_handler(struct smbXsrv_connection *xconn);
826
827/* The following definitions come from smbd/quotas.c */
828
829bool disk_quotas(connection_struct *conn, struct smb_filename *fname,
830 uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
831
832/* The following definitions come from smbd/reply.c */
833
834NTSTATUS check_path_syntax(char *path);
835NTSTATUS check_path_syntax_wcard(char *path, bool *p_contains_wcard);
836NTSTATUS check_path_syntax_posix(char *path);
837size_t srvstr_get_path_wcard(TALLOC_CTX *ctx,
838 const char *inbuf,
839 uint16_t smb_flags2,
840 char **pp_dest,
841 const char *src,
842 size_t src_len,
843 int flags,
844 NTSTATUS *err,
845 bool *contains_wcard);
846size_t srvstr_get_path_wcard_posix(TALLOC_CTX *ctx,
847 const char *inbuf,
848 uint16_t smb_flags2,
849 char **pp_dest,
850 const char *src,
851 size_t src_len,
852 int flags,
853 NTSTATUS *err,
854 bool *contains_wcard);
855size_t srvstr_get_path(TALLOC_CTX *ctx,
856 const char *inbuf,
857 uint16_t smb_flags2,
858 char **pp_dest,
859 const char *src,
860 size_t src_len,
861 int flags,
862 NTSTATUS *err);
863size_t srvstr_get_path_posix(TALLOC_CTX *ctx,
864 const char *inbuf,
865 uint16_t smb_flags2,
866 char **pp_dest,
867 const char *src,
868 size_t src_len,
869 int flags,
870 NTSTATUS *err);
871size_t srvstr_get_path_req_wcard(TALLOC_CTX *mem_ctx, struct smb_request *req,
872 char **pp_dest, const char *src, int flags,
873 NTSTATUS *err, bool *contains_wcard);
874size_t srvstr_get_path_req(TALLOC_CTX *mem_ctx, struct smb_request *req,
875 char **pp_dest, const char *src, int flags,
876 NTSTATUS *err);
877size_t srvstr_pull_req_talloc(TALLOC_CTX *ctx, struct smb_request *req,
878 char **dest, const uint8_t *src, int flags);
879bool check_fsp_open(connection_struct *conn, struct smb_request *req,
880 files_struct *fsp);
881bool check_fsp(connection_struct *conn, struct smb_request *req,
882 files_struct *fsp);
883bool check_fsp_ntquota_handle(connection_struct *conn, struct smb_request *req,
884 files_struct *fsp);
885void reply_special(struct smbXsrv_connection *xconn, char *inbuf, size_t inbuf_size);
886void reply_tcon(struct smb_request *req);
887void reply_tcon_and_X(struct smb_request *req);
888void reply_unknown_new(struct smb_request *req, uint8_t type);
889void reply_ioctl(struct smb_request *req);
890void reply_checkpath(struct smb_request *req);
891void reply_getatr(struct smb_request *req);
892void reply_setatr(struct smb_request *req);
893void reply_dskattr(struct smb_request *req);
894void reply_search(struct smb_request *req);
895void reply_fclose(struct smb_request *req);
896void reply_open(struct smb_request *req);
897void reply_open_and_X(struct smb_request *req);
898void reply_ulogoffX(struct smb_request *req);
899void reply_mknew(struct smb_request *req);
900void reply_ctemp(struct smb_request *req);
901NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req,
902 uint32_t dirtype, struct smb_filename *smb_fname,
903 bool has_wild);
904void reply_unlink(struct smb_request *req);
905ssize_t fake_sendfile(struct smbXsrv_connection *xconn, files_struct *fsp,
906 off_t startpos, size_t nread);
907ssize_t sendfile_short_send(struct smbXsrv_connection *xconn,
908 files_struct *fsp,
909 ssize_t nread,
910 size_t headersize,
911 size_t smb_maxcnt);
912void reply_readbraw(struct smb_request *req);
913void reply_lockread(struct smb_request *req);
914int setup_readX_header(char *outbuf, size_t smb_maxcnt);
915void reply_read(struct smb_request *req);
916void reply_read_and_X(struct smb_request *req);
917void error_to_writebrawerr(struct smb_request *req);
918void reply_writebraw(struct smb_request *req);
919void reply_writeunlock(struct smb_request *req);
920void reply_write(struct smb_request *req);
921bool is_valid_writeX_buffer(struct smbXsrv_connection *xconn,
922 const uint8_t *inbuf);
923void reply_write_and_X(struct smb_request *req);
924void reply_lseek(struct smb_request *req);
925void reply_flush(struct smb_request *req);
926void reply_exit(struct smb_request *req);
927void reply_close(struct smb_request *req);
928void reply_writeclose(struct smb_request *req);
929void reply_lock(struct smb_request *req);
930void reply_unlock(struct smb_request *req);
931void reply_tdis(struct smb_request *req);
932void reply_echo(struct smb_request *req);
933void reply_printopen(struct smb_request *req);
934void reply_printclose(struct smb_request *req);
935void reply_printqueue(struct smb_request *req);
936void reply_printwrite(struct smb_request *req);
937void reply_mkdir(struct smb_request *req);
938void reply_rmdir(struct smb_request *req);
939NTSTATUS rename_internals_fsp(connection_struct *conn,
940 files_struct *fsp,
941 const struct smb_filename *smb_fname_dst_in,
942 uint32_t attrs,
943 bool replace_if_exists);
944NTSTATUS rename_internals(TALLOC_CTX *ctx,
945 connection_struct *conn,
946 struct smb_request *req,
947 struct smb_filename *smb_fname_src,
948 struct smb_filename *smb_fname_dst,
949 uint32_t attrs,
950 bool replace_if_exists,
951 bool src_has_wild,
952 bool dest_has_wild,
953 uint32_t access_mask);
954void reply_mv(struct smb_request *req);
955NTSTATUS copy_file(TALLOC_CTX *ctx,
956 connection_struct *conn,
957 struct smb_filename *smb_fname_src,
958 struct smb_filename *smb_fname_dst,
959 int ofun,
960 int count,
961 bool target_is_directory);
962void reply_copy(struct smb_request *req);
963uint64_t get_lock_pid(const uint8_t *data, int data_offset,
964 bool large_file_format);
965uint64_t get_lock_count(const uint8_t *data, int data_offset,
966 bool large_file_format);
967uint64_t get_lock_offset(const uint8_t *data, int data_offset,
968 bool large_file_format);
969void reply_lockingX(struct smb_request *req);
970void reply_readbmpx(struct smb_request *req);
971void reply_readbs(struct smb_request *req);
972void reply_setattrE(struct smb_request *req);
973void reply_writebmpx(struct smb_request *req);
974void reply_writebs(struct smb_request *req);
975void reply_getattrE(struct smb_request *req);
976
977/* The following definitions come from smbd/seal.c */
978
979bool is_encrypted_packet(const uint8_t *inbuf);
980void srv_free_enc_buffer(struct smbXsrv_connection *xconn, char *buf);
981NTSTATUS srv_decrypt_buffer(struct smbXsrv_connection *xconn, char *buf);
982NTSTATUS srv_encrypt_buffer(struct smbXsrv_connection *xconn, char *buf,
983 char **buf_out);
984NTSTATUS srv_request_encryption_setup(connection_struct *conn,
985 unsigned char **ppdata,
986 size_t *p_data_size,
987 unsigned char **pparam,
988 size_t *p_param_size);
989NTSTATUS srv_encryption_start(connection_struct *conn);
990void server_encryption_shutdown(struct smbXsrv_connection *xconn);
991
992/* The following definitions come from smbd/sec_ctx.c */
993
994bool unix_token_equal(const struct security_unix_token *t1, const struct security_unix_token *t2);
995bool push_sec_ctx(void);
996void set_sec_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups, const struct security_token *token);
997void set_root_sec_ctx(void);
998bool pop_sec_ctx(void);
999void init_sec_ctx(void);
1000const struct security_token *sec_ctx_active_token(void);
1001
1002/* The following definitions come from smbd/server.c */
1003
1004struct memcache *smbd_memcache(void);
1005bool snum_is_shared_printer(int snum);
1006void delete_and_reload_printers(struct tevent_context *ev,
1007 struct messaging_context *msg_ctx);
1008bool reload_services(struct smbd_server_connection *sconn,
1009 bool (*snumused) (struct smbd_server_connection *, int),
1010 bool test);
1011
1012/* The following definitions come from smbd/server_exit.c */
1013
1014void smbd_exit_server(const char *reason) _NORETURN_;
1015void smbd_exit_server_cleanly(const char *const reason) _NORETURN_;
1016
1017/* The following definitions come from smbd/service.c */
1018
1019bool set_conn_connectpath(connection_struct *conn, const char *connectpath);
1020NTSTATUS set_conn_force_user_group(connection_struct *conn, int snum);
1021bool set_current_service(connection_struct *conn, uint16_t flags, bool do_chdir);
1022void load_registry_shares(void);
1023int add_home_service(const char *service, const char *username, const char *homedir);
1024int find_service(TALLOC_CTX *ctx, const char *service, char **p_service_out);
1025connection_struct *make_connection_smb2(struct smbd_smb2_request *req,
1026 struct smbXsrv_tcon *tcon,
1027 int snum,
1028 struct user_struct *vuser,
1029 const char *pdev,
1030 NTSTATUS *pstatus);
1031connection_struct *make_connection(struct smb_request *req,
1032 NTTIME now,
1033 const char *service_in,
1034 const char *pdev, uint64_t vuid,
1035 NTSTATUS *status);
1036void close_cnum(connection_struct *conn, uint64_t vuid);
1037
1038/* The following definitions come from smbd/session.c */
1039struct sessionid;
1040struct smbXsrv_session;
1041bool session_init(void);
1042bool session_claim(struct smbXsrv_session *session);
1043void session_yield(struct smbXsrv_session *session);
1044int list_sessions(TALLOC_CTX *mem_ctx, struct sessionid **session_list);
1045int find_sessions(TALLOC_CTX *mem_ctx, const char *username,
1046 const char *machine, struct sessionid **session_list);
1047
1048/* The following definitions come from smbd/sesssetup.c */
1049
1050void reply_sesssetup_and_X(struct smb_request *req);
1051
1052/* The following definitions come from smbd/share_access.c */
1053
1054bool token_contains_name_in_list(const char *username,
1055 const char *domain,
1056 const char *sharename,
1057 const struct security_token *token,
1058 const char **list);
1059bool user_ok_token(const char *username, const char *domain,
1060 const struct security_token *token, int snum);
1061bool is_share_read_only_for_token(const char *username,
1062 const char *domain,
1063 const struct security_token *token,
1064 connection_struct *conn);
1065
1066/* The following definitions come from smbd/srvstr.c */
1067
1068NTSTATUS srvstr_push_fn(const char *base_ptr, uint16_t smb_flags2, void *dest,
1069 const char *src, int dest_len, int flags, size_t *ret_len);
1070ssize_t message_push_string(uint8_t **outbuf, const char *str, int flags);
1071
1072/* The following definitions come from smbd/statcache.c */
1073
1074void stat_cache_add( const char *full_orig_name,
1075 char *translated_path,
1076 bool case_sensitive);
1077bool stat_cache_lookup(connection_struct *conn,
1078 bool posix_paths,
1079 char **pp_name,
1080 char **pp_dirpath,
1081 char **pp_start,
1082 SMB_STRUCT_STAT *pst);
1083void smbd_send_stat_cache_delete_message(struct messaging_context *msg_ctx,
1084 const char *name);
1085void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
1086 const char *name);
1087void stat_cache_delete(const char *name);
1088struct TDB_DATA;
1089unsigned int fast_string_hash(struct TDB_DATA *key);
1090bool reset_stat_cache( void );
1091
1092/* The following definitions come from smbd/statvfs.c */
1093
1094int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf);
1095
1096/* The following definitions come from smbd/trans2.c */
1097
1098NTSTATUS check_access_fsp(const struct files_struct *fsp,
1099 uint32_t access_mask);
1100NTSTATUS check_access(connection_struct *conn,
1101 files_struct *fsp,
1102 const struct smb_filename *smb_fname,
1103 uint32_t access_mask);
1104uint64_t smb_roundup(connection_struct *conn, uint64_t val);
1105uint64_t get_FileIndex(connection_struct *conn, const SMB_STRUCT_STAT *psbuf);
1106bool samba_private_attr_name(const char *unix_ea_name);
1107NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn,
1108 files_struct *fsp, const char *fname,
1109 const char *ea_name, struct ea_struct *pea);
1110NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn,
1111 files_struct *fsp, const char *fname,
1112 char ***pnames, size_t *pnum_names);
1113NTSTATUS set_ea(connection_struct *conn, files_struct *fsp,
1114 const struct smb_filename *smb_fname, struct ea_list *ea_list);
1115struct ea_list *read_ea_list_entry(TALLOC_CTX *ctx, const char *pdata, size_t data_size, size_t *pbytes_used);
1116void send_trans2_replies(connection_struct *conn,
1117 struct smb_request *req,
1118 NTSTATUS status,
1119 const char *params,
1120 int paramsize,
1121 const char *pdata,
1122 int datasize,
1123 int max_data_bytes);
1124unsigned char *create_volume_objectid(connection_struct *conn, unsigned char objid[16]);
1125NTSTATUS hardlink_internals(TALLOC_CTX *ctx,
1126 connection_struct *conn,
1127 struct smb_request *req,
1128 bool overwrite_if_exists,
1129 const struct smb_filename *smb_fname_old,
1130 struct smb_filename *smb_fname_new);
1131NTSTATUS smb_set_file_time(connection_struct *conn,
1132 files_struct *fsp,
1133 const struct smb_filename *smb_fname,
1134 struct smb_file_time *ft,
1135 bool setting_write_time);
1136void reply_findclose(struct smb_request *req);
1137void reply_findnclose(struct smb_request *req);
1138void reply_trans2(struct smb_request *req);
1139void reply_transs2(struct smb_request *req);
1140
1141/* The following definitions come from smbd/uid.c */
1142
1143bool change_to_guest(void);
1144NTSTATUS check_user_share_access(connection_struct *conn,
1145 const struct auth_session_info *session_info,
1146 uint32_t *p_share_access,
1147 bool *p_readonly_share);
1148bool change_to_user(connection_struct *conn, uint64_t vuid);
1149bool smbd_change_to_root_user(void);
1150bool smbd_become_authenticated_pipe_user(struct auth_session_info *session_info);
1151bool smbd_unbecome_authenticated_pipe_user(void);
1152void become_root(void);
1153void unbecome_root(void);
1154void smbd_become_root(void);
1155void smbd_unbecome_root(void);
1156bool become_user(connection_struct *conn, uint64_t vuid);
1157bool become_user_by_session(connection_struct *conn,
1158 const struct auth_session_info *session_info);
1159bool unbecome_user(void);
1160uid_t get_current_uid(connection_struct *conn);
1161gid_t get_current_gid(connection_struct *conn);
1162const struct security_unix_token *get_current_utok(connection_struct *conn);
1163const struct security_token *get_current_nttok(connection_struct *conn);
1164uint64_t get_current_vuid(connection_struct *conn);
1165
1166/* The following definitions come from smbd/utmp.c */
1167
1168void sys_utmp_claim(const char *username, const char *hostname,
1169 const char *id_str, int id_num);
1170void sys_utmp_yield(const char *username, const char *hostname,
1171 const char *id_str, int id_num);
1172
1173/* The following definitions come from smbd/vfs.c */
1174
1175bool vfs_init_custom(connection_struct *conn, const char *vfs_object);
1176bool smbd_vfs_init(connection_struct *conn);
1177NTSTATUS vfs_file_exist(connection_struct *conn, struct smb_filename *smb_fname);
1178ssize_t vfs_read_data(files_struct *fsp, char *buf, size_t byte_count);
1179ssize_t vfs_write_data(struct smb_request *req,
1180 files_struct *fsp,
1181 const char *buffer,
1182 size_t N);
1183ssize_t vfs_pwrite_data(struct smb_request *req,
1184 files_struct *fsp,
1185 const char *buffer,
1186 size_t N,
1187 off_t offset);
1188int vfs_allocate_file_space(files_struct *fsp, uint64_t len);
1189int vfs_set_filelen(files_struct *fsp, off_t len);
1190int vfs_slow_fallocate(files_struct *fsp, off_t offset, off_t len);
1191int vfs_fill_sparse(files_struct *fsp, off_t len);
1192off_t vfs_transfer_file(files_struct *in, files_struct *out, off_t n);
1193const char *vfs_readdirname(connection_struct *conn, void *p,
1194 SMB_STRUCT_STAT *sbuf, char **talloced);
1195int vfs_ChDir(connection_struct *conn, const char *path);
1196char *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn);
1197NTSTATUS check_reduced_name(connection_struct *conn, const char *fname);
1198NTSTATUS check_reduced_name_with_privilege(connection_struct *conn,
1199 const char *fname,
1200 struct smb_request *smbreq);
1201int vfs_stat_smb_basename(struct connection_struct *conn, const char *fname,
1202 SMB_STRUCT_STAT *psbuf);
1203NTSTATUS vfs_stat_fsp(files_struct *fsp);
1204NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid);
1205NTSTATUS vfs_streaminfo(connection_struct *conn,
1206 struct files_struct *fsp,
1207 const char *fname,
1208 TALLOC_CTX *mem_ctx,
1209 unsigned int *num_streams,
1210 struct stream_struct **streams);
1211
1212/* The following definitions come from smbd/avahi_register.c */
1213
1214void *avahi_start_register(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
1215 uint16_t port);
1216
1217/* The following definitions come from smbd/smb2_create.c */
1218
1219NTSTATUS vfs_default_durable_cookie(struct files_struct *fsp,
1220 TALLOC_CTX *mem_ctx,
1221 DATA_BLOB *cookie_blob);
1222NTSTATUS vfs_default_durable_disconnect(struct files_struct *fsp,
1223 const DATA_BLOB old_cookie,
1224 TALLOC_CTX *mem_ctx,
1225 DATA_BLOB *new_cookie);
1226NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn,
1227 struct smb_request *smb1req,
1228 struct smbXsrv_open *op,
1229 const DATA_BLOB old_cookie,
1230 TALLOC_CTX *mem_ctx,
1231 files_struct **result,
1232 DATA_BLOB *new_cookie);
1233
1234#endif /* _SMBD_PROTO_H_ */
Note: See TracBrowser for help on using the repository browser.