|
|
1524bc |
From 13601560c9b48466b70ad577ebab245fea1f50b5 Mon Sep 17 00:00:00 2001
|
|
|
1524bc |
From: Andreas Schneider <asn@samba.org>
|
|
|
1524bc |
Date: Wed, 13 Nov 2019 10:12:41 +0100
|
|
|
1524bc |
Subject: [PATCH 153/187] libcli:auth: Check return code of
|
|
|
1524bc |
netlogon_creds_step()
|
|
|
1524bc |
|
|
|
1524bc |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14195
|
|
|
1524bc |
|
|
|
1524bc |
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
|
1524bc |
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
|
|
|
1524bc |
(cherry picked from commit 05f59cbcf803d57ab41b4c7fa4f81da50cd02cd6)
|
|
|
1524bc |
---
|
|
|
1524bc |
libcli/auth/credentials.c | 20 +++++++++++++++++---
|
|
|
1524bc |
1 file changed, 17 insertions(+), 3 deletions(-)
|
|
|
1524bc |
|
|
|
1524bc |
diff --git a/libcli/auth/credentials.c b/libcli/auth/credentials.c
|
|
|
1524bc |
index e5bf2c4703c..3dd50a11bce 100644
|
|
|
1524bc |
--- a/libcli/auth/credentials.c
|
|
|
1524bc |
+++ b/libcli/auth/credentials.c
|
|
|
1524bc |
@@ -191,9 +191,10 @@ static NTSTATUS netlogon_creds_first_step(struct netlogon_creds_CredentialState
|
|
|
1524bc |
step the credentials to the next element in the chain, updating the
|
|
|
1524bc |
current client and server credentials and the seed
|
|
|
1524bc |
*/
|
|
|
1524bc |
-static void netlogon_creds_step(struct netlogon_creds_CredentialState *creds)
|
|
|
1524bc |
+static NTSTATUS netlogon_creds_step(struct netlogon_creds_CredentialState *creds)
|
|
|
1524bc |
{
|
|
|
1524bc |
struct netr_Credential time_cred;
|
|
|
1524bc |
+ NTSTATUS status;
|
|
|
1524bc |
|
|
|
1524bc |
DEBUG(5,("\tseed %08x:%08x\n",
|
|
|
1524bc |
IVAL(creds->seed.data, 0), IVAL(creds->seed.data, 4)));
|
|
|
1524bc |
@@ -220,6 +221,8 @@ static void netlogon_creds_step(struct netlogon_creds_CredentialState *creds)
|
|
|
1524bc |
IVAL(creds->server.data, 0), IVAL(creds->server.data, 4)));
|
|
|
1524bc |
|
|
|
1524bc |
creds->seed = time_cred;
|
|
|
1524bc |
+
|
|
|
1524bc |
+ return NT_STATUS_OK;
|
|
|
1524bc |
}
|
|
|
1524bc |
|
|
|
1524bc |
|
|
|
1524bc |
@@ -518,6 +521,7 @@ netlogon_creds_client_authenticator(struct netlogon_creds_CredentialState *creds
|
|
|
1524bc |
struct netr_Authenticator *next)
|
|
|
1524bc |
{
|
|
|
1524bc |
uint32_t t32n = (uint32_t)time(NULL);
|
|
|
1524bc |
+ NTSTATUS status;
|
|
|
1524bc |
|
|
|
1524bc |
/*
|
|
|
1524bc |
* we always increment and ignore an overflow here
|
|
|
1524bc |
@@ -540,7 +544,10 @@ netlogon_creds_client_authenticator(struct netlogon_creds_CredentialState *creds
|
|
|
1524bc |
}
|
|
|
1524bc |
}
|
|
|
1524bc |
|
|
|
1524bc |
- netlogon_creds_step(creds);
|
|
|
1524bc |
+ status = netlogon_creds_step(creds);
|
|
|
1524bc |
+ if (!NT_STATUS_IS_OK(status)) {
|
|
|
1524bc |
+ return status;
|
|
|
1524bc |
+ }
|
|
|
1524bc |
|
|
|
1524bc |
next->cred = creds->client;
|
|
|
1524bc |
next->timestamp = creds->sequence;
|
|
|
1524bc |
@@ -686,6 +693,8 @@ NTSTATUS netlogon_creds_server_step_check(struct netlogon_creds_CredentialState
|
|
|
1524bc |
const struct netr_Authenticator *received_authenticator,
|
|
|
1524bc |
struct netr_Authenticator *return_authenticator)
|
|
|
1524bc |
{
|
|
|
1524bc |
+ NTSTATUS status;
|
|
|
1524bc |
+
|
|
|
1524bc |
if (!received_authenticator || !return_authenticator) {
|
|
|
1524bc |
return NT_STATUS_INVALID_PARAMETER;
|
|
|
1524bc |
}
|
|
|
1524bc |
@@ -695,7 +704,12 @@ NTSTATUS netlogon_creds_server_step_check(struct netlogon_creds_CredentialState
|
|
|
1524bc |
}
|
|
|
1524bc |
|
|
|
1524bc |
creds->sequence = received_authenticator->timestamp;
|
|
|
1524bc |
- netlogon_creds_step(creds);
|
|
|
1524bc |
+ status = netlogon_creds_step(creds);
|
|
|
1524bc |
+ if (!NT_STATUS_IS_OK(status)) {
|
|
|
1524bc |
+ ZERO_STRUCTP(return_authenticator);
|
|
|
1524bc |
+ return status;
|
|
|
1524bc |
+ }
|
|
|
1524bc |
+
|
|
|
1524bc |
if (netlogon_creds_server_check_internal(creds, &received_authenticator->cred)) {
|
|
|
1524bc |
return_authenticator->cred = creds->server;
|
|
|
1524bc |
return_authenticator->timestamp = 0;
|
|
|
1524bc |
--
|
|
|
1524bc |
2.23.0
|
|
|
1524bc |
|