s3-passdb: Return list of sids from python wrapper enum_group_members
authorAmitay Isaacs <amitay@gmail.com>
Thu, 18 Aug 2011 05:07:06 +0000 (15:07 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 19 Aug 2011 06:35:01 +0000 (16:35 +1000)
Instead of returning rids as the C api does, return sids, so it is
similar to enum_aliasmem and can be used easily in s3_upgrade.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
source3/passdb/py_passdb.c

index 81eb59d40da972d6fedf30314b6a600e1226dfce..c4f0508c084d0f82e79a347b571297b38eb747fd 100644 (file)
@@ -1864,7 +1864,8 @@ static PyObject *py_pdb_enum_group_members(pytalloc_Object *self, PyObject *args
        struct dom_sid *group_sid;
        uint32_t *member_rids;
        size_t num_members;
        struct dom_sid *group_sid;
        uint32_t *member_rids;
        size_t num_members;
-       PyObject *py_rid_list;
+       PyObject *py_sid_list;
+       struct dom_sid *domain_sid, *member_sid;
        int i;
 
        if (!PyArg_ParseTuple(args, "O!:enum_group_members", dom_sid_Type, &py_group_sid)) {
        int i;
 
        if (!PyArg_ParseTuple(args, "O!:enum_group_members", dom_sid_Type, &py_group_sid)) {
@@ -1890,20 +1891,23 @@ static PyObject *py_pdb_enum_group_members(pytalloc_Object *self, PyObject *args
                return NULL;
        }
 
                return NULL;
        }
 
-       py_rid_list = PyList_New(0);
-       if (py_rid_list == NULL) {
+       py_sid_list = PyList_New(0);
+       if (py_sid_list == NULL) {
                PyErr_NoMemory();
                talloc_free(tframe);
                return NULL;
        }
 
                PyErr_NoMemory();
                talloc_free(tframe);
                return NULL;
        }
 
+       domain_sid = get_global_sam_sid();
+
        for(i=0; i<num_members; i++) {
        for(i=0; i<num_members; i++) {
-               PyList_Append(py_rid_list, PyInt_FromLong(member_rids[i]));
+               member_sid = dom_sid_add_rid(tframe, domain_sid, member_rids[i]);
+               PyList_Append(py_sid_list, pytalloc_steal(dom_sid_Type, member_sid));
        }
 
        talloc_free(tframe);
 
        }
 
        talloc_free(tframe);
 
-       return py_rid_list;
+       return py_sid_list;
 }
 
 
 }