r20460: Simplfy the handling of password hashes in the samba3sam module.
authorAndrew Bartlett <abartlet@samba.org>
Tue, 2 Jan 2007 03:40:29 +0000 (03:40 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:35:51 +0000 (14:35 -0500)
Andrew Bartlett
(This used to be commit 2959b4ba8bb5764ea654ae7b152284a4e02405ab)

source4/dsdb/samdb/ldb_modules/samba3sam.c

index 1653812b8807dca28bd8365bb5991005bba757c1..c66dbee360d6eb0d8c93f758d510536795616255 100644 (file)
@@ -246,15 +246,11 @@ static struct ldb_val hex2bin(struct ldb_module *module, TALLOC_CTX *ctx, const
 {
        struct ldb_val out;
        struct samr_Password *pwd;
-       pwd = smbpasswd_gethexpwd(ctx, talloc_strndup(ctx, (const char *)val->data, val->length));
+       pwd = smbpasswd_gethexpwd(ctx, (const char *)val->data);
        if (!pwd) {
                return data_blob(NULL, 0);
        }
-       out.data = talloc_memdup(ctx, pwd->hash, sizeof(pwd->hash));
-       if (!out.data) {
-               return data_blob(NULL, 0);
-       }
-       out.length = sizeof(pwd->hash);
+       out = data_blob_talloc(ctx, pwd->hash, sizeof(pwd->hash));
        return out;
 }
 
@@ -331,7 +327,7 @@ const struct ldb_map_attribute samba3_attributes[] =
 
        /* sambaLMPassword -> lmPwdHash*/
        {
-               .local_name = "lmpwdhash",
+               .local_name = "lmPwdHash",
                .type = MAP_CONVERT,
                .u = {
                        .convert = {