From: Ralph Boehme Date: Sat, 7 Sep 2024 13:20:14 +0000 (+0200) Subject: smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when removing directories X-Git-Tag: tdb-1.4.13~703 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=680da2b3af34e5acf624f04484a1baefa75ebb87;p=thirdparty%2Fsamba.git smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when removing directories Signed-off-by: Ralph Boehme Reviewed-by: Stefan Metzmacher --- diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 8f90b7f9da0..cbb2d89446c 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -1614,12 +1614,28 @@ done: remove_pending_change_notify_requests_by_fid(fsp, notify_status); - if (lck_state.delete_object) { + if (lck_state.delete_object && NT_STATUS_IS_OK(status)) { + const struct smb2_lease *lease = fsp_get_smb2_lease(fsp); + + if (lease != NULL) { + /* + * If parent lease key of handle on which delete + * disposition was set does not match the parent lease + * key of last closed handle, break all leases on the + * parent directory. + */ + if (!smb2_lease_key_equal(&lease->parent_lease_key, + &lck_state.parent_lease_key)) + { + lease = NULL; + } + } notify_fname(conn, - NOTIFY_ACTION_REMOVED, + NOTIFY_ACTION_REMOVED | + NOTIFY_ACTION_DIRLEASE_BREAK, FILE_NOTIFY_CHANGE_DIR_NAME, fsp->fsp_name, - NULL); + lease); } status1 = fd_close(fsp);