From 7ebffca28d3caa496e36467618f80725e8864efe Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn@samba.org>
Date: Wed, 13 Nov 2019 09:41:18 +0100
Subject: [PATCH 147/187] libcli:auth: Check return status of
netlogon_creds_init_64bit()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14195
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit e4ae1ba451d408b3b5c74d303493cb7c38e6e1c8)
---
libcli/auth/credentials.c | 29 ++++++++++++++++++++++-------
1 file changed, 22 insertions(+), 7 deletions(-)
diff --git a/libcli/auth/credentials.c b/libcli/auth/credentials.c
index 1c01930a9d9..36d0368d198 100644
--- a/libcli/auth/credentials.c
+++ b/libcli/auth/credentials.c
@@ -51,10 +51,10 @@ static void netlogon_creds_step_crypt(struct netlogon_creds_CredentialState *cre
this call is made after the netr_ServerReqChallenge call
*/
-static void netlogon_creds_init_64bit(struct netlogon_creds_CredentialState *creds,
- const struct netr_Credential *client_challenge,
- const struct netr_Credential *server_challenge,
- const struct samr_Password *machine_password)
+static NTSTATUS netlogon_creds_init_64bit(struct netlogon_creds_CredentialState *creds,
+ const struct netr_Credential *client_challenge,
+ const struct netr_Credential *server_challenge,
+ const struct samr_Password *machine_password)
{
uint32_t sum[2];
uint8_t sum2[8];
@@ -68,6 +68,8 @@ static void netlogon_creds_init_64bit(struct netlogon_creds_CredentialState *cre
ZERO_ARRAY(creds->session_key);
des_crypt128(creds->session_key, sum2, machine_password->hash);
+
+ return NT_STATUS_OK;
}
/*
@@ -458,7 +460,14 @@ struct netlogon_creds_CredentialState *netlogon_creds_client_init(TALLOC_CTX *me
return NULL;
}
} else {
- netlogon_creds_init_64bit(creds, client_challenge, server_challenge, machine_password);
+ status = netlogon_creds_init_64bit(creds,
+ client_challenge,
+ server_challenge,
+ machine_password);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(creds);
+ return NULL;
+ }
}
netlogon_creds_first_step(creds, client_challenge, server_challenge);
@@ -624,8 +633,14 @@ struct netlogon_creds_CredentialState *netlogon_creds_server_init(TALLOC_CTX *me
return NULL;
}
} else {
- netlogon_creds_init_64bit(creds, client_challenge, server_challenge,
- machine_password);
+ status = netlogon_creds_init_64bit(creds,
+ client_challenge,
+ server_challenge,
+ machine_password);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(creds);
+ return NULL;
+ }
}
netlogon_creds_first_step(creds, client_challenge, server_challenge);
--
2.23.0