summaryrefslogtreecommitdiff
path: root/source4/lib/ldb
diff options
context:
space:
mode:
authorzahari <zahari@darkstar.zahari.local>2009-03-20 12:03:29 +0200
committerJelmer Vernooij <jelmer@samba.org>2009-03-20 22:54:15 +0100
commit4fff36f618420dea2e004f87ae5a2699eabd140a (patch)
tree70fc6026b8b5dbda953d8b8e9f6ef6ace35f5fb1 /source4/lib/ldb
parentee577ef0eef2d666504d1b78bb102b5c2e070b03 (diff)
downloadsamba-4fff36f618420dea2e004f87ae5a2699eabd140a.tar.gz
samba-4fff36f618420dea2e004f87ae5a2699eabd140a.tar.bz2
samba-4fff36f618420dea2e004f87ae5a2699eabd140a.zip
Setting nTSecurityDescriptor via LDAP fails
Fix for the problem was substitute talloc_strndup() with talloc_memdup(), allocate 1 more character and put null character ('\0') in the extra place so data copied is null terminated. Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r--source4/lib/ldb/pyldb.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c
index c552d68635..b91f9b797f 100644
--- a/source4/lib/ldb/pyldb.c
+++ b/source4/lib/ldb/pyldb.c
@@ -1293,9 +1293,11 @@ struct ldb_message_element *PyObject_AsMessageElement(TALLOC_CTX *mem_ctx,
me->num_values = 1;
me->values = talloc_array(me, struct ldb_val, me->num_values);
me->values[0].length = PyString_Size(set_obj);
- me->values[0].data = (uint8_t *)talloc_strndup(me->values,
+ me->values[0].data = (uint8_t *)talloc_memdup(me->values,
PyString_AsString(set_obj),
- me->values[0].length);
+ me->values[0].length + 1);
+ me->values[0].data[me->values[0].length] = '\0';
+
} else if (PySequence_Check(set_obj)) {
int i;
me->num_values = PySequence_Size(set_obj);