diff options
author | Andreas Schneider <asn@samba.org> | 2019-05-29 16:46:36 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2019-06-27 12:54:23 +0000 |
commit | 31f110317f52e90693e71c7035b360ac9bc21967 (patch) | |
tree | 0374fef9cf9a86487a4d80ed5388d403f61b7748 | |
parent | 8c9cf56fe9865029bf033557b00e8987873a7096 (diff) | |
download | samba-31f110317f52e90693e71c7035b360ac9bc21967.tar.gz |
libcli:auth: Return NTSTATUS for netlogon_creds_encrypt_samlogon_logon()
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r-- | libcli/auth/credentials.c | 8 | ||||
-rw-r--r-- | libcli/auth/netlogon_creds_cli.c | 22 | ||||
-rw-r--r-- | libcli/auth/proto.h | 6 |
3 files changed, 24 insertions, 12 deletions
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); |