/* The following definitions come from smbd/signing.c */
-bool srv_check_sign_mac(struct smbd_server_connection *conn,
+struct smbXsrv_connection;
+
+bool srv_check_sign_mac(struct smbXsrv_connection *conn,
const char *inbuf, uint32_t *seqnum, bool trusted_channel);
-void srv_calculate_sign_mac(struct smbd_server_connection *conn,
+void srv_calculate_sign_mac(struct smbXsrv_connection *conn,
char *outbuf, uint32_t seqnum);
-void srv_cancel_sign_response(struct smbd_server_connection *conn);
-bool srv_init_signing(struct smbd_server_connection *conn);
-void srv_set_signing_negotiated(struct smbd_server_connection *conn,
+void srv_cancel_sign_response(struct smbXsrv_connection *conn);
+bool srv_init_signing(struct smbXsrv_connection *conn);
+void srv_set_signing_negotiated(struct smbXsrv_connection *conn,
bool allowed, bool mandatory);
-bool srv_is_signing_active(struct smbd_server_connection *conn);
-bool srv_is_signing_negotiated(struct smbd_server_connection *conn);
-void srv_set_signing(struct smbd_server_connection *conn,
+bool srv_is_signing_active(struct smbXsrv_connection *conn);
+bool srv_is_signing_negotiated(struct smbXsrv_connection *conn);
+void srv_set_signing(struct smbXsrv_connection *conn,
const DATA_BLOB user_session_key,
const DATA_BLOB response);
/* The following definitions come from smbd/blocking.c */
-void brl_timeout_fn(struct event_context *event_ctx,
- struct timed_event *te,
+void brl_timeout_fn(struct tevent_context *event_ctx,
+ struct tevent_timer *te,
struct timeval now,
void *private_data);
struct timeval timeval_brl_min(const struct timeval *tv1,
/* The following definitions come from smbd/dir.c */
-bool make_dir_struct(TALLOC_CTX *ctx,
- char *buf,
- const char *mask,
- const char *fname,
- off_t size,
- uint32 mode,
- time_t date,
- bool uc);
bool init_dptrs(struct smbd_server_connection *sconn);
const char *dptr_path(struct smbd_server_connection *sconn, int key);
const char *dptr_wcard(struct smbd_server_connection *sconn, int key);
int dptr_dnum(struct dptr_struct *dptr);
bool dptr_get_priv(struct dptr_struct *dptr);
void dptr_set_priv(struct dptr_struct *dptr);
-char *dptr_ReadDirName(TALLOC_CTX *ctx,
- struct dptr_struct *dptr,
- long *poffset,
- SMB_STRUCT_STAT *pst);
bool dptr_SearchDir(struct dptr_struct *dptr, const char *name, long *poffset, SMB_STRUCT_STAT *pst);
-void dptr_DirCacheAdd(struct dptr_struct *dptr, const char *name, long offset);
void dptr_init_search_op(struct dptr_struct *dptr);
bool dptr_fill(struct smbd_server_connection *sconn,
char *buf1,unsigned int key);
char *buf,int *num);
struct dptr_struct *dptr_fetch_lanman2(struct smbd_server_connection *sconn,
int dptr_num);
-bool dir_check_ftype(connection_struct *conn, uint32 mode, uint32 dirtype);
bool get_dir_entry(TALLOC_CTX *ctx,
struct dptr_struct *dirptr,
const char *mask,
void RewindDir(struct smb_Dir *dirp, long *poffset);
void SeekDir(struct smb_Dir *dirp, long offset);
long TellDir(struct smb_Dir *dirp);
-void DirCacheAdd(struct smb_Dir *dirp, const char *name, long offset);
bool SearchDir(struct smb_Dir *dirp, const char *name, long *poffset);
NTSTATUS can_delete_directory(struct connection_struct *conn,
const char *dirname);
/* 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 event_context *ctx,
- struct timed_event *te,
+void update_write_time_handler(struct tevent_context *ctx,
+ struct tevent_timer *te,
struct timeval now,
void *private_data);
void trigger_write_time_update(struct files_struct *fsp);
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 fid);
+struct files_struct *file_fsp_get(struct smbd_smb2_request *smb2req,
+ uint64_t persistent_id,
+ uint64_t volatile_id);
struct files_struct *file_fsp_smb2(struct smbd_smb2_request *smb2req,
uint64_t persistent_id,
uint64_t volatile_id);
connection_struct **pconn,
int snum,
const char *path,
- const struct auth_session_info *session_info,
- char **poldcwd);
+ 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,
+ int snum,
+ const char *path,
+ const struct auth_session_info *session_info,
+ char **poldcwd);
/* The following definitions come from smbd/negprot.c */
const char *path);
char *notify_filter_string(TALLOC_CTX *mem_ctx, uint32 filter);
struct sys_notify_context *sys_notify_context_create(TALLOC_CTX *mem_ctx,
- struct event_context *ev);
+ struct tevent_context *ev);
/* The following definitions come from smbd/notify_inotify.c */
struct notify_context *notify_init(TALLOC_CTX *mem_ctx,
struct messaging_context *messaging_ctx,
- struct event_context *ev);
+ struct tevent_context *ev);
NTSTATUS notify_add(struct notify_context *notify,
const char *path, uint32_t filter, uint32_t subdir_filter,
- void (*callback)(void *, const struct notify_event *),
+ void (*callback)(void *, struct timespec,
+ const struct notify_event *),
void *private_data);
NTSTATUS notify_remove(struct notify_context *notify, void *private_data);
void notify_trigger(struct notify_context *notify,
const char *fname,
SMB_STRUCT_STAT *psbuf);
bool is_stat_open(uint32 access_mask);
-void remove_deferred_open_entry(struct file_id id, uint64_t mid,
- struct server_id pid);
-bool is_deferred_open_async(const void *ptr);
-NTSTATUS open_file_fchmod(connection_struct *conn,
- struct smb_filename *smb_fname,
- files_struct **result);
+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,
struct smb_filename *smb_dname);
void msg_file_was_renamed(struct messaging_context *msg,
uint32_t create_options,
uint32_t file_attributes,
uint32_t oplock_request,
+ struct smb2_lease *lease,
uint64_t allocation_size,
uint32_t private_flags,
struct security_descriptor *sd,
/* The following definitions come from smbd/oplock.c */
void break_kernel_oplock(struct messaging_context *msg_ctx, files_struct *fsp);
-NTSTATUS set_file_oplock(files_struct *fsp, int oplock_type);
-void release_file_oplock(files_struct *fsp);
+NTSTATUS set_file_oplock(files_struct *fsp);
bool remove_oplock(files_struct *fsp);
bool downgrade_oplock(files_struct *fsp);
-bool should_notify_deferred_opens(struct smbd_server_connection *sconn);
-void break_level2_to_none_async(files_struct *fsp);
-void reply_to_oplock_break_requests(files_struct *fsp);
void contend_level2_oplocks_begin(files_struct *fsp,
enum level2_contention_type type);
void contend_level2_oplocks_end(files_struct *fsp,
void smbd_contend_level2_oplocks_end(files_struct *fsp,
enum level2_contention_type type);
void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e);
-void message_to_share_mode_entry(struct share_mode_entry *e, char *msg);
+void message_to_share_mode_entry(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/posix_acls.c */
void create_file_sids(const SMB_STRUCT_STAT *psbuf, struct dom_sid *powner_sid, struct dom_sid *pgroup_sid);
-bool nt4_compatible_acls(void);
uint32_t map_canon_ace_perms(int snum,
enum security_ace_type *pacl_type,
mode_t perms,
TALLOC_CTX *mem_ctx,
struct security_descriptor **ppdesc);
NTSTATUS try_chown(files_struct *fsp, uid_t uid, gid_t gid);
-NTSTATUS append_parent_acl(files_struct *fsp,
- const struct security_descriptor *pcsd,
- struct security_descriptor **pp_new_sd);
NTSTATUS set_nt_acl(files_struct *fsp, uint32 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);
const SMB_STRUCT_STAT *psbuf,
uint16 num_def_acls, const char *pdata);
bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp, const char *fname, uint16 num_acls, const char *pdata);
-struct security_descriptor *get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname, uint32 security_info_wanted);
+NTSTATUS get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname,
+ uint32 security_info_wanted,
+ struct security_descriptor **sd);
NTSTATUS make_default_filesystem_acl(TALLOC_CTX *ctx,
const char *name,
SMB_STRUCT_STAT *psbuf,
bool open_was_deferred(struct smbd_server_connection *sconn, uint64_t mid);
bool get_deferred_open_message_state(struct smb_request *smbreq,
struct timeval *p_request_time,
- void **pp_state);
+ struct deferred_open_record **open_rec);
bool push_deferred_open_message_smb(struct smb_request *req,
- struct timeval request_time,
- struct timeval timeout,
- struct file_id id,
- char *private_data,
- size_t priv_len);
+ struct timeval request_time,
+ struct timeval timeout,
+ struct file_id id,
+ struct deferred_open_record *open_rec);
NTSTATUS allow_new_trans(struct trans_state *list, uint64_t mid);
void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes);
void smb_request_done(struct smb_request *req);
struct smbd_server_connection *sconn,
bool encrypted, uint32_t seqnum,
struct smb_request ***reqs, unsigned *num_reqs);
-bool req_is_in_chain(struct smb_request *req);
+bool req_is_in_chain(const struct smb_request *req);
void smbd_process(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx,
int sock_fd,
size_t srvstr_get_path_req(TALLOC_CTX *mem_ctx, struct smb_request *req,
char **pp_dest, const char *src, int flags,
NTSTATUS *err);
+size_t srvstr_pull_req_talloc(TALLOC_CTX *ctx, struct smb_request *req,
+ char **dest, const uint8_t *src, int flags);
bool check_fsp_open(connection_struct *conn, struct smb_request *req,
files_struct *fsp);
bool check_fsp(connection_struct *conn, struct smb_request *req,
files_struct *fsp);
bool check_fsp_ntquota_handle(connection_struct *conn, struct smb_request *req,
files_struct *fsp);
-void reply_special(struct smbd_server_connection *sconn, char *inbuf, size_t inbuf_len);
+void reply_special(struct smbXsrv_connection *xconn, char *inbuf, size_t inbuf_size);
void reply_tcon(struct smb_request *req);
void reply_tcon_and_X(struct smb_request *req);
void reply_unknown_new(struct smb_request *req, uint8 type);
uint32 dirtype, struct smb_filename *smb_fname,
bool has_wild);
void reply_unlink(struct smb_request *req);
-ssize_t fake_sendfile(files_struct *fsp, off_t startpos, size_t nread);
-void sendfile_short_send(files_struct *fsp,
- ssize_t nread,
- size_t headersize,
- size_t smb_maxcnt);
+ssize_t fake_sendfile(struct smbXsrv_connection *xconn, files_struct *fsp,
+ off_t startpos, size_t nread);
+ssize_t sendfile_short_send(struct smbXsrv_connection *xconn,
+ files_struct *fsp,
+ ssize_t nread,
+ size_t headersize,
+ size_t smb_maxcnt);
void reply_readbraw(struct smb_request *req);
void reply_lockread(struct smb_request *req);
void reply_read(struct smb_request *req);
void reply_writebraw(struct smb_request *req);
void reply_writeunlock(struct smb_request *req);
void reply_write(struct smb_request *req);
-bool is_valid_writeX_buffer(struct smbd_server_connection *sconn,
+bool is_valid_writeX_buffer(struct smbXsrv_connection *xconn,
const uint8_t *inbuf);
void reply_write_and_X(struct smb_request *req);
void reply_lseek(struct smb_request *req);
uint64_t get_lock_count(const uint8_t *data, int data_offset,
bool large_file_format);
uint64_t get_lock_offset(const uint8_t *data, int data_offset,
- bool large_file_format, bool *err);
+ bool large_file_format);
void reply_lockingX(struct smb_request *req);
void reply_readbmpx(struct smb_request *req);
void reply_readbs(struct smb_request *req);
/* The following definitions come from smbd/seal.c */
-bool is_encrypted_packet(struct smbd_server_connection *sconn,
- const uint8_t *inbuf);
-void srv_free_enc_buffer(struct smbd_server_connection *sconn, char *buf);
-NTSTATUS srv_decrypt_buffer(struct smbd_server_connection *sconn, char *buf);
-NTSTATUS srv_encrypt_buffer(struct smbd_server_connection *sconn, char *buf,
+bool is_encrypted_packet(const uint8_t *inbuf);
+void srv_free_enc_buffer(struct smbXsrv_connection *xconn, char *buf);
+NTSTATUS srv_decrypt_buffer(struct smbXsrv_connection *xconn, char *buf);
+NTSTATUS srv_encrypt_buffer(struct smbXsrv_connection *xconn, char *buf,
char **buf_out);
NTSTATUS srv_request_encryption_setup(connection_struct *conn,
unsigned char **ppdata,
unsigned char **pparam,
size_t *p_param_size);
NTSTATUS srv_encryption_start(connection_struct *conn);
-void server_encryption_shutdown(struct smbd_server_connection *sconn);
+void server_encryption_shutdown(struct smbXsrv_connection *xconn);
/* The following definitions come from smbd/sec_ctx.c */
void set_root_sec_ctx(void);
bool pop_sec_ctx(void);
void init_sec_ctx(void);
+const struct security_token *sec_ctx_active_token(void);
/* The following definitions come from smbd/server.c */
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);
bool reload_services(struct smbd_server_connection *sconn,
bool (*snumused) (struct smbd_server_connection *, int),
bool test);
-NTSTATUS messaging_send_to_children(struct messaging_context *msg_ctx,
- uint32_t msg_type, DATA_BLOB* data);
/* The following definitions come from smbd/server_exit.c */
const char *pdev,
NTSTATUS *pstatus);
connection_struct *make_connection(struct smbd_server_connection *sconn,
+ NTTIME now,
const char *service_in,
const char *pdev, uint64_t vuid,
NTSTATUS *status);
bool session_claim(struct smbXsrv_session *session);
void session_yield(struct smbXsrv_session *session);
int list_sessions(TALLOC_CTX *mem_ctx, struct sessionid **session_list);
+int find_sessions(TALLOC_CTX *mem_ctx, const char *username,
+ const char *machine, struct sessionid **session_list);
/* The following definitions come from smbd/sesssetup.c */
/* The following definitions come from smbd/srvstr.c */
-size_t srvstr_push_fn(const char *base_ptr, uint16 smb_flags2, void *dest,
- const char *src, int dest_len, int flags);
+NTSTATUS srvstr_push_fn(const char *base_ptr, uint16 smb_flags2, void *dest,
+ const char *src, int dest_len, int flags, size_t *ret_len);
ssize_t message_push_string(uint8 **outbuf, const char *str, int flags);
/* The following definitions come from smbd/statcache.c */
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);
+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);
struct ea_list *read_ea_list_entry(TALLOC_CTX *ctx, const char *pdata, size_t data_size, size_t *pbytes_used);
void send_trans2_replies(connection_struct *conn,
struct smb_request *req,
+ NTSTATUS status,
const char *params,
int paramsize,
const char *pdata,
/* The following definitions come from smbd/uid.c */
bool change_to_guest(void);
+NTSTATUS check_user_share_access(connection_struct *conn,
+ const struct auth_session_info *session_info,
+ uint32_t *p_share_access,
+ bool *p_readonly_share);
bool change_to_user(connection_struct *conn, uint64_t vuid);
-bool change_to_root_user(void);
bool smbd_change_to_root_user(void);
-bool become_authenticated_pipe_user(struct auth_session_info *session_info);
-bool unbecome_authenticated_pipe_user(void);
+bool smbd_become_authenticated_pipe_user(struct auth_session_info *session_info);
+bool smbd_unbecome_authenticated_pipe_user(void);
void become_root(void);
void unbecome_root(void);
void smbd_become_root(void);
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_pread_data(files_struct *fsp, char *buf,
- size_t byte_count, off_t offset);
ssize_t vfs_write_data(struct smb_request *req,
files_struct *fsp,
const char *buffer,