]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Slightly simplify smb2srv_open_recreate()
authorVolker Lendecke <vl@samba.org>
Wed, 4 Jan 2023 13:05:55 +0000 (14:05 +0100)
committerStefan Metzmacher <metze@samba.org>
Wed, 18 Jan 2023 11:49:38 +0000 (11:49 +0000)
This moves the bit-fiddling right next to the check we do,
"global_zeros" was only used for this one purpose and its assignment
was a few lines away.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/smbd/smbXsrv_open.c

index c67556545be0ca543bf1f5c3d0dcad2c181e47f2..8f0812311775dc0721ea53ba0e0927008d2d0585 100644 (file)
@@ -1211,8 +1211,7 @@ NTSTATUS smb2srv_open_recreate(struct smbXsrv_connection *conn,
 {
        struct smbXsrv_open_table *table = conn->client->open_table;
        struct smbXsrv_open *op = NULL;
-       uint32_t global_id = persistent_id & UINT32_MAX;
-       uint64_t global_zeros = persistent_id & 0xFFFFFFFF00000000LLU;
+       uint32_t global_id;
        NTSTATUS status;
        struct security_token *current_token = NULL;
        int local_id;
@@ -1228,10 +1227,14 @@ NTSTATUS smb2srv_open_recreate(struct smbXsrv_connection *conn,
                return NT_STATUS_INVALID_HANDLE;
        }
 
-       if (global_zeros != 0) {
-               DEBUG(10, ("global_zeros!=0\n"));
+       if ((persistent_id & 0xFFFFFFFF00000000LLU) != 0) {
+               /*
+                * We only use 32 bit for the persistent ID
+                */
+               DBG_DEBUG("persistent_id=%"PRIx64"\n", persistent_id);
                return NT_STATUS_OBJECT_NAME_NOT_FOUND;
        }
+       global_id = persistent_id & UINT32_MAX; /* truncate to 32 bit */
 
        op = talloc_zero(table, struct smbXsrv_open);
        if (op == NULL) {