From: Andreas Schneider Date: Wed, 29 May 2019 14:46:36 +0000 (+0200) Subject: libcli:auth: Return NTSTATUS for netlogon_creds_encrypt_samlogon_logon() X-Git-Tag: ldb-2.0.5~169 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=31f110317f52e90693e71c7035b360ac9bc21967;p=thirdparty%2Fsamba.git libcli:auth: Return NTSTATUS for netlogon_creds_encrypt_samlogon_logon() Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett --- diff --git a/libcli/auth/credentials.c b/libcli/auth/credentials.c index 562dd4f3c58..b7d2c4fa3a3 100644 --- a/libcli/auth/credentials.c +++ b/libcli/auth/credentials.c @@ -811,11 +811,13 @@ void netlogon_creds_decrypt_samlogon_logon(struct netlogon_creds_CredentialState netlogon_creds_crypt_samlogon_logon(creds, level, logon, false); } -void netlogon_creds_encrypt_samlogon_logon(struct netlogon_creds_CredentialState *creds, - enum netr_LogonInfoClass level, - union netr_LogonLevel *logon) +NTSTATUS netlogon_creds_encrypt_samlogon_logon(struct netlogon_creds_CredentialState *creds, + enum netr_LogonInfoClass level, + union netr_LogonLevel *logon) { netlogon_creds_crypt_samlogon_logon(creds, level, logon, true); + + return NT_STATUS_OK; } union netr_LogonLevel *netlogon_creds_shallow_copy_logon(TALLOC_CTX *mem_ctx, diff --git a/libcli/auth/netlogon_creds_cli.c b/libcli/auth/netlogon_creds_cli.c index 01831930cef..8dce4cc30e1 100644 --- a/libcli/auth/netlogon_creds_cli.c +++ b/libcli/auth/netlogon_creds_cli.c @@ -2365,9 +2365,15 @@ static void netlogon_creds_cli_LogonSamLogon_start(struct tevent_req *req) return; } - netlogon_creds_encrypt_samlogon_logon(state->ro_creds, - state->logon_level, - state->logon); + status = netlogon_creds_encrypt_samlogon_logon(state->ro_creds, + state->logon_level, + state->logon); + if (!NT_STATUS_IS_OK(status)) { + status = NT_STATUS_ACCESS_DENIED; + tevent_req_nterror(req, status); + netlogon_creds_cli_LogonSamLogon_cleanup(req, status); + return; + } } subreq = dcerpc_netr_LogonSamLogonEx_send(state, state->ev, @@ -2419,9 +2425,13 @@ static void netlogon_creds_cli_LogonSamLogon_start(struct tevent_req *req) return; } - netlogon_creds_encrypt_samlogon_logon(&state->tmp_creds, - state->logon_level, - state->logon); + status = netlogon_creds_encrypt_samlogon_logon(&state->tmp_creds, + state->logon_level, + state->logon); + if (tevent_req_nterror(req, status)) { + netlogon_creds_cli_LogonSamLogon_cleanup(req, status); + return; + } state->validation_level = 3; diff --git a/libcli/auth/proto.h b/libcli/auth/proto.h index 6bf83d60e81..88ef50357c9 100644 --- a/libcli/auth/proto.h +++ b/libcli/auth/proto.h @@ -68,9 +68,9 @@ NTSTATUS netlogon_creds_encrypt_samlogon_validation(struct netlogon_creds_Creden void netlogon_creds_decrypt_samlogon_logon(struct netlogon_creds_CredentialState *creds, enum netr_LogonInfoClass level, union netr_LogonLevel *logon); -void netlogon_creds_encrypt_samlogon_logon(struct netlogon_creds_CredentialState *creds, - enum netr_LogonInfoClass level, - union netr_LogonLevel *logon); +NTSTATUS netlogon_creds_encrypt_samlogon_logon(struct netlogon_creds_CredentialState *creds, + enum netr_LogonInfoClass level, + union netr_LogonLevel *logon); union netr_LogonLevel *netlogon_creds_shallow_copy_logon(TALLOC_CTX *mem_ctx, enum netr_LogonInfoClass level, const union netr_LogonLevel *in);