mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
s3: smbd: Remove the ucf_flags parameter from extract_snapshot_token().
Now we always call check_path_syntaxXXX(), even on DFS names we no longer need this. It was a BAD change, and I should feel BAD :-). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
This commit is contained in:
parent
d21cf6bbb1
commit
5c9404f753
@ -300,28 +300,14 @@ static bool find_snapshot_token(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool extract_snapshot_token(char *fname, uint32_t ucf_flags, NTTIME *twrp)
|
||||
bool extract_snapshot_token(char *fname, NTTIME *twrp)
|
||||
{
|
||||
const char *start = NULL;
|
||||
const char *next = NULL;
|
||||
size_t remaining;
|
||||
bool found;
|
||||
bool posix_path = (ucf_flags & UCF_POSIX_PATHNAMES);
|
||||
bool msdfs_path = (ucf_flags & UCF_DFS_PATHNAME);
|
||||
|
||||
if (msdfs_path && !posix_path) {
|
||||
/*
|
||||
* A raw (non-POSIX) MSDFS path looks like \server\share\path.
|
||||
* find_snapshot_token only looks for '/' separators.
|
||||
* Convert the separator characters in place.
|
||||
*/
|
||||
string_replace(fname, '\\', '/');
|
||||
}
|
||||
found = find_snapshot_token(fname, &start, &next, twrp);
|
||||
if (msdfs_path && !posix_path) {
|
||||
/* Put the original separators back. */
|
||||
string_replace(fname, '/', '\\');
|
||||
}
|
||||
if (!found) {
|
||||
return false;
|
||||
}
|
||||
@ -360,7 +346,7 @@ NTSTATUS canonicalize_snapshot_path(struct smb_filename *smb_fname,
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
found = extract_snapshot_token(smb_fname->base_name, ucf_flags, &twrp);
|
||||
found = extract_snapshot_token(smb_fname->base_name, &twrp);
|
||||
if (!found) {
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
@ -1941,7 +1927,7 @@ NTSTATUS filename_convert_smb1_search_path(TALLOC_CTX *ctx,
|
||||
DBG_DEBUG("name_in: %s\n", name_in);
|
||||
|
||||
if (ucf_flags & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(name_in, ucf_flags, &twrp);
|
||||
extract_snapshot_token(name_in, &twrp);
|
||||
ucf_flags &= ~UCF_GMT_PATHNAME;
|
||||
}
|
||||
|
||||
|
@ -356,7 +356,7 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
|
||||
NTTIME twrp,
|
||||
struct smb_filename **smb_fname,
|
||||
uint32_t ucf_flags);
|
||||
bool extract_snapshot_token(char *fname, uint32_t ucf_flags, NTTIME *twrp);
|
||||
bool extract_snapshot_token(char *fname, NTTIME *twrp);
|
||||
NTSTATUS canonicalize_snapshot_path(struct smb_filename *smb_fname,
|
||||
uint32_t ucf_flags,
|
||||
NTTIME twrp);
|
||||
|
@ -626,7 +626,7 @@ void reply_ntcreate_and_X(struct smb_request *req)
|
||||
|
||||
ucf_flags = filename_create_ucf_flags(req, create_disposition);
|
||||
if (ucf_flags & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(fname, ucf_flags, &twrp);
|
||||
extract_snapshot_token(fname, &twrp);
|
||||
}
|
||||
status = filename_convert_dirfsp(
|
||||
ctx, conn, fname, ucf_flags, twrp, &dirfsp, &smb_fname);
|
||||
@ -1081,7 +1081,7 @@ static void call_nt_transact_create(connection_struct *conn,
|
||||
|
||||
ucf_flags = filename_create_ucf_flags(req, create_disposition);
|
||||
if (ucf_flags & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(fname, ucf_flags, &twrp);
|
||||
extract_snapshot_token(fname, &twrp);
|
||||
}
|
||||
status = filename_convert_dirfsp(ctx,
|
||||
conn,
|
||||
@ -1468,7 +1468,7 @@ void reply_ntrename(struct smb_request *req)
|
||||
}
|
||||
|
||||
if (ucf_flags_src & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(oldname, ucf_flags_src, &src_twrp);
|
||||
extract_snapshot_token(oldname, &src_twrp);
|
||||
}
|
||||
status = filename_convert_dirfsp(ctx,
|
||||
conn,
|
||||
@ -1510,7 +1510,6 @@ void reply_ntrename(struct smb_request *req)
|
||||
} else {
|
||||
if (ucf_flags_dst & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(newname,
|
||||
ucf_flags_dst,
|
||||
&dst_twrp);
|
||||
}
|
||||
status = filename_convert_dirfsp(ctx,
|
||||
|
@ -581,7 +581,7 @@ void reply_checkpath(struct smb_request *req)
|
||||
DEBUG(3,("reply_checkpath %s mode=%d\n", name, (int)SVAL(req->vwv+0, 0)));
|
||||
|
||||
if (ucf_flags & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(name, ucf_flags, &twrp);
|
||||
extract_snapshot_token(name, &twrp);
|
||||
}
|
||||
status = filename_convert_dirfsp(ctx,
|
||||
conn,
|
||||
@ -686,7 +686,7 @@ void reply_getatr(struct smb_request *req)
|
||||
uint32_t ucf_flags = ucf_flags_from_smb_request(req);
|
||||
NTTIME twrp = 0;
|
||||
if (ucf_flags & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(fname, ucf_flags, &twrp);
|
||||
extract_snapshot_token(fname, &twrp);
|
||||
}
|
||||
status = filename_convert_dirfsp(ctx,
|
||||
conn,
|
||||
@ -794,7 +794,7 @@ void reply_setatr(struct smb_request *req)
|
||||
}
|
||||
|
||||
if (ucf_flags & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(fname, ucf_flags, &twrp);
|
||||
extract_snapshot_token(fname, &twrp);
|
||||
}
|
||||
status = filename_convert_dirfsp(ctx,
|
||||
conn,
|
||||
@ -1470,7 +1470,7 @@ void reply_open(struct smb_request *req)
|
||||
ucf_flags = filename_create_ucf_flags(req, create_disposition);
|
||||
|
||||
if (ucf_flags & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(fname, ucf_flags, &twrp);
|
||||
extract_snapshot_token(fname, &twrp);
|
||||
}
|
||||
status = filename_convert_dirfsp(ctx,
|
||||
conn,
|
||||
@ -1666,7 +1666,7 @@ void reply_open_and_X(struct smb_request *req)
|
||||
ucf_flags = filename_create_ucf_flags(req, create_disposition);
|
||||
|
||||
if (ucf_flags & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(fname, ucf_flags, &twrp);
|
||||
extract_snapshot_token(fname, &twrp);
|
||||
}
|
||||
|
||||
status = filename_convert_dirfsp(ctx,
|
||||
@ -2098,7 +2098,7 @@ void reply_mknew(struct smb_request *req)
|
||||
|
||||
ucf_flags = filename_create_ucf_flags(req, create_disposition);
|
||||
if (ucf_flags & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(fname, ucf_flags, &twrp);
|
||||
extract_snapshot_token(fname, &twrp);
|
||||
}
|
||||
|
||||
status = filename_convert_dirfsp(ctx,
|
||||
@ -2248,7 +2248,7 @@ void reply_ctemp(struct smb_request *req)
|
||||
|
||||
ucf_flags = filename_create_ucf_flags(req, FILE_CREATE);
|
||||
if (ucf_flags & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(fname, ucf_flags, &twrp);
|
||||
extract_snapshot_token(fname, &twrp);
|
||||
}
|
||||
status = filename_convert_dirfsp(ctx,
|
||||
conn,
|
||||
@ -2395,7 +2395,7 @@ void reply_unlink(struct smb_request *req)
|
||||
}
|
||||
|
||||
if (ucf_flags & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(name, ucf_flags, &twrp);
|
||||
extract_snapshot_token(name, &twrp);
|
||||
}
|
||||
status = filename_convert_dirfsp(ctx,
|
||||
conn,
|
||||
@ -5835,7 +5835,7 @@ void reply_mkdir(struct smb_request *req)
|
||||
|
||||
ucf_flags = filename_create_ucf_flags(req, FILE_CREATE);
|
||||
if (ucf_flags & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(directory, ucf_flags, &twrp);
|
||||
extract_snapshot_token(directory, &twrp);
|
||||
}
|
||||
status = filename_convert_dirfsp(ctx,
|
||||
conn,
|
||||
@ -5911,7 +5911,7 @@ void reply_rmdir(struct smb_request *req)
|
||||
}
|
||||
|
||||
if (ucf_flags & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(directory, ucf_flags, &twrp);
|
||||
extract_snapshot_token(directory, &twrp);
|
||||
}
|
||||
status = filename_convert_dirfsp(ctx,
|
||||
conn,
|
||||
@ -6056,7 +6056,7 @@ void reply_mv(struct smb_request *req)
|
||||
}
|
||||
|
||||
if (src_ucf_flags & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(name, src_ucf_flags, &src_twrp);
|
||||
extract_snapshot_token(name, &src_twrp);
|
||||
}
|
||||
status = filename_convert_dirfsp(ctx,
|
||||
conn,
|
||||
@ -6077,7 +6077,7 @@ void reply_mv(struct smb_request *req)
|
||||
}
|
||||
|
||||
if (dst_ucf_flags & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(newname, dst_ucf_flags, &dst_twrp);
|
||||
extract_snapshot_token(newname, &dst_twrp);
|
||||
}
|
||||
status = filename_convert_dirfsp(ctx,
|
||||
conn,
|
||||
|
@ -586,7 +586,7 @@ static void call_trans2open(connection_struct *conn,
|
||||
(unsigned int)open_ofun, open_size));
|
||||
|
||||
if (ucf_flags & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(fname, ucf_flags, &twrp);
|
||||
extract_snapshot_token(fname, &twrp);
|
||||
}
|
||||
status = filename_convert_dirfsp(ctx,
|
||||
conn,
|
||||
@ -2111,7 +2111,7 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
|
||||
}
|
||||
|
||||
if (ucf_flags & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(fname, ucf_flags, &twrp);
|
||||
extract_snapshot_token(fname, &twrp);
|
||||
}
|
||||
status = filename_convert_dirfsp(req,
|
||||
conn,
|
||||
@ -2510,7 +2510,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
|
||||
}
|
||||
|
||||
if (ucf_flags & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(fname, ucf_flags, &twrp);
|
||||
extract_snapshot_token(fname, &twrp);
|
||||
}
|
||||
status = filename_convert_dirfsp(req,
|
||||
conn,
|
||||
@ -2687,7 +2687,7 @@ static void call_trans2mkdir(connection_struct *conn, struct smb_request *req,
|
||||
DEBUG(3,("call_trans2mkdir : name = %s\n", directory));
|
||||
|
||||
if (ucf_flags & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(directory, ucf_flags, &twrp);
|
||||
extract_snapshot_token(directory, &twrp);
|
||||
}
|
||||
status = filename_convert_dirfsp(ctx,
|
||||
conn,
|
||||
|
@ -4914,7 +4914,7 @@ static NTSTATUS smb_set_file_unix_hlink(connection_struct *conn,
|
||||
smb_fname_str_dbg(smb_fname_new), oldname));
|
||||
|
||||
if (ucf_flags & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(oldname, ucf_flags, &old_twrp);
|
||||
extract_snapshot_token(oldname, &old_twrp);
|
||||
}
|
||||
status = filename_convert_dirfsp(ctx,
|
||||
conn,
|
||||
@ -5014,7 +5014,7 @@ static NTSTATUS smb2_file_rename_information(connection_struct *conn,
|
||||
}
|
||||
} else {
|
||||
if (ucf_flags & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(newname, ucf_flags, &dst_twrp);
|
||||
extract_snapshot_token(newname, &dst_twrp);
|
||||
}
|
||||
status = filename_convert_dirfsp(ctx,
|
||||
conn,
|
||||
@ -5118,7 +5118,7 @@ static NTSTATUS smb_file_link_information(connection_struct *conn,
|
||||
newname));
|
||||
|
||||
if (ucf_flags & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(newname, ucf_flags, &dst_twrp);
|
||||
extract_snapshot_token(newname, &dst_twrp);
|
||||
}
|
||||
status = filename_convert_dirfsp(ctx,
|
||||
conn,
|
||||
@ -5290,7 +5290,7 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn,
|
||||
}
|
||||
|
||||
if (ucf_flags & UCF_GMT_PATHNAME) {
|
||||
extract_snapshot_token(base_name, ucf_flags, &dst_twrp);
|
||||
extract_snapshot_token(base_name, &dst_twrp);
|
||||
}
|
||||
status = filename_convert_dirfsp(ctx,
|
||||
conn,
|
||||
|
Loading…
x
Reference in New Issue
Block a user