]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbpasswd4: Simplify smbpasswd_sethexpwd()
authorVolker Lendecke <vl@samba.org>
Thu, 14 Nov 2024 19:48:14 +0000 (20:48 +0100)
committerRalph Boehme <slow@samba.org>
Tue, 19 Nov 2024 18:11:29 +0000 (18:11 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source4/lib/samba3/smbpasswd.c

index 6f4d832ae2ba2a83da2b6a503261d599bb459d4f..d0b7e9dbd48fae4a6e5f9a762521552a65edbed0 100644 (file)
@@ -89,11 +89,7 @@ char *smbpasswd_sethexpwd(TALLOC_CTX *mem_ctx, struct samr_Password *pwd, uint16
 {
        char *p;
        if (pwd != NULL) {
-               p = talloc_array(mem_ctx, char, 33);
-               if (!p) {
-                       return NULL;
-               }
-               hex_encode_buf(p, pwd->hash, sizeof(pwd->hash));
+               p = hex_encode_talloc(mem_ctx, pwd->hash, sizeof(pwd->hash));
        } else {
                if (acb_info & ACB_PWNOTREQ)
                        p = talloc_strdup(mem_ctx, "NO PASSWORDXXXXXXXXXXXXXXXXXXXXX");