summaryrefslogtreecommitdiff
path: root/source4/scripting/swig/ldb.i
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2006-04-04 22:15:27 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:00:16 -0500
commit9956009a41f2489abefa0a7a21553fb0b78e1fed (patch)
tree8812f70922bfd5620d740a2b5f7550e6f6b26faa /source4/scripting/swig/ldb.i
parent1385cd968bf94dd9b9b252bc679667568845c682 (diff)
downloadsamba-9956009a41f2489abefa0a7a21553fb0b78e1fed.tar.gz
samba-9956009a41f2489abefa0a7a21553fb0b78e1fed.tar.bz2
samba-9956009a41f2489abefa0a7a21553fb0b78e1fed.zip
r14915: Work in progress - getting ldb_add() working.
(This used to be commit d50661ed4ef3f6c96811649a1acbe5d702e80654)
Diffstat (limited to 'source4/scripting/swig/ldb.i')
-rw-r--r--source4/scripting/swig/ldb.i24
1 files changed, 24 insertions, 0 deletions
diff --git a/source4/scripting/swig/ldb.i b/source4/scripting/swig/ldb.i
index 6930ea4c9b..31c1ffe3e4 100644
--- a/source4/scripting/swig/ldb.i
+++ b/source4/scripting/swig/ldb.i
@@ -156,6 +156,30 @@ struct ldb_message {
void *private_data; /* private to the backend */
};
+%typemap(in) struct ldb_message * {
+ PyObject *obj, *key, *value;
+ int pos;
+
+ $1 = ldb_msg_new(NULL);
+
+ obj = PyObject_GetAttrString($input, "dn");
+ $1->dn = ldb_dn_explode(NULL, PyString_AsString(obj));
+
+ obj = PyObject_GetAttrString($input, "private_data");
+ $1->private_data = PyString_AsString(obj);
+
+ obj = PyObject_GetAttrString($input, "elements");
+
+ pos = 0;
+ while (PyDict_Next(obj, &pos, &key, &value)) {
+ struct ldb_val v;
+
+ v.data = PyString_AsString(value);
+ v.length = PyString_Size(value);
+ ldb_msg_add_value($1, PyString_AsString(key), &v);
+ }
+}
+
/*
* Wrap struct ldb_result
*/