s3:smbd: skip empty records in smbXsrv_open_cleanup()
authorStefan Metzmacher <metze@samba.org>
Tue, 24 Dec 2013 08:00:01 +0000 (09:00 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 30 Jan 2014 17:49:37 +0000 (18:49 +0100)
This should avoid scary ndr_pull errors, if there's
a cleanup race.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Jan 30 18:49:37 CET 2014 on sn-devel-104

source3/smbd/smbXsrv_open.c

index 3566dc25918fb62b5c84af3ab179937b0beb78a0..3e2fed3ac1427bf5aa058ca9533eaad4801b12a8 100644 (file)
@@ -1388,6 +1388,7 @@ NTSTATUS smbXsrv_open_cleanup(uint64_t persistent_id)
        struct smbXsrv_open_global0 *op = NULL;
        uint8_t key_buf[SMBXSRV_OPEN_GLOBAL_TDB_KEY_SIZE];
        TDB_DATA key;
+       TDB_DATA val;
        struct db_record *rec;
        bool delete_open = false;
        uint32_t global_id = persistent_id & UINT32_MAX;
@@ -1403,6 +1404,14 @@ NTSTATUS smbXsrv_open_cleanup(uint64_t persistent_id)
                goto done;
        }
 
+       val = dbwrap_record_get_value(rec);
+       if (val.dsize == 0) {
+               DEBUG(10, ("smbXsrv_open_cleanup[global: 0x%08x] "
+                         "empty record in %s, skipping...\n",
+                          global_id, dbwrap_name(smbXsrv_open_global_db_ctx)));
+               goto done;
+       }
+
        status = smbXsrv_open_global_parse_record(talloc_tos(), rec, &op);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(1, ("smbXsrv_open_cleanup[global: 0x%08x] "