summaryrefslogtreecommitdiff
path: root/source4/librpc/ndr
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-12-21 18:25:59 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-12-21 18:25:59 +0100
commitf2b4aa82e0febd6528eb8231ac14d845b8aa80d0 (patch)
tree83f20f8bf8e73ce9ae0793cdd3e9f94d97a45afb /source4/librpc/ndr
parenta925e22d7aefad3b9cb0d9c258c33c41978a0015 (diff)
downloadsamba-f2b4aa82e0febd6528eb8231ac14d845b8aa80d0.tar.gz
samba-f2b4aa82e0febd6528eb8231ac14d845b8aa80d0.tar.bz2
samba-f2b4aa82e0febd6528eb8231ac14d845b8aa80d0.zip
Merge the rest of security.i into samba.dcerpc.security.
Diffstat (limited to 'source4/librpc/ndr')
-rw-r--r--source4/librpc/ndr/py_security.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/source4/librpc/ndr/py_security.c b/source4/librpc/ndr/py_security.c
index 11ad6ed2c4..a7cb0515cf 100644
--- a/source4/librpc/ndr/py_security.c
+++ b/source4/librpc/ndr/py_security.c
@@ -270,3 +270,38 @@ static PyObject *py_token_new(PyTypeObject *self, PyObject *args, PyObject *kwar
NULL }, \
{ "set_privilege", (PyCFunction)py_token_set_privilege, METH_VARARGS, \
NULL },
+
+static PyObject *py_privilege_name(PyObject *self, PyObject *args)
+{
+ int priv;
+ if (!PyArg_ParseTuple(args, "i", &priv))
+ return NULL;
+
+ return PyString_FromString(sec_privilege_name(priv));
+}
+
+static PyObject *py_privilege_id(PyObject *self, PyObject *args)
+{
+ char *name;
+
+ if (!PyArg_ParseTuple(args, "s", &name))
+ return NULL;
+
+ return PyInt_FromLong(sec_privilege_id(name));
+}
+
+static PyObject *py_random_sid(PyObject *self)
+{
+ struct dom_sid *sid;
+ PyObject *ret;
+ char *str = talloc_asprintf(NULL, "S-1-5-21-%u-%u-%u",
+ (unsigned)generate_random(),
+ (unsigned)generate_random(),
+ (unsigned)generate_random());
+
+ sid = dom_sid_parse_talloc(NULL, str);
+ talloc_free(str);
+ ret = py_talloc_import(&PyDomSidType, sid);
+ talloc_free(sid);
+ return ret;
+}