s4:password_hash Only store the LM hash if 'lanman auth = yes'
[kai/samba.git] / source4 / dsdb / samdb / ldb_modules / password_hash.c
index 56d4c4fe36855f71e8d5b208347d1ee5f8fa2f02..5a9926b6d18c6e8113512e346b69b77941db3191 100644 (file)
@@ -1379,7 +1379,8 @@ static int setup_password_fields(struct setup_password_fields_io *io)
        if (io->n.cleartext_utf8) {
                struct samr_Password *lm_hash;
                char *cleartext_unix;
-               if (convert_string_talloc_convenience(io->ac, lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm")), 
+               if (lp_lanman_auth(ldb_get_opaque(ldb, "loadparm")) &&
+                   convert_string_talloc_convenience(io->ac, lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm")), 
                                                         CH_UTF8, CH_UNIX, io->n.cleartext_utf8->data, io->n.cleartext_utf8->length, 
                                                         (void **)&cleartext_unix, &converted_pw_len, false)) {
                        lm_hash = talloc(io->ac, struct samr_Password);