/* The following definitions come from smbd/smb2_signing.c */
-bool smb2_srv_init_signing(struct smbXsrv_connection *conn);
bool srv_init_signing(struct smbXsrv_connection *conn);
/* The following definitions come from smbd/aio.c */
int conn_num_open(struct smbd_server_connection *sconn);
bool conn_snum_used(struct smbd_server_connection *sconn, int snum);
+enum protocol_types conn_protocol(struct smbd_server_connection *sconn);
+bool conn_using_smb2(struct smbd_server_connection *sconn);
connection_struct *conn_new(struct smbd_server_connection *sconn);
bool conn_idle_all(struct smbd_server_connection *sconn, time_t t);
void conn_clear_vuid_caches(struct smbd_server_connection *sconn, uint64_t vuid);
uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
void flush_dfree_cache(void);
-/* The following definitions come from smbd/dir.c */
-
-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);
-uint16_t dptr_attr(struct smbd_server_connection *sconn, int key);
-void dptr_closecnum(connection_struct *conn);
-NTSTATUS dptr_create(connection_struct *conn,
- struct smb_request *req,
- files_struct *fsp,
- bool old_handle,
- const char *wcard,
- 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);
-unsigned int dptr_FileNumber(struct dptr_struct *dptr);
-bool dptr_has_wild(struct dptr_struct *dptr);
-int dptr_dnum(struct dptr_struct *dptr);
-bool dptr_get_priv(struct dptr_struct *dptr);
-void dptr_set_priv(struct dptr_struct *dptr);
-bool dptr_case_sensitive(struct dptr_struct *dptr);
-bool dptr_SearchDir(struct dptr_struct *dptr, const char *name, long *poffset, SMB_STRUCT_STAT *pst);
-bool dptr_fill(struct smbd_server_connection *sconn,
- char *buf1,unsigned int key);
-files_struct *dptr_fetch_fsp(struct smbd_server_connection *sconn,
- char *buf,int *num);
-struct smb_Dir;
-struct files_struct *dir_hnd_fetch_fsp(struct smb_Dir *dir_hnd);
-files_struct *dptr_fetch_lanman2_fsp(struct smbd_server_connection *sconn,
- int dptr_num);
-bool get_dir_entry(TALLOC_CTX *ctx,
- struct dptr_struct *dirptr,
- const char *mask,
- uint32_t dirtype,
- char **pp_fname_out,
- off_t *size,
- uint32_t *mode,
- struct timespec *date,
- bool check_descend,
- bool ask_sharemode);
-struct smb_Dir;
-bool is_visible_fsp(files_struct *fsp);
-NTSTATUS OpenDir(TALLOC_CTX *mem_ctx,
- connection_struct *conn,
- const struct smb_filename *smb_dname,
- const char *mask,
- uint32_t attr,
- struct smb_Dir **_dir_hnd);
-NTSTATUS OpenDir_from_pathref(TALLOC_CTX *mem_ctx,
- struct files_struct *dirfsp,
- const char *mask,
- uint32_t attr,
- struct smb_Dir **_dir_hnd);
-const char *ReadDirName(struct smb_Dir *dir_hnd, long *poffset,
- SMB_STRUCT_STAT *sbuf, char **talloced);
-void RewindDir(struct smb_Dir *dir_hnd, 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 void *dmapi_get_current_session(void);
const struct smb_filename *smb_fname,
struct files_struct *parent_dirfsp);
uint32_t dos_mode_msdfs(connection_struct *conn,
- const struct smb_filename *smb_fname);
+ const char *name,
+ const struct stat_ex *st);
uint32_t fdos_mode(struct files_struct *fsp);
struct tevent_req *dos_mode_at_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
int file_ntimes(connection_struct *conn,
files_struct *fsp,
struct smb_file_time *ft);
-bool set_sticky_write_time_path(struct file_id fileid, struct timespec mtime);
bool set_sticky_write_time_fsp(struct files_struct *fsp,
struct timespec mtime);
connection_struct *conn,
const char *filename_in,
uint32_t ucf_flags);
-NTSTATUS filename_convert_smb1_search_path(TALLOC_CTX *ctx,
- connection_struct *conn,
- char *name_in,
- uint32_t ucf_flags,
- struct files_struct **_dirfsp,
- struct smb_filename **_smb_fname_out,
- char **_mask_out);
NTSTATUS get_real_filename_at(struct files_struct *dirfsp,
const char *name,
TALLOC_CTX *mem_ctx,
NTSTATUS open_stream_pathref_fsp(
struct files_struct **_base_fsp,
struct smb_filename *smb_fname);
-NTSTATUS openat_pathref_dirfsp_nosymlink(
+
+struct reparse_data_buffer;
+
+NTSTATUS openat_pathref_fsp_nosymlink(
TALLOC_CTX *mem_ctx,
struct connection_struct *conn,
+ struct files_struct *dirfsp,
const char *path_in,
NTTIME twrp,
bool posix,
struct smb_filename **_smb_fname,
- size_t *unparsed,
- char **substitute);
+ struct reparse_data_buffer **_symlink_err);
+NTSTATUS openat_pathref_fsp_lcomp(struct files_struct *dirfsp,
+ struct smb_filename *smb_fname_rel,
+ uint32_t ucf_flags);
NTSTATUS readlink_talloc(
TALLOC_CTX *mem_ctx,
struct files_struct *dirfsp,
struct smb_filename *smb_relname,
char **_substitute);
+NTSTATUS read_symlink_reparse(TALLOC_CTX *mem_ctx,
+ struct files_struct *dirfsp,
+ struct smb_filename *smb_relname,
+ struct reparse_data_buffer **_reparse);
+
void smb_fname_fsp_unlink(struct smb_filename *smb_fname);
NTSTATUS move_smb_fname_fsp_link(struct smb_filename *smb_fname_dst,
uint32_t access_mask);
NTSTATUS check_parent_access_fsp(struct files_struct *fsp,
uint32_t access_mask);
+bool smbd_is_tmpname(const char *n, int *_unlink_flags);
NTSTATUS fd_openat(const struct files_struct *dirfsp,
struct smb_filename *smb_fname,
files_struct *fsp,
enum level2_contention_type type);
void smbd_contend_level2_oplocks_end(files_struct *fsp,
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 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);
size_t smb_maxcnt);
NTSTATUS rename_internals_fsp(connection_struct *conn,
files_struct *fsp,
- struct files_struct *dst_dirfsp,
struct smb_filename *smb_fname_dst_in,
const char *dst_original_lcomp,
uint32_t attrs,
struct smb_request *req,
struct files_struct *src_dirfsp,
struct smb_filename *smb_fname_src,
- struct files_struct *dst_dirfsp,
struct smb_filename *smb_fname_dst,
const char *dst_original_lcomp,
uint32_t attrs,
const char *domain,
const char *sharename,
const struct security_token *token,
- const char **list);
+ const char **list,
+ bool *match);
bool user_ok_token(const char *username, const char *domain,
const struct security_token *token, int snum);
bool is_share_read_only_for_token(const char *username,
const char *domain,
const struct security_token *token,
- connection_struct *conn);
+ connection_struct *conn,
+ bool *_read_only);
/* The following definitions come from smbd/srvstr.c */
files_struct *fsp,
struct smb_filename *smb_fname);
NTSTATUS refuse_symlink_fsp(const struct files_struct *fsp);
-NTSTATUS check_access_fsp(struct files_struct *fsp,
- uint32_t access_mask);
+NTSTATUS check_any_access_fsp(struct files_struct *fsp,
+ uint32_t access_requested);
uint64_t smb_roundup(connection_struct *conn, uint64_t val);
bool samba_private_attr_name(const char *unix_ea_name);
NTSTATUS get_ea_value_fsp(TALLOC_CTX *mem_ctx,
connection_struct *conn,
struct smb_request *req,
bool overwrite_if_exists,
- struct files_struct *old_dirfsp,
const struct smb_filename *smb_fname_old,
- struct files_struct *new_dirfsp,
struct smb_filename *smb_fname_new);
NTSTATUS smb_set_file_time(connection_struct *conn,
files_struct *fsp,
off_t vfs_transfer_file(files_struct *in, files_struct *out, off_t n);
const char *vfs_readdirname(connection_struct *conn,
struct files_struct *dirfsp,
- void *p,
- SMB_STRUCT_STAT *sbuf,
+ DIR *d,
char **talloced);
int vfs_ChDir(connection_struct *conn,
const struct smb_filename *smb_fname);
files_struct **result,
DATA_BLOB *new_cookie);
-/* The following definitions come from smbd/smb2_posix.c */
-ssize_t smb2_posix_cc_info(
+struct smb3_file_posix_information;
+void smb3_file_posix_information_init(
connection_struct *conn,
- uint32_t reparse_tag,
- const SMB_STRUCT_STAT *psbuf,
- const struct dom_sid *owner,
- const struct dom_sid *group,
- uint8_t *buf,
- size_t buflen);
-ssize_t store_smb2_posix_info(
- connection_struct *conn,
- const SMB_STRUCT_STAT *psbuf,
+ const struct stat_ex *st,
uint32_t reparse_tag,
uint32_t dos_attributes,
- uint8_t *buf,
- size_t buflen);
+ struct smb3_file_posix_information *dst);
#endif /* _SMBD_PROTO_H_ */