diff -Nura python-ldap-2.2.1.orig/Modules/errors.c python-ldap-2.2.1/Modules/errors.c
--- python-ldap-2.2.1.orig/Modules/errors.c	2005-11-17 21:49:28.000000000 +0100
+++ python-ldap-2.2.1/Modules/errors.c	2007-03-27 15:57:05.000000000 +0200
@@ -17,9 +17,16 @@
 
 /* list of error objects */
 
+#if LDAP_VENDOR_VERSION>=20200
+/* OpenLDAP 2.2+ defines negative error constants */
 #define LDAP_ERROR_MIN          LDAP_REFERRAL_LIMIT_EXCEEDED
 #define LDAP_ERROR_MAX          LDAP_OTHER
 #define LDAP_ERROR_OFFSET       -LDAP_ERROR_MIN
+#else
+#define LDAP_ERROR_MIN          0
+#define LDAP_ERROR_MAX          LDAP_REFERRAL_LIMIT_EXCEEDED
+#define LDAP_ERROR_OFFSET       0
+#endif
 
 static PyObject* errobjects[ LDAP_ERROR_MAX-LDAP_ERROR_MIN+1 ];
 
diff -Nura python-ldap-2.2.1.orig/setup.cfg python-ldap-2.2.1/setup.cfg
--- python-ldap-2.2.1.orig/setup.cfg	2006-11-15 18:26:26.000000000 +0100
+++ python-ldap-2.2.1/setup.cfg	2007-03-27 15:53:52.000000000 +0200
@@ -7,8 +7,8 @@
 # for wrapping OpenLDAP 2 libs
 [_ldap]
 
-library_dirs = /usr/local/openldap-2.3/lib
-include_dirs = /usr/local/openldap-2.3/include /usr/include/sasl
+library_dirs = /usr/lib/sasl2
+include_dirs = /usr/include/sasl
 
 extra_compile_args = 
 extra_objects = 
