]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: distinguish "no record" from "bad record" in smbXsrv_open_global_lookup()
authorRalph Boehme <slow@samba.org>
Sat, 18 Oct 2025 10:45:49 +0000 (12:45 +0200)
committerVolker Lendecke <vl@samba.org>
Thu, 27 Nov 2025 09:01:30 +0000 (09:01 +0000)
Allows callers to distinguish between "no record" and "bad record" when
smbXsrv_open_global_parse_record() fails.

No change in behaviour, but might be useful in the future.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/smbd/smbXsrv_open.c

index 17424300f1244e649f7f71d2e23bb2e9e217e9ce..c33508fd5259ce56b6f45ea4301534c336b9228f 100644 (file)
@@ -303,6 +303,12 @@ static void smbXsrv_open_global_lookup_fn(struct db_record *rec,
        struct smbXsrv_open_global_lookup_state *state = private_data;
        TDB_DATA key = dbwrap_record_get_key(rec);
 
+       if (val.dsize == 0) {
+               /* Likely a ctdb tombstone record */
+               state->status = NT_STATUS_NOT_FOUND;
+               return;
+       }
+
        state->status = smbXsrv_open_global_parse_record(state->mem_ctx,
                                                         key,
                                                         val,
@@ -330,6 +336,10 @@ static NTSTATUS smbXsrv_open_global_lookup(
                DBG_ERR("dbwrap_do_locked failed\n");
                return status;
        }
+       if (NT_STATUS_EQUAL(state.status, NT_STATUS_NOT_FOUND)) {
+               DBG_DEBUG("smbXsrv_open record not found\n");
+               return state.status;
+       }
        if (!NT_STATUS_IS_OK(state.status)) {
                DBG_ERR("smbXsrv_open_global_lookup_fn failed\n");
                return state.status;