diff options
author | Garming Sam <garming@catalyst.net.nz> | 2014-11-25 14:45:26 +1300 |
---|---|---|
committer | Garming Sam <garming@samba.org> | 2014-12-03 04:21:09 +0100 |
commit | 7979c6cc50eaa792e5094866878c63df36e715c3 (patch) | |
tree | 114195414f6efaa628aaeb4e8c21f07199a02a0e /source3/passdb/py_passdb.c | |
parent | 3b90bfb1089e6a4b7e05e7ed62bb642521f57917 (diff) | |
download | samba-7979c6cc50eaa792e5094866878c63df36e715c3.tar.gz samba-7979c6cc50eaa792e5094866878c63df36e715c3.tar.xz samba-7979c6cc50eaa792e5094866878c63df36e715c3.zip |
idmap: unify passdb *id_to_sid methods
Instead of passing down gid or uid, a pointer to a unixid is now sent
down. This acts as an in-out variable so that the idmap functions can
correctly receive ID_TYPE_BOTH, filling in cache details correctly
rather than forcing the cache to store ID_TYPE_UID or ID_TYPE_GID.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=10720
Change-Id: I11409a0f498e61a3c0a6ae606dd7af1135e6b066
Pair-programmed-with: Andrew Bartlett <abarlet@samba.org>
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3/passdb/py_passdb.c')
-rw-r--r-- | source3/passdb/py_passdb.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source3/passdb/py_passdb.c b/source3/passdb/py_passdb.c index dec45c3a5c..3a1e583f0f 100644 --- a/source3/passdb/py_passdb.c +++ b/source3/passdb/py_passdb.c @@ -25,6 +25,7 @@ #include "librpc/gen_ndr/idmap.h" #include "passdb.h" #include "secrets.h" +#include "idmap.h" /* There's no Py_ssize_t in 2.4, apparently */ #if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 5 @@ -2678,6 +2679,7 @@ static PyObject *py_pdb_uid_to_sid(pytalloc_Object *self, PyObject *args) { TALLOC_CTX *frame = talloc_stackframe(); struct pdb_methods *methods; + struct unixid id; unsigned int uid; struct dom_sid user_sid, *copy_user_sid; PyObject *py_user_sid; @@ -2689,7 +2691,10 @@ static PyObject *py_pdb_uid_to_sid(pytalloc_Object *self, PyObject *args) methods = pytalloc_get_ptr(self); - if (!methods->uid_to_sid(methods, uid, &user_sid)) { + id.id = uid; + id.type = ID_TYPE_UID; + + if (!methods->id_to_sid(methods, &id, &user_sid)) { PyErr_Format(py_pdb_error, "Unable to get sid for uid=%d", uid); talloc_free(frame); return NULL; @@ -2713,6 +2718,7 @@ static PyObject *py_pdb_gid_to_sid(pytalloc_Object *self, PyObject *args) { TALLOC_CTX *frame = talloc_stackframe(); struct pdb_methods *methods; + struct unixid id; unsigned int gid; struct dom_sid group_sid, *copy_group_sid; PyObject *py_group_sid; @@ -2722,9 +2728,12 @@ static PyObject *py_pdb_gid_to_sid(pytalloc_Object *self, PyObject *args) return NULL; } + id.id = gid; + id.type = ID_TYPE_GID; + methods = pytalloc_get_ptr(self); - if (!methods->gid_to_sid(methods, gid, &group_sid)) { + if (!methods->id_to_sid(methods, &id, &group_sid)) { PyErr_Format(py_pdb_error, "Unable to get sid for gid=%d", gid); talloc_free(frame); return NULL; |