1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-27 00:57:50 +00:00

py-ldap1: from ldapmodule,

py-ldap2: import CVS snapshoot.
Fix Makefile
This commit is contained in:
Dirk Meyer 2002-02-28 08:27:36 +00:00
parent 0a2c4bd032
commit d81c80bd23
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=55328
10 changed files with 45 additions and 654 deletions

View File

@ -205,7 +205,6 @@
SUBDIR += kxicq2
SUBDIR += lam
SUBDIR += lambdamoo
SUBDIR += ldapmodule
SUBDIR += ldapsdk
SUBDIR += libfreenet
SUBDIR += libicq
@ -376,6 +375,8 @@
SUBDIR += py-adns
SUBDIR += py-ipy
SUBDIR += py-jabber
SUBDIR += py-ldap1
SUBDIR += py-ldap2
SUBDIR += py-libnet
SUBDIR += py-pcap
SUBDIR += py-smb

View File

@ -4,24 +4,39 @@
#
# $FreeBSD$
PORTNAME= ldapmodule
PORTVERSION= 1.10alpha3
PORTREVISION= 4
CATEGORIES= net python
PORTNAME= ldap2
PORTVERSION= CVS200201041716
CATEGORIES= net
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= python-ldap
DISTNAME= python-ldap-${PORTVERSION}-src
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
DISTNAME= Python-LDAP-${PORTVERSION}
MAINTAINER= dinoex@FreeBSD.org
LIB_DEPENDS= ldap.1:${PORTSDIR}/net/openldap
LIB_DEPENDS= ldap.2:${PORTSDIR}/net/openldap2
BUILD_DEPENDS= python:${PORTSDIR}/lang/python
RUN_DEPENDS= python:${PORTSDIR}/lang/python
USE_PYTHON= yes
GNU_CONFIGURE= yes
CONFIGURE_ARGS+=--with-ldap=${LOCALBASE} --with-python=${PYTHON_CMD}
WRKSRC= ${WRKDIR}/${DISTNAME:S=-src==}
pre-configure:
@${CP} ${FILESDIR}/Makefile.pre.in ${WRKSRC}/Misc/Makefile.python-1.4
#class = OpenLDAP2
#library_dirs = /usr/local/openldap2/lib
#include_dirs = /usr/local/openldap2/include
#libs = lber ldap resolv
do-configure:
@${PERL5} -pi -e "s=/usr/local/openldap2/lib=${LOCALBASE}/lib=" \
${WRKSRC}/setup.cfg
@${PERL5} -pi \
-e "s=/usr/local/openldap2/include=${LOCALBASE}/include=" \
${WRKSRC}/setup.cfg
@${PERL5} -pi -e "s=lber ldap resolv=lber ldap=" ${WRKSRC}/setup.cfg
do-build:
cd ${WRKSRC} && python setup.py build
do-install:
cd ${WRKSRC} && python setup.py install
.include <bsd.port.mk>

View File

@ -1 +1 @@
MD5 (python-ldap-1.10alpha3-src.tar.gz) = a4e95cf9edec1b7952a5decbc8080372
MD5 (Python-LDAP-CVS200201041716.tar.gz) = 2ab1887f971fdbfac1c58d343398f674

View File

