]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libcli/auth: let netlogon_creds_copy() copy all scalar elements
authorStefan Metzmacher <metze@samba.org>
Wed, 19 Jul 2023 19:02:23 +0000 (21:02 +0200)
committerJule Anger <janger@samba.org>
Wed, 13 Nov 2024 10:39:12 +0000 (10:39 +0000)
This version is good for now, as we want it to be backportable.
For master we'll add a ndr_deepcopy_struct() helper in order
to avoid future problems.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15425

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
(cherry picked from commit 8edbdd65ef78e3f26357d0254b58db3120a32880)

libcli/auth/credentials.c

index 2d2da080efe328beb230d9b9756f45f245ec3ca2..12f4b1fbb8ce99168f576917717bcc4051976490 100644 (file)
@@ -1407,9 +1407,7 @@ struct netlogon_creds_CredentialState *netlogon_creds_copy(
                return NULL;
        }
 
-       creds->sequence                 = creds_in->sequence;
-       creds->negotiate_flags          = creds_in->negotiate_flags;
-       creds->secure_channel_type      = creds_in->secure_channel_type;
+       *creds = *creds_in;
 
        creds->computer_name = talloc_strdup(creds, creds_in->computer_name);
        if (!creds->computer_name) {
@@ -1432,10 +1430,5 @@ struct netlogon_creds_CredentialState *netlogon_creds_copy(
                *creds->ex = *creds_in->ex;
        }
 
-       memcpy(creds->session_key, creds_in->session_key, sizeof(creds->session_key));
-       memcpy(creds->seed.data, creds_in->seed.data, sizeof(creds->seed.data));
-       memcpy(creds->client.data, creds_in->client.data, sizeof(creds->client.data));
-       memcpy(creds->server.data, creds_in->server.data, sizeof(creds->server.data));
-
        return creds;
 }