/* 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,
bool recursive_rmdir(TALLOC_CTX *ctx,
connection_struct *conn,
struct smb_filename *smb_dname);
+bool has_other_nonposix_opens(struct share_mode_lock *lck,
+ struct files_struct *fsp,
+ struct server_id self);
/* The following definitions come from smbd/conn.c */
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);
+void flush_dfree_cache(void);
/* The following definitions come from smbd/dir.c */
uint32_t dos_mode_msdfs(connection_struct *conn,
const struct smb_filename *smb_fname);
uint32_t dos_mode(connection_struct *conn, struct smb_filename *smb_fname);
+struct tevent_req *dos_mode_at_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ files_struct *dir_fsp,
+ struct smb_filename *smb_fname);
+NTSTATUS dos_mode_at_recv(struct tevent_req *req, uint32_t *dosmode);
int file_set_dosmode(connection_struct *conn, struct smb_filename *smb_fname,
uint32_t dosmode, const char *parent_dir, bool newfile);
NTSTATUS file_set_sparse(connection_struct *conn,
struct files_struct *fsp,
const struct smb_filename *smb_fname);
+NTSTATUS parse_dos_attribute_blob(struct smb_filename *smb_fname,
+ DATA_BLOB blob,
+ uint32_t *pattr);
+
/* The following definitions come from smbd/error.c */
bool use_nt_status(void);
void error_packet_set(char *outbuf, uint8_t eclass, uint32_t ecode, NTSTATUS ntstatus, int line, const char *file);
-int error_packet(char *outbuf, uint8_t eclass, uint32_t ecode, NTSTATUS ntstatus, int line, const char *file);
+size_t error_packet(char *outbuf,
+ uint8_t eclass,
+ uint32_t ecode,
+ NTSTATUS ntstatus,
+ int line,
+ const char *file);
void reply_nt_error(struct smb_request *req, NTSTATUS ntstatus,
int line, const char *file);
void reply_force_dos_error(struct smb_request *req, uint8_t eclass, uint32_t ecode,
/* The following definitions come from smbd/fileio.c */
ssize_t read_file(files_struct *fsp,char *data,off_t pos,size_t n);
-void update_write_time_handler(struct tevent_context *ctx,
- struct tevent_timer *te,
- struct timeval now,
- void *private_data);
+void fsp_flush_write_time_update(struct files_struct *fsp);
void trigger_write_time_update(struct files_struct *fsp);
void trigger_write_time_update_immediate(struct files_struct *fsp);
void mark_file_modified(files_struct *fsp);
connection_struct *conn,
const char *name_in,
uint32_t ucf_flags,
+ time_t *twrp,
bool *ppath_contains_wcard,
struct smb_filename **pp_smb_fname);
NTSTATUS filename_convert_with_privilege(TALLOC_CTX *mem_ctx,
struct smbd_server_connection *sconn,
const struct smb2_lease_key *lease_key);
bool file_find_subpath(files_struct *dir_fsp);
-void file_sync_all(connection_struct *conn);
void fsp_free(files_struct *fsp);
void file_free(struct smb_request *req, files_struct *fsp);
files_struct *file_fsp(struct smb_request *req, uint16_t fid);
bool allow_broken_path,
char **pp_name_out,
bool *ppath_contains_wcard);
-NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
- struct tevent_context *ev,
- struct messaging_context *msg,
- connection_struct **pconn,
- int snum,
- const char *path,
- const struct auth_session_info *session_info);
-NTSTATUS create_conn_struct_cwd(TALLOC_CTX *ctx,
- struct tevent_context *ev,
- struct messaging_context *msg,
- connection_struct **pconn,
+struct connection_struct;
+struct smb_filename;
+struct conn_struct_tos {
+ struct connection_struct *conn;
+ struct smb_filename *oldcwd_fname;
+};
+NTSTATUS create_conn_struct_tos(struct messaging_context *msg,
int snum,
const char *path,
const struct auth_session_info *session_info,
- struct smb_filename **poldcwd_fname);
+ struct conn_struct_tos **_c);
+NTSTATUS create_conn_struct_tos_cwd(struct messaging_context *msg,
+ int snum,
+ const char *path,
+ const struct auth_session_info *session_info,
+ struct conn_struct_tos **_c);
/* The following definitions come from smbd/negprot.c */
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,
+NTSTATUS change_notify_create(struct files_struct *fsp,
+ uint32_t max_buffer_size,
+ uint32_t filter,
bool recursive);
NTSTATUS change_notify_add_request(struct smb_request *req,
uint32_t max_param,
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,
uint32_t max_data_count,
uint8_t **ppmarshalled_sd,
size_t *psd_size);
+#ifdef HAVE_SYS_QUOTAS
+
+struct smb2_query_quota_info;
+
+NTSTATUS smbd_do_query_getinfo_quota(TALLOC_CTX *mem_ctx,
+ files_struct *fsp,
+ bool restart_scan,
+ bool return_single,
+ uint32_t sid_list_length,
+ DATA_BLOB *sidbuffer,
+ uint32_t max_data_count,
+ uint8_t **p_data,
+ uint32_t *p_data_size);
+#endif
void reply_nttrans(struct smb_request *req);
void reply_nttranss(struct smb_request *req);
files_struct *fsp);
bool is_stat_open(uint32_t access_mask);
NTSTATUS send_break_message(struct messaging_context *msg_ctx,
- const struct share_mode_entry *exclusive,
- uint16_t break_to);
+ const struct file_id *id,
+ const struct share_mode_entry *exclusive,
+ uint16_t break_to);
struct deferred_open_record;
bool is_deferred_open_async(const struct deferred_open_record *rec);
NTSTATUS create_directory(connection_struct *conn, struct smb_request *req,
uint32_t msg_type,
struct server_id server_id,
DATA_BLOB *data);
-int find_share_mode_lease(struct share_mode_data *d,
- const struct GUID *client_guid,
- const struct smb2_lease_key *key);
struct share_mode_lease;
-struct fsp_lease *find_fsp_lease(files_struct *new_fsp,
+NTSTATUS update_share_mode_lease_from_db(
+ struct share_mode_data *d,
+ const struct GUID *client_guid,
+ const struct smb2_lease_key *lease_key);
+struct fsp_lease *find_fsp_lease(struct files_struct *new_fsp,
const struct smb2_lease_key *key,
- const struct share_mode_lease *l);
+ uint32_t current_state,
+ uint16_t lease_version,
+ uint16_t lease_epoch);
NTSTATUS create_file_default(connection_struct *conn,
struct smb_request *req,
uint16_t root_dir_fid,
enum level2_contention_type type);
void share_mode_entry_to_message(char *msg, const struct file_id *id,
const struct share_mode_entry *e);
-void message_to_share_mode_entry(struct share_mode_entry *e, const char *msg);
+void message_to_share_mode_entry(struct file_id *id,
+ struct share_mode_entry *e,
+ const char *msg);
bool init_oplocks(struct smbd_server_connection *sconn);
void init_kernel_oplocks(struct smbd_server_connection *sconn);
-/* The following definitions come from smbd/oplock_irix.c */
-
-struct kernel_oplocks *irix_init_kernel_oplocks(struct smbd_server_connection *sconn);
-
/* The following definitions come from smbd/oplock_linux.c */
void linux_set_lease_capability(void);
/* The following definitions come from smbd/posix_acls.c */
+mode_t unix_perms_to_acl_perms(mode_t mode, int r_mask, int w_mask, int x_mask);
+int map_acl_perms_to_permset(mode_t mode, SMB_ACL_PERMSET_T *p_permset);
uint32_t map_canon_ace_perms(int snum,
enum security_ace_type *pacl_type,
mode_t perms,
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 struct smb_filename *smb_fname,
uint16_t num_def_acls, const char *pdata);
TALLOC_CTX *ctx,
enum default_acl_style acl_style,
const char *name,
- SMB_STRUCT_STAT *psbuf,
+ const SMB_STRUCT_STAT *psbuf,
struct security_descriptor **ppdesc);
/* The following definitions come from smbd/process.c */
-void smbd_setup_sig_term_handler(struct smbd_server_connection *sconn);
-void smbd_setup_sig_hup_handler(struct smbd_server_connection *sconn);
bool srv_send_smb(struct smbXsrv_connection *xconn, char *buffer,
bool no_signing, uint32_t seqnum,
bool do_encrypt,
struct smb_perfcount_data *pcd);
-int srv_set_message(char *buf,
- int num_words,
- int num_bytes,
- bool zero);
+size_t srv_set_message(char *buf,
+ size_t num_words,
+ size_t num_bytes,
+ bool zero);
void remove_deferred_open_message_smb(struct smbXsrv_connection *xconn,
uint64_t mid);
bool schedule_deferred_open_message_smb(struct smbXsrv_connection *xconn,
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);
+size_t 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);
struct memcache *smbd_memcache(void);
bool snum_is_shared_printer(int snum);
-void delete_and_reload_printers(struct tevent_context *ev,
- struct messaging_context *msg_ctx);
+void delete_and_reload_printers(void);
bool reload_services(struct smbd_server_connection *sconn,
bool (*snumused) (struct smbd_server_connection *, int),
bool test);
bool set_conn_connectpath(connection_struct *conn, const char *connectpath);
NTSTATUS set_conn_force_user_group(connection_struct *conn, int snum);
-bool set_current_service(connection_struct *conn, uint16_t flags, bool do_chdir);
+void set_current_case_sensitive(connection_struct *conn, uint16_t flags);
+bool chdir_current_service(connection_struct *conn);
void load_registry_shares(void);
int add_home_service(const char *service, const char *username, const char *homedir);
int find_service(TALLOC_CTX *ctx, const char *service, char **p_service_out);
uint32_t *p_share_access,
bool *p_readonly_share);
bool change_to_user(connection_struct *conn, uint64_t vuid);
+bool change_to_user_by_fsp(struct files_struct *fsp);
bool smbd_change_to_root_user(void);
bool smbd_become_authenticated_pipe_user(struct auth_session_info *session_info);
bool smbd_unbecome_authenticated_pipe_user(void);
void smbd_become_root(void);
void smbd_unbecome_root(void);
bool become_user(connection_struct *conn, uint64_t vuid);
+bool become_user_by_fsp(struct files_struct *fsp);
bool become_user_by_session(connection_struct *conn,
const struct auth_session_info *session_info);
bool unbecome_user(void);
bool vfs_init_custom(connection_struct *conn, const char *vfs_object);
bool smbd_vfs_init(connection_struct *conn);
NTSTATUS vfs_file_exist(connection_struct *conn, struct smb_filename *smb_fname);
-ssize_t vfs_read_data(files_struct *fsp, char *buf, size_t byte_count);
-ssize_t vfs_write_data(struct smb_request *req,
- files_struct *fsp,
- const char *buffer,
- size_t N);
ssize_t vfs_pwrite_data(struct smb_request *req,
files_struct *fsp,
const char *buffer,