@ -1,304 +0,0 @@
# Universal Unix Makefile for Python extensions
# =============================================
# Short Instructions
# ------------------
# 1. Build and install Python (1.5 or newer).
# 2. "make -f Makefile.pre.in boot"
# 3. "make"
# You should now have a shared library.
# Long Instructions
# -----------------
# Build *and install* the basic Python 1.5 distribution. See the
# Python README for instructions. (This version of Makefile.pre.in
# only withs with Python 1.5, alpha 3 or newer.)
# Create a file Setup.in for your extension. This file follows the
# format of the Modules/Setup.dist file; see the instructions there.
# For a simple module called "spam" on file "spammodule.c", it can
# contain a single line:
# spam spammodule.c
# You can build as many modules as you want in the same directory --
# just have a separate line for each of them in the Setup.in file.
# If you want to build your extension as a shared library, insert a
# line containing just the string
# *shared*
# at the top of your Setup.in file.
# Note that the build process copies Setup.in to Setup, and then works
# with Setup. It doesn't overwrite Setup when Setup.in is changed, so
# while you're in the process of debugging your Setup.in file, you may
# want to edit Setup instead, and copy it back to Setup.in later.
# (All this is done so you can distribute your extension easily and
# someone else can select the modules they actually want to build by
# commenting out lines in the Setup file, without editing the
# original. Editing Setup is also used to specify nonstandard
# locations for include or library files.)
# Copy this file (Misc/Makefile.pre.in) to the directory containing
# your extension.
# Run "make -f Makefile.pre.in boot". This creates Makefile
# (producing Makefile.pre and sedscript as intermediate files) and
# config.c, incorporating the values for sys.prefix, sys.exec_prefix
# and sys.version from the installed Python binary. For this to work,
# the python binary must be on your path. If this fails, try
# make -f Makefile.pre.in Makefile VERSION=1.5 installdir=<prefix>
# where <prefix> is the prefix used to install Python for installdir
# (and possibly similar for exec_installdir=<exec_prefix>).
# Note: "make boot" implies "make clobber" -- it assumes that when you
# bootstrap you may have changed platforms so it removes all previous
# output files.
# If you are building your extension as a shared library (your
# Setup.in file starts with *shared*), run "make" or "make sharedmods"
# to build the shared library files. If you are building a statically
# linked Python binary (the only solution of your platform doesn't
# support shared libraries, and sometimes handy if you want to
# distribute or install the resulting Python binary), run "make
# python".
# Note: Each time you edit Makefile.pre.in or Setup, you must run
# "make Makefile" before running "make".
# Hint: if you want to use VPATH, you can start in an empty
# subdirectory and say (e.g.):
# make -f ../Makefile.pre.in boot srcdir=.. VPATH=..
# === Bootstrap variables (edited through "make boot") ===
# The prefix used by "make inclinstall libainstall" of core python
installdir= /usr/local
# The exec_prefix used by the same
exec_installdir=$(installdir)
# Source directory and VPATH in case you want to use VPATH.
# (You will have to edit these two lines yourself -- there is no
# automatic support as the Makefile is not generated by
# config.status.)
srcdir= .
VPATH= .
# === Variables that you may want to customize (rarely) ===
# (Static) build target
TARGET= python
# Installed python binary (used only by boot target)
PYTHON?= python
# Add more -I and -D options here
CFLAGS= $(OPT) -I$(INCLUDEPY) -I$(EXECINCLUDEPY) $(DEFS)
# These two variables can be set in Setup to merge extensions.
# See example[23].
BASELIB=
BASESETUP=
# === Variables set by makesetup ===
MODOBJS= _MODOBJS_
MODLIBS= _MODLIBS_
# === Definitions added by makesetup ===
# === Variables from configure (through sedscript) ===
VERSION= @VERSION@
CC= @CC@
LINKCC= @LINKCC@
SGI_ABI= @SGI_ABI@
OPT= @OPT@
LDFLAGS= @LDFLAGS@
LDLAST= @LDLAST@
DEFS= @DEFS@
LIBS= @LIBS@
LIBM= @LIBM@
LIBC= @LIBC@
RANLIB= @RANLIB@
MACHDEP= @MACHDEP@
SO= @SO@
LDSHARED= @LDSHARED@
CCSHARED= @CCSHARED@
LINKFORSHARED= @LINKFORSHARED@
CXX= @CXX@
# Install prefix for architecture-independent files
prefix= /usr/local
# Install prefix for architecture-dependent files
exec_prefix= $(prefix)
# Uncomment the following two lines for AIX
#LINKCC= $(LIBPL)/makexp_aix $(LIBPL)/python.exp "" $(LIBRARY); $(PURIFY) $(CC)
#LDSHARED= $(LIBPL)/ld_so_aix $(CC) -bI:$(LIBPL)/python.exp
# === Fixed definitions ===
# Shell used by make (some versions default to the login shell, which is bad)
SHELL= /bin/sh
# Expanded directories
BINDIR= $(exec_installdir)/bin
LIBDIR= $(exec_prefix)/lib
MANDIR= $(installdir)/man
INCLUDEDIR= $(installdir)/include
SCRIPTDIR= $(prefix)/lib
# Detailed destination directories
BINLIBDEST= $(LIBDIR)/python$(VERSION)
LIBDEST= $(SCRIPTDIR)/python$(VERSION)
INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
EXECINCLUDEPY= $(exec_installdir)/include/python$(VERSION)
LIBP= $(exec_installdir)/lib/python$(VERSION)
DESTSHARED= $(BINLIBDEST)/site-packages
LIBPL= $(LIBP)/config
PYTHONLIBS= $(LIBPL)/libpython$(VERSION).a
MAKESETUP= $(LIBPL)/makesetup
MAKEFILE= $(LIBPL)/Makefile
CONFIGC= $(LIBPL)/config.c
CONFIGCIN= $(LIBPL)/config.c.in
SETUP= $(LIBPL)/Setup.config $(LIBPL)/Setup.local $(LIBPL)/Setup
SYSLIBS= $(LIBM) $(LIBC)
ADDOBJS= $(LIBPL)/python.o config.o
# Portable install script (configure doesn't always guess right)
INSTALL= $(LIBPL)/install-sh -c
# Shared libraries must be installed with executable mode on some systems;
# rather than figuring out exactly which, we always give them executable mode.
# Also, making them read-only seems to be a good idea...
INSTALL_SHARED= ${INSTALL} -m 555
# === Fixed rules ===
# Default target. This builds shared libraries only
default: sharedmods
# Build everything
all: static sharedmods
# Build shared libraries from our extension modules
sharedmods: $(SHAREDMODS)
# Build a static Python binary containing our extension modules
static: $(TARGET)
$(TARGET): $(ADDOBJS) lib.a $(PYTHONLIBS) Makefile $(BASELIB)
$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) \
$(ADDOBJS) lib.a $(PYTHONLIBS) \
$(LINKPATH) $(BASELIB) $(MODLIBS) $(LIBS) $(SYSLIBS) \
-o $(TARGET) $(LDLAST)
install: sharedmods
if test ! -d $(DESTSHARED) ; then \
mkdir $(DESTSHARED) ; else true ; fi
-for i in X $(SHAREDMODS); do \
if test $$i != X; \
then $(INSTALL_SHARED) $$i $(DESTSHARED)/$$i; \
fi; \
done
# Build the library containing our extension modules
lib.a: $(MODOBJS)
-rm -f lib.a
ar cr lib.a $(MODOBJS)
-$(RANLIB) lib.a
# This runs makesetup *twice* to use the BASESETUP definition from Setup
config.c Makefile: Makefile.pre Setup $(BASESETUP) $(MAKESETUP)
$(MAKESETUP) \
-m Makefile.pre -c $(CONFIGCIN) Setup -n $(BASESETUP) $(SETUP)
$(MAKE) -f Makefile do-it-again
# Internal target to run makesetup for the second time
do-it-again:
$(MAKESETUP) \
-m Makefile.pre -c $(CONFIGCIN) Setup -n $(BASESETUP) $(SETUP)
# Make config.o from the config.c created by makesetup
config.o: config.c
$(CC) $(CFLAGS) -c config.c
# Setup is copied from Setup.in *only* if it doesn't yet exist
Setup:
cp $(srcdir)/Setup.in Setup
# Make the intermediate Makefile.pre from Makefile.pre.in
Makefile.pre: Makefile.pre.in sedscript
sed -f sedscript $(srcdir)/Makefile.pre.in >Makefile.pre
# Shortcuts to make the sed arguments on one line
P=prefix
E=exec_prefix
H=Generated automatically from Makefile.pre.in by sedscript.
L=LINKFORSHARED
# Make the sed script used to create Makefile.pre from Makefile.pre.in
sedscript: $(MAKEFILE)
sed -n \
-e '1s/.*/1i\\/p' \
-e '2s%.*%# $H%p' \
-e '/^VERSION=/s/^VERSION=[ ]*\(.*\)/s%@VERSION[@]%\1%/p' \
-e '/^CC=/s/^CC=[ ]*\(.*\)/s%@CC[@]%\1%/p' \
-e '/^CXX=/s/^CXX=[ ]*\(.*\)/s%@CXX[@]%\1%/p' \
-e '/^LINKCC=/s/^LINKCC=[ ]*\(.*\)/s%@LINKCC[@]%\1%/p' \
-e '/^OPT=/s/^OPT=[ ]*\(.*\)/s%@OPT[@]%\1%/p' \
-e '/^LDFLAGS=/s/^LDFLAGS=[ ]*\(.*\)/s%@LDFLAGS[@]%\1%/p' \
-e '/^LDLAST=/s/^LDLAST=[ ]*\(.*\)/s%@LDLAST[@]%\1%/p' \
-e '/^DEFS=/s/^DEFS=[ ]*\(.*\)/s%@DEFS[@]%\1%/p' \
-e '/^LIBS=/s/^LIBS=[ ]*\(.*\)/s%@LIBS[@]%\1%/p' \
-e '/^LIBM=/s/^LIBM=[ ]*\(.*\)/s%@LIBM[@]%\1%/p' \
-e '/^LIBC=/s/^LIBC=[ ]*\(.*\)/s%@LIBC[@]%\1%/p' \
-e '/^RANLIB=/s/^RANLIB=[ ]*\(.*\)/s%@RANLIB[@]%\1%/p' \
-e '/^MACHDEP=/s/^MACHDEP=[ ]*\(.*\)/s%@MACHDEP[@]%\1%/p' \
-e '/^SO=/s/^SO=[ ]*\(.*\)/s%@SO[@]%\1%/p' \
-e '/^LDSHARED=/s/^LDSHARED=[ ]*\(.*\)/s%@LDSHARED[@]%\1%/p' \
-e '/^CCSHARED=/s/^CCSHARED=[ ]*\(.*\)/s%@CCSHARED[@]%\1%/p' \
-e '/^SGI_ABI=/s/^SGI_ABI=[ ]*\(.*\)/s%@SGI_ABI[@]%\1%/p' \
-e '/^$L=/s/^$L=[ ]*\(.*\)/s%@$L[@]%\1%/p' \
-e '/^$P=/s/^$P=\(.*\)/s%^$P=.*%$P=\1%/p' \
-e '/^$E=/s/^$E=\(.*\)/s%^$E=.*%$E=\1%/p' \
$(MAKEFILE) >sedscript
echo "/^installdir=/s%=.*%= $(installdir)%" >>sedscript
echo "/^exec_installdir=/s%=.*%=$(exec_installdir)%" >>sedscript
echo "/^srcdir=/s%=.*%= $(srcdir)%" >>sedscript
echo "/^VPATH=/s%=.*%= $(VPATH)%" >>sedscript
echo "/^LINKPATH=/s%=.*%= $(LINKPATH)%" >>sedscript
echo "/^BASELIB=/s%=.*%= $(BASELIB)%" >>sedscript
echo "/^BASESETUP=/s%=.*%= $(BASESETUP)%" >>sedscript
# Bootstrap target
boot: clobber
VERSION=`$(PYTHON) -c "import sys; print sys.version[:3]"`; \
installdir=`$(PYTHON) -c "import sys; print sys.prefix"`; \
exec_installdir=`$(PYTHON) -c "import sys; print sys.exec_prefix"`; \
$(MAKE) -f $(srcdir)/Makefile.pre.in VPATH=$(VPATH) srcdir=$(srcdir) \
VERSION=$$VERSION \
installdir=$$installdir \
exec_installdir=$$exec_installdir \
Makefile
# Handy target to remove intermediate files and backups
clean:
-rm -f *.o *~
# Handy target to remove everything that is easily regenerated
clobber: clean
-rm -f *.a tags TAGS config.c Makefile.pre $(TARGET) sedscript
-rm -f *.so *.sl so_locations
# Handy target to remove everything you don't want to distribute
distclean: clobber
-rm -f Makefile Setup

