Hello community, here is the log from the commit of package python-ldap for openSUSE:Factory checked in at 2012-06-10 20:19:01 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-ldap (Old) and /work/SRC/openSUSE:Factory/.python-ldap.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-ldap", Maintainer is "[email protected]" Changes: -------- --- /work/SRC/openSUSE:Factory/python-ldap/python-ldap.changes 2012-04-02 10:30:50.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-ldap.new/python-ldap.changes 2012-06-10 21:52:17.000000000 +0200 @@ -1,0 +2,5 @@ +Thu Jun 7 18:44:07 UTC 2012 - [email protected] + +- update to 2.4.10 + +------------------------------------------------------------------- Old: ---- python-ldap-2.4.9.tar.gz New: ---- python-ldap-2.4.10.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-ldap.spec ++++++ --- /var/tmp/diff_new_pack.wtA6hu/_old 2012-06-10 21:52:18.000000000 +0200 +++ /var/tmp/diff_new_pack.wtA6hu/_new 2012-06-10 21:52:18.000000000 +0200 @@ -17,7 +17,7 @@ Name: python-ldap -Version: 2.4.9 +Version: 2.4.10 Release: 1 Summary: Python LDAP interface License: SUSE-Public-Domain ++++++ python-ldap-2.4.9.tar.gz -> python-ldap-2.4.10.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-ldap-2.4.9/CHANGES new/python-ldap-2.4.10/CHANGES --- old/python-ldap-2.4.9/CHANGES 2012-03-14 20:55:33.000000000 +0100 +++ new/python-ldap-2.4.10/CHANGES 2012-06-07 20:39:42.000000000 +0200 @@ -1,4 +1,18 @@ ---------------------------------------------------------------- +Released 2.4.10 2012-06-07 + +Changes since 2.4.9: + +Lib/ +* ldapobject.ReconnectLDAPObject.reconnect() now preserves + order of options set with LDAPObject.set_option before. + This is needed e.g. for setting connection-specific TLS options. + +Demo/ +* Better version of Demo/pyasn1/syncrepl.py + (thanks to Ben Cooksley) + +---------------------------------------------------------------- Released 2.4.9 2012-03-14 Changes since 2.4.8: @@ -55,7 +69,7 @@ Installation: * defines for SASL and SSL in setup.cfg to be more friendly to Python setup tools (easy_install) - + Lib/ * Fixed typo in ldap.functions._ldap_function_call() which always released ldap._ldap_module_lock instead of local lock @@ -136,7 +150,7 @@ compliance with RFC 2589 (fix available for OpenLDAP ITS#6886) * New sub-module ldap.controls.sessiontrack implements request control as described in draft-wahl-ldap-session (needs pyasn1_modules) - + ---------------------------------------------------------------- Released 2.4.0 2011-06-02 @@ -490,7 +504,7 @@ * Switched back to old implementation of ldap.schema.tokenizer.split_tokens() since the new one had a bug which deletes the spaces from DESC -* ldap.INSUFFICIENT_ACCESS is now ignored in +* ldap.INSUFFICIENT_ACCESS is now ignored in ldap.ldapobject.LDAPObject.search_subschemasubentry_s() ---------------------------------------------------------------- @@ -1004,4 +1018,4 @@ ---------------------------------------------------------------- Released 1.10alpha3 2000-09-19 -$Id: CHANGES,v 1.288 2012/03/14 19:55:33 stroeder Exp $ +$Id: CHANGES,v 1.291 2012/06/07 18:38:47 stroeder Exp $ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-ldap-2.4.9/Demo/pyasn1/syncrepl.py new/python-ldap-2.4.10/Demo/pyasn1/syncrepl.py --- old/python-ldap-2.4.9/Demo/pyasn1/syncrepl.py 2011-10-26 21:41:49.000000000 +0200 +++ new/python-ldap-2.4.10/Demo/pyasn1/syncrepl.py 2012-06-07 20:39:43.000000000 +0200 @@ -1,93 +1,170 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- +""" +This script implements a syncrepl consumer which syncs data from an OpenLDAP +server to a local (shelve) database. + +Notes: + +The bound user needs read access to the attributes entryDN and entryCSN. + +This needs the following software: +Python +pyasn1 0.1.4+ +pyasn1-modules +python-ldap 2.4.10+ +""" + +# Import the python-ldap modules +import ldap,ldapurl +# Import specific classes from python-ldap +from ldap.ldapobject import ReconnectLDAPObject +from ldap.syncrepl import SyncreplConsumer + +# Import modules from Python standard lib +import shelve,signal,time,sys,logging + + +# Global state +watcher_running = True +ldap_connection = False + + +class SyncReplConsumer(ReconnectLDAPObject,SyncreplConsumer): + """ + Syncrepl Consumer interface + """ + + def __init__(self,db_path,*args,**kwargs): + # Initialise the LDAP Connection first + ldap.ldapobject.ReconnectLDAPObject.__init__(self, *args, **kwargs) + # Now prepare the data store + self.__data = shelve.open(db_path, 'c') + # We need this for later internal use + self.__presentUUIDs = dict() + + def __del__(self): + # Close the data store properly to avoid corruption + self.__data.close() -import sys,anydbm,getpass -import ldap,ldapurl,ldap.syncrepl - - -class DNSync(ldap.ldapobject.LDAPObject,ldap.syncrepl.SyncreplConsumer): - - def __init__(self, filename, *args, **kwargs): - ldap.ldapobject.LDAPObject.__init__(self, *args, **kwargs) - self.__db = anydbm.open(filename, 'c', 0640) - self.__presentUUIDs = {} + def syncrepl_get_cookie(self): + if 'cookie' in self.__data: + return self.__data['cookie'] def syncrepl_set_cookie(self,cookie): - self.__db['cookie'] = cookie - - def syncrepl_get_cookie(self): - if 'cookie' in self.__db: - return self.__db['cookie'] + self.__data['cookie'] = cookie - def syncrepl_delete(self, uuids): + def syncrepl_entry(self,dn,attributes,uuid): + # First we determine the type of change we have here (and store away the previous data for later if needed) + previous_attributes = dict() + if uuid in self.__data: + change_type = 'modify' + previous_attributes = self.__data[uuid] + else: + change_type = 'add' + # Now we store our knowledge of the existence of this entry (including the DN as an attribute for convenience) + attributes['dn'] = dn + self.__data[uuid] = attributes + # Debugging + print 'Detected', change_type, 'of entry:', dn + # If we have a cookie then this is not our first time being run, so it must be a change + if 'ldap_cookie' in self.__data: + self.perform_application_sync(dn, attributes, previous_attributes) + + def syncrepl_delete(self,uuids): + # Make sure we know about the UUID being deleted, just in case... + uuids = [uuid for uuid in uuids if uuid in self.__data] + # Delete all the UUID values we know of for uuid in uuids: - dn = self.__db[uuid] - print "delete %s" % dn - del self.__db[uuid] + print 'Detected deletion of entry:', self.__data[uuid]['dn'] + del self.__data[uuid] - def syncrepl_present(self, uuids, refreshDeletes=False): + def syncrepl_present(self,uuids,refreshDeletes=False): + # If we have not been given any UUID values, then we have recieved all the present controls... if uuids is None: + # We only do things if refreshDeletes is false as the syncrepl extension will call syncrepl_delete instead when it detects a delete notice if refreshDeletes is False: - nonpresent = [] - for uuid in self.__db.keys(): - if uuid == 'cookie': continue - if uuid in self.__presentUUIDs: continue - nonpresent.append(uuid) - self.syncrepl_delete(nonpresent) + deletedEntries = [uuid for uuid in self.__data.keys() if uuid not in self.__presentUUIDs and uuid != 'ldap_cookie'] + self.syncrepl_delete( deletedEntries ) + # Phase is now completed, reset the list self.__presentUUIDs = {} else: + # Note down all the UUIDs we have been sent for uuid in uuids: - self.__presentUUIDs[uuid] = True + self.__presentUUIDs[uuid] = True - def syncrepl_entry(self, dn, attrs, uuid): - if uuid in self.__db: - odn = self.__db[uuid] - if odn != dn: - print "moddn %s -> %s" % ( odn, dn ) - else: - print "modify %s" % self.__db[uuid] - else: - print "add %s" % dn - self.__db[uuid] = dn + def perform_application_sync(self,dn,attributes,previous_attributes): + print 'Performing application sync for:', dn + return True -try: - ldap_url = ldapurl.LDAPUrl(sys.argv[1]) - db_filename = sys.argv[2] -except IndexError,ValueError: - print 'Usage: syncrepl.py <LDAP URL> <DB filename>' - sys.exit(1) +# Shutdown handler +def commenceShutdown(signum, stack): + # Declare the needed global variables + global watcher_running, ldap_connection + print 'Shutting down!' -# Set debugging level -#ldap.set_option(ldap.OPT_DEBUG_LEVEL,255) -ldapmodule_trace_level = 2 -ldapmodule_trace_file = sys.stderr - -ldap_sync_conn = DNSync( - db_filename, - ldap_url.initializeUrl(), - trace_level=ldapmodule_trace_level, - trace_file=ldapmodule_trace_file -) - -if ldap_url.who and ldap_url.cred is None: - print 'Password for %s:' % (repr(ldap_url.who)) - ldap_url.cred = getpass.getpass() + # We are no longer running + watcher_running = False -try: - ldap_sync_conn.simple_bind_s(ldap_url.who or '',ldap_url.cred or '') + # Tear down the server connection + if( ldap_connection ): + del ldap_connection + + # Shutdown + sys.exit(0) + +# Time to actually begin execution +# Install our signal handlers +signal.signal(signal.SIGTERM,commenceShutdown) +signal.signal(signal.SIGINT,commenceShutdown) -except ldap.INVALID_CREDENTIALS,e: - print 'Simple bind failed:',str(e) - sys.exit(1) -msgid = ldap_sync_conn.syncrepl_search( - ldap_url.dn, - ldap_url.scope, - mode='refreshAndPersist', - filterstr=ldap_url.filterstr -) try: - while ldap_sync_conn.syncrepl_poll(all=1, msgid=msgid): + ldap_url = ldapurl.LDAPUrl(sys.argv[1]) + database_path = sys.argv[2] +except IndexError,e: + print 'Usage: syncrepl-client.py <LDAP URL> <pathname of database>' + sys.exit(1) +except ValueError,e: + print 'Error parsing command-line arguments:',str(e) + sys.exit(1) + +while watcher_running: + print 'Connecting to LDAP server now...' + # Prepare the LDAP server connection (triggers the connection as well) + ldap_connection = SyncReplConsumer(database_path,ldap_url.initializeUrl()) + + # Now we login to the LDAP server + try: + ldap_connection.simple_bind_s(ldap_url.who,ldap_url.cred) + except ldap.INVALID_CREDENTIALS, e: + print 'Login to LDAP server failed: ', str(e) + sys.exit(1) + except ldap.SERVER_DOWN: + print 'LDAP server is down, going to retry.' + time.sleep(5) + continue + + # Commence the syncing + print 'Commencing sync process' + ldap_search = ldap_connection.syncrepl_search( + ldap_url.dn or '', + ldap_url.scope or ldap.SCOPE_SUBTREE, + mode = 'refreshAndPersist', + filterstr = ldap_url.filterstr or '(objectClass=*)' + ) + + try: + while ldap_connection.syncrepl_poll( all = 1, msgid = ldap_search): + pass + except KeyboardInterrupt: + # User asked to exit + commenceShutdown() + pass + except Exception, e: + # Handle any exception + if watcher_running: + print 'Encountered a problem, going to retry. Error:', str(e) + time.sleep(5) pass -except KeyboardInterrupt: - pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-ldap-2.4.9/Lib/dsml.py new/python-ldap-2.4.10/Lib/dsml.py --- old/python-ldap-2.4.9/Lib/dsml.py 2012-03-14 20:53:40.000000000 +0100 +++ new/python-ldap-2.4.10/Lib/dsml.py 2012-06-07 20:41:12.000000000 +0200 @@ -4,13 +4,13 @@ See http://www.python-ldap.org/ for details. -$Id: dsml.py,v 1.26 2012/03/03 17:45:57 stroeder Exp $ +$Id: dsml.py,v 1.27 2012/06/07 18:40:59 stroeder Exp $ Python compability note: Tested with Python 2.0+. """ -__version__ = '2.4.9' +__version__ = '2.4.10' import string,base64 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-ldap-2.4.9/Lib/ldap/__init__.py new/python-ldap-2.4.10/Lib/ldap/__init__.py --- old/python-ldap-2.4.9/Lib/ldap/__init__.py 2012-03-14 20:53:41.000000000 +0100 +++ new/python-ldap-2.4.10/Lib/ldap/__init__.py 2012-06-07 20:41:12.000000000 +0200 @@ -3,12 +3,12 @@ See http://www.python-ldap.org/ for details. -$Id: __init__.py,v 1.82 2012/03/10 13:30:39 stroeder Exp $ +$Id: __init__.py,v 1.83 2012/06/07 18:40:59 stroeder Exp $ """ # This is also the overall release version number -__version__ = '2.4.9' +__version__ = '2.4.10' import sys diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-ldap-2.4.9/Lib/ldap/controls/__init__.py new/python-ldap-2.4.10/Lib/ldap/controls/__init__.py --- old/python-ldap-2.4.9/Lib/ldap/controls/__init__.py 2011-10-26 20:46:55.000000000 +0200 +++ new/python-ldap-2.4.10/Lib/ldap/controls/__init__.py 2012-06-07 20:39:43.000000000 +0200 @@ -4,7 +4,7 @@ See http://www.python-ldap.org/ for details. -$Id: __init__.py,v 1.6 2011/07/22 13:27:02 stroeder Exp $ +$Id: __init__.py,v 1.7 2012/04/11 13:31:01 stroeder Exp $ Description: The ldap.controls module provides LDAPControl classes. @@ -14,8 +14,7 @@ from ldap import __version__ __all__ = [ - # control OID to class registy - 'KNOWN_CONTROLS', + 'KNOWN_RESPONSE_CONTROLS', # Classes 'AssertionControl', 'BooleanControl', @@ -32,6 +31,7 @@ 'DecodeControlTuples', ] +# response control OID to class registry KNOWN_RESPONSE_CONTROLS = {} import _ldap,ldap diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-ldap-2.4.9/Lib/ldap/ldapobject.py new/python-ldap-2.4.10/Lib/ldap/ldapobject.py --- old/python-ldap-2.4.9/Lib/ldap/ldapobject.py 2012-03-14 20:53:41.000000000 +0100 +++ new/python-ldap-2.4.10/Lib/ldap/ldapobject.py 2012-06-07 20:39:43.000000000 +0200 @@ -3,7 +3,7 @@ See http://www.python-ldap.org/ for details. -\$Id: ldapobject.py,v 1.132 2012/03/13 19:23:03 stroeder Exp $ +\$Id: ldapobject.py,v 1.133 2012/06/02 10:23:15 stroeder Exp $ Compability: - Tested with Python 2.0+ but should work with Python 1.5.x @@ -726,7 +726,7 @@ Time span to wait between two reconnect trials """ self._uri = uri - self._options = {} + self._options = [] self._last_bind = None self._pending_reconnect = 0 SimpleLDAPObject.__init__(self,uri,trace_level,trace_file,trace_stack_limit) @@ -757,7 +757,7 @@ def _restore_options(self): """Restore all recorded options""" - for k,v in self._options.items(): + for k,v in self._options: SimpleLDAPObject.set_option(self,k,v) def reconnect(self,uri): @@ -819,7 +819,7 @@ return func(self,*args,**kwargs) def set_option(self,option,invalue): - self._options[option] = invalue + self._options.append((option,invalue)) return SimpleLDAPObject.set_option(self,option,invalue) def bind_s(self,*args,**kwargs): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-ldap-2.4.9/Lib/ldapurl.py new/python-ldap-2.4.10/Lib/ldapurl.py --- old/python-ldap-2.4.9/Lib/ldapurl.py 2012-03-14 20:53:40.000000000 +0100 +++ new/python-ldap-2.4.10/Lib/ldapurl.py 2012-06-07 20:41:12.000000000 +0200 @@ -3,7 +3,7 @@ See http://www.python-ldap.org/ for details. -\$Id: ldapurl.py,v 1.57 2012/03/03 17:45:57 stroeder Exp $ +\$Id: ldapurl.py,v 1.58 2012/06/07 18:40:59 stroeder Exp $ Python compability note: This module only works with Python 2.0+ since @@ -11,7 +11,7 @@ 2. list comprehensions are used. """ -__version__ = '2.4.9' +__version__ = '2.4.10' __all__ = [ # constants diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-ldap-2.4.9/Lib/ldif.py new/python-ldap-2.4.10/Lib/ldif.py --- old/python-ldap-2.4.9/Lib/ldif.py 2012-03-14 20:53:41.000000000 +0100 +++ new/python-ldap-2.4.10/Lib/ldif.py 2012-06-07 20:41:12.000000000 +0200 @@ -3,13 +3,13 @@ See http://www.python-ldap.org/ for details. -$Id: ldif.py,v 1.66 2012/03/03 17:45:57 stroeder Exp $ +$Id: ldif.py,v 1.67 2012/06/07 18:40:59 stroeder Exp $ Python compability note: Tested with Python 2.0+, but should work with Python 1.5.2+. """ -__version__ = '2.4.9' +__version__ = '2.4.10' __all__ = [ # constants diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-ldap-2.4.9/Lib/python_ldap.egg-info/PKG-INFO new/python-ldap-2.4.10/Lib/python_ldap.egg-info/PKG-INFO --- old/python-ldap-2.4.9/Lib/python_ldap.egg-info/PKG-INFO 2012-03-14 20:56:37.000000000 +0100 +++ new/python-ldap-2.4.10/Lib/python_ldap.egg-info/PKG-INFO 2012-06-07 20:41:33.000000000 +0200 @@ -1,6 +1,6 @@ -Metadata-Version: 1.0 +Metadata-Version: 1.1 Name: python-ldap -Version: 2.4.9 +Version: 2.4.10 Summary: Python modules for implementing LDAP clients Home-page: http://www.python-ldap.org/ Author: python-ldap project diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-ldap-2.4.9/PKG-INFO new/python-ldap-2.4.10/PKG-INFO --- old/python-ldap-2.4.9/PKG-INFO 2012-03-14 20:56:37.000000000 +0100 +++ new/python-ldap-2.4.10/PKG-INFO 2012-06-07 20:41:34.000000000 +0200 @@ -1,6 +1,6 @@ -Metadata-Version: 1.0 +Metadata-Version: 1.1 Name: python-ldap -Version: 2.4.9 +Version: 2.4.10 Summary: Python modules for implementing LDAP clients Home-page: http://www.python-ldap.org/ Author: python-ldap project -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
