]> 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)
committerGünther Deschner <gd@samba.org>
Thu, 19 Sep 2024 19:36:19 +0000 (19:36 +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

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 0dac04450fe2de124fb6bcb63e24ce9b39ed56ce..dfb87dd3775cdfee71d02b2766df24895a2a84fb 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);