smbd: Simplify smbXsrv_open_purge_replay_cache()
authorVolker Lendecke <vl@samba.org>
Fri, 9 Feb 2024 12:02:25 +0000 (13:02 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 30 Apr 2024 22:18:51 +0000 (15:18 -0700)
GUID_buf_string is supposed to never fail except if the guid passed in
is NULL. Our only current caller already checks
that. dbwrap_purge_bystring() could actually fail, so put the result
into a variable for the debugger.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/smbXsrv_open.c

index ed2cf6f8a9f53abcc2b5769e797f2344daa9bf55..31cbef29bd5ff5883407ab56212253d17855994d 100644 (file)
@@ -660,21 +660,16 @@ NTSTATUS smbXsrv_open_purge_replay_cache(struct smbXsrv_client *client,
                                         const struct GUID *create_guid)
 {
        struct GUID_txt_buf buf;
-       char *guid_string;
-       struct db_context *db;
+       NTSTATUS status;
 
        if (client->open_table == NULL) {
                return NT_STATUS_OK;
        }
 
-       db = client->open_table->local.replay_cache_db_ctx;
-
-       guid_string = GUID_buf_string(create_guid, &buf);
-       if (guid_string == NULL) {
-               return NT_STATUS_INVALID_PARAMETER;
-       }
-
-       return dbwrap_purge_bystring(db, guid_string);
+       status = dbwrap_purge_bystring(
+               client->open_table->local.replay_cache_db_ctx,
+               GUID_buf_string(create_guid, &buf));
+       return status;
 }
 
 static NTSTATUS smbXsrv_open_clear_replay_cache(struct smbXsrv_open *op)