diff options
author | Amitay Isaacs <amitay@gmail.com> | 2011-08-18 15:05:18 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-08-19 16:35:00 +1000 |
commit | 590ed81c4868c030ee84870fd8cdaca4fad20520 (patch) | |
tree | c957a635fc3c793f5fdab058f2e1b9f30ffe3e90 | |
parent | f4c7a448d4b6d875281c3c4db61e9e5aabb91173 (diff) | |
download | samba-590ed81c4868c030ee84870fd8cdaca4fad20520.tar.gz samba-590ed81c4868c030ee84870fd8cdaca4fad20520.tar.bz2 samba-590ed81c4868c030ee84870fd8cdaca4fad20520.zip |
s3-passdb: Make arguments for python wrapper enum_group_mapping() optional
Set the defaults, if no arguments are provided.
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r-- | source3/passdb/py_passdb.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/source3/passdb/py_passdb.c b/source3/passdb/py_passdb.c index 5b10c465fe..81eb59d40d 100644 --- a/source3/passdb/py_passdb.c +++ b/source3/passdb/py_passdb.c @@ -1791,16 +1791,19 @@ static PyObject *py_pdb_enum_group_mapping(pytalloc_Object *self, PyObject *args struct pdb_methods *methods; TALLOC_CTX *tframe; enum lsa_SidType sid_name_use; - int lsa_sidtype_value; - int unix_only; + int lsa_sidtype_value = SID_NAME_UNKNOWN; + int unix_only = 0; PyObject *py_domain_sid; - struct dom_sid *domain_sid; + struct dom_sid *domain_sid = NULL; GROUP_MAP *gmap, *group_map; size_t num_entries; PyObject *py_gmap_list, *py_group_map; int i; - if (!PyArg_ParseTuple(args, "O!ii:enum_group_mapping", dom_sid_Type, &py_domain_sid, + py_domain_sid = Py_None; + Py_INCREF(Py_None); + + if (!PyArg_ParseTuple(args, "|O!ii:enum_group_mapping", dom_sid_Type, &py_domain_sid, &lsa_sidtype_value, &unix_only)) { return NULL; } @@ -1814,7 +1817,9 @@ static PyObject *py_pdb_enum_group_mapping(pytalloc_Object *self, PyObject *args sid_name_use = lsa_sidtype_value; - domain_sid = pytalloc_get_ptr(py_domain_sid); + if (py_domain_sid != Py_None) { + domain_sid = pytalloc_get_ptr(py_domain_sid); + } status = methods->enum_group_mapping(methods, domain_sid, sid_name_use, &gmap, &num_entries, unix_only); |