View File

@ -1,11 +0,0 @@
--- Makefile.in.orig Wed May 23 09:11:33 2001
+++ Makefile.in Wed May 23 09:12:10 2001
@@ -26,6 +26,8 @@
$(INSTALL_DIR) $(DESTDIR)$(LIBDEST)/site-packages/python-ldap
$(INSTALL_DATA) $(srcdir)/Misc/ldap.pth \
$(DESTDIR)$(LIBDEST)/site-packages/ldap.pth
+ $(INSTALL_DATA) $(srcdir)/Modules/_ldapmodule.so \
+ $(DESTDIR)$(LIBDEST)/site-packages/_ldapmodule.so
for f in $(srcdir)/Lib/*.py; do \
$(INSTALL_DATA) $$f $(DESTDIR)$(LIBDEST)/site-packages/python-ldap/;\
done

View File

@ -1,156 +0,0 @@
--- Modules/constants.c.orig Sun Aug 13 16:00:59 2000
+++ Modules/constants.c Mon Nov 6 11:02:43 2000
@@ -66,7 +66,6 @@
add_int(d,VERSION1);
add_int(d,VERSION2);
add_int(d,VERSION);
- add_int(d,MAX_ATTR_LEN);
add_int(d,TAG_MESSAGE);
add_int(d,TAG_MSGID);
@@ -79,9 +78,27 @@
add_int(d,REQ_MODRDN);
add_int(d,REQ_COMPARE);
add_int(d,REQ_ABANDON);
+
+#if defined(LDAP_API_VERSION)
+ /* OpenLDAPv2 */
+ add_int(d,VERSION3);
+ add_int(d,VERSION_MIN);
+ add_int(d,VERSION_MAX);
+ add_int(d,TAG_LDAPDN);
+ add_int(d,TAG_LDAPCRED);
+ add_int(d,TAG_CONTROLS);
+ add_int(d,TAG_REFERRAL);
+
+ add_int(d,REQ_MODDN);
+ add_int(d,REQ_RENAME);
+#else
+ /* OpenLDAPv1 */
+ add_int(d,MAX_ATTR_LEN);
+
add_int(d,REQ_UNBIND_30);
add_int(d,REQ_DELETE_30);
add_int(d,REQ_ABANDON_30);
+#endif
/* reversibles */
@@ -89,6 +106,14 @@
PyDict_SetItem( reverse, zero, Py_None );
Py_DECREF( zero );
+#if defined(LDAP_API_VERSION)
+ /* OpenLDAPv2 */
+ add_int_r(d,RES_SEARCH_REFERENCE);
+ add_int_r(d,RES_MODDN); /* Aliases for RES_MODRDN; */
+ add_int_r(d,RES_RENAME); /* init them before the main name */
+ add_int(d,RES_UNSOLICITED);
+#endif
+
add_int_r(d,RES_BIND);
add_int_r(d,RES_SEARCH_ENTRY);
add_int_r(d,RES_SEARCH_RESULT);
@@ -106,9 +131,6 @@
add_int(d,AUTH_KRBV4);
add_int(d,AUTH_KRBV41);
add_int(d,AUTH_KRBV42);
- add_int(d,AUTH_SIMPLE_30);
- add_int(d,AUTH_KRBV41_30);
- add_int(d,AUTH_KRBV42_30);
add_int(d,FILTER_AND);
add_int(d,FILTER_OR);
add_int(d,FILTER_NOT);
@@ -118,13 +140,9 @@
add_int(d,FILTER_LE);
add_int(d,FILTER_PRESENT);
add_int(d,FILTER_APPROX);
- add_int(d,FILTER_PRESENT_30);
add_int(d,SUBSTRING_INITIAL);
add_int(d,SUBSTRING_ANY);
add_int(d,SUBSTRING_FINAL);
- add_int(d,SUBSTRING_INITIAL_30);
- add_int(d,SUBSTRING_ANY_30);
- add_int(d,SUBSTRING_FINAL_30);
add_int(d,SCOPE_BASE);
add_int(d,SCOPE_ONELEVEL);
add_int(d,SCOPE_SUBTREE);
@@ -133,6 +151,16 @@
add_int(d,MOD_REPLACE);
add_int(d,MOD_BVALUES);
+#if !defined(LDAP_API_VERSION)
+ /* OpenLDAPv1 */
+ add_int(d,AUTH_SIMPLE_30);
+ add_int(d,AUTH_KRBV41_30);
+ add_int(d,AUTH_KRBV42_30);
+ add_int(d,FILTER_PRESENT_30);
+ add_int(d,SUBSTRING_INITIAL_30);
+ add_int(d,SUBSTRING_ANY_30);
+ add_int(d,SUBSTRING_FINAL_30);
+
/* (errors.c contains the error constants) */
add_int(d,DEFAULT_REFHOPLIMIT);
@@ -145,15 +173,36 @@
#ifdef LDAP_CACHE_OPT_CACHEALLERRS
add_int(d,CACHE_OPT_CACHEALLERRS);
#endif
+
+#endif /* !defined(LDAP_API_VERSION) */
add_int(d,FILT_MAXSIZ);
add_int(d,DEREF_NEVER);
add_int(d,DEREF_SEARCHING);
add_int(d,DEREF_FINDING);
add_int(d,DEREF_ALWAYS);
add_int(d,NO_LIMIT);
+#if defined(LDAP_API_VERSION)
+ /* OpenLDAPv2 */
+ add_int(d,OPT_API_INFO);
+ add_int(d,OPT_DESC);
+ add_int(d,OPT_DEREF);
+ add_int(d,OPT_SIZELIMIT);
+ add_int(d,OPT_TIMELIMIT);
+ add_int(d,OPT_PROTOCOL_VERSION);
+ add_int(d,OPT_SERVER_CONTROLS);
+ add_int(d,OPT_CLIENT_CONTROLS);
+ add_int(d,OPT_API_FEATURE_INFO);
+ add_int(d,OPT_HOST_NAME);
+ add_int(d,OPT_ERROR_NUMBER);
+ add_int(d,OPT_ERROR_STRING);
+ add_int(d,OPT_MATCHED_DN);
+ add_int(d,OPT_PRIVATE_EXTENSION_BASE);
+#else
+ /* OpenLDAPv1 */
#ifdef LDAP_OPT_DNS
add_int(d,OPT_DNS);
#endif
+#endif /* defined(LDAP_API_VERSION) */
#ifdef LDAP_OPT_REFERRALS
add_int(d,OPT_REFERRALS);
#endif
@@ -161,9 +210,24 @@
/* XXX - these belong in errors.c */
+#if defined(LDAP_API_VERSION)
+ /* OpenLDAPv2 */
+ add_int(d,URL_SUCCESS);
+ add_int(d,URL_ERR_PARAM);
+ add_int(d,URL_ERR_BADSCHEME);
+ add_int(d,URL_ERR_BADENCLOSURE);
+ add_int(d,URL_ERR_BADURL);
+ add_int(d,URL_ERR_BADHOST);
+ add_int(d,URL_ERR_BADATTRS);
+ add_int(d,URL_ERR_BADSCOPE);
+ add_int(d,URL_ERR_BADFILTER);
+ add_int(d,URL_ERR_BADEXTS);
+#else
+ /* OpenLDAPv1 */
add_int(d,URL_ERR_NOTLDAP);
add_int(d,URL_ERR_NODN);
add_int(d,URL_ERR_BADSCOPE);
+#endif /* defined(LDAP_API_VERSION) */
add_int(d,URL_ERR_MEM);
/* author */

