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:
parent
282a5778fb
commit
804568a1d7
@ -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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user