diff options
author | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2009-11-06 15:15:53 +0100 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2009-11-06 15:19:39 +0100 |
commit | bb531b039902fa613d7462e0bc2114326808d9fe (patch) | |
tree | 53dc96857f025f504b483480f6f8d71c5bdfbdbe /source4 | |
parent | 17d6506c9e9e4033c6932bbc9b562bec0cb08a89 (diff) | |
download | samba-bb531b039902fa613d7462e0bc2114326808d9fe.tar.gz samba-bb531b039902fa613d7462e0bc2114326808d9fe.tar.bz2 samba-bb531b039902fa613d7462e0bc2114326808d9fe.zip |
s4:samdb_validate_password - Adapt the function to use the UNIX charset for the password data blob
Diffstat (limited to 'source4')
-rw-r--r-- | source4/dsdb/common/util.c | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index d953e634be..76a4efc82d 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -1574,37 +1574,24 @@ int samdb_search_for_parent_domain(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, /* - * Performs checks on a user password (plaintext UTF 16 format - attribute + * Performs checks on a user password (plaintext UNIX format - attribute * "password"). The remaining parameters have to be extracted from the domain * object in the AD. * * Result codes from "enum samr_ValidationStatus" (consider "samr.idl") */ -enum samr_ValidationStatus samdb_check_password(TALLOC_CTX *mem_ctx, - struct loadparm_context *lp_ctx, - const DATA_BLOB *password, +enum samr_ValidationStatus samdb_check_password(const DATA_BLOB *password, const uint32_t pwdProperties, const uint32_t minPwdLength) { - char *utf8_password; - size_t utf8_password_len; - /* checks if the "minPwdLength" property is satisfied */ - if (minPwdLength > utf16_len_n(password->data, password->length) / 2) + if (minPwdLength > password->length) return SAMR_VALIDATION_STATUS_PWD_TOO_SHORT; - /* Try to convert the password to UTF8 and perform other checks */ - if (convert_string_talloc_convenience(mem_ctx, - lp_iconv_convenience(lp_ctx), - CH_UTF16MUNGED, CH_UTF8, - password->data, password->length, - (void **)&utf8_password, - &utf8_password_len, false)) { - /* checks the password complexity */ - if (((pwdProperties & DOMAIN_PASSWORD_COMPLEX) != 0) - && (!check_password_quality(utf8_password))) - return SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH; - } + /* checks the password complexity */ + if (((pwdProperties & DOMAIN_PASSWORD_COMPLEX) != 0) + && (!check_password_quality((const char *) password->data))) + return SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH; return SAMR_VALIDATION_STATUS_SUCCESS; } |