]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: remove just created sharemode entry in the error codepaths
authorRalph Boehme <slow@samba.org>
Tue, 9 Apr 2024 12:53:32 +0000 (14:53 +0200)
committerJule Anger <janger@samba.org>
Wed, 2 Oct 2024 14:34:13 +0000 (14:34 +0000)
Without this we leave stale sharemode entries around that can lead to all sorts
of havoc.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15624

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Thu Sep 19 19:36:19 UTC 2024 on atb-devel-224

(cherry picked from commit 2ff3b9bc0d254a63a913ff9084de3d794fee27d0)

selftest/knownfail.d/samba3.blackbox.durable_v2_delay [deleted file]
source3/smbd/durable.c

diff --git a/selftest/knownfail.d/samba3.blackbox.durable_v2_delay b/selftest/knownfail.d/samba3.blackbox.durable_v2_delay
deleted file mode 100644 (file)
index 88e2996..0000000
+++ /dev/null
@@ -1 +0,0 @@
-^samba3.blackbox.durable_v2_delay.durable-v2-regressions.durable_v2_reconnect_bug15624
index 50075ddd3f7f399830760d0d0cf2453e64cca959..98d0d403e305018a163db0431c0e515637ce2f06 100644 (file)
@@ -538,6 +538,7 @@ NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn,
        enum ndr_err_code ndr_err;
        struct vfs_default_durable_cookie cookie;
        DATA_BLOB new_cookie_blob = data_blob_null;
+       bool have_share_mode_entry = false;
 
        *result = NULL;
        *new_cookie = data_blob_null;
@@ -776,6 +777,7 @@ NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn,
                status = NT_STATUS_INTERNAL_ERROR;
                goto fail;
        }
+       have_share_mode_entry = true;
 
        ok = brl_reconnect_disconnected(fsp);
        if (!ok) {
@@ -872,6 +874,12 @@ NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn,
        return NT_STATUS_OK;
 
 fail:
+       if (fsp != NULL && have_share_mode_entry) {
+               /*
+                * Something is screwed up, delete the sharemode entry.
+                */
+               del_share_mode(lck, fsp);
+       }
        if (fsp != NULL && fsp_get_pathref_fd(fsp) != -1) {
                NTSTATUS close_status;
                close_status = fd_close(fsp);