]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3/locking: update share_entry_stale_pid() check for Persistent Handles
authorRalph Boehme <slow@samba.org>
Tue, 17 Sep 2019 16:47:52 +0000 (09:47 -0700)
committerRalph Boehme <slow@samba.org>
Fri, 17 Jul 2026 10:18:36 +0000 (10:18 +0000)
Disconnected Persistent Handles are NOT "stale" and must be preserved. But while
we're at it to check if the handle is connected or not, remember this
information so we can check this later in the open code.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/locking/locking.c

index 2f78bae6285c461a3c1c14559655add7fb9f34bc..dbefbd16f9f0fa5bb6d383f722dc9bfa4022995d 100644 (file)
@@ -726,7 +726,12 @@ bool share_entry_stale_pid(struct share_mode_entry *e)
        struct server_id_buf buf;
        bool exists;
 
+       if (e->protect) {
+               SMB_ASSERT(!e->stale);
+               return false;
+       }
        if (e->stale) {
+               SMB_ASSERT(!e->protect);
                return true;
        }
 
@@ -740,6 +745,11 @@ bool share_entry_stale_pid(struct share_mode_entry *e)
        DBG_DEBUG("PID %s does not exist anymore\n",
                  server_id_str_buf(e->pid, &buf));
 
+       if (e->flags & SHARE_ENTRY_FLAG_PERSISTENT_OPEN) {
+               e->protect = true;
+               return false;
+       }
+
        e->stale = true;
 
        return true;