From avinash at sultanpur.org Tue Oct 6 13:22:28 2009 From: avinash at sultanpur.org (Avinash Sultanpur) Date: Tue, 06 Oct 2009 16:52:28 +0530 Subject: Changing password as administrator Message-ID: <4ACB2874.8070105@sultanpur.org> Hi, What is the equivalent of running the below command in python-ldap? ldappasswd -x -D -w -s secret_password \ uid=user000,ou=People,dc=example,dc=com Thus far I had been manipulating the userPassword attribute with the encrypted password. Now I would like to send the plain password to the server so that it can do the encryption according to the password-hash configuration in slapd.conf. -thanks Avinash From michael at stroeder.com Tue Oct 6 14:17:40 2009 From: michael at stroeder.com (=?ISO-8859-1?Q?Michael_Str=F6der?=) Date: Tue, 06 Oct 2009 14:17:40 +0200 Subject: Changing password as administrator In-Reply-To: <4ACB2874.8070105@sultanpur.org> References: <4ACB2874.8070105@sultanpur.org> Message-ID: <4ACB3564.1040901@stroeder.com> Avinash Sultanpur wrote: > > What is the equivalent of running the below command in python-ldap? > > ldappasswd -x -D -w -s secret_password \ > uid=user000,ou=People,dc=example,dc=com ldap_conn = ldap.initialize(...) ldap_conn.simple_bind_s(','') ldap_conn.passwd_s('uid=user000,ou=People,dc=example,dc=com',None,'') Ciao, Michael. From avinash at sultanpur.org Tue Oct 6 14:23:02 2009 From: avinash at sultanpur.org (Avinash Sultanpur) Date: Tue, 06 Oct 2009 17:53:02 +0530 Subject: Changing password as administrator In-Reply-To: <4ACB3564.1040901@stroeder.com> References: <4ACB2874.8070105@sultanpur.org> <4ACB3564.1040901@stroeder.com> Message-ID: <4ACB36A6.3030401@sultanpur.org> Michael Str?der wrote: > Avinash Sultanpur wrote: > >> What is the equivalent of running the below command in python-ldap? >> >> ldappasswd -x -D -w -s secret_password \ >> uid=user000,ou=People,dc=example,dc=com >> > > ldap_conn = ldap.initialize(...) > ldap_conn.simple_bind_s(','') > ldap_conn.passwd_s('uid=user000,ou=People,dc=example,dc=com',None,'') > Thanks Michael. I didn't realize I could use 'None' for the old password! -Avinash From michael at stroeder.com Wed Oct 7 16:01:53 2009 From: michael at stroeder.com (=?ISO-8859-1?Q?Michael_Str=F6der?=) Date: Wed, 07 Oct 2009 16:01:53 +0200 Subject: python-ldap on CIFS In-Reply-To: <4ACC94C5.2080306@safersignup.com> References: <4ACC94C5.2080306@safersignup.com> Message-ID: <4ACC9F51.9080302@stroeder.com> phobie wrote: > C:\> \\somehost\someshare\python2.6\python.exe >>>> import ldap > Traceback (most recent call last): > File "", line 1, in > File > "\\somehost\someshare\python2.6\lib\site-packages\python_ldap-2.3.8-py2.6-win32.egg\ldap\__init__ > .py", line 22, in > from _ldap import * > ImportError: DLL load failed: The specified module could not be found. Try -v to get more output: \\somehost\someshare\python2.6\python.exe -v -c "import ldap" I'm not too familiar with using Python under Windows. I suspect that there might also be some registry settings for setting the lib path. Ciao, Michael. From sflists.phobie at safersignup.com Wed Oct 7 15:16:53 2009 From: sflists.phobie at safersignup.com (phobie) Date: Wed, 07 Oct 2009 15:16:53 +0200 Subject: python-ldap on CIFS Message-ID: <4ACC94C5.2080306@safersignup.com> I am trying to use Python with python-ldap on a CIFS share. While Python works fine the import of ldap fails. Installed Active Python 2.6.2.2. Copied the Python dir to the share. Copied python26.dll pythoncom26.dll pywintypes26.dll to the new Python dir. Uninstalled the local Python! C:\> \\somehost\someshare\python2.6\python.exe ActivePython 2.6.2.2 (ActiveState Software Inc.) based on Python 2.6.2 (r262:71600, Apr 21 2009, 15:05:37) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.path.insert(0,) >>> from setuptools.command.easy_install import main >>> main(['setuptools-0.6c9-py2.6.egg']) >>> main(['python_ldap-2.3.8-py2.6-win32.egg']) Everything installed fine but "import ldap" fails! C:\> \\somehost\someshare\python2.6\python.exe >>> import ldap Traceback (most recent call last): File "", line 1, in File "\\somehost\someshare\python2.6\lib\site-packages\python_ldap-2.3.8-py2.6-win32.egg\ldap\__init__ .py", line 22, in from _ldap import * ImportError: DLL load failed: The specified module could not be found. >>> import sys >>> sys.path[2] '\\\\somehost\someshare\\python2.6\\lib\\site-packages\\python_ldap-2.3.8-py2.6-win32.egg' >>> import os >>> os.listdir(sys.path[2]) ['dsml.py', 'dsml.pyc', 'dsml.pyo', 'EGG-INFO', 'ldap', 'ldapurl.py', 'ldapurl.pyc', 'ldapurl.pyo', 'ldif.py', 'ldif.pyc ', 'ldif.pyo', '_ldap.py', '_ldap.pyc', '_ldap.pyd', '_ldap.pyo'] Actually it does not matter if the python2.6 dir is on a CIFS-share or on some other dir like D:\python2.6\. How to fix that Problem? Regards, Per From sflists.phobie at safersignup.com Wed Oct 7 17:10:13 2009 From: sflists.phobie at safersignup.com (phobie) Date: Wed, 07 Oct 2009 17:10:13 +0200 Subject: python-ldap on CIFS In-Reply-To: <4ACC9F51.9080302@stroeder.com> References: <4ACC94C5.2080306@safersignup.com> <4ACC9F51.9080302@stroeder.com> Message-ID: <4ACCAF55.60505@safersignup.com> Michael Str?der schrieb: > \\somehost\someshare\python2.6\python.exe -v -c "import ldap" File attached! (converted to utf-8 and translated to english) > I'm not too familiar with using Python under Windows. I suspect that there > might also be some registry settings for setting the lib path. It's a bit suspicious because other c-modules like win32api, sqlite3 or ssl import flawlessly. Greets Per -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: import_ldap_log2.txt URL: From michael at stroeder.com Wed Oct 7 17:16:05 2009 From: michael at stroeder.com (=?ISO-8859-1?Q?Michael_Str=F6der?=) Date: Wed, 07 Oct 2009 17:16:05 +0200 Subject: python-ldap on CIFS In-Reply-To: <4ACCAF55.60505@safersignup.com> References: <4ACC94C5.2080306@safersignup.com> <4ACC9F51.9080302@stroeder.com> <4ACCAF55.60505@safersignup.com> Message-ID: <4ACCB0B5.7010208@stroeder.com> phobie wrote: > Michael Str?der schrieb: >> \\somehost\someshare\python2.6\python.exe -v -c "import ldap" > > File attached! > (converted to utf-8 and translated to english) Which Win32 build of python-ldap are you using? It seems it requests a separate DLL. Ciao, Michael. From sflists.phobie at safersignup.com Wed Oct 7 17:26:08 2009 From: sflists.phobie at safersignup.com (phobie) Date: Wed, 07 Oct 2009 17:26:08 +0200 Subject: python-ldap on CIFS In-Reply-To: <4ACCB0B5.7010208@stroeder.com> References: <4ACC94C5.2080306@safersignup.com> <4ACC9F51.9080302@stroeder.com> <4ACCAF55.60505@safersignup.com> <4ACCB0B5.7010208@stroeder.com> Message-ID: <4ACCB310.4050801@safersignup.com> Michael Str?der wrote: > Which Win32 build of python-ldap are you using? It seems it requests a > separate DLL. I wrote "main(['python_ldap-2.3.8-py2.6-win32.egg'])" in my first mail. Got that file from http://svn.kmrc.de/download/distribution/contrib/python_ldap-2.3.8-py2.6-win32.egg . (The .egg builds linked from http://python-ldap.org/download.shtml .) The pypi exe-installers does not seem to have a silent install option... Per From waldemar.osuch at gmail.com Wed Oct 7 18:41:20 2009 From: waldemar.osuch at gmail.com (Waldemar Osuch) Date: Wed, 7 Oct 2009 10:41:20 -0600 Subject: python-ldap on CIFS In-Reply-To: <4ACCB310.4050801@safersignup.com> References: <4ACC94C5.2080306@safersignup.com> <4ACC9F51.9080302@stroeder.com> <4ACCAF55.60505@safersignup.com> <4ACCB0B5.7010208@stroeder.com> <4ACCB310.4050801@safersignup.com> Message-ID: <6fae95540910070941k5fa06617xba04e3d03593276d@mail.gmail.com> 2009/10/7 phobie : > Michael Str?der wrote: >> Which Win32 build of python-ldap are you using? It seems it requests a >> separate DLL. > > I wrote "main(['python_ldap-2.3.8-py2.6-win32.egg'])" in my first mail. > The pypi exe-installers does not seem to have a silent install option... > If you insists on silent option and do not depend on ldap.sasl try the MSI installer with /q option. http://www.osuch.org/python-ldap-2.3.9.win32-py2.6.msi From michael at stroeder.com Thu Oct 8 20:27:21 2009 From: michael at stroeder.com (=?ISO-8859-1?Q?Michael_Str=F6der?=) Date: Thu, 08 Oct 2009 20:27:21 +0200 Subject: l_ldap_result3(): controls are now parsed for all response types (SF#2829057) Message-ID: <4ACE2F09.7050605@stroeder.com> HI! Please test the following change in CVS HEAD with your code which makes use of controls received in LDAP responses. My short test was with Demo/page_control.py which seems to work. http://python-ldap.cvs.sourceforge.net/viewvc/python-ldap/python-ldap/Modules/LDAPObject.c?r1=1.87&r2=1.88 I have no clue why the removed if-statement was there at all. See also the tracker entry with the feature request: Support for reading controls sent with LDAP_RES_SEARCH_ENTRY - ID: 2829057 http://sourceforge.net/tracker/?func=detail&aid=2829057&group_id=2072&atid=352072 Ciao, Michael. From michael at stroeder.com Thu Oct 8 20:39:48 2009 From: michael at stroeder.com (=?ISO-8859-1?Q?Michael_Str=F6der?=) Date: Thu, 08 Oct 2009 20:39:48 +0200 Subject: Preparing release 2.3.10, please test! Message-ID: <4ACE31F4.2070601@stroeder.com> HI! There are some fixes waiting to be released as version 2.3.10. See current CHANGES: http://python-ldap.cvs.sourceforge.net/viewvc/python-ldap/python-ldap/CHANGES So please test current CVS HEAD on various platforms. Ciao, Michael. From michael at stroeder.com Tue Oct 13 08:53:05 2009 From: michael at stroeder.com (=?ISO-8859-1?Q?Michael_Str=F6der?=) Date: Tue, 13 Oct 2009 08:53:05 +0200 Subject: Python ldap and syncrepl controls In-Reply-To: References: Message-ID: <4AD423D1.7080708@stroeder.com> Sean Burford wrote: > > I've been working on implementing an RFC 4533 syncrepl consumer using > python-ldap. I can't work out why I can't get the SyncDoneControl that > is returned with the LDAP_RES_SEARCH_RESULT through python-ldap. Sean, could you please re-try with current python-ldap CVS HEAD. I've checked in a change --------------------------- snip --------------------------- * l_ldap_result3(): controls are now parsed for all response types (SF#2829057) --------------------------- snip --------------------------- Ciao, Michael. From michael at stroeder.com Fri Oct 16 12:48:57 2009 From: michael at stroeder.com (=?ISO-8859-1?Q?Michael_Str=F6der?=) Date: Fri, 16 Oct 2009 12:48:57 +0200 Subject: Preparing release 2.3.10, please test! In-Reply-To: <4ACE31F4.2070601@stroeder.com> References: <4ACE31F4.2070601@stroeder.com> Message-ID: <4AD84F99.8010901@stroeder.com> Michael Str?der wrote: > There are some fixes waiting to be released as version 2.3.10. > > See current CHANGES: > http://python-ldap.cvs.sourceforge.net/viewvc/python-ldap/python-ldap/CHANGES > > So please test current CVS HEAD on various platforms. Did anybody here test anything? Ciao, Michael. From pakraticus at gmail.com Thu Oct 22 18:29:08 2009 From: pakraticus at gmail.com (Chris Dukes) Date: Thu, 22 Oct 2009 12:29:08 -0400 Subject: Preparing release 2.3.10, please test! Message-ID: <89732f340910220929k75033d56m1a1b558b738ac785@mail.gmail.com> Michael, I went to check my patch to provide msgid in a result exception against 2.3.10. I have found a problem on constants.c gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DHAVE_LIBLDAP_R -DHAVE_SASL -DHAVE_TLS -DLDAPMODULE_VERSION=2.3.10 -IModules -I/usr/local/openldap-2.3/include -I/usr/include/sasl -I/usr/include/python2.5 -c Modules/constants.c -o build/temp.linux-i686-2.5/Modules/constants.o Modules/constants.c: In function ?LDAPinit_constants?: Modules/constants.c:185: error: ?LDAP_OPT_X_TLS_PROTOCOL_MIN? undeclared (first use in this function) Modules/constants.c:185: error: (Each undeclared identifier is reported only once Modules/constants.c:185: error: for each function it appears in.) error: command 'gcc' failed with exit status 1 This error is repeatable with a pristine checkout before I applied my patch. This #define is not present in libldap2-dev 2.4.9-0ubuntu0 (Which ships with Ubuntu Hardy), but is present in libldap2-dev 2.4.17-2 (Debian Sid). I am currently disinclined to update libldap2 until a new ubuntu LTS is released, but I do make use of python-virtualenv when I need a python environment that is newer than the one that ships with ubuntu Hardy. Thanks, Chris Dukes -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at stroeder.com Thu Oct 22 19:16:32 2009 From: michael at stroeder.com (=?windows-1252?Q?Michael_Str=F6der?=) Date: Thu, 22 Oct 2009 19:16:32 +0200 Subject: Preparing release 2.3.10, please test! In-Reply-To: <89732f340910220929k75033d56m1a1b558b738ac785@mail.gmail.com> References: <89732f340910220929k75033d56m1a1b558b738ac785@mail.gmail.com> Message-ID: <4AE09370.7010907@stroeder.com> Chris Dukes wrote: > > I went to check my patch to provide msgid in a result exception against > 2.3.10. > I have found a problem on constants.c > [..] > Modules/constants.c:185: error: ?LDAP_OPT_X_TLS_PROTOCOL_MIN? undeclared > (first use in this function) Should be #ifdef LDAP_OPT_X_TLS_PROTOCOL_MIN add_int(d,OPT_X_TLS_PROTOCOL_MIN); #endif Will committ the patch later. Thanks for testing! Ciao, Michael. From michael at stroeder.com Fri Oct 23 11:10:18 2009 From: michael at stroeder.com (=?ISO-8859-1?Q?Michael_Str=F6der?=) Date: Fri, 23 Oct 2009 11:10:18 +0200 Subject: Preparing release 2.3.10, please test! In-Reply-To: <89732f340910221013m13de5d96n4efa33caba9e20dc@mail.gmail.com> References: <89732f340910221013m13de5d96n4efa33caba9e20dc@mail.gmail.com> Message-ID: <4AE172FA.9070701@stroeder.com> Chris Dukes wrote: > The following patch allows the LDAP_OPT_X_TLS_PROTOCOL_MIN to work with > libldap2-dev 2.4.9-0ubuntu0 Thanks. I've committed this patch in HEAD. Please test. Ciao, Michael. From pakraticus at gmail.com Thu Oct 22 16:08:21 2009 From: pakraticus at gmail.com (Chris Dukes) Date: Thu, 22 Oct 2009 10:08:21 -0400 Subject: Add msgid to info dict created by LDAPerror. Message-ID: <89732f340910220708y4e9fa6c9gc8151de4b58fc6d9@mail.gmail.com> While rewriting a nasty perl LDAP sync program in python I encountered one quirk with python-ldap that made my life a bit difficult. When doing asynchronous searches an ldap exception in result3() doesn't include 'msgid' in the info dict. Since I'm tracking pending work by the msgid of the search, having the msgid in the exception is very useful for removing work items. Here is a patch to the 'C' code of python-ldap to provide msgid. Thanks, Chris Dukes -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: LDAPerror_msgid.diff Type: text/x-diff Size: 10150 bytes Desc: not available URL: From michael at stroeder.com Fri Oct 23 11:22:58 2009 From: michael at stroeder.com (=?ISO-8859-1?Q?Michael_Str=F6der?=) Date: Fri, 23 Oct 2009 11:22:58 +0200 Subject: Add msgid to info dict created by LDAPerror. In-Reply-To: <89732f340910220708y4e9fa6c9gc8151de4b58fc6d9@mail.gmail.com> References: <89732f340910220708y4e9fa6c9gc8151de4b58fc6d9@mail.gmail.com> Message-ID: <4AE175F2.5000303@stroeder.com> Chris Dukes wrote: > While rewriting a nasty perl LDAP sync program in python I encountered > one quirk with python-ldap that made my life a bit difficult. When > doing asynchronous searches an ldap exception in result3() doesn't > include 'msgid' in the info dict. Since I'm tracking pending work by > the msgid of the search, having the msgid in the exception is very > useful for removing work items. This is only useful if you sent several LDAP operations with asynchronous methods and then poll *all* results with LDAPObject.result3(msgid=-1). This is a very special use-case. I'd be curious to see some code illustrating this *before* applying your patch. BTW: I still have an idea to eliminate all the thread-locking in LDAPObject by serializing all calls into _ldap module within the wrapper class. For this your patch could be useful. Still I think about some implications of this approach (polling results is CPU intensive, how is invoking result triggered without the need for a separate thread). So again your client code could be an useful inspiration for this. Ciao, Michael. From zhbmaillistonly at gmail.com Wed Nov 4 14:13:51 2009 From: zhbmaillistonly at gmail.com (Zhang Huangbin) Date: Wed, 4 Nov 2009 21:13:51 +0800 Subject: Compile error on RHEL 5.3 (x86_64), python-ldap-2.3.10 Message-ID: <0B709828-0F0F-4F77-84AF-DD4AAEC68545@gmail.com> Hi, list. I got below compile error on Red Hat Enterprise Linux 5.3 (x86_64) with python-ldap-2.3.10, but 2.3.8 was compiled and installed success. What's wrong with it? ---- # easy_install python-ldap==2.3.10 Searching for python-ldap==2.3.10 Reading http://cheeseshop.python.org/pypi/python-ldap/ Reading http://cheeseshop.python.org/pypi/python-ldap/2.3.8 Reading http://www.python-ldap.org/ Reading http://cheeseshop.python.org/pypi/python-ldap/2.3.10 Best match: python-ldap 2.3.10 Downloading http://pypi.python.org/packages/source/p/python-ldap/python-ldap-2.3.10.tar.gz#md5=564d741a7c6d5fdcb45322fe9262d1a5 Processing python-ldap-2.3.10.tar.gz Running python-ldap-2.3.10/setup.py -q bdist_egg --dist-dir /tmp/ easy_install-H9lpqP/python-ldap-2.3.10/egg-dist-tmp-qxCHzX extra_compile_args: extra_objects: include_dirs: /usr/local/openldap-2.3/include /usr/include/sasl library_dirs: /usr/local/openldap-2.3/lib libs: ldap_r lber sasl2 ssl crypto file Lib/ldap.py (for module ldap) not found file Lib/ldap/schema.py (for module ldap.schema) not found warning: no files found matching 'Makefile' warning: no files found matching 'Modules/LICENSE' file Lib/ldap.py (for module ldap) not found file Lib/ldap/schema.py (for module ldap.schema) not found file Lib/ldap.py (for module ldap) not found file Lib/ldap/schema.py (for module ldap.schema) not found Modules/constants.c: In function ?LDAPinit_constants?: Modules/constants.c:184: error: ?LDAP_OPT_X_TLS_NEWCTX? undeclared (first use in this function) Modules/constants.c:184: error: (Each undeclared identifier is reported only once Modules/constants.c:184: error: for each function it appears in.) error: Setup script exited with error: command 'gcc' failed with exit status 1 ---- -- Best Regards. Zhang Huangbin - Open Source Mail Server Solution for Red Hat(R) Enterprise Linux, CentOS, Debian, Ubuntu: http://www.iredmail.org/ From michael at stroeder.com Wed Nov 4 18:14:47 2009 From: michael at stroeder.com (=?windows-1252?Q?Michael_Str=F6der?=) Date: Wed, 04 Nov 2009 18:14:47 +0100 Subject: Compile error on RHEL 5.3 (x86_64), python-ldap-2.3.10 In-Reply-To: <0B709828-0F0F-4F77-84AF-DD4AAEC68545@gmail.com> References: <0B709828-0F0F-4F77-84AF-DD4AAEC68545@gmail.com> Message-ID: <4AF1B687.9040501@stroeder.com> Zhang Huangbin wrote: > > I got below compile error on Red Hat Enterprise Linux 5.3 (x86_64) > with python-ldap-2.3.10, but 2.3.8 was compiled and installed success. > What's wrong with it? > > Modules/constants.c:184: error: ?LDAP_OPT_X_TLS_NEWCTX? undeclared Well, I asked for testing long *before* releasing 2.3.10... This is because of older OpenLDAP libs. Try the patch below. It's also in HEAD now. Ciao, Michael. Index: Modules/constants.c =================================================================== RCS file: /cvsroot/python-ldap/python-ldap/Modules/constants.c,v retrieving revision 1.43 diff -u -r1.43 constants.c --- Modules/constants.c 23 Oct 2009 09:09:37 -0000 1.43 +++ Modules/constants.c 4 Nov 2009 15:48:04 -0000 @@ -162,7 +162,9 @@ add_int(d,OPT_URI); #ifdef HAVE_TLS add_int(d,OPT_X_TLS); +#ifdef LDAP_OPT_X_TLS_NEWCTX add_int(d,OPT_X_TLS_CTX); +#endif add_int(d,OPT_X_TLS_CACERTFILE); add_int(d,OPT_X_TLS_CACERTDIR); add_int(d,OPT_X_TLS_CERTFILE); Index: Modules/options.c =================================================================== RCS file: /cvsroot/python-ldap/python-ldap/Modules/options.c,v retrieving revision 1.33 diff -u -r1.33 options.c --- Modules/options.c 23 Oct 2009 09:09:37 -0000 1.33 +++ Modules/options.c 4 Nov 2009 15:48:04 -0000 @@ -79,7 +79,9 @@ #ifdef HAVE_TLS case LDAP_OPT_X_TLS: case LDAP_OPT_X_TLS_REQUIRE_CERT: +#ifdef LDAP_OPT_X_TLS_NEWCTX case LDAP_OPT_X_TLS_NEWCTX: +#endif #ifdef OPT_X_TLS_PROTOCOL_MIN case LDAP_OPT_X_TLS_PROTOCOL_MIN: #endif From michael at stroeder.com Wed Nov 4 18:15:43 2009 From: michael at stroeder.com (=?ISO-8859-1?Q?Michael_Str=F6der?=) Date: Wed, 04 Nov 2009 18:15:43 +0100 Subject: How to modify several dn in one time In-Reply-To: References: Message-ID: <4AF1B6BF.7080601@stroeder.com> Zhang Huangbin wrote: > it seems .modify() or .modify_s() can only modify one dn in one time. > How can i modify several dn in one time? You can't. These methods strictly follow the LDAP functional model (see RFC 4511, section 4.6. Modify Operation). > Such as ldapadd command: > > # ldapadd -x -D 'cn=Manager,dc=xxx,dc=xxx' -wpasswd -f new.ldif > > Content of new.ldif: > > dn: cn=vmail,dc=xxx,dc=xxx > changetype: modify > add: cn > cn: newCN > cn: newCN2 > -- > dn: cn=user01,dc=xxx,dc=xxx > changetype: modify > cn: newCN > cn: newCN2 These will lead to sevaral add requests being sent by command-line tool ldapadd. Same with ldapmodify reading several change records from LDIF file and sending a modify request for each of these. Ciao, Michael. From michael at stroeder.com Wed Nov 4 18:28:11 2009 From: michael at stroeder.com (=?ISO-8859-1?Q?Michael_Str=F6der?=) Date: Wed, 04 Nov 2009 18:28:11 +0100 Subject: connection pooling In-Reply-To: <4AEFC683.5020300@entic.net> References: <4AEFC683.5020300@entic.net> Message-ID: <4AF1B9AB.9050609@stroeder.com> Anil wrote: > I am looking to do connection pooling and am thinking of doing something > like http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/pooling.html > > Can you guys give some advice and/or better yet, has someone already > done this? I don't know any connection pooling for python-ldap's LDAPObject instances. It would be certainly nice to have one. I'd recommend to make it look like ReconnectLDAPObject instances. Ciao, Michael. From anilj at entic.net Tue Nov 3 06:58:27 2009 From: anilj at entic.net (Anil) Date: Mon, 02 Nov 2009 21:58:27 -0800 Subject: connection pooling Message-ID: <4AEFC683.5020300@entic.net> I am looking to do connection pooling and am thinking of doing something like http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/pooling.html Can you guys give some advice and/or better yet, has someone already done this? Thanks From zhbmaillistonly at gmail.com Thu Nov 5 02:58:56 2009 From: zhbmaillistonly at gmail.com (Zhang Huangbin) Date: Thu, 5 Nov 2009 09:58:56 +0800 Subject: How to modify several dn in one time In-Reply-To: <4AF1B6BF.7080601@stroeder.com> References: <4AF1B6BF.7080601@stroeder.com> Message-ID: On Nov 5, 2009, at 1:15 AM, Michael Str?der wrote: > Zhang Huangbin wrote: >> it seems .modify() or .modify_s() can only modify one dn in one time. >> How can i modify several dn in one time? > > You can't. These methods strictly follow the LDAP functional model > (see RFC > 4511, section 4.6. Modify Operation). Got it. Thanks Chris & Chaos & Michael. :) -- Best Regards. Zhang Huangbin - Open Source Mail Server Solution for Red Hat(R) Enterprise Linux, CentOS, Debian, Ubuntu: http://www.iredmail.org/ From roborsini at gmail.com Thu Nov 12 02:29:30 2009 From: roborsini at gmail.com (Rob Orsini) Date: Wed, 11 Nov 2009 17:29:30 -0800 Subject: Compile error on RHEL 5.3 (x86_64), python-ldap-2.3.10 Message-ID: Hi, I'm also having trouble getting 2.3.10 to compile on RHEL 5. I tried applying the patches supplied in this thread (I just joined this email list, btw): http://sourceforge.net/mailarchive/forum.php?thread_name=4AF1B687.9040501%40stroeder.com&forum_name=python-ldap-dev but that didn't work. I noticed that some work related to this has been going on in the trunk: http://python-ldap.cvs.sourceforge.net/viewvc/python-ldap/python-ldap/CHANGES?revision=1.217&view=markup I downloaded that version and tried to build it. It failed, with: $ python ./setup.py build extra_compile_args: extra_objects: include_dirs: /usr/local/openldap-2.3/include /usr/include/sasl library_dirs: /usr/local/openldap-2.3/lib libs: ldap_r lber sasl2 ssl crypto running build running build_py file Lib/ldap.py (for module ldap) not found file Lib/ldap/schema.py (for module ldap.schema) not found file Lib/ldap.py (for module ldap) not found file Lib/ldap/schema.py (for module ldap.schema) not found running egg_info writing requirements to Lib/python_ldap.egg-info/requires.txt writing Lib/python_ldap.egg-info/PKG-INFO writing top-level names to Lib/python_ldap.egg-info/top_level.txt writing dependency_links to Lib/python_ldap.egg-info/dependency_links.txt file Lib/ldap.py (for module ldap) not found file Lib/ldap/schema.py (for module ldap.schema) not found reading manifest template 'MANIFEST.in' warning: no files found matching 'Makefile' warning: no files found matching 'Modules/LICENSE' writing manifest file 'Lib/python_ldap.egg-info/SOURCES.txt' running build_ext building '_ldap' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fPIC -DHAVE_LIBLDAP_R -DHAVE_SASL -DHAVE_TLS -DLDAPMODULE_VERSION=2.3.10 -IModules -I/usr/local/openldap-2.3/include -I/usr/include/sasl -I/usr/include/python2.4 -c Modules/LDAPObject.c -o build/temp.linux-x86_64-2.4/Modules/LDAPObject.o In file included from Modules/LDAPObject.c:4: Modules/common.h:10:20: error: Python.h: No such file or directory In file included from Modules/LDAPObject.c:4: Modules/common.h:35: error: expected ?)? before ?*? token Modules/LDAPObject.c:5:24: error: patchlevel.h: No such file or directory In file included from Modules/LDAPObject.c:9: Modules/errors.h:11: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token Modules/errors.h:12: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token Modules/errors.h:13: error: expected ?)? before ?*? token Modules/errors.h:14: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token In file included from Modules/LDAPObject.c:10: Modules/constants.h:8: error: expected ?)? before ?*? token Modules/constants.h:9: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token In file included from Modules/LDAPObject.c:11: Modules/LDAPObject.h:16: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token Modules/LDAPObject.h:22: error: expected specifier-qualifier-list before ?PyObject_HEAD? Modules/LDAPObject.h:28: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?LDAP_Type? In file included from Modules/LDAPObject.c:12: Modules/ldapcontrol.h:10: error: expected ?)? before ?*? token Modules/ldapcontrol.h:12: error: expected ?)? before ?*? token Modules/ldapcontrol.h:13: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token In file included from Modules/LDAPObject.c:13: Modules/message.h:11: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token In file included from Modules/LDAPObject.c:14: Modules/berval.h:10: error: expected ?)? before ?*? token Modules/berval.h:11: error: expected ?)? before ?*? token Modules/berval.h:13: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token In file included from Modules/LDAPObject.c:15: Modules/options.h:5: error: expected declaration specifiers or ?...? before ?PyObject? Modules/options.h:6: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token Modules/LDAPObject.c: In function ?newLDAPObject?: Modules/LDAPObject.c:28: warning: implicit declaration of function ?PyObject_NEW? Modules/LDAPObject.c:28: error: expected expression before ?LDAPObject? Modules/LDAPObject.c:28: warning: cast to pointer from integer of different size Modules/LDAPObject.c:31: error: ?LDAPObject? has no member named ?ldap? Modules/LDAPObject.c:32: error: ?LDAPObject? has no member named ?_save? Modules/LDAPObject.c:33: error: ?LDAPObject? has no member named ?valid? Modules/LDAPObject.c: In function ?dealloc?: Modules/LDAPObject.c:42: error: ?LDAPObject? has no member named ?ldap? Modules/LDAPObject.c:43: error: ?LDAPObject? has no member named ?valid? Modules/LDAPObject.c:44: error: ?LDAPObject? has no member named ?_save? Modules/LDAPObject.c:44: warning: implicit declaration of function ?Py_FatalError? Modules/LDAPObject.c:44: error: ?LDAPObject? has no member named ?_save? Modules/LDAPObject.c:44: warning: implicit declaration of function ?PyEval_SaveThread? Modules/LDAPObject.c:45: error: ?LDAPObject? has no member named ?ldap? Modules/LDAPObject.c:46: error: ?_threadstate? undeclared (first use in this function) Modules/LDAPObject.c:46: error: (Each undeclared identifier is reported only once Modules/LDAPObject.c:46: error: for each function it appears in.) Modules/LDAPObject.c:46: error: expected ?;? before ?_save? Modules/LDAPObject.c:46: error: ?LDAPObject? has no member named ?_save? Modules/LDAPObject.c:46: warning: implicit declaration of function ?PyEval_RestoreThread? Modules/LDAPObject.c:46: error: ?_save? undeclared (first use in this function) Modules/LDAPObject.c:47: error: ?LDAPObject? has no member named ?valid? Modules/LDAPObject.c:49: error: ?LDAPObject? has no member named ?ldap? Modules/LDAPObject.c:51: warning: implicit declaration of function ?PyObject_DEL? Modules/LDAPObject.c: In function ?not_valid?: Modules/LDAPObject.c:65: error: ?LDAPObject? has no member named ?valid? Modules/LDAPObject.c:68: warning: implicit declaration of function ?PyErr_SetString? Modules/LDAPObject.c:68: error: ?LDAPexception_class? undeclared (first use in this function) Modules/LDAPObject.c: In function ?LDAPMod_DEL?: Modules/LDAPObject.c:81: warning: implicit declaration of function ?PyMem_DEL? Modules/LDAPObject.c: At top level: Modules/LDAPObject.c:104: error: expected ?)? before ?*? token Modules/LDAPObject.c:207: error: expected ?)? before ?*? token Modules/LDAPObject.c:259: error: expected ?)? before ?*? token Modules/LDAPObject.c:327: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token Modules/LDAPObject.c:367: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token Modules/LDAPObject.c:407: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token Modules/LDAPObject.c:453: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token Modules/LDAPObject.c:554: error: expected declaration specifiers or ?...? before ?PyObject? Modules/LDAPObject.c: In function ?interaction?: Modules/LDAPObject.c:557: error: ?PyObject? undeclared (first use in this function) Modules/LDAPObject.c:557: error: ?result? undeclared (first use in this function) Modules/LDAPObject.c:559: warning: implicit declaration of function ?PyObject_CallMethod? Modules/LDAPObject.c:559: error: ?SASLObject? undeclared (first use in this function) Modules/LDAPObject.c:570: warning: implicit declaration of function ?PyString_AsString? Modules/LDAPObject.c:570: warning: assignment makes pointer from integer without a cast Modules/LDAPObject.c:586: warning: implicit declaration of function ?Py_DECREF? Modules/LDAPObject.c: In function ?py_ldap_sasl_interaction?: Modules/LDAPObject.c:608: error: ?PyObject? undeclared (first use in this function) Modules/LDAPObject.c:608: error: ?SASLObject? undeclared (first use in this function) Modules/LDAPObject.c:608: error: expected expression before ?)? token Modules/LDAPObject.c:612: error: too many arguments to function ?interaction? Modules/LDAPObject.c: At top level: Modules/LDAPObject.c:619: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token Modules/LDAPObject.c:697: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token Modules/LDAPObject.c:739: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token Modules/LDAPObject.c:784: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token Modules/LDAPObject.c:825: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token Modules/LDAPObject.c:873: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token Modules/LDAPObject.c:917: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token Modules/LDAPObject.c:1015: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token Modules/LDAPObject.c:1082: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token Modules/LDAPObject.c:1126: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token Modules/LDAPObject.c:1148: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token Modules/LDAPObject.c:1165: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token Modules/LDAPObject.c:1178: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token Modules/LDAPObject.c:1235: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?methods? Modules/LDAPObject.c:1264: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token Modules/LDAPObject.c:1273: error: expected declaration specifiers or ?...? before ?PyObject? Modules/LDAPObject.c: In function ?setattr?: Modules/LDAPObject.c:1275: error: ?PyExc_AttributeError? undeclared (first use in this function) Modules/LDAPObject.c: At top level: Modules/LDAPObject.c:1281: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?LDAP_Type? error: command 'gcc' failed with exit status 1 I would love to help test this. Please let me know what I can send you to be most useful. Also, thanks for all your work on this. Rob -------------- next part -------------- An HTML attachment was scrubbed... URL: From pakraticus at gmail.com Wed Nov 11 16:24:23 2009 From: pakraticus at gmail.com (Chris Dukes) Date: Wed, 11 Nov 2009 10:24:23 -0500 Subject: Best way to add an implementation specific schema model? Message-ID: <89732f340911110724v21868328r17ea1847bd8af44c@mail.gmail.com> I have to work with IBM Directory Server on a regular basis, and that includes some nasty schema analysis for moving some history local schema modifications to new versions of the product. I was able to use ldap.schema to simplify most of the nastiness. However, IBM extends the schema with the additional attribute IBMAttributetypes, which describes chracteristics of how attributes will be stored in the backend. IBM was polite enough to document the grammar for this new attribute and I'll be attempting to create an IBMAttributetype class to hold these. Now, should I just add the new class to ldap.schema.models and submit a patch once done? Or should a long term approach of being able to indicate the addition of server specific extensions be contemplated? Thanks, Chris Dukes -------------- next part -------------- An HTML attachment was scrubbed... URL: From pakrat at ftp.linux.org.uk Wed Oct 21 22:59:58 2009 From: pakrat at ftp.linux.org.uk (Chris Dukes) Date: Wed, 21 Oct 2009 21:59:58 +0100 Subject: Trying to track down msgid associated with ldap.NO_SUCH_OBJECT exception Message-ID: <20091021205958.GW3722@ZenIV.linux.org.uk> I'm trying to create a python port of a perl script to update an LDAP directory against an LDIF file. As I read LDIF entries I do an mesgid = l.search(dn, ldap.SCOPE_BASE, '(objectclass=*)', ['*']) I am currently keeping the ldif entries in a dict indexed by the msgid so I may retrieve them for comparison as they come back from l.result3(timeout=0). As this is for updates, I am expecting the occasional ldap.NO_SUCH_OBJECT exception. Unfortunately, this exception does not provide the msgid associated with the ldap.NO_SUCH_OBJECT. Would it be possible for the msgid to be included in the dictionary that also has {'matched': 'dc=COM', 'desc': 'No such object'} -- Chris Dukes "In cynicism she's about 35" -- Terry Pratchett's "Hog Father" From marcus at python.my Thu Nov 5 05:13:08 2009 From: marcus at python.my (Marcus) Date: Thu, 05 Nov 2009 12:13:08 +0800 Subject: How to modify several dn in one time In-Reply-To: References: <4AF1B6BF.7080601@stroeder.com> Message-ID: <4AF250D4.8030909@python.my> Hi, Anyone knows of any python based LDAP servers? The main objective is to have on that run on Windows. The OpenLdap i have tested is pretty unstable in Windows, crashes every 4-5 days. The Apache DS in java works better but would prefer if there is a python version. Or anyone have ldaptor working as a basic LDAP, i just need to provide simple lookups , don't even need full compliance of authentication etc. Marc. Zhang Huangbin wrote: > On Nov 5, 2009, at 1:15 AM, Michael Str?der wrote: > > >> Zhang Huangbin wrote: >> >>> it seems .modify() or .modify_s() can only modify one dn in one time. >>> How can i modify several dn in one time? >>> >> You can't. These methods strictly follow the LDAP functional model >> (see RFC >> 4511, section 4.6. Modify Operation). >> > > Got it. Thanks Chris & Chaos & Michael. :) > > From michaelbibby at gmail.com Tue Nov 3 15:01:47 2009 From: michaelbibby at gmail.com (Zhang Huangbin) Date: Tue, 3 Nov 2009 22:01:47 +0800 Subject: How to modify several dn in one time Message-ID: <70BE95A3-D46B-40FB-8FE6-CD36726500D3@gmail.com> Hi, list. it seems .modify() or .modify_s() can only modify one dn in one time. How can i modify several dn in one time? Such as ldapadd command: # ldapadd -x -D 'cn=Manager,dc=xxx,dc=xxx' -wpasswd -f new.ldif Content of new.ldif: dn: cn=vmail,dc=xxx,dc=xxx changetype: modify add: cn cn: newCN cn: newCN2 -- dn: cn=user01,dc=xxx,dc=xxx changetype: modify cn: newCN cn: newCN2 -- Best Regards. Zhang Huangbin - Open Source Mail Server Solution for Red Hat(R) Enterprise Linux, CentOS, Debian, Ubuntu: http://www.iredmail.org/ From pakrat at ftp.linux.org.uk Wed Nov 4 03:43:48 2009 From: pakrat at ftp.linux.org.uk (Chris Dukes) Date: Wed, 4 Nov 2009 02:43:48 +0000 Subject: How to modify several dn in one time In-Reply-To: References: Message-ID: <20091104024348.GH3722@ZenIV.linux.org.uk> On Wed, Nov 04, 2009 at 10:27:15AM +0800, Zhang Huangbin wrote: > Hi, list. > > it seems .modify() or .modify_s() can only modify one dn in one time. It doesn't just seem, it *IS* > How can i modify several dn in one time? Issue multiple .modify()s. Collect the .result()s to make sure they worked. > > Such as ldapadd command: > > # ldapadd -x -D 'cn=Manager,dc=xxx,dc=xxx' -wpasswd -f new.ldif > > Content of new.ldif: > > dn: cn=vmail,dc=xxx,dc=xxx > changetype: modify > add: cn > cn: newCN > cn: newCN2 > -- > dn: cn=user01,dc=xxx,dc=xxx > changetype: modify > cn: newCN > cn: newCN2 That shouldn't work either. ldapmodify -c << EEOOTT # This is one LDIF record dn: cn=foo,dc=xxx changetype: modify add: sn sn: baz - #This is a SECOND LDIF record dn: cn=bar,dc=xxx changetype: modify add: sn sn: quf - > > > > -- > Best Regards. > > Zhang Huangbin > > - Open Source Mail Server Solution for Red Hat(R) Enterprise Linux, > CentOS, Debian, Ubuntu: http://www.iredmail.org/ > > From michael at stroeder.com Thu Nov 12 19:30:01 2009 From: michael at stroeder.com (=?windows-1252?Q?Michael_Str=F6der?=) Date: Thu, 12 Nov 2009 19:30:01 +0100 Subject: Compile error on RHEL 5.3 (x86_64), python-ldap-2.3.10 In-Reply-To: References: Message-ID: <4AFC5429.9010601@stroeder.com> Rob Orsini wrote: > Hi, I'm also having trouble getting 2.3.10 to compile on RHEL 5. I tried > applying the patches supplied in this thread (I just joined this email > list, btw): > > In file included from Modules/LDAPObject.c:4: > Modules/common.h:10:20: error: Python.h: No such file or directory Please make sure you have all the necessary headers available on your system for building Python extension modules and all the libs needed by python-ldap. I don't know the package names on RHEL though. Ciao, Michael. From michael at stroeder.com Thu Nov 12 19:44:37 2009 From: michael at stroeder.com (=?ISO-8859-1?Q?Michael_Str=F6der?=) Date: Thu, 12 Nov 2009 19:44:37 +0100 Subject: Best way to add an implementation specific schema model? In-Reply-To: <89732f340911110724v21868328r17ea1847bd8af44c@mail.gmail.com> References: <89732f340911110724v21868328r17ea1847bd8af44c@mail.gmail.com> Message-ID: <4AFC5795.6040107@stroeder.com> Chris Dukes wrote: > I have to work with IBM Directory Server on a regular basis, and that > includes some nasty schema analysis for moving some history local schema > modifications to new versions of the product. > I was able to use ldap.schema to simplify most of the nastiness. > > However, IBM extends the schema with the additional attribute > IBMAttributetypes, which describes chracteristics of how attributes will > be stored in the backend. > > IBM was polite enough to document the grammar for this new attribute and > I'll be attempting to create an IBMAttributetype class to hold these. I vaguely remember coming across these proprietary IBM schema attributes. I wonder why they did not add their specific things to normal AttributeTypeDescription like other directory vendors did. Oh, well... Could you please refer to docs of the grammar? > Now, should I just add the new class to ldap.schema.models and submit a > patch once done? Or should a long term approach of being able to > indicate the addition of server specific extensions be contemplated? I already thought about this when looking at vendor-specific extensions for AttributeTypeDescription for Novell eDirectory and OpenLDAP. Here are some remarks: 1. ldap.schema is somewhat experimental although quite robust in recent deployments. The API is still undocumented mainly because I would be willing to change it if someone comes up with good ideas how to improve it. 2. Lib/ldap/schema/models.py is very closely modeled after RFC 4512. If the IBM grammar loosely follows what's in that RFC 4512 you have a good chance to derive from these classes and extend them by setting class attribute token_defaults according to what's needed. 3. There's ldap.schema.subentry.SCHEMA_CLASS_MAPPING which maps subschema subentry attribute types to Python schema classes in ldap.schema.models. So you have to somewhat register the IBM-specific attributes there. Curious to hear about how to proceed with that. Ciao, Michael. From zhbmaillistonly at gmail.com Fri Nov 13 03:36:56 2009 From: zhbmaillistonly at gmail.com (Zhang Huangbin) Date: Fri, 13 Nov 2009 10:36:56 +0800 Subject: Compile error on RHEL 5.3 (x86_64), python-ldap-2.3.10 In-Reply-To: <4AF1B687.9040501@stroeder.com> References: <0B709828-0F0F-4F77-84AF-DD4AAEC68545@gmail.com> <4AF1B687.9040501@stroeder.com> Message-ID: <8B523705-1FFC-4182-8935-956F388D1188@gmail.com> On Nov 5, 2009, at 1:14 AM, Michael Str?der wrote: > This is because of older OpenLDAP libs. Try the patch below. It's also in HEAD > now. I'm so sorry that i forgot this thread :( I tested patch moment ago, failed to build, same as in HEAD (checked out moment ago): ---- # python setup.py clean extra_compile_args: extra_objects: include_dirs: /usr/local/openldap-2.3/include /usr/include/sasl library_dirs: /usr/local/openldap-2.3/lib libs: ldap_r lber sasl2 ssl crypto running clean [root at r6 python-ldap]# python setup.py install extra_compile_args: extra_objects: include_dirs: /usr/local/openldap-2.3/include /usr/include/sasl library_dirs: /usr/local/openldap-2.3/lib libs: ldap_r lber sasl2 ssl crypto running install running bdist_egg running egg_info creating Lib/python_ldap.egg-info writing requirements to Lib/python_ldap.egg-info/requires.txt writing Lib/python_ldap.egg-info/PKG-INFO writing top-level names to Lib/python_ldap.egg-info/top_level.txt writing dependency_links to Lib/python_ldap.egg-info/dependency_links.txt writing manifest file 'Lib/python_ldap.egg-info/SOURCES.txt' file Lib/ldap.py (for module ldap) not found file Lib/ldap/schema.py (for module ldap.schema) not found reading manifest template 'MANIFEST.in' warning: no files found matching 'Makefile' warning: no files found matching 'Modules/LICENSE' writing manifest file 'Lib/python_ldap.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py file Lib/ldap.py (for module ldap) not found file Lib/ldap/schema.py (for module ldap.schema) not found creating build creating build/lib.linux-x86_64-2.4 copying Lib/ldapurl.py -> build/lib.linux-x86_64-2.4 copying Lib/ldif.py -> build/lib.linux-x86_64-2.4 copying Lib/dsml.py -> build/lib.linux-x86_64-2.4 creating build/lib.linux-x86_64-2.4/ldap copying Lib/ldap/__init__.py -> build/lib.linux-x86_64-2.4/ldap copying Lib/ldap/async.py -> build/lib.linux-x86_64-2.4/ldap copying Lib/ldap/controls.py -> build/lib.linux-x86_64-2.4/ldap copying Lib/ldap/cidict.py -> build/lib.linux-x86_64-2.4/ldap copying Lib/ldap/dn.py -> build/lib.linux-x86_64-2.4/ldap copying Lib/ldap/filter.py -> build/lib.linux-x86_64-2.4/ldap copying Lib/ldap/functions.py -> build/lib.linux-x86_64-2.4/ldap copying Lib/ldap/ldapobject.py -> build/lib.linux-x86_64-2.4/ldap copying Lib/ldap/modlist.py -> build/lib.linux-x86_64-2.4/ldap copying Lib/ldap/resiter.py -> build/lib.linux-x86_64-2.4/ldap copying Lib/ldap/sasl.py -> build/lib.linux-x86_64-2.4/ldap creating build/lib.linux-x86_64-2.4/ldap/schema copying Lib/ldap/schema/__init__.py -> build/lib.linux-x86_64-2.4/ldap/schema copying Lib/ldap/schema/models.py -> build/lib.linux-x86_64-2.4/ldap/schema copying Lib/ldap/schema/subentry.py -> build/lib.linux-x86_64-2.4/ldap/schema copying Lib/ldap/schema/tokenizer.py -> build/lib.linux-x86_64-2.4/ldap/schema file Lib/ldap.py (for module ldap) not found file Lib/ldap/schema.py (for module ldap.schema) not found running build_ext building '_ldap' extension creating build/temp.linux-x86_64-2.4 creating build/temp.linux-x86_64-2.4/Modules gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fPIC -DHAVE_LIBLDAP_R -DHAVE_SASL -DHAVE_TLS -DLDAPMODULE_VERSION=2.3.10 -IModules -I/usr/local/openldap-2.3/include -I/usr/include/sasl -I/usr/include/python2.4 -c Modules/LDAPObject.c -o build/temp.linux-x86_64-2.4/Modules/LDAPObject.o gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fPIC -DHAVE_LIBLDAP_R -DHAVE_SASL -DHAVE_TLS -DLDAPMODULE_VERSION=2.3.10 -IModules -I/usr/local/openldap-2.3/include -I/usr/include/sasl -I/usr/include/python2.4 -c Modules/ldapcontrol.c -o build/temp.linux-x86_64-2.4/Modules/ldapcontrol.o gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fPIC -DHAVE_LIBLDAP_R -DHAVE_SASL -DHAVE_TLS -DLDAPMODULE_VERSION=2.3.10 -IModules -I/usr/local/openldap-2.3/include -I/usr/include/sasl -I/usr/include/python2.4 -c Modules/common.c -o build/temp.linux-x86_64-2.4/Modules/common.o gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fPIC -DHAVE_LIBLDAP_R -DHAVE_SASL -DHAVE_TLS -DLDAPMODULE_VERSION=2.3.10 -IModules -I/usr/local/openldap-2.3/include -I/usr/include/sasl -I/usr/include/python2.4 -c Modules/constants.c -o build/temp.linux-x86_64-2.4/Modules/constants.o Modules/constants.c: In function ?LDAPinit_constants?: Modules/constants.c:186: error: ?LDAP_OPT_X_TLS_NEWCTX? undeclared (first use in this function) Modules/constants.c:186: error: (Each undeclared identifier is reported only once Modules/constants.c:186: error: for each function it appears in.) error: command 'gcc' failed with exit status 1 ---- -- Best Regards. Zhang Huangbin - Open Source Mail Server Solution for Red Hat(R) Enterprise Linux, CentOS, Debian, Ubuntu: http://www.iredmail.org/ From pakraticus at gmail.com Thu Oct 22 19:13:42 2009 From: pakraticus at gmail.com (Chris Dukes) Date: Thu, 22 Oct 2009 13:13:42 -0400 Subject: Preparing release 2.3.10, please test! Message-ID: <89732f340910221013m13de5d96n4efa33caba9e20dc@mail.gmail.com> The following patch allows the LDAP_OPT_X_TLS_PROTOCOL_MIN to work with libldap2-dev 2.4.9-0ubuntu0 Thanks, Chris Dukes -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: LDAP_OPT_X_TLS_PROTOCOL_MIN.diff Type: text/x-diff Size: 1615 bytes Desc: not available URL: From michael at stroeder.com Fri Nov 13 09:47:43 2009 From: michael at stroeder.com (=?windows-1252?Q?Michael_Str=F6der?=) Date: Fri, 13 Nov 2009 09:47:43 +0100 Subject: Compile error on RHEL 5.3 (x86_64), python-ldap-2.3.10 In-Reply-To: <8B523705-1FFC-4182-8935-956F388D1188@gmail.com> References: <0B709828-0F0F-4F77-84AF-DD4AAEC68545@gmail.com> <4AF1B687.9040501@stroeder.com> <8B523705-1FFC-4182-8935-956F388D1188@gmail.com> Message-ID: <4AFD1D2F.5040002@stroeder.com> Zhang Huangbin wrote: > On Nov 5, 2009, at 1:14 AM, Michael Str?der wrote: > >> This is because of older OpenLDAP libs. Try the patch below. It's also in HEAD >> now. > > I tested patch moment ago, failed to build, same as in HEAD (checked out moment ago): Sorry, please try again from HEAD. I fixed also another typo. Ciao, Michael. From zhbmaillistonly at gmail.com Fri Nov 13 10:25:14 2009 From: zhbmaillistonly at gmail.com (Zhang Huangbin) Date: Fri, 13 Nov 2009 17:25:14 +0800 Subject: Compile error on RHEL 5.3 (x86_64), python-ldap-2.3.10 In-Reply-To: <4AFD1D2F.5040002@stroeder.com> References: <0B709828-0F0F-4F77-84AF-DD4AAEC68545@gmail.com> <4AF1B687.9040501@stroeder.com> <8B523705-1FFC-4182-8935-956F388D1188@gmail.com> <4AFD1D2F.5040002@stroeder.com> Message-ID: On Nov 13, 2009, at 4:47 PM, Michael Str?der wrote: > > Sorry, please try again from HEAD. I fixed also another typo. It (HEAD) works now. :) -- Best Regards. Zhang Huangbin - Open Source Mail Server Solution for Red Hat(R) Enterprise Linux, CentOS, Debian, Ubuntu: http://www.iredmail.org/ From christian.oudard at gmail.com Tue Dec 8 00:20:40 2009 From: christian.oudard at gmail.com (Christian Oudard) Date: Mon, 7 Dec 2009 18:20:40 -0500 Subject: Using the test ldap server for unittests Message-ID: I tried to run the runtests.sh script in the Tests/ directory, but it didn't work, saying that the test ldap server wasn't running. I tried installing slapd, but it still didn't work even when slapd was running. What do I need to have installed or running to use these unittests? Also, I would like to set up a test ldap server for my own unittests in another project, can anyone point me in the right direction for this? From christian.oudard at gmail.com Tue Dec 15 15:53:09 2009 From: christian.oudard at gmail.com (Christian Oudard) Date: Tue, 15 Dec 2009 09:53:09 -0500 Subject: Patch for broken slapd.py Message-ID: On my system, slapd.py fails because of a missing /var/tmp/python-ldap-test . Not sure what your patch submission procedure is, but here's a patch to fix that: ================================== diff --git a/pstat/dynamic_ldap/slapd.py b/pstat/dynamic_ldap/slapd.py index 735b58e..2cd3e25 100644 --- a/pstat/dynamic_ldap/slapd.py +++ b/pstat/dynamic_ldap/slapd.py @@ -13,12 +13,25 @@ def quote(s): '''Quotes the '"' and '\' characters in a string and surrounds with "..."''' return '"' + s.replace('\\','\\\\').replace('"','\\"') + '"' -def mkdirs(path): - """Creates the directory path unless it already exists""" - if not os.access(os.path.join(path, os.path.curdir), os.F_OK): - _log.debug("creating temp directory %s", path) - os.mkdir(path) - return path +def mkdir(newdir): + #http://code.activestate.com/recipes/82465/ + """works the way a good mkdir should :) + - already exists, silently complete + - regular file in the way, raise an exception + - parent directory(ies) does not exist, make them as well + """ + if os.path.isdir(newdir): + pass + elif os.path.isfile(newdir): + raise OSError("a file with the same name as the desired " \ + "dir, '%s', already exists." % newdir) + else: + head, tail = os.path.split(newdir) + if head and not os.path.isdir(head): + mkdir(head) + if tail: + os.mkdir(newdir) + return newdir def delete_directory_content(path): for dirpath,dirnames,filenames in os.walk(path, topdown=False): @@ -138,7 +151,8 @@ class Slapd: cfg.append("allow bind_v2") # Database - ldif_dir = mkdirs(os.path.join(self.get_tmpdir(), "ldif-data")) + ldif_dir = os.path.join(self.get_tmpdir(), "ldif-data") + mkdir(ldif_dir) delete_directory_content(ldif_dir) # clear it out cfg.append("database ldif") cfg.append("directory " + quote(ldif_dir)) @@ -150,7 +164,7 @@ class Slapd: def _write_config(self): """Writes the slapd.conf file out, and returns the path to it.""" path = os.path.join(self._tmpdir, "slapd.conf") - ldif_dir = mkdirs(self._tmpdir) + mkdir(self._tmpdir) if os.access(path, os.F_OK): self._log.debug("deleting existing %s", path) os.remove(path) From bra at fsn.hu Wed Nov 25 15:49:38 2009 From: bra at fsn.hu (Attila Nagy) Date: Wed, 25 Nov 2009 15:49:38 +0100 Subject: Decoding binary packets Message-ID: <4B0D4402.10203@fsn.hu> Hello, I would like to decode LDAP packets (queries and responses), captured with BPF. Is there any easy way with py-ldap to do this? I've seen the LDAPmessage_to_python function, but it's not exported to python. Is that what I'm looking for? Thanks, From michael at stroeder.com Thu Dec 17 17:40:38 2009 From: michael at stroeder.com (=?ISO-8859-1?Q?Michael_Str=F6der?=) Date: Thu, 17 Dec 2009 17:40:38 +0100 Subject: Patch for broken slapd.py In-Reply-To: References: Message-ID: <4B2A5F06.1060900@stroeder.com> Christian Oudard wrote: > On my system, slapd.py fails because of a missing /var/tmp/python-ldap-test . > > Not sure what your patch submission procedure is, but here's a patch > to fix that: Hmm, normally I review patches and commit them. So you did the right thing posting it here. In this case I'm not familiar with slapd.py which was written by David and after glancing over it I strongly dislike some of the assumptions made therein. So I'm not going to touch that now because of lack of time. Ciao, Michael. From christian.oudard at gmail.com Thu Dec 17 20:56:25 2009 From: christian.oudard at gmail.com (Christian Oudard) Date: Thu, 17 Dec 2009 14:56:25 -0500 Subject: Patch for broken slapd.py In-Reply-To: <4B2A5F06.1060900@stroeder.com> References: <4B2A5F06.1060900@stroeder.com> Message-ID: I'm in the process of adapting slapd.py to be a general purpose mock ldap test server for running unit tests against. I would be interested in contributing improvements to it that keep it compatible with the test suite of python-ldap. Specifically, what sort of assumptions are you trying to get rid of? 2009/12/17 Michael Str?der : > Christian Oudard wrote: >> On my system, slapd.py fails because of a missing /var/tmp/python-ldap-test . >> >> Not sure what your patch submission procedure is, but here's a patch >> to fix that: > > Hmm, normally I review patches and commit them. So you did the right thing > posting it here. > > In this case I'm not familiar with slapd.py which was written by David and > after glancing over it I strongly dislike some of the assumptions made > therein. So I'm not going to touch that now because of lack of time. > > Ciao, Michael. > > From michael at stroeder.com Fri Dec 18 09:53:50 2009 From: michael at stroeder.com (=?ISO-8859-1?Q?Michael_Str=F6der?=) Date: Fri, 18 Dec 2009 09:53:50 +0100 Subject: Patch for broken slapd.py In-Reply-To: References: <4B2A5F06.1060900@stroeder.com> Message-ID: <4B2B431E.8080102@stroeder.com> Christian Oudard wrote: > 2009/12/17 Michael Str?der : >> In this case I'm not familiar with slapd.py which was written by David and >> after glancing over it I strongly dislike some of the assumptions made >> therein. So I'm not going to touch that now because of lack of time. > > I'm in the process of adapting slapd.py to be a general purpose mock > ldap test server for running unit tests against. I would be interested > in contributing improvements to it that keep it compatible with the > test suite of python-ldap. > Specifically, what sort of assumptions are you trying to get rid of? Some short comments: 1. It should also work on Windows which is not possible with the currently implemented filename handling. 2. Probably a template for slapd.conf should be used which can be more easily adapted to various OpenLDAP releases, especially no references to specific schema files etc. 3. Data should be kept locally in a sub-directory like with OpenLDAP's test suite. No need for /var/blurb. 4. The assumption about slapd executable being in something like /usr/sbin/ is wrong. Rather the full path to slapd and slaptest should be specified. Ciao, Michael. From michael at stroeder.com Fri Dec 18 09:56:39 2009 From: michael at stroeder.com (=?UTF-8?B?TWljaGFlbCBTdHLDtmRlcg==?=) Date: Fri, 18 Dec 2009 09:56:39 +0100 Subject: python-ldap syncrepl consumer In-Reply-To: <1260269333.1816.4.camel@localhost> References: <1260269333.1816.4.camel@localhost> Message-ID: <4B2B43C7.3050907@stroeder.com> Mikkel Kruse Johnsen wrote: > Sean did you ever get your python-ldap consumer to work ? I'd also like to know this. But I suspect it's currently not possible due to http://sourceforge.net/tracker/?func=detail&aid=2829057&group_id=2072&atid=352072 > I was searching the net for a way to update other systems, when my LDAP > changed. I found your attempt to make a python consumer. Do you have any > code, other than want i can find in the maillinglist ? In a customer project we've implemented a short-time polling system querying OpenLDAP's accesslog database which also leads to quick updates on the target. Ciao, Michael. From mikkel at linet.dk Tue Dec 8 11:48:53 2009 From: mikkel at linet.dk (Mikkel Kruse Johnsen) Date: Tue, 08 Dec 2009 11:48:53 +0100 Subject: python-ldap syncrepl consumer Message-ID: <1260269333.1816.4.camel@localhost> Hi All and Sean Burford Sean did you ever get your python-ldap consumer to work ? I was searching the net for a way to update other systems, when my LDAP changed. I found your attempt to make a python consumer. Do you have any code, other than want i can find in the maillinglist ? Thoughts for usability is: GConf LDAP proxy/backend Kerberos password updater OpenAFS user administration Med Venlig Hilsen / Kind Regards Mikkel Kruse Johnsen Adm.Dir. Linet ?rholmgade 6 st tv Copenhagen N 2200 Denmark Work: +45 21287793 Mobile: +45 21287793 Email: mikkel at linet.dk IM: mikkel at linet.dk (MSN) Professional Profile Healthcare Network Consultant -------------- next part -------------- An HTML attachment was scrubbed... URL: From c.holtermann at gmx.de Wed Dec 30 14:41:03 2009 From: c.holtermann at gmx.de (Christoph Holtermann) Date: Wed, 30 Dec 2009 14:41:03 +0100 Subject: Multiple Email Values In-Reply-To: <4B2B43C7.3050907@stroeder.com> References: <1260269333.1816.4.camel@localhost> <4B2B43C7.3050907@stroeder.com> Message-ID: <4B3B586F.9030205@gmx.de> Hello all ! I have a basic question about data representation in LDAP. I know just this list, maybe you can point me to the right one. I use LDAP for storing my contacts. I keep thinking about the simple case of people having multiple email. One case would be to have an attribute "mail" another one "mozillaSecond Email". On the other hand I know that it is possible to store multiple values in the corresponding LDAP- attribute. but i wonder how it could be possible to also store an additional information about these email. For example Hans Wurst has a at b.c "work", b at b.c "outdated since 2000"... I guess that this is not possible or needs complex modifications. Does anybody know something helpful about this ? regards, C.Holtermann From michael at stroeder.com Wed Dec 30 15:08:01 2009 From: michael at stroeder.com (=?ISO-8859-1?Q?Michael_Str=F6der?=) Date: Wed, 30 Dec 2009 15:08:01 +0100 Subject: Multiple Email Values In-Reply-To: <4B3B586F.9030205@gmx.de> References: <1260269333.1816.4.camel@localhost> <4B2B43C7.3050907@stroeder.com> <4B3B586F.9030205@gmx.de> Message-ID: <4B3B5EC1.4040904@stroeder.com> Christoph Holtermann wrote: > I have a basic question about data representation in LDAP. > I know just this list, maybe you can point me to the right one. For general LDAP questions you might find ldap at umich.edu more helpful since there are more people lurking there. > I use LDAP for storing my contacts. I keep thinking about the > simple case of people having multiple email. Unfortunately this case is not simple. > One case > would be to have an attribute "mail" another one "mozillaSecond > Email". On the other hand I know that it > is possible to store multiple values in the corresponding LDAP- > attribute. but i wonder how it could be possible to also store > an additional information about these email. For example > Hans Wurst has > a at b.c "work", > b at b.c "outdated since 2000"... > I guess that this is not possible or needs complex modifications. > Does anybody know something helpful about this ? The big question is what your LDAP-enabled MUAs or other LDAP clients expect in the attribute 'mail' or how you can configure the clients used to handle other attributes etc. E.g. I don't any MUA which handles multiple attribute values in 'mail' in a smart way. Simply the first value is taken. I guess at the end you'll find yourself to add separate entries for all e-mail adresses and office locations. Ciao, Michael. From michael at stroeder.com Wed Dec 30 15:08:01 2009 From: michael at stroeder.com (=?ISO-8859-1?Q?Michael_Str=F6der?=) Date: Wed, 30 Dec 2009 15:08:01 +0100 Subject: Multiple Email Values In-Reply-To: <4B3B586F.9030205@gmx.de> References: <1260269333.1816.4.camel@localhost> <4B2B43C7.3050907@stroeder.com> <4B3B586F.9030205@gmx.de> Message-ID: <4B3B5EC1.4040904@stroeder.com> Christoph Holtermann wrote: > I have a basic question about data representation in LDAP. > I know just this list, maybe you can point me to the right one. For general LDAP questions you might find ldap at umich.edu more helpful since there are more people lurking there. > I use LDAP for storing my contacts. I keep thinking about the > simple case of people having multiple email. Unfortunately this case is not simple. > One case > would be to have an attribute "mail" another one "mozillaSecond > Email". On the other hand I know that it > is possible to store multiple values in the corresponding LDAP- > attribute. but i wonder how it could be possible to also store > an additional information about these email. For example > Hans Wurst has > a at b.c "work", > b at b.c "outdated since 2000"... > I guess that this is not possible or needs complex modifications. > Does anybody know something helpful about this ? The big question is what your LDAP-enabled MUAs or other LDAP clients expect in the attribute 'mail' or how you can configure the clients used to handle other attributes etc. E.g. I don't any MUA which handles multiple attribute values in 'mail' in a smart way. Simply the first value is taken. I guess at the end you'll find yourself to add separate entries for all e-mail adresses and office locations. Ciao, Michael. From pakrat at ftp.linux.org.uk Wed Dec 30 16:22:31 2009 From: pakrat at ftp.linux.org.uk (Chris Dukes) Date: Wed, 30 Dec 2009 15:22:31 +0000 Subject: Multiple Email Values In-Reply-To: <4B3B586F.9030205@gmx.de> References: <1260269333.1816.4.camel@localhost> <4B2B43C7.3050907@stroeder.com> <4B3B586F.9030205@gmx.de> Message-ID: <20091230152231.GW20638@ZenIV.linux.org.uk> On Wed, Dec 30, 2009 at 02:41:03PM +0100, Christoph Holtermann wrote: > Hello all ! > > I have a basic question about data representation in LDAP. > I know just this list, maybe you can point me to the right one. > I use LDAP for storing my contacts. I keep thinking about the > simple case of people having multiple email. One case > would be to have an attribute "mail" another one "mozillaSecond > Email". On the other hand I know that it > is possible to store multiple values in the corresponding LDAP- > attribute. but i wonder how it could be possible to also store > an additional information about these email. For example > Hans Wurst has > a at b.c "work", > b at b.c "outdated since 2000"... > I guess that this is not possible or needs complex modifications. > Does anybody know something helpful about this ? You probably want a general LDAP or openldap mailing list for this but... I'm not subscribed to one either :-). First take a peek at this from the openldap-software list http://www.openldap.org/lists/openldap-software/200203/msg00646.html If you're caring from an MTA perspective... Postfix's LDAP maps suggest a 'maildrop' attribute for calculating actual delivery. And now a suggestion so you can spend an afternoon seeing what it breaks... Well, atleast in my LDAP schemas the mail attribute has syntax 1.3.6.1.4.1.1466.115.121.1.15 And looking at 6.10 of RFC2252 http://tools.ietf.org/html/rfc2252 You can put any unicode string there you want to such as Christoph Holtermann Obsolete -- Chris Dukes "In cynicism she's about 35" -- Terry Pratchett's "Hog Father" From bgollmer at tcnetworks.com Wed Nov 4 21:11:52 2009 From: bgollmer at tcnetworks.com (Ben Gollmer) Date: Wed, 4 Nov 2009 14:11:52 -0600 Subject: Contributing Mac OS X packages to PyPI Message-ID: I have built universal binary packages for Python-LDAP 2.3.10 on both Mac OS X 10.5 (Python 2.5) and 10.6 (Python 2.6). Is it possible to add these to the PyPI page, to go along with the Windows installers? They can be very useful for users that don't have Xcode / gcc installed. Cheers, -- Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2429 bytes Desc: not available URL: From fintan.macmahon at gmail.com Sun Oct 18 22:55:15 2009 From: fintan.macmahon at gmail.com (Fintan MacMahon) Date: Sun, 18 Oct 2009 21:55:15 +0100 Subject: KeyError while performing 'ldapsearch' operation and processing the result data In-Reply-To: <7c956f0c0909200702hb45a6fs51950086c3f19365@mail.gmail.com> References: <7c956f0c0909200702hb45a6fs51950086c3f19365@mail.gmail.com> Message-ID: <200910182155.16085.fintan.macmahon@gmail.com> Hi Guruprasad Had the same issue and someone was kind enough to point me in the right direction. Here's what I was told "A uid has to be changed into a legible format Chapter 3 of RFC 4515 (LDAPv3 filter strings) starts with: The string representation of an LDAP search filter is a string of UTF-8 [RFC3629] encoded Unicode characters [Unicode] [..] So please have a look at RFC 4515 to find out how to escape hex values in a search filter. Function ldap.filter.escape_filter_chars() is helpful for that." Thanks fintan On Sunday 20 September 2009 15:02:14 Guruprasad wrote: > Hi, > I have been trying to write a function to search a LDAP directory by > using the python-ldap APIs. > Here is the code I have written: > > > def getNextUid(): > uidList=[] > try: > l=ldap.initialize(ldap_host) > l.bind_s(ldap_admin_dn,ldap_admin_pass) > > ldap_result=l.search(ldap_base_dn,ldap.SCOPE_SUBTREE,'cn=*',['uidNumber']) > while 1: > result_type, result_data=l.result(ldap_result,0) > if (result_data == []): > break > a=result_data[0][1]['uidNumber'] > print a > except ldap.SERVER_DOWN: > print "LDAP server down" > > > What I am trying to do in this piece of code is get the list of the > values of 'uidNumber' attribute. The search operation returns a list > containing a tuple. The tuple contains the DN as one value and a > dictionary with uidNumber and its value. I am trying to extract the > value of the uidNumber. I found that result_data was a dictionary > having a key 'uidNumber', but when I try to print its value, I get a > KeyError. Strangely, when I print result_data.keys(), 'uidNumber' is > present. > > > Thank you. > > Regards, > Guruprasad. > > From pakraticus at gmail.com Thu Oct 22 19:22:25 2009 From: pakraticus at gmail.com (Chris Dukes) Date: Thu, 22 Oct 2009 13:22:25 -0400 Subject: Add msgid to info dict created by LDAPerror. Message-ID: <89732f340910221022v75ae08ear3c1855c1f5950aec@mail.gmail.com> And here is the patch cleaned up against python-ldap 2.3.10 Thanks, Chris Dukes -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: LDAPerror.diff Type: text/x-diff Size: 10508 bytes Desc: not available URL: