diff options
author | Andrew Tridgell <tridge@samba.org> | 2011-06-22 13:49:37 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2011-06-22 14:47:08 +1000 |
commit | 341884c835b9c5785794cba562c2a21939eb4bce (patch) | |
tree | c5ca0bd6296bfff399effaca17dd85aa05e854cd /source4 | |
parent | dd5350b0a87c82be7d0b0d124885ecfd73bb1b5b (diff) | |
download | samba-341884c835b9c5785794cba562c2a21939eb4bce.tar.gz samba-341884c835b9c5785794cba562c2a21939eb4bce.tar.bz2 samba-341884c835b9c5785794cba562c2a21939eb4bce.zip |
ldb: added extended_str() method to pyldb
this gives access to ldb_dn_get_extended_linearized() from python
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/ldb/pyldb.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c index 1bcdaabe13..842da633bb 100644 --- a/source4/lib/ldb/pyldb.c +++ b/source4/lib/ldb/pyldb.c @@ -7,6 +7,8 @@ Copyright (C) 2006 Simo Sorce <idra@samba.org> Copyright (C) 2007-2010 Jelmer Vernooij <jelmer@samba.org> Copyright (C) 2009-2010 Matthias Dieter Wallnöfer + Copyright (C) 2009-2011 Andrew Tridgell + Copyright (C) 2009-2011 Andrew Bartlett ** NOTE! The following LGPL license applies to the ldb ** library. This does NOT imply that all of Samba is released @@ -384,6 +386,17 @@ static PyObject *py_ldb_dn_canonical_ex_str(PyLdbDnObject *self) return PyString_FromString(ldb_dn_canonical_ex_string(self->dn, self->dn)); } +static PyObject *py_ldb_dn_extended_str(PyLdbDnObject *self, PyObject *args, PyObject *kwargs) +{ + const char * const kwnames[] = { "mode", NULL }; + int mode = 1; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|i", + discard_const_p(char *, kwnames), + &mode)) + return NULL; + return PyString_FromString(ldb_dn_get_extended_linearized(self->dn, self->dn, mode)); +} + static PyObject *py_ldb_dn_repr(PyLdbDnObject *self) { return PyString_FromFormat("Dn(%s)", PyObject_REPR(PyString_FromString(ldb_dn_get_linearized(self->dn)))); @@ -485,6 +498,9 @@ static PyMethodDef py_ldb_dn_methods[] = { { "canonical_ex_str", (PyCFunction)py_ldb_dn_canonical_ex_str, METH_NOARGS, "S.canonical_ex_str() -> string\n" "Canonical version of this DN (like a posix path, with terminating newline)." }, + { "extended_str", (PyCFunction)py_ldb_dn_extended_str, METH_VARARGS | METH_KEYWORDS, + "S.extended_str(mode=1) -> string\n" + "Extended version of this DN" }, { "parent", (PyCFunction)py_ldb_dn_get_parent, METH_NOARGS, "S.parent() -> dn\n" "Get the parent for this DN." }, |