mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +03:00
libcli:auth: Return NTSTATUS for encode_or_decode_arc4_passwd_buffer()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14031 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
7915a48e53
commit
57dd415ba4
@ -184,7 +184,8 @@ bool decode_pw_buffer(TALLOC_CTX *ctx,
|
||||
/***********************************************************
|
||||
Decode an arc4 encrypted password change buffer.
|
||||
************************************************************/
|
||||
void encode_or_decode_arc4_passwd_buffer(unsigned char pw_buf[532], const DATA_BLOB *psession_key);
|
||||
NTSTATUS encode_or_decode_arc4_passwd_buffer(unsigned char pw_buf[532],
|
||||
const DATA_BLOB *psession_key);
|
||||
|
||||
/***********************************************************
|
||||
encode a password buffer with an already unicode password. The
|
||||
|
@ -843,27 +843,32 @@ bool decode_pw_buffer(TALLOC_CTX *ctx,
|
||||
Decode an arc4 encrypted password change buffer.
|
||||
************************************************************/
|
||||
|
||||
void encode_or_decode_arc4_passwd_buffer(unsigned char pw_buf[532], const DATA_BLOB *psession_key)
|
||||
NTSTATUS encode_or_decode_arc4_passwd_buffer(unsigned char pw_buf[532],
|
||||
const DATA_BLOB *psession_key)
|
||||
{
|
||||
gnutls_hash_hd_t hash_hnd = NULL;
|
||||
unsigned char key_out[16];
|
||||
NTSTATUS status;
|
||||
int rc;
|
||||
|
||||
/* Confounder is last 16 bytes. */
|
||||
|
||||
rc = gnutls_hash_init(&hash_hnd, GNUTLS_DIG_MD5);
|
||||
if (rc < 0) {
|
||||
status = gnutls_error_to_ntstatus(rc, NT_STATUS_HASH_NOT_SUPPORTED);
|
||||
goto out;
|
||||
}
|
||||
|
||||
rc = gnutls_hash(hash_hnd, &pw_buf[516], 16);
|
||||
if (rc < 0) {
|
||||
gnutls_hash_deinit(hash_hnd, NULL);
|
||||
status = gnutls_error_to_ntstatus(rc, NT_STATUS_HASH_NOT_SUPPORTED);
|
||||
goto out;
|
||||
}
|
||||
rc = gnutls_hash(hash_hnd, psession_key->data, psession_key->length);
|
||||
if (rc < 0) {
|
||||
gnutls_hash_deinit(hash_hnd, NULL);
|
||||
status = gnutls_error_to_ntstatus(rc, NT_STATUS_HASH_NOT_SUPPORTED);
|
||||
goto out;
|
||||
}
|
||||
gnutls_hash_deinit(hash_hnd, key_out);
|
||||
@ -873,8 +878,9 @@ void encode_or_decode_arc4_passwd_buffer(unsigned char pw_buf[532], const DATA_B
|
||||
|
||||
ZERO_ARRAY(key_out);
|
||||
|
||||
status = NT_STATUS_OK;
|
||||
out:
|
||||
return;
|
||||
return status;
|
||||
}
|
||||
|
||||
/***********************************************************
|
||||
|
@ -5185,9 +5185,12 @@ NTSTATUS _samr_SetUserInfo(struct pipes_struct *p,
|
||||
if(!NT_STATUS_IS_OK(status)) {
|
||||
break;
|
||||
}
|
||||
encode_or_decode_arc4_passwd_buffer(
|
||||
status = encode_or_decode_arc4_passwd_buffer(
|
||||
info->info25.password.data,
|
||||
&session_key);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
break;
|
||||
}
|
||||
|
||||
dump_data(100, info->info25.password.data, 532);
|
||||
|
||||
@ -5201,9 +5204,12 @@ NTSTATUS _samr_SetUserInfo(struct pipes_struct *p,
|
||||
if(!NT_STATUS_IS_OK(status)) {
|
||||
break;
|
||||
}
|
||||
encode_or_decode_arc4_passwd_buffer(
|
||||
status = encode_or_decode_arc4_passwd_buffer(
|
||||
info->info26.password.data,
|
||||
&session_key);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
break;
|
||||
}
|
||||
|
||||
dump_data(100, info->info26.password.data, 516);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user