]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: Add ucf_flags parameter to extract_snapshot_token().
authorJeremy Allison <jra@samba.org>
Wed, 3 Aug 2022 16:08:48 +0000 (09:08 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 4 Aug 2022 17:09:31 +0000 (17:09 +0000)
Will be needed to cope with MSDFS paths which can be passed in
to this function.

Note, this a temporary measure until we handle DFS paths better
and will be removed in the next patchset.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Reviewed-by: Volker Lendecke <vl@samba.org>
source3/smbd/filename.c
source3/smbd/proto.h
source3/smbd/smb1_nttrans.c
source3/smbd/smb1_reply.c
source3/smbd/smb1_trans2.c
source3/smbd/smb2_trans2.c

index 3e90b8dd71be3c8c42898792e5392731ba4fe758..de29942bde0acf67ed59f713fc485fb4aac5b8f6 100644 (file)
@@ -300,7 +300,7 @@ static bool find_snapshot_token(
        return true;
 }
 
-bool extract_snapshot_token(char *fname, NTTIME *twrp)
+bool extract_snapshot_token(char *fname, uint32_t ucf_flags, NTTIME *twrp)
 {
        const char *start = NULL;
        const char *next = NULL;
@@ -346,7 +346,7 @@ NTSTATUS canonicalize_snapshot_path(struct smb_filename *smb_fname,
                return NT_STATUS_OK;
        }
 
-       found = extract_snapshot_token(smb_fname->base_name, &twrp);
+       found = extract_snapshot_token(smb_fname->base_name, ucf_flags, &twrp);
        if (!found) {
                return NT_STATUS_OK;
        }
index 0d541d15466cc5613c8f665c91d747afdd556ef2..21eb32a9388838a422d490ca3cbcf87ffb450af1 100644 (file)
@@ -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, NTTIME *twrp);
+bool extract_snapshot_token(char *fname, uint32_t ucf_flags, NTTIME *twrp);
 NTSTATUS canonicalize_snapshot_path(struct smb_filename *smb_fname,
                                    uint32_t ucf_flags,
                                    NTTIME twrp);
index cd68ecd259014aee1050582855d8b4a0e814ef8b..aa346a91ced21515672d31305ac6924eb1c41b07 100644 (file)
@@ -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, &twrp);
+               extract_snapshot_token(fname, ucf_flags, &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, &twrp);
+               extract_snapshot_token(fname, ucf_flags, &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, &src_twrp);
+               extract_snapshot_token(oldname, ucf_flags_src, &src_twrp);
        }
        status = filename_convert_dirfsp(ctx,
                                         conn,
@@ -1519,7 +1519,9 @@ void reply_ntrename(struct smb_request *req)
                }
        } else {
                if (ucf_flags_dst & UCF_GMT_PATHNAME) {
-                       extract_snapshot_token(newname, &dst_twrp);
+                       extract_snapshot_token(newname,
+                                              ucf_flags_dst,
+                                              &dst_twrp);
                }
                status = filename_convert_dirfsp(ctx,
                                                 conn,
index fcfd670163dd57f4a73cd5213624ef1dd6886681..1e969d4083403b5f181b65ec985930d69d8ca08e 100644 (file)
@@ -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, &twrp);
+               extract_snapshot_token(name, ucf_flags, &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, &twrp);
+                       extract_snapshot_token(fname, ucf_flags, &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, &twrp);
+               extract_snapshot_token(fname, ucf_flags, &twrp);
        }
        status = filename_convert_dirfsp(ctx,
                                         conn,
@@ -1468,7 +1468,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, &twrp);
+               extract_snapshot_token(fname, ucf_flags, &twrp);
        }
        status = filename_convert_dirfsp(ctx,
                                         conn,
@@ -1664,7 +1664,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, &twrp);
+               extract_snapshot_token(fname, ucf_flags, &twrp);
        }
 
        status = filename_convert_dirfsp(ctx,
@@ -2096,7 +2096,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, &twrp);
+               extract_snapshot_token(fname, ucf_flags, &twrp);
        }
 
        status = filename_convert_dirfsp(ctx,
@@ -2246,7 +2246,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, &twrp);
+                       extract_snapshot_token(fname, ucf_flags, &twrp);
                }
                status = filename_convert_dirfsp(ctx,
                                                 conn,
@@ -2393,7 +2393,7 @@ void reply_unlink(struct smb_request *req)
        }
 
        if (ucf_flags & UCF_GMT_PATHNAME) {
-               extract_snapshot_token(name, &twrp);
+               extract_snapshot_token(name, ucf_flags, &twrp);
        }
        status = filename_convert_dirfsp(ctx,
                                         conn,
@@ -5833,7 +5833,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, &twrp);
+               extract_snapshot_token(directory, ucf_flags, &twrp);
        }
        status = filename_convert_dirfsp(ctx,
                                         conn,
@@ -5909,7 +5909,7 @@ void reply_rmdir(struct smb_request *req)
        }
 
        if (ucf_flags & UCF_GMT_PATHNAME) {
-               extract_snapshot_token(directory, &twrp);
+               extract_snapshot_token(directory, ucf_flags, &twrp);
        }
        status = filename_convert_dirfsp(ctx,
                                         conn,
@@ -6054,7 +6054,7 @@ void reply_mv(struct smb_request *req)
         }
 
        if (src_ucf_flags & UCF_GMT_PATHNAME) {
-               extract_snapshot_token(name, &src_twrp);
+               extract_snapshot_token(name, src_ucf_flags, &src_twrp);
        }
        status = filename_convert_dirfsp(ctx,
                                         conn,
@@ -6075,7 +6075,7 @@ void reply_mv(struct smb_request *req)
        }
 
        if (dst_ucf_flags & UCF_GMT_PATHNAME) {
-               extract_snapshot_token(newname, &dst_twrp);
+               extract_snapshot_token(newname, dst_ucf_flags, &dst_twrp);
        }
        status = filename_convert_dirfsp(ctx,
                                         conn,
index f46a45ab124f382329ee2037c1e050a044d32f65..dc21e14aa86ed36fe6e683ed30675bc2e9c0eecd 100644 (file)
@@ -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, &twrp);
+               extract_snapshot_token(fname, ucf_flags, &twrp);
        }
        status = filename_convert_dirfsp(ctx,
                                         conn,
@@ -2109,7 +2109,7 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
                }
 
                if (ucf_flags & UCF_GMT_PATHNAME) {
-                       extract_snapshot_token(fname, &twrp);
+                       extract_snapshot_token(fname, ucf_flags, &twrp);
                }
                status = filename_convert_dirfsp(req,
                                                 conn,
@@ -2508,7 +2508,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
                }
 
                if (ucf_flags & UCF_GMT_PATHNAME) {
-                       extract_snapshot_token(fname, &twrp);
+                       extract_snapshot_token(fname, ucf_flags, &twrp);
                }
                status = filename_convert_dirfsp(req,
                                                 conn,
@@ -2685,7 +2685,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, &twrp);
+               extract_snapshot_token(directory, ucf_flags, &twrp);
        }
        status = filename_convert_dirfsp(ctx,
                                         conn,
index d0f30a782bf9eab3b18f23dc0d618fb4f8562406..5834f2b146744d6ebb5ce544757e5bb40a483517 100644 (file)
@@ -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, &old_twrp);
+               extract_snapshot_token(oldname, ucf_flags, &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, &dst_twrp);
+                       extract_snapshot_token(newname, ucf_flags, &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, &dst_twrp);
+               extract_snapshot_token(newname, ucf_flags, &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, &dst_twrp);
+                       extract_snapshot_token(base_name, ucf_flags, &dst_twrp);
                }
                status = filename_convert_dirfsp(ctx,
                                         conn,