From c41ffe9c06a687c0f6233ae5ba0e64f7ff5d54a2 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iusty@k1024.org>
Date: Mon, 8 Oct 2007 10:05:01 +0200
Subject: [PATCH] Disallow cmp on ACLs

---
 acl.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/acl.c b/acl.c
index d5e6451..a477b73 100644
--- a/acl.c
+++ b/acl.c
@@ -286,6 +286,13 @@ static PyObject* ACL_richcompare(PyObject* o1, PyObject* o2, int op) {
 }
 #endif
 
+/* Implementation of the compare for ACLs */
+static int ACL_nocmp(PyObject* o1, PyObject* o2) {
+
+    PyErr_SetString(PyExc_TypeError, "cannot compare ACLs using cmp()");
+    return -1;
+}
+
 /* Custom methods */
 static char __applyto_doc__[] =
     "Apply the ACL to a file or filehandle.\n"
@@ -1081,7 +1088,7 @@ static PyTypeObject ACL_Type = {
     0,                  /* tp_print */
     0,                  /* tp_getattr */
     0,                  /* tp_setattr */
-    0,                  /* tp_compare */
+    ACL_nocmp,          /* tp_compare */
     0,                  /* tp_repr */
     0,                  /* tp_as_number */
     0,                  /* tp_as_sequence */
-- 
2.39.5