summaryrefslogtreecommitdiff
path: root/source4/librpc
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2011-08-18 15:11:20 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-08-19 16:35:03 +1000
commitc71e781e7d66022cd6181e910f5fb8b7d750cbc1 (patch)
treee6e37b32333eabb446a9b0ff02fe4e523793abe3 /source4/librpc
parent0fef5a3a268219adea8f9a4614abe1f90f1d845e (diff)
downloadsamba-c71e781e7d66022cd6181e910f5fb8b7d750cbc1.tar.gz
samba-c71e781e7d66022cd6181e910f5fb8b7d750cbc1.tar.bz2
samba-c71e781e7d66022cd6181e910f5fb8b7d750cbc1.zip
py_security: Fix comparison between two dom_sid objects
dom_sid_compare() function can return values other than -1, 0, 1. Python requires compare function to return value from [-1, 0, 1]. Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org> Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/librpc')
-rw-r--r--source4/librpc/ndr/py_security.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source4/librpc/ndr/py_security.c b/source4/librpc/ndr/py_security.c
index 2d038cfcca..7f79796ea2 100644
--- a/source4/librpc/ndr/py_security.c
+++ b/source4/librpc/ndr/py_security.c
@@ -72,11 +72,19 @@ static PyObject *py_dom_sid_split(PyObject *py_self, PyObject *args)
static int py_dom_sid_cmp(PyObject *py_self, PyObject *py_other)
{
struct dom_sid *self = pytalloc_get_ptr(py_self), *other;
+ int val;
+
other = pytalloc_get_ptr(py_other);
if (other == NULL)
return -1;
- return dom_sid_compare(self, other);
+ val = dom_sid_compare(self, other);
+ if (val > 0) {
+ return 1;
+ } else if (val < 0) {
+ return -1;
+ }
+ return 0;
}
static PyObject *py_dom_sid_str(PyObject *py_self)