summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2013-02-04 09:18:59 +0100
committerMichael Adam <obnox@samba.org>2013-02-04 17:14:22 +0100
commit6eccfc74cd9a16e96a2b6214b943f5b2f9adfe65 (patch)
treed36b46c7521f0b32c4d9f044514e01d49c8889ca /source4/dsdb/samdb
parent9292e5b74310632e1f0b4b2b76a9ef4ccae6874e (diff)
downloadsamba-6eccfc74cd9a16e96a2b6214b943f5b2f9adfe65.tar.gz
samba-6eccfc74cd9a16e96a2b6214b943f5b2f9adfe65.tar.bz2
samba-6eccfc74cd9a16e96a2b6214b943f5b2f9adfe65.zip
dsdb/password_hash: make sure that io->n.cleartext_utf8.data is a null terminated string
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/password_hash.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c
index 9bf596c3bc..6b8cd9cd15 100644
--- a/source4/dsdb/samdb/ldb_modules/password_hash.c
+++ b/source4/dsdb/samdb/ldb_modules/password_hash.c
@@ -2203,6 +2203,29 @@ static int setup_io(struct ph_context *ac,
}
}
+ if (io->n.cleartext_utf8 != NULL) {
+ struct ldb_val *cleartext_utf8_blob;
+ char *p;
+
+ cleartext_utf8_blob = talloc(io->ac, struct ldb_val);
+ if (!cleartext_utf8_blob) {
+ return ldb_oom(ldb);
+ }
+
+ *cleartext_utf8_blob = *io->n.cleartext_utf8;
+
+ /* make sure we have a null terminated string */
+ p = talloc_strndup(cleartext_utf8_blob,
+ (const char *)io->n.cleartext_utf8->data,
+ io->n.cleartext_utf8->length);
+ if ((p == NULL) && (io->n.cleartext_utf8->length > 0)) {
+ return ldb_oom(ldb);
+ }
+ cleartext_utf8_blob->data = (uint8_t *)p;
+
+ io->n.cleartext_utf8 = cleartext_utf8_blob;
+ }
+
ret = msg_find_old_and_new_pwd_val(orig_msg, "clearTextPassword",
ac->req->operation,
&io->n.cleartext_utf16,