]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: Convert reply_unlink() to use filename_convert_dirfsp().
authorJeremy Allison <jra@samba.org>
Thu, 28 Jul 2022 18:52:36 +0000 (11:52 -0700)
committerJeremy Allison <jra@samba.org>
Tue, 2 Aug 2022 19:49:32 +0000 (19:49 +0000)
One less use of filename_convert().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/smbd/smb1_reply.c

index cbe15a1fac63f06d693a867459a6a9ebd248a62b..440283c20846f6b235a69192cf64da34b10e89d7 100644 (file)
@@ -2368,10 +2368,12 @@ void reply_unlink(struct smb_request *req)
 {
        connection_struct *conn = req->conn;
        char *name = NULL;
+       struct files_struct *dirfsp = NULL;
        struct smb_filename *smb_fname = NULL;
        uint32_t dirtype;
        NTSTATUS status;
        uint32_t ucf_flags = ucf_flags_from_smb_request(req);
+       NTTIME twrp = 0;
        TALLOC_CTX *ctx = talloc_tos();
 
        START_PROFILE(SMBunlink);
@@ -2390,11 +2392,16 @@ void reply_unlink(struct smb_request *req)
                goto out;
        }
 
-       status = filename_convert(ctx, conn,
-                                 name,
-                                 ucf_flags,
-                                 0,
-                                 &smb_fname);
+       if (ucf_flags & UCF_GMT_PATHNAME) {
+               extract_snapshot_token(name, &twrp);
+       }
+       status = filename_convert_dirfsp(ctx,
+                                        conn,
+                                        name,
+                                        ucf_flags,
+                                        twrp,
+                                        &dirfsp,
+                                        &smb_fname);
        if (!NT_STATUS_IS_OK(status)) {
                if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
                        reply_botherror(req, NT_STATUS_PATH_NOT_COVERED,
@@ -2407,7 +2414,7 @@ void reply_unlink(struct smb_request *req)
 
        DEBUG(3,("reply_unlink : %s\n", smb_fname_str_dbg(smb_fname)));
 
-       status = unlink_internals(conn, req, dirtype, NULL, smb_fname);
+       status = unlink_internals(conn, req, dirtype, dirfsp, smb_fname);
        if (!NT_STATUS_IS_OK(status)) {
                if (open_was_deferred(req->xconn, req->mid)) {
                        /* We have re-scheduled this call. */