mirror of
https://github.com/samba-team/samba.git
synced 2025-03-11 16:58:40 +03:00
libcli/auth: let netlogon_creds_copy() make use of ndr_deepcopy_struct()
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Thu Nov 28 13:53:25 UTC 2024 on atb-devel-224
This commit is contained in:
parent
63a5269a77
commit
bb92c70f0e
@ -22,6 +22,7 @@
|
||||
|
||||
#include "includes.h"
|
||||
#include "system/time.h"
|
||||
#include "librpc/gen_ndr/ndr_schannel.h"
|
||||
#include "libcli/auth/libcli_auth.h"
|
||||
#include "../libcli/security/dom_sid.h"
|
||||
#include "lib/util/util_str_escape.h"
|
||||
@ -1408,33 +1409,18 @@ struct netlogon_creds_CredentialState *netlogon_creds_copy(
|
||||
const struct netlogon_creds_CredentialState *creds_in)
|
||||
{
|
||||
struct netlogon_creds_CredentialState *creds = talloc_zero(mem_ctx, struct netlogon_creds_CredentialState);
|
||||
enum ndr_err_code ndr_err;
|
||||
|
||||
if (!creds) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*creds = *creds_in;
|
||||
|
||||
creds->computer_name = talloc_strdup(creds, creds_in->computer_name);
|
||||
if (!creds->computer_name) {
|
||||
talloc_free(creds);
|
||||
ndr_err = ndr_deepcopy_struct(netlogon_creds_CredentialState,
|
||||
creds_in, creds, creds);
|
||||
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
|
||||
TALLOC_FREE(creds);
|
||||
return NULL;
|
||||
}
|
||||
creds->account_name = talloc_strdup(creds, creds_in->account_name);
|
||||
if (!creds->account_name) {
|
||||
talloc_free(creds);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (creds_in->ex != NULL) {
|
||||
creds->ex = talloc_zero(creds,
|
||||
struct netlogon_creds_CredentialState_extra_info);
|
||||
if (creds->ex == NULL) {
|
||||
talloc_free(creds);
|
||||
return NULL;
|
||||
}
|
||||
*creds->ex = *creds_in->ex;
|
||||
}
|
||||
|
||||
return creds;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user