diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-12-21 23:05:35 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-12-21 23:05:35 +0100 |
commit | 2227860a793dbde0b41e6ba1a720ac0d161ad784 (patch) | |
tree | 31e9701e978e4355362c199863d11ce52c04d5db /source4/librpc | |
parent | d75c51eef34836f9eb5fa3449cef31f6463ce470 (diff) | |
download | samba-2227860a793dbde0b41e6ba1a720ac0d161ad784.tar.gz samba-2227860a793dbde0b41e6ba1a720ac0d161ad784.tar.bz2 samba-2227860a793dbde0b41e6ba1a720ac0d161ad784.zip |
Fix more tests, improve repr() functions for various Python types.
Diffstat (limited to 'source4/librpc')
-rw-r--r-- | source4/librpc/ndr/py_security.c | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/source4/librpc/ndr/py_security.c b/source4/librpc/ndr/py_security.c index 2d01dedaec..5100517c57 100644 --- a/source4/librpc/ndr/py_security.c +++ b/source4/librpc/ndr/py_security.c @@ -32,19 +32,14 @@ static void PyType_AddMethods(PyTypeObject *type, PyMethodDef *methods) } } -static PyObject *py_dom_sid_eq(PyObject *self, PyObject *args) +static int py_dom_sid_cmp(PyObject *self, PyObject *py_other) { struct dom_sid *this = py_talloc_get_ptr(self), *other; - PyObject *py_other; - - if (!PyArg_ParseTuple(args, "O", &py_other)) - return NULL; - - other = py_talloc_get_type(py_other, struct dom_sid); + other = py_talloc_get_ptr(py_other); if (other == NULL) - return Py_False; + return -1; - return dom_sid_equal(this, other)?Py_True:Py_False; + return dom_sid_compare(this, other); } static PyObject *py_dom_sid_str(PyObject *self) @@ -82,17 +77,12 @@ static int py_dom_sid_init(PyObject *self, PyObject *args, PyObject *kwargs) return 0; } -static PyMethodDef py_dom_sid_extra_methods[] = { - { "__eq__", (PyCFunction)py_dom_sid_eq, METH_VARARGS, "S.__eq__(x) -> S == x" }, \ - { NULL } -}; - static void py_dom_sid_patch(PyTypeObject *type) { type->tp_init = py_dom_sid_init; type->tp_str = py_dom_sid_str; type->tp_repr = py_dom_sid_repr; - PyType_AddMethods(type, py_dom_sid_extra_methods); + type->tp_compare = py_dom_sid_cmp; } #define PY_DOM_SID_PATCH py_dom_sid_patch @@ -162,19 +152,6 @@ static PyObject *py_descriptor_sacl_del(PyObject *self, PyObject *args) return Py_None; } -static PyObject *py_descriptor_eq(PyObject *self, PyObject *args) -{ - struct security_descriptor *desc1 = py_talloc_get_ptr(self), *desc2; - PyObject *py_other; - - if (!PyArg_ParseTuple(args, "O", &py_other)) - return NULL; - - desc2 = py_talloc_get_ptr(py_other); - - return PyBool_FromLong(security_descriptor_equal(desc1, desc2)); -} - static PyObject *py_descriptor_new(PyTypeObject *self, PyObject *args, PyObject *kwargs) { return py_talloc_import(self, security_descriptor_initialise(NULL)); @@ -190,8 +167,6 @@ static PyMethodDef py_descriptor_extra_methods[] = { NULL }, { "sacl_del", (PyCFunction)py_descriptor_sacl_del, METH_VARARGS, NULL }, - { "__eq__", (PyCFunction)py_descriptor_eq, METH_VARARGS, - NULL }, { NULL } }; |