/* The following definitions come from smbd/aio.c */
+int get_outstanding_aio_calls(void);
+void increment_outstanding_aio_calls(void);
+void decrement_outstanding_aio_calls(void);
struct aio_extra;
bool aio_write_through_requested(struct aio_extra *aio_ex);
NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
uint32_t msg_type,
struct server_id server_id,
DATA_BLOB *data);
-NTSTATUS delete_all_streams(connection_struct *conn, const char *fname);
+NTSTATUS delete_all_streams(connection_struct *conn,
+ const struct smb_filename *smb_fname);
bool recursive_rmdir(TALLOC_CTX *ctx,
connection_struct *conn,
struct smb_filename *smb_dname);
/* The following definitions come from smbd/dfree.c */
-void disk_norm(uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
-uint64_t sys_disk_free(connection_struct *conn, const char *path,
- uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
-uint64_t get_dfree_info(connection_struct *conn,
- const char *path,
- uint64_t *bsize,
- uint64_t *dfree,
- uint64_t *dsize);
+uint64_t sys_disk_free(connection_struct *conn, struct smb_filename *fname,
+ uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
+uint64_t get_dfree_info(connection_struct *conn, struct smb_filename *fname,
+ uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
/* The following definitions come from smbd/dir.c */
NTSTATUS dptr_create(connection_struct *conn,
struct smb_request *req,
files_struct *fsp,
- const char *path, bool old_handle, bool expect_close,uint16_t spid,
- const char *wcard, bool wcard_has_wild, uint32_t attr, struct dptr_struct **dptr_ret);
+ const struct smb_filename *smb_dname,
+ bool old_handle,
+ bool expect_close,
+ uint16_t spid,
+ const char *wcard,
+ bool wcard_has_wild,
+ uint32_t attr,
+ struct dptr_struct **dptr_ret);
void dptr_CloseDir(files_struct *fsp);
void dptr_SeekDir(struct dptr_struct *dptr, long offset);
long dptr_TellDir(struct dptr_struct *dptr);
bool check_descend,
bool ask_sharemode);
bool is_visible_file(connection_struct *conn, const char *dir_path, const char *name, SMB_STRUCT_STAT *pst, bool use_veto);
-struct smb_Dir *OpenDir(TALLOC_CTX *mem_ctx, connection_struct *conn,
- const char *name, const char *mask, uint32_t attr);
+struct smb_Dir *OpenDir(TALLOC_CTX *mem_ctx,
+ connection_struct *conn,
+ const struct smb_filename *smb_fname,
+ const char *mask,
+ uint32_t attr);
const char *ReadDirName(struct smb_Dir *dirp, long *poffset,
SMB_STRUCT_STAT *sbuf, char **talloced);
void RewindDir(struct smb_Dir *dirp, long *poffset);
bool SearchDir(struct smb_Dir *dirp, const char *name, long *poffset);
NTSTATUS can_delete_directory(struct connection_struct *conn,
const char *dirname);
+bool have_file_open_below(connection_struct *conn,
+ const struct smb_filename *name);
/* The following definitions come from smbd/dmapi.c */
const char *inherit_from_dir);
uint32_t dos_mode_msdfs(connection_struct *conn,
const struct smb_filename *smb_fname);
-int dos_attributes_to_stat_dos_flags(uint32_t dosmode);
uint32_t dos_mode(connection_struct *conn, struct smb_filename *smb_fname);
int file_set_dosmode(connection_struct *conn, struct smb_filename *smb_fname,
uint32_t dosmode, const char *parent_dir, bool newfile);
bool set_sticky_write_time_fsp(struct files_struct *fsp,
struct timespec mtime);
+NTSTATUS get_ea_dos_attribute(connection_struct *conn,
+ struct smb_filename *smb_fname,
+ uint32_t *pattr);
+NTSTATUS set_ea_dos_attribute(connection_struct *conn,
+ const struct smb_filename *smb_fname,
+ uint32_t dosmode);
+
NTSTATUS set_create_timespec_ea(connection_struct *conn,
const struct smb_filename *smb_fname,
struct timespec create_time);
/* The following definitions come from smbd/filename.c */
+uint32_t ucf_flags_from_smb_request(struct smb_request *req);
+uint32_t filename_create_ucf_flags(struct smb_request *req, uint32_t create_disposition);
NTSTATUS unix_convert(TALLOC_CTX *ctx,
connection_struct *conn,
const char *orig_path,
char **found_name);
NTSTATUS filename_convert(TALLOC_CTX *mem_ctx,
connection_struct *conn,
- bool dfs_path,
const char *name_in,
uint32_t ucf_flags,
bool *ppath_contains_wcard,
NTSTATUS fsp_set_smb_fname(struct files_struct *fsp,
const struct smb_filename *smb_fname_in);
const struct GUID *fsp_client_guid(const files_struct *fsp);
-uint32_t fsp_lease_type(struct files_struct *fsp);
+size_t fsp_fullbasepath(struct files_struct *fsp, char *buf, size_t buflen);
/* The following definitions come from smbd/ipc.c */
/* The following definitions come from smbd/msdfs.c */
bool is_msdfs_link(connection_struct *conn,
- const char *path,
- SMB_STRUCT_STAT *sbufp);
+ struct smb_filename *smb_fname);
struct junction_map;
NTSTATUS get_referred_path(TALLOC_CTX *ctx,
- const char *dfs_path,
- bool allow_broken_path,
- struct junction_map *jucn,
- int *consumedcntp,
- bool *self_referralp);
+ const char *dfs_path,
+ const struct tsocket_address *remote_address,
+ const struct tsocket_address *local_address,
+ bool allow_broken_path,
+ struct junction_map *jucn,
+ int *consumedcntp,
+ bool *self_referralp);
int setup_dfs_referral(connection_struct *orig_conn,
const char *dfs_path,
int max_referral_level,
struct junction_map *enum_msdfs_links(TALLOC_CTX *ctx, size_t *p_num_jn);
NTSTATUS resolve_dfspath_wcard(TALLOC_CTX *ctx,
connection_struct *conn,
- bool dfs_pathnames,
const char *name_in,
- bool allow_wcards,
+ uint32_t ucf_flags,
bool allow_broken_path,
char **pp_name_out,
bool *ppath_contains_wcard);
int snum,
const char *path,
const struct auth_session_info *session_info,
- char **poldcwd);
+ struct smb_filename **poldcwd_fname);
/* The following definitions come from smbd/negprot.c */
void (*reply_fn)(struct smb_request *req,
NTSTATUS error_code,
uint8_t *buf, size_t len));
+void notify_callback(struct smbd_server_connection *sconn,
+ void *private_data, struct timespec when,
+ const struct notify_event *e);
NTSTATUS change_notify_create(struct files_struct *fsp, uint32_t filter,
bool recursive);
NTSTATUS change_notify_add_request(struct smb_request *req,
void smbd_notify_cancel_deleted(struct messaging_context *msg,
void *private_data, uint32_t msg_type,
struct server_id server_id, DATA_BLOB *data);
+void smbd_notifyd_restarted(struct messaging_context *msg,
+ void *private_data, uint32_t msg_type,
+ struct server_id server_id, DATA_BLOB *data);
void remove_pending_change_notify_requests_by_mid(
struct smbd_server_connection *sconn, uint64_t mid);
void remove_pending_change_notify_requests_by_fid(files_struct *fsp,
uint32_t *subdir_filter,
void (*callback)(struct sys_notify_context *ctx,
void *private_data,
- struct notify_event *ev),
+ struct notify_event *ev,
+ uint32_t filter),
void *private_data,
void *handle_p);
-int _fam_watch(TALLOC_CTX *mem_ctx,
+int fam_watch(TALLOC_CTX *mem_ctx,
struct sys_notify_context *ctx,
const char *path,
uint32_t *filter,
uint32_t *subdir_filter,
void (*callback)(struct sys_notify_context *ctx,
void *private_data,
- struct notify_event *ev),
+ struct notify_event *ev,
+ uint32_t filter),
void *private_data,
void *handle_p);
/* The following definitions come from smbd/notify_internal.c */
-struct notify_context *notify_init(TALLOC_CTX *mem_ctx,
- struct messaging_context *messaging_ctx,
- struct tevent_context *ev);
-NTSTATUS notify_add(struct notify_context *notify,
+struct notify_context *notify_init(
+ TALLOC_CTX *mem_ctx, struct messaging_context *msg,
+ struct tevent_context *ev,
+ struct smbd_server_connection *sconn,
+ void (*callback)(struct smbd_server_connection *sconn,
+ void *, struct timespec,
+ const struct notify_event *));
+NTSTATUS notify_add(struct notify_context *ctx,
const char *path, uint32_t filter, uint32_t subdir_filter,
- void (*callback)(void *, struct timespec,
- const struct notify_event *),
void *private_data);
-NTSTATUS notify_remove(struct notify_context *notify, void *private_data);
+NTSTATUS notify_remove(struct notify_context *ctx, void *private_data,
+ char *path);
void notify_trigger(struct notify_context *notify,
uint32_t action, uint32_t filter,
const char *dir, const char *path);
-void notify_walk_idx(struct notify_context *notify,
- void (*fn)(const char *path,
- uint32_t *vnns, size_t num_vnns,
+
+struct notify_instance;
+NTSTATUS notify_walk(struct notify_context *notify,
+ bool (*fn)(const char *path, struct server_id server,
+ const struct notify_instance *instance,
void *private_data),
void *private_data);
-void notify_walk(struct notify_context *notify,
- void (*fn)(const char *path,
- struct notify_db_entry *entries,
- size_t num_entries,
- time_t deleted_time, void *private_data),
- void *private_data);
-void notify_cleanup(struct notify_context *notify);
/* The following definitions come from smbd/ntquotas.c */
-int vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, struct dom_sid *psid, SMB_NTQUOTA_STRUCT *qt);
+NTSTATUS vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype,
+ struct dom_sid *psid, SMB_NTQUOTA_STRUCT *qt);
int vfs_set_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, struct dom_sid *psid, SMB_NTQUOTA_STRUCT *qt);
int vfs_get_user_ntquota_list(files_struct *fsp, SMB_NTQUOTA_LIST **qt_list);
void *init_quota_handle(TALLOC_CTX *mem_ctx);
const struct smb_filename *smb_fname,
bool use_privs,
uint32_t access_mask);
+NTSTATUS check_parent_access(struct connection_struct *conn,
+ struct smb_filename *smb_fname,
+ uint32_t access_mask);
NTSTATUS fd_open(struct connection_struct *conn, files_struct *fsp,
int flags, mode_t mode);
NTSTATUS fd_close(files_struct *fsp);
void change_file_owner_to_parent(connection_struct *conn,
const char *inherit_from_dir,
files_struct *fsp);
-NTSTATUS change_dir_owner_to_parent(connection_struct *conn,
- const char *inherit_from_dir,
- const char *fname,
- SMB_STRUCT_STAT *psbuf);
bool is_stat_open(uint32_t access_mask);
NTSTATUS send_break_message(struct messaging_context *msg_ctx,
const struct share_mode_entry *exclusive,
uint32_t msg_type,
struct server_id server_id,
DATA_BLOB *data);
-NTSTATUS open_streams_for_delete(connection_struct *conn,
- const char *fname);
int find_share_mode_lease(struct share_mode_data *d,
const struct GUID *client_guid,
const struct smb2_lease_key *key);
/* The following definitions come from smbd/oplock.c */
-uint32_t map_oplock_to_lease_type(uint16_t op_type);
-uint32_t get_lease_type(struct share_mode_data *d, struct share_mode_entry *e);
+uint32_t get_lease_type(const struct share_mode_data *d,
+ const struct share_mode_entry *e);
bool update_num_read_oplocks(files_struct *fsp, struct share_mode_lock *lck);
void break_kernel_oplock(struct messaging_context *msg_ctx, files_struct *fsp);
NTSTATUS set_file_oplock(files_struct *fsp);
+bool remove_oplock_under_lock(files_struct *fsp, struct share_mode_lock *lck);
bool remove_oplock(files_struct *fsp);
bool downgrade_oplock(files_struct *fsp);
bool fsp_lease_update(struct share_mode_lock *lck,
/* The following definitions come from smbd/posix_acls.c */
-void create_file_sids(const SMB_STRUCT_STAT *psbuf, struct dom_sid *powner_sid, struct dom_sid *pgroup_sid);
uint32_t map_canon_ace_perms(int snum,
enum security_ace_type *pacl_type,
mode_t perms,
NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info,
TALLOC_CTX *mem_ctx,
struct security_descriptor **ppdesc);
-NTSTATUS posix_get_nt_acl(struct connection_struct *conn, const char *name,
- uint32_t security_info,
- TALLOC_CTX *mem_ctx,
- struct security_descriptor **ppdesc);
+NTSTATUS posix_get_nt_acl(struct connection_struct *conn,
+ const struct smb_filename *smb_fname_in,
+ uint32_t security_info,
+ TALLOC_CTX *mem_ctx,
+ struct security_descriptor **ppdesc);
NTSTATUS try_chown(files_struct *fsp, uid_t uid, gid_t gid);
NTSTATUS set_nt_acl(files_struct *fsp, uint32_t security_info_sent, const struct security_descriptor *psd);
-int get_acl_group_bits( connection_struct *conn, const char *fname, mode_t *mode );
-int chmod_acl(connection_struct *conn, const char *name, mode_t mode);
-int inherit_access_posix_acl(connection_struct *conn, const char *inherit_from_dir,
- const char *name, mode_t mode);
+int get_acl_group_bits( connection_struct *conn,
+ const struct smb_filename *smb_fname,
+ mode_t *mode);
+int chmod_acl(connection_struct *conn,
+ const struct smb_filename *smb_fname,
+ mode_t mode);
+int inherit_access_posix_acl(connection_struct *conn,
+ const char *inherit_from_dir,
+ const struct smb_filename *smb_fname,
+ mode_t mode);
int fchmod_acl(files_struct *fsp, mode_t mode);
-bool set_unix_posix_default_acl(connection_struct *conn, const char *fname,
- const SMB_STRUCT_STAT *psbuf,
+bool set_unix_posix_default_acl(connection_struct *conn,
+ const struct smb_filename *smb_fname,
uint16_t num_def_acls, const char *pdata);
-bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp, const char *fname, uint16_t num_acls, const char *pdata);
+bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp,
+ const struct smb_filename *smb_fname,
+ uint16_t num_acls,
+ const char *pdata);
NTSTATUS get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname,
uint32_t security_info_wanted,
struct security_descriptor **sd);
-NTSTATUS make_default_filesystem_acl(TALLOC_CTX *ctx,
- const char *name,
- SMB_STRUCT_STAT *psbuf,
- struct security_descriptor **ppdesc);
int posix_sys_acl_blob_get_file(vfs_handle_struct *handle,
- const char *path_p,
+ const struct smb_filename *smb_fname,
TALLOC_CTX *mem_ctx,
char **blob_description,
DATA_BLOB *blob);
/* The following definitions come from smbd/quotas.c */
-bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
-bool disk_quotas_vxfs(const char *name, char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
+bool disk_quotas(connection_struct *conn, struct smb_filename *fname,
+ uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
/* The following definitions come from smbd/reply.c */
int flags,
NTSTATUS *err,
bool *contains_wcard);
+size_t srvstr_get_path_wcard_posix(TALLOC_CTX *ctx,
+ const char *inbuf,
+ uint16_t smb_flags2,
+ char **pp_dest,
+ const char *src,
+ size_t src_len,
+ int flags,
+ NTSTATUS *err,
+ bool *contains_wcard);
size_t srvstr_get_path(TALLOC_CTX *ctx,
const char *inbuf,
uint16_t smb_flags2,
size_t src_len,
int flags,
NTSTATUS *err);
+size_t srvstr_get_path_posix(TALLOC_CTX *ctx,
+ const char *inbuf,
+ uint16_t smb_flags2,
+ char **pp_dest,
+ const char *src,
+ size_t src_len,
+ int flags,
+ NTSTATUS *err);
size_t srvstr_get_path_req_wcard(TALLOC_CTX *mem_ctx, struct smb_request *req,
char **pp_dest, const char *src, int flags,
NTSTATUS *err, bool *contains_wcard);
size_t smb_maxcnt);
void reply_readbraw(struct smb_request *req);
void reply_lockread(struct smb_request *req);
+int setup_readX_header(char *outbuf, size_t smb_maxcnt);
void reply_read(struct smb_request *req);
void reply_read_and_X(struct smb_request *req);
void error_to_writebrawerr(struct smb_request *req);
/* The following definitions come from smbd/trans2.c */
+NTSTATUS check_access_fsp(const struct files_struct *fsp,
+ uint32_t access_mask);
NTSTATUS check_access(connection_struct *conn,
files_struct *fsp,
const struct smb_filename *smb_fname,
uint32_t access_mask);
uint64_t smb_roundup(connection_struct *conn, uint64_t val);
uint64_t get_FileIndex(connection_struct *conn, const SMB_STRUCT_STAT *psbuf);
+void aapl_force_zero_file_id(struct smbd_server_connection *sconn);
bool samba_private_attr_name(const char *unix_ea_name);
NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn,
- files_struct *fsp, const char *fname,
- const char *ea_name, struct ea_struct *pea);
-NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn,
- files_struct *fsp, const char *fname,
- char ***pnames, size_t *pnum_names);
+ files_struct *fsp,
+ const struct smb_filename *smb_fname,
+ const char *ea_name,
+ struct ea_struct *pea);
+NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx,
+ connection_struct *conn,
+ files_struct *fsp,
+ const struct smb_filename *smb_fname,
+ char ***pnames,
+ size_t *pnum_names);
NTSTATUS set_ea(connection_struct *conn, files_struct *fsp,
const struct smb_filename *smb_fname, struct ea_list *ea_list);
struct ea_list *read_ea_list_entry(TALLOC_CTX *ctx, const char *pdata, size_t data_size, size_t *pbytes_used);
off_t vfs_transfer_file(files_struct *in, files_struct *out, off_t n);
const char *vfs_readdirname(connection_struct *conn, void *p,
SMB_STRUCT_STAT *sbuf, char **talloced);
-int vfs_ChDir(connection_struct *conn, const char *path);
+int vfs_ChDir(connection_struct *conn,
+ const struct smb_filename *smb_fname);
char *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn);
-NTSTATUS check_reduced_name(connection_struct *conn, const char *fname);
+NTSTATUS check_reduced_name(connection_struct *conn,
+ const char *cwd_name,
+ const char *fname);
NTSTATUS check_reduced_name_with_privilege(connection_struct *conn,
const char *fname,
struct smb_request *smbreq);
-int vfs_stat_smb_basename(struct connection_struct *conn, const char *fname,
+int vfs_stat_smb_basename(struct connection_struct *conn,
+ const struct smb_filename *smb_fname_in,
SMB_STRUCT_STAT *psbuf);
NTSTATUS vfs_stat_fsp(files_struct *fsp);
NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid);
NTSTATUS vfs_streaminfo(connection_struct *conn,
struct files_struct *fsp,
- const char *fname,
+ const struct smb_filename *smb_fname,
TALLOC_CTX *mem_ctx,
unsigned int *num_streams,
struct stream_struct **streams);