View File

@ -1,115 +0,0 @@
--- Modules/errors.c.orig Wed Nov 15 10:41:35 2000
+++ Modules/errors.c Wed Nov 15 14:17:15 2000
@@ -17,7 +17,13 @@
/* list of error objects */
+#if defined(LDAP_API_VERSION)
+/* OpenLDAPv2 */
+#define NUM_LDAP_ERRORS LDAP_REFERRAL_LIMIT_EXCEEDED+1
+#else
+/* OpenLDAPv1 */
#define NUM_LDAP_ERRORS LDAP_NO_MEMORY+1
+#endif
static PyObject*
errobjects[ NUM_LDAP_ERRORS ];
@@ -30,21 +36,26 @@
PyErr_SetFromErrno( LDAPexception_class );
return NULL;
}
-#ifdef LDAP_TYPE_IS_OPAQUE
+#if defined(LDAP_TYPE_IS_OPAQUE) && !defined(LDAP_API_VERSION)
else {
PyErr_SetString(LDAPexception_class,
"unknown error (C API does not expose error)");
return NULL;
}
-#else
+#else /* defined(LDAP_TYPE_IS_OPAQUE) && !defined(LDAP_API_VERSION) */
else {
int errnum;
PyObject *errobj;
PyObject *info;
PyObject *str;
+#if defined(LDAP_API_VERSION)
+ char *matched, *error;
+ if (ldap_get_option(l, LDAP_OPT_ERROR_NUMBER, &errnum) < 0)
+#else
errnum = l->ld_errno;
if (errnum<0 || errnum>=NUM_LDAP_ERRORS)
+#endif /* defined(LDAP_API_VERSION) */
errobj = LDAPexception_class; /* unknown error XXX */
else
errobj = errobjects[errnum];
@@ -61,6 +72,35 @@
PyDict_SetItemString( info, "desc", str );
Py_XDECREF(str);
+#if defined(LDAP_API_VERSION)
+ if (ldap_get_option(l, LDAP_OPT_MATCHED_DN, &matched) >= 0
+ && matched != NULL) {
+ if (*matched != '\0') {
+ str = PyString_FromString(matched);
+ if (str)
+ PyDict_SetItemString( info, "matched", str );
+ Py_XDECREF(str);
+ }
+ ldap_memfree(matched);
+ }
+
+ if (errnum == LDAP_REFERRAL) {
+ str = PyString_FromString(msg);
+ if (str)
+ PyDict_SetItemString( info, "info", str );
+ Py_XDECREF(str);
+ } else if (ldap_get_option(l, LDAP_OPT_ERROR_STRING, &error) >= 0
+ && error != NULL) {
+ if (error != '\0') {
+ str = PyString_FromString(error);
+ if (str)
+ PyDict_SetItemString( info, "info", str );
+ Py_XDECREF(str);
+ }
+ ldap_memfree(error);
+ }
+
+#else /* defined(LDAP_API_VERSION) */
if (l->ld_matched != NULL && *l->ld_matched != '\0')
{
str = PyString_FromString(l->ld_matched);
@@ -76,11 +116,12 @@
PyDict_SetItemString( info, "info", str );
Py_XDECREF(str);
}
+#endif /* defined(LDAP_API_VERSION) */
PyErr_SetObject( errobj, info );
Py_DECREF(info);
return NULL;
}
-#endif
+#endif /* defined(LDAP_TYPE_IS_OPAQUE) && !defined(LDAP_API_VERSION) */
}
@@ -163,4 +204,19 @@
seterrobj(USER_CANCELLED);
seterrobj(PARAM_ERROR);
seterrobj(NO_MEMORY);
+#if defined(LDAP_API_VERSION)
+ seterrobj(REFERRAL);
+ seterrobj(ADMINLIMIT_EXCEEDED);
+ seterrobj(UNAVAILABLE_CRITICAL_EXTENSION);
+ seterrobj(CONFIDENTIALITY_REQUIRED);
+ seterrobj(SASL_BIND_IN_PROGRESS);
+ seterrobj(AFFECTS_MULTIPLE_DSAS);
+ seterrobj(CONNECT_ERROR);
+ seterrobj(NOT_SUPPORTED);
+ seterrobj(CONTROL_NOT_FOUND);
+ seterrobj(NO_RESULTS_RETURNED);
+ seterrobj(MORE_RESULTS_TO_RETURN);
+ seterrobj(CLIENT_LOOP);
+ seterrobj(REFERRAL_LIMIT_EXCEEDED);
+#endif
}

