1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-11 16:58:40 +03:00

lib: simplify smbpasswd_sethexpwd() with hex_encode_buf()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Volker Lendecke 2024-09-20 15:17:33 +02:00 committed by Ralph Boehme
parent 282a5778fb
commit 804568a1d7

View File

@ -89,14 +89,11 @@ char *smbpasswd_sethexpwd(TALLOC_CTX *mem_ctx, struct samr_Password *pwd, uint16
{
char *p;
if (pwd != NULL) {
int i;
p = talloc_array(mem_ctx, char, 33);
if (!p) {
return NULL;
}
for (i = 0; i < sizeof(pwd->hash); i++)
slprintf(&p[i*2], 3, "%02X", pwd->hash[i]);
hex_encode_buf(p, pwd->hash, sizeof(pwd->hash));
} else {
if (acb_info & ACB_PWNOTREQ)
p = talloc_strdup(mem_ctx, "NO PASSWORDXXXXXXXXXXXXXXXXXXXXX");