1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

smbd: remove just created sharemode entry in the error codepaths

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
This commit is contained in:
Ralph Boehme 2024-04-09 14:53:32 +02:00 committed by Günther Deschner
parent a91457f97c
commit 2ff3b9bc0d
2 changed files with 8 additions and 1 deletions

View File

@ -1 +0,0 @@
^samba3.blackbox.durable_v2_delay.durable-v2-regressions.durable_v2_reconnect_bug15624

View 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);