summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-01-24 18:38:09 +1100
committerAndrew Bartlett <abartlet@samba.org>2012-01-24 18:38:09 +1100
commit6acce6e5d71743b824a822e9b6f24dcc6d8106ca (patch)
treee4e09fbe0242843c1318ebac663be57b48be0f72 /source3
parent6bab4a3810f9b42e62d2fe1a9b1544e34893cb50 (diff)
downloadsamba-6acce6e5d71743b824a822e9b6f24dcc6d8106ca.tar.gz
samba-6acce6e5d71743b824a822e9b6f24dcc6d8106ca.tar.bz2
samba-6acce6e5d71743b824a822e9b6f24dcc6d8106ca.zip
s3-passdb: Fix pdb_samba4 setting of plaintext passwords
We were setting a UTF8 password into the UTF16 clearTextPassword. Converting from CH_UNIX to CH_UTF16 should fix this. Andrew Bartlett
Diffstat (limited to 'source3')
-rw-r--r--source3/passdb/pdb_samba4.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source3/passdb/pdb_samba4.c b/source3/passdb/pdb_samba4.c
index f336b8a9c6..bc3b1238c1 100644
--- a/source3/passdb/pdb_samba4.c
+++ b/source3/passdb/pdb_samba4.c
@@ -368,11 +368,19 @@ static int pdb_samba4_replace_by_sam(struct pdb_samba4_state *state,
pw = pdb_get_plaintext_passwd(sam);
if (need_update(sam, PDB_PLAINTEXT_PW)) {
+ struct ldb_val pw_utf16;
if (pw == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
- ret |= ldb_msg_add_string(msg, "clearTextPassword", pw);
+ if (!convert_string_talloc(msg,
+ CH_UNIX, CH_UTF16,
+ pw, strlen(pw),
+ (void *)&pw_utf16.data,
+ &pw_utf16.length)) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+ ret |= ldb_msg_add_value(msg, "clearTextPassword", &pw_utf16, NULL);
} else {
bool changed_lm_pw = false;
bool changed_nt_pw = false;