mirror of
https://github.com/samba-team/samba.git
synced 2025-01-24 02:04:21 +03:00
s3: smbd: Always use ucf_flags_from_smb_request() in place of checking by hand (in most cases).
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Uri Simchoni <uri@samba.org>
This commit is contained in:
parent
f5866c66a4
commit
4910febdac
@ -1573,8 +1573,8 @@ void reply_ntrename(struct smb_request *req)
|
||||
bool src_has_wcard = False;
|
||||
bool dest_has_wcard = False;
|
||||
uint32_t attrs;
|
||||
uint32_t ucf_flags_src = (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
|
||||
uint32_t ucf_flags_dst = (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
|
||||
uint32_t ucf_flags_src = ucf_flags_from_smb_request(req);
|
||||
uint32_t ucf_flags_dst = ucf_flags_from_smb_request(req);
|
||||
uint16_t rename_type;
|
||||
TALLOC_CTX *ctx = talloc_tos();
|
||||
bool stream_rename = false;
|
||||
|
@ -5366,8 +5366,7 @@ NTSTATUS get_relative_fid_filename(connection_struct *conn,
|
||||
files_struct *dir_fsp;
|
||||
char *parent_fname = NULL;
|
||||
char *new_base_name = NULL;
|
||||
uint32_t ucf_flags = ((req != NULL && req->posix_pathnames) ?
|
||||
UCF_POSIX_PATHNAMES : 0);
|
||||
uint32_t ucf_flags = ucf_flags_from_smb_request(req);
|
||||
NTSTATUS status;
|
||||
|
||||
if (root_dir_fid == 0 || !smb_fname) {
|
||||
|
@ -1278,7 +1278,7 @@ void reply_checkpath(struct smb_request *req)
|
||||
struct smb_filename *smb_fname = NULL;
|
||||
char *name = NULL;
|
||||
NTSTATUS status;
|
||||
uint32_t ucf_flags = (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
|
||||
uint32_t ucf_flags = ucf_flags_from_smb_request(req);
|
||||
TALLOC_CTX *ctx = talloc_tos();
|
||||
|
||||
START_PROFILE(SMBcheckpath);
|
||||
@ -1393,8 +1393,7 @@ void reply_getatr(struct smb_request *req)
|
||||
size = 0;
|
||||
mtime = 0;
|
||||
} else {
|
||||
uint32_t ucf_flags = (req->posix_pathnames ?
|
||||
UCF_POSIX_PATHNAMES : 0);
|
||||
uint32_t ucf_flags = ucf_flags_from_smb_request(req);
|
||||
status = filename_convert(ctx,
|
||||
conn,
|
||||
req->flags2 & FLAGS2_DFS_PATHNAMES,
|
||||
@ -1480,7 +1479,7 @@ void reply_setatr(struct smb_request *req)
|
||||
time_t mtime;
|
||||
const char *p;
|
||||
NTSTATUS status;
|
||||
uint32_t ucf_flags = (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
|
||||
uint32_t ucf_flags = ucf_flags_from_smb_request(req);
|
||||
TALLOC_CTX *ctx = talloc_tos();
|
||||
|
||||
START_PROFILE(SMBsetatr);
|
||||
@ -1798,7 +1797,7 @@ void reply_search(struct smb_request *req)
|
||||
if (status_len == 0) {
|
||||
struct smb_filename *smb_dname = NULL;
|
||||
uint32_t ucf_flags = UCF_ALWAYS_ALLOW_WCARD_LCOMP |
|
||||
(req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
|
||||
ucf_flags_from_smb_request(req);
|
||||
nt_status = filename_convert(ctx, conn,
|
||||
req->flags2 & FLAGS2_DFS_PATHNAMES,
|
||||
path,
|
||||
@ -3220,7 +3219,7 @@ void reply_unlink(struct smb_request *req)
|
||||
NTSTATUS status;
|
||||
bool path_contains_wcard = False;
|
||||
uint32_t ucf_flags = UCF_COND_ALLOW_WCARD_LCOMP |
|
||||
(req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
|
||||
ucf_flags_from_smb_request(req);
|
||||
TALLOC_CTX *ctx = talloc_tos();
|
||||
|
||||
START_PROFILE(SMBunlink);
|
||||
@ -6210,7 +6209,7 @@ void reply_rmdir(struct smb_request *req)
|
||||
TALLOC_CTX *ctx = talloc_tos();
|
||||
files_struct *fsp = NULL;
|
||||
int info = 0;
|
||||
uint32_t ucf_flags = (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
|
||||
uint32_t ucf_flags = ucf_flags_from_smb_request(req);
|
||||
struct smbd_server_connection *sconn = req->sconn;
|
||||
|
||||
START_PROFILE(SMBrmdir);
|
||||
@ -7294,12 +7293,15 @@ void reply_mv(struct smb_request *req)
|
||||
TALLOC_CTX *ctx = talloc_tos();
|
||||
struct smb_filename *smb_fname_src = NULL;
|
||||
struct smb_filename *smb_fname_dst = NULL;
|
||||
uint32_t src_ucf_flags = (req->posix_pathnames ?
|
||||
(UCF_UNIX_NAME_LOOKUP|UCF_POSIX_PATHNAMES) :
|
||||
UCF_COND_ALLOW_WCARD_LCOMP);
|
||||
uint32_t dst_ucf_flags = UCF_SAVE_LCOMP |
|
||||
(req->posix_pathnames ? UCF_POSIX_PATHNAMES :
|
||||
UCF_COND_ALLOW_WCARD_LCOMP);
|
||||
uint32_t src_ucf_flags = ucf_flags_from_smb_request(req) |
|
||||
(req->posix_pathnames ?
|
||||
UCF_UNIX_NAME_LOOKUP :
|
||||
UCF_COND_ALLOW_WCARD_LCOMP);
|
||||
uint32_t dst_ucf_flags = ucf_flags_from_smb_request(req) |
|
||||
UCF_SAVE_LCOMP |
|
||||
(req->posix_pathnames ?
|
||||
0 :
|
||||
UCF_COND_ALLOW_WCARD_LCOMP);
|
||||
bool stream_rename = false;
|
||||
|
||||
START_PROFILE(SMBmv);
|
||||
@ -7612,9 +7614,9 @@ void reply_copy(struct smb_request *req)
|
||||
bool dest_has_wild = False;
|
||||
NTSTATUS status;
|
||||
uint32_t ucf_flags_src = UCF_COND_ALLOW_WCARD_LCOMP |
|
||||
(req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
|
||||
ucf_flags_from_smb_request(req);
|
||||
uint32_t ucf_flags_dst = UCF_COND_ALLOW_WCARD_LCOMP |
|
||||
(req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
|
||||
ucf_flags_from_smb_request(req);
|
||||
TALLOC_CTX *ctx = talloc_tos();
|
||||
|
||||
START_PROFILE(SMBcopy);
|
||||
|
@ -1225,7 +1225,7 @@ static void call_trans2open(connection_struct *conn,
|
||||
uint32_t create_disposition;
|
||||
uint32_t create_options = 0;
|
||||
uint32_t private_flags = 0;
|
||||
uint32_t ucf_flags = (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
|
||||
uint32_t ucf_flags = ucf_flags_from_smb_request(req);
|
||||
TALLOC_CTX *ctx = talloc_tos();
|
||||
|
||||
/*
|
||||
@ -2637,7 +2637,7 @@ static void call_trans2findfirst(connection_struct *conn,
|
||||
struct dptr_struct *dirptr = NULL;
|
||||
struct smbd_server_connection *sconn = req->sconn;
|
||||
uint32_t ucf_flags = UCF_SAVE_LCOMP | UCF_ALWAYS_ALLOW_WCARD_LCOMP |
|
||||
(req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
|
||||
ucf_flags_from_smb_request(req);
|
||||
bool backup_priv = false;
|
||||
bool as_root = false;
|
||||
|
||||
@ -5800,8 +5800,7 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
|
||||
} else {
|
||||
uint32_t name_hash;
|
||||
char *fname = NULL;
|
||||
uint32_t ucf_flags = (req->posix_pathnames ?
|
||||
UCF_POSIX_PATHNAMES : 0);
|
||||
uint32_t ucf_flags = ucf_flags_from_smb_request(req);
|
||||
|
||||
/* qpathinfo */
|
||||
if (total_params < 7) {
|
||||
@ -6654,7 +6653,7 @@ static NTSTATUS smb_set_file_unix_hlink(connection_struct *conn,
|
||||
{
|
||||
char *oldname = NULL;
|
||||
struct smb_filename *smb_fname_old = NULL;
|
||||
uint32_t ucf_flags = (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
|
||||
uint32_t ucf_flags = ucf_flags_from_smb_request(req);
|
||||
TALLOC_CTX *ctx = talloc_tos();
|
||||
NTSTATUS status = NT_STATUS_OK;
|
||||
|
||||
@ -6720,7 +6719,7 @@ static NTSTATUS smb2_file_rename_information(connection_struct *conn,
|
||||
char *newname = NULL;
|
||||
struct smb_filename *smb_fname_dst = NULL;
|
||||
uint32_t ucf_flags = UCF_SAVE_LCOMP |
|
||||
(req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
|
||||
ucf_flags_from_smb_request(req);
|
||||
NTSTATUS status = NT_STATUS_OK;
|
||||
TALLOC_CTX *ctx = talloc_tos();
|
||||
|
||||
@ -6832,7 +6831,7 @@ static NTSTATUS smb_file_link_information(connection_struct *conn,
|
||||
struct smb_filename *smb_fname_dst = NULL;
|
||||
NTSTATUS status = NT_STATUS_OK;
|
||||
uint32_t ucf_flags = UCF_SAVE_LCOMP |
|
||||
(req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
|
||||
ucf_flags_from_smb_request(req);
|
||||
TALLOC_CTX *ctx = talloc_tos();
|
||||
|
||||
if (!fsp) {
|
||||
@ -8790,8 +8789,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
|
||||
}
|
||||
} else {
|
||||
char *fname = NULL;
|
||||
uint32_t ucf_flags = (req->posix_pathnames ?
|
||||
UCF_POSIX_PATHNAMES : 0);
|
||||
uint32_t ucf_flags = ucf_flags_from_smb_request(req);
|
||||
|
||||
/* set path info */
|
||||
if (total_params < 7) {
|
||||
@ -8941,7 +8939,7 @@ static void call_trans2mkdir(connection_struct *conn, struct smb_request *req,
|
||||
char *directory = NULL;
|
||||
NTSTATUS status = NT_STATUS_OK;
|
||||
struct ea_list *ea_list = NULL;
|
||||
uint32_t ucf_flags = (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
|
||||
uint32_t ucf_flags = ucf_flags_from_smb_request(req);
|
||||
TALLOC_CTX *ctx = talloc_tos();
|
||||
|
||||
if (!CAN_WRITE(conn)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user