View File

@ -1,43 +0,0 @@
--- Modules/message.c.orig Wed Nov 15 10:41:35 2000
+++ Modules/message.c Wed Nov 15 16:51:18 2000
@@ -114,6 +114,40 @@
PyList_Append(result, entrytuple);
Py_DECREF(entrytuple);
}
+#if defined(LDAP_API_VERSION)
+ for(entry = ldap_first_reference(ld,m);
+ entry != NULL;
+ entry = ldap_next_reference(ld,entry))
+ {
+ char **refs = NULL;
+ PyObject* entrytuple;
+ PyObject* reflist = PyList_New(0);
+
+ if (reflist == NULL) {
+ Py_DECREF(result);
+ ldap_msgfree( m );
+ return NULL;
+ }
+ if (ldap_parse_reference(ld, entry, &refs, NULL, 0) != LDAP_SUCCESS) {
+ Py_DECREF(result);
+ ldap_msgfree( m );
+ return LDAPerror( ld, "ldap_parse_reference" );
+ }
+ if (refs) {
+ int i;
+ for (i=0; refs[i] != NULL; i++) {
+ PyObject *refstr = PyString_FromString(refs[i]);
+ PyList_Append(reflist, refstr);
+ Py_DECREF(refstr);
+ }
+ ber_memvfree( (void **) refs );
+ }
+ entrytuple = Py_BuildValue("(sO)", NULL, reflist);
+ Py_DECREF(reflist);
+ PyList_Append(result, entrytuple);
+ Py_DECREF(entrytuple);
+ }
+#endif
ldap_msgfree( m );
return result;
}

View File

@ -1 +1 @@
An LDAP module for python
An LDAP module for python, for OpenLDAP2

View File

@ -1,12 +1,16 @@
lib/%%PYTHON_VERSION%%/site-packages/python-ldap/ldap.py
lib/%%PYTHON_VERSION%%/site-packages/python-ldap/ldap.pyc
lib/%%PYTHON_VERSION%%/site-packages/python-ldap/ldap.pyo
lib/%%PYTHON_VERSION%%/site-packages/python-ldap/ldif.py
lib/%%PYTHON_VERSION%%/site-packages/python-ldap/ldif.pyc
lib/%%PYTHON_VERSION%%/site-packages/python-ldap/ldif.pyo
lib/%%PYTHON_VERSION%%/site-packages/python-ldap/perldap.py
lib/%%PYTHON_VERSION%%/site-packages/python-ldap/perldap.pyc
lib/%%PYTHON_VERSION%%/site-packages/python-ldap/perldap.pyo
lib/%%PYTHON_VERSION%%/site-packages/_ldapmodule.so
lib/%%PYTHON_VERSION%%/site-packages/ldap.pth
@dirrm lib/%%PYTHON_VERSION%%/site-packages/python-ldap
lib/%%PYTHON_VERSION%%/site-packages/ldap/__init__.py
lib/%%PYTHON_VERSION%%/site-packages/ldap/__init__.pyc
lib/%%PYTHON_VERSION%%/site-packages/ldap/async.py
lib/%%PYTHON_VERSION%%/site-packages/ldap/async.pyc
lib/%%PYTHON_VERSION%%/site-packages/ldap/functions.py
lib/%%PYTHON_VERSION%%/site-packages/ldap/functions.pyc
lib/%%PYTHON_VERSION%%/site-packages/ldap/ldapobject.py
lib/%%PYTHON_VERSION%%/site-packages/ldap/ldapobject.pyc
lib/%%PYTHON_VERSION%%/site-packages/ldap/modlist.py
lib/%%PYTHON_VERSION%%/site-packages/ldap/modlist.pyc
lib/%%PYTHON_VERSION%%/site-packages/ldapurl.py
lib/%%PYTHON_VERSION%%/site-packages/ldapurl.pyc
lib/%%PYTHON_VERSION%%/site-packages/ldif.py
lib/%%PYTHON_VERSION%%/site-packages/ldif.pyc
lib/%%PYTHON_VERSION%%/site-packages/_ldap.so
@dirrm lib/%%PYTHON_VERSION%%/site-packages/ldap