From 7d16ba245c295ca7c2947620e77a9b1d7f82d66f Mon Sep 17 00:00:00 2001 From: stroeder Date: Wed, 9 Dec 2015 17:12:02 +0000 Subject: [PATCH 01/12] correct use of :c:func --- Doc/ldap.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/ldap.rst b/Doc/ldap.rst index ccb661a..4d6068e 100644 --- a/Doc/ldap.rst +++ b/Doc/ldap.rst @@ -1,4 +1,4 @@ -.. % $Id: ldap.rst,v 1.29 2015/11/19 05:16:46 stroeder Exp $ +.. % $Id: ldap.rst,v 1.30 2015/12/09 17:12:02 stroeder Exp $ ******************************************** :py:mod:`ldap` LDAP library interface module @@ -961,7 +961,7 @@ and wait for and return with the server's result, or with values are lists of strings. The DN in *dn* is automatically extracted using the underlying libldap - function :cfunc:`ldap_get_dn()`, which may raise an exception if the + function :c:func:`ldap_get_dn()`, which may raise an exception if the DN is malformed. If *attrsonly* is non-zero, the values of *attrs* will be meaningless From 7c569e3687d965d1ea0fb2719019195a876b071c Mon Sep 17 00:00:00 2001 From: stroeder Date: Wed, 9 Dec 2015 17:33:14 +0000 Subject: [PATCH 02/12] release 2.4.22: Use Sphinx' pyramid theme and set html_static_path --- Doc/conf.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/conf.py b/Doc/conf.py index 51fb9d5..e9e4833 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -11,7 +11,7 @@ # All configuration values have a default value; values that are commented out # serve to show the default value. # -# $Id: conf.py,v 1.22 2015/10/24 12:37:39 stroeder Exp $ +# $Id: conf.py,v 1.23 2015/12/09 17:33:14 stroeder Exp $ import sys @@ -44,7 +44,7 @@ copyright = '2008-2015, python-ldap project team' # The short X.Y version. version = '2.4' # The full version, including alpha/beta/rc tags. -release = '2.4.21.0' +release = '2.4.22.0' # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: @@ -76,12 +76,12 @@ pygments_style = 'sphinx' # The style sheet to use for HTML and HTML Help pages. A file of that name # must exist either in Sphinx' static/ path, or in one of the custom paths # given in html_static_path. -html_style = 'default.css' +html_style = 'pyramid.css' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['.static'] +html_static_path = ['/usr/lib/python2.7/site-packages/sphinx/themes/pyramid/static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. From 634079e79bc128c07752de36393f584eedc828ca Mon Sep 17 00:00:00 2001 From: stroeder Date: Wed, 9 Dec 2015 17:56:38 +0000 Subject: [PATCH 03/12] Replaced OpenLDAP version number 2.3 with 2.4 --- Doc/installing.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/installing.rst b/Doc/installing.rst index 475adcf..ace20b4 100644 --- a/Doc/installing.rst +++ b/Doc/installing.rst @@ -1,4 +1,4 @@ -.. % $Id: installing.rst,v 1.15 2011/07/24 19:00:53 stroeder Exp $ +.. % $Id: installing.rst,v 1.16 2015/12/09 17:56:38 stroeder Exp $ *********************** Building and installing @@ -95,14 +95,14 @@ Example The following example is for a full-featured build (including SSL and SASL support) of python-ldap with OpenLDAP installed in a different prefix directory -(here /opt/openldap-2.3) and SASL header files found in /usr/include/sasl. +(here /opt/openldap-2.4) and SASL header files found in /usr/include/sasl. Debugging symbols are preserved with compile option -g. :: [_ldap] - library_dirs = /opt/openldap-2.3/lib - include_dirs = /opt/openldap-2.3/include /usr/include/sasl + library_dirs = /opt/openldap-2.4/lib + include_dirs = /opt/openldap-2.4/include /usr/include/sasl extra_compile_args = -g extra_objects = From 507dcd6b7dbb93b7a9b150514a6fc1bd22ad32bb Mon Sep 17 00:00:00 2001 From: stroeder Date: Wed, 9 Dec 2015 17:57:18 +0000 Subject: [PATCH 04/12] Removed OpenLDAP version number, better links for I-Ds --- Doc/ldap-controls.rst | 8 ++++---- Doc/ldap.rst | 23 +++++++++++++++-------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/Doc/ldap-controls.rst b/Doc/ldap-controls.rst index 00266e6..f006bae 100644 --- a/Doc/ldap-controls.rst +++ b/Doc/ldap-controls.rst @@ -1,4 +1,4 @@ -.. % $Id: ldap-controls.rst,v 1.11 2012/08/09 07:19:30 stroeder Exp $ +.. % $Id: ldap-controls.rst,v 1.12 2015/12/09 17:57:18 stroeder Exp $ ********************************************************************* @@ -91,7 +91,7 @@ RFC or Internet-Draft is very helpful to understand the API. .. seealso:: - http://tools.ietf.org/draft/draft-zeilenga-ldap-relax/ + `draft-zeilenga-ldap-relax `_ .. autoclass:: ldap.controls.simple.ProxyAuthzControl :members: @@ -165,7 +165,7 @@ search. .. seealso:: - http://tools.ietf.org/html/draft-ietf-ldapext-psearch + `draft-ietf-ldapext-psearch `_ .. autoclass:: ldap.controls.psearch.PersistentSearchControl @@ -183,7 +183,7 @@ search. .. seealso:: - http://tools.ietf.org/html/draft-wahl-ldap-session + `draft-wahl-ldap-session `_ .. autoclass:: ldap.controls.sessiontrack.SessionTrackingControl diff --git a/Doc/ldap.rst b/Doc/ldap.rst index 4d6068e..70f15d3 100644 --- a/Doc/ldap.rst +++ b/Doc/ldap.rst @@ -1,4 +1,4 @@ -.. % $Id: ldap.rst,v 1.30 2015/12/09 17:12:02 stroeder Exp $ +.. % $Id: ldap.rst,v 1.31 2015/12/09 17:57:18 stroeder Exp $ ******************************************** :py:mod:`ldap` LDAP library interface module @@ -10,13 +10,20 @@ .. moduleauthor:: python-ldap project (see http://www.python-ldap.org/) -This module provides access to the LDAP (Lightweight Directory Access Protocol) -C API implemented in OpenLDAP 2.3 or newer. It is similar to the C API, with -the notable differences that lists are manipulated via Python list operations -and errors appear as exceptions. For far more detailed information on the C -interface, please see the (expired) draft-ietf-ldapext-ldap-c-api-04. This -documentation is current for the Python LDAP module, version |release|. Source -and binaries are available from http://www.python-ldap.org/. +This module provides access to the LDAP (Lightweight Directory Access Protocol) +C API implemented in OpenLDAP. It is similar to the C API, with +the notable differences that lists are manipulated via Python list operations +and errors appear as exceptions. + + .. seealso:: + + For more detailed information on the C interface, please see the (expired) + `draft-ietf-ldapext-ldap-c-api `_ + + +This documentation is current for the Python LDAP module, version +|release|. Source and binaries are available from +http://www.python-ldap.org/. Functions From be777af099c2f40aaa8fda5fe59c80b552837097 Mon Sep 17 00:00:00 2001 From: stroeder Date: Sat, 16 Jan 2016 19:00:08 +0000 Subject: [PATCH 05/12] Missing items for 2.4.22 --- CHANGES | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index cf8757a..667ca07 100644 --- a/CHANGES +++ b/CHANGES @@ -12,9 +12,9 @@ Lib/ * Hmmpf! Added missing self to LDAPObject.fileno(). * ReconnectLDAPObject.sasl_bind_s() now correctly uses generic wrapper arguments *args,**kwargs -* LDIFParser.parse_change_records() now correctly calls - LDIFParser.handle_change_modify() -* Corrected ldap.controls.pwdpolicy.__all__ +* Correct method name LDIFParser.handle_modify() +* Corrected __all__ in modules ldap.controls.pwdpolicy and + ldap.controls.openldap Doc/ * Started missing docs for sub-module ldap.sasl. @@ -1216,4 +1216,4 @@ Released 2.0.0pre02 2002-02-01 ---------------------------------------------------------------- Released 1.10alpha3 2000-09-19 -$Id: CHANGES,v 1.363 2015/10/24 15:55:07 stroeder Exp $ +$Id: CHANGES,v 1.364 2016/01/16 19:00:08 stroeder Exp $ From a2cf4c134b519930dd3f07854dce48f9eb321eaa Mon Sep 17 00:00:00 2001 From: stroeder Date: Sat, 16 Jan 2016 19:00:47 +0000 Subject: [PATCH 06/12] Started 2.4.23 --- CHANGES | 10 +++++++++- Lib/dsml.py | 4 ++-- Lib/ldap/__init__.py | 4 ++-- Lib/ldapurl.py | 4 ++-- Lib/ldif.py | 4 ++-- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/CHANGES b/CHANGES index 667ca07..c52b403 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,11 @@ +---------------------------------------------------------------- +Released 2.4.23 2016-01-xx + +Changes since 2.4.22: + +Modules/ +* + ---------------------------------------------------------------- Released 2.4.22 2015-10-25 @@ -1216,4 +1224,4 @@ Released 2.0.0pre02 2002-02-01 ---------------------------------------------------------------- Released 1.10alpha3 2000-09-19 -$Id: CHANGES,v 1.364 2016/01/16 19:00:08 stroeder Exp $ +$Id: CHANGES,v 1.365 2016/01/16 19:00:47 stroeder Exp $ diff --git a/Lib/dsml.py b/Lib/dsml.py index 6db30c8..007ca48 100644 --- a/Lib/dsml.py +++ b/Lib/dsml.py @@ -4,13 +4,13 @@ dsml - generate and parse DSMLv1 data See http://www.python-ldap.org/ for details. -$Id: dsml.py,v 1.39 2015/09/30 17:15:53 stroeder Exp $ +$Id: dsml.py,v 1.40 2016/01/16 19:00:47 stroeder Exp $ Python compability note: Tested with Python 2.0+. """ -__version__ = '2.4.22' +__version__ = '2.4.23' import string,base64 diff --git a/Lib/ldap/__init__.py b/Lib/ldap/__init__.py index cecec33..b453dfd 100644 --- a/Lib/ldap/__init__.py +++ b/Lib/ldap/__init__.py @@ -3,12 +3,12 @@ ldap - base module See http://www.python-ldap.org/ for details. -$Id: __init__.py,v 1.99 2015/09/30 17:15:53 stroeder Exp $ +$Id: __init__.py,v 1.100 2016/01/16 19:00:47 stroeder Exp $ """ # This is also the overall release version number -__version__ = '2.4.22' +__version__ = '2.4.23' import sys diff --git a/Lib/ldapurl.py b/Lib/ldapurl.py index e5bf13d..36a26f8 100644 --- a/Lib/ldapurl.py +++ b/Lib/ldapurl.py @@ -3,7 +3,7 @@ ldapurl - handling of LDAP URLs as described in RFC 4516 See http://www.python-ldap.org/ for details. -\$Id: ldapurl.py,v 1.74 2015/09/30 17:15:53 stroeder Exp $ +\$Id: ldapurl.py,v 1.75 2016/01/16 19:00:47 stroeder Exp $ Python compability note: This module only works with Python 2.0+ since @@ -11,7 +11,7 @@ This module only works with Python 2.0+ since 2. list comprehensions are used. """ -__version__ = '2.4.22' +__version__ = '2.4.23' __all__ = [ # constants diff --git a/Lib/ldif.py b/Lib/ldif.py index 5145190..1739394 100644 --- a/Lib/ldif.py +++ b/Lib/ldif.py @@ -3,13 +3,13 @@ ldif - generate and parse LDIF data (see RFC 2849) See http://www.python-ldap.org/ for details. -$Id: ldif.py,v 1.87 2015/10/24 16:12:31 stroeder Exp $ +$Id: ldif.py,v 1.88 2016/01/16 19:00:47 stroeder Exp $ Python compability note: Tested with Python 2.0+, but should work with Python 1.5.2+. """ -__version__ = '2.4.22' +__version__ = '2.4.23' __all__ = [ # constants From 1cf5326eb1211075684a0d900cfe2fd27c76f755 Mon Sep 17 00:00:00 2001 From: stroeder Date: Sat, 16 Jan 2016 19:08:34 +0000 Subject: [PATCH 07/12] Ref count issue in attrs_from_List() was fixed (thanks to Elmir Jagudin) --- CHANGES | 5 ++-- Modules/LDAPObject.c | 64 +++++++++++++++++++++++--------------------- 2 files changed, 37 insertions(+), 32 deletions(-) diff --git a/CHANGES b/CHANGES index c52b403..1137836 100644 --- a/CHANGES +++ b/CHANGES @@ -4,7 +4,8 @@ Released 2.4.23 2016-01-xx Changes since 2.4.22: Modules/ -* +* Ref count issue in attrs_from_List() was fixed + (thanks to Elmir Jagudin) ---------------------------------------------------------------- Released 2.4.22 2015-10-25 @@ -1224,4 +1225,4 @@ Released 2.0.0pre02 2002-02-01 ---------------------------------------------------------------- Released 1.10alpha3 2000-09-19 -$Id: CHANGES,v 1.365 2016/01/16 19:00:47 stroeder Exp $ +$Id: CHANGES,v 1.366 2016/01/16 19:08:34 stroeder Exp $ diff --git a/Modules/LDAPObject.c b/Modules/LDAPObject.c index eddd7e1..b8c4795 100644 --- a/Modules/LDAPObject.c +++ b/Modules/LDAPObject.c @@ -1,5 +1,5 @@ /* See http://www.python-ldap.org/ for details. - * $Id: LDAPObject.c,v 1.91 2015/05/02 16:19:23 stroeder Exp $ */ + * $Id: LDAPObject.c,v 1.92 2016/01/16 19:08:34 stroeder Exp $ */ #include "common.h" #include "patchlevel.h" @@ -18,7 +18,7 @@ #include #endif -static void free_attrs(char***); +static void free_attrs(char***, PyObject*); /* constructor */ @@ -252,16 +252,17 @@ error: /* * convert a python list of strings into an attr list (char*[]). * returns 1 if successful, 0 if not (with exception set) - * XXX the strings should live longer than the resulting attrs pointer. */ int -attrs_from_List( PyObject *attrlist, char***attrsp ) { +attrs_from_List( PyObject *attrlist, char***attrsp, PyObject** seq) { char **attrs = NULL; Py_ssize_t i, len; PyObject *item; + *seq = NULL; + if (attrlist == Py_None) { /* None means a NULL attrlist */ } else if (PyString_Check(attrlist)) { @@ -269,32 +270,32 @@ attrs_from_List( PyObject *attrlist, char***attrsp ) { PyErr_SetObject( PyExc_TypeError, Py_BuildValue("sO", "expected *list* of strings, not a string", attrlist )); goto error; - } else if (PySequence_Check(attrlist)) { - len = PySequence_Length(attrlist); - attrs = PyMem_NEW(char *, len + 1); - if (attrs == NULL) + } + + *seq = PySequence_Fast(attrlist, "expected list of strings or None"); + + if (*seq == NULL) + goto error; + len = PySequence_Length(attrlist); + + attrs = PyMem_NEW(char *, len + 1); + if (attrs == NULL) goto nomem; - for (i = 0; i < len; i++) { - attrs[i] = NULL; - item = PySequence_GetItem(attrlist, i); - if (item == NULL) - goto error; - if (!PyString_Check(item)) { - PyErr_SetObject(PyExc_TypeError, Py_BuildValue("sO", - "expected string in list", item)); - Py_DECREF(item); - goto error; - } - attrs[i] = PyString_AsString(item); - Py_DECREF(item); + + for (i = 0; i < len; i++) { + attrs[i] = NULL; + item = PySequence_Fast_GET_ITEM(*seq, i); + if (item == NULL) + goto error; + if (!PyString_Check(item)) { + PyErr_SetObject(PyExc_TypeError, Py_BuildValue("sO", + "expected string in list", item)); + goto error; } - attrs[len] = NULL; - } else { - PyErr_SetObject( PyExc_TypeError, Py_BuildValue("sO", - "expected list of strings or None", attrlist )); - goto error; + attrs[i] = PyString_AsString(item); } + attrs[len] = NULL; *attrsp = attrs; return 1; @@ -302,20 +303,22 @@ attrs_from_List( PyObject *attrlist, char***attrsp ) { nomem: PyErr_NoMemory(); error: - free_attrs(&attrs); + free_attrs(&attrs, *seq); return 0; } /* free memory allocated from above routine */ static void -free_attrs( char*** attrsp ) { +free_attrs( char*** attrsp, PyObject* seq ) { char **attrs = *attrsp; if (attrs != NULL) { PyMem_DEL(attrs); *attrsp = NULL; } + + Py_XDECREF(seq); } /*------------------------------------------------------------ @@ -1107,6 +1110,7 @@ l_ldap_search_ext( LDAPObject* self, PyObject* args ) PyObject *serverctrls = Py_None; PyObject *clientctrls = Py_None; + PyObject *attrs_seq = NULL; LDAPControl** server_ldcs = NULL; LDAPControl** client_ldcs = NULL; @@ -1124,7 +1128,7 @@ l_ldap_search_ext( LDAPObject* self, PyObject* args ) &serverctrls, &clientctrls, &timeout, &sizelimit )) return NULL; if (not_valid(self)) return NULL; - if (!attrs_from_List( attrlist, &attrs )) + if (!attrs_from_List( attrlist, &attrs, &attrs_seq )) return NULL; if (timeout >= 0) { @@ -1149,7 +1153,7 @@ l_ldap_search_ext( LDAPObject* self, PyObject* args ) server_ldcs, client_ldcs, tvp, sizelimit, &msgid ); LDAP_END_ALLOW_THREADS( self ); - free_attrs( &attrs ); + free_attrs( &attrs, attrs_seq); LDAPControl_List_DEL( server_ldcs ); LDAPControl_List_DEL( client_ldcs ); From 861529790c2ca69cf282c29f84e0e43ce501073e Mon Sep 17 00:00:00 2001 From: stroeder Date: Sun, 17 Jan 2016 20:29:41 +0000 Subject: [PATCH 08/12] Started 2.4.24 --- CHANGES | 9 +++++++-- Lib/dsml.py | 4 ++-- Lib/ldap/__init__.py | 4 ++-- Lib/ldapurl.py | 4 ++-- Lib/ldif.py | 4 ++-- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CHANGES b/CHANGES index 1137836..8bc3f96 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,10 @@ ---------------------------------------------------------------- -Released 2.4.23 2016-01-xx +Released 2.4.24 2016-01-18 + +Changes since 2.4.23: + +---------------------------------------------------------------- +Released 2.4.23 2016-01-17 Changes since 2.4.22: @@ -1225,4 +1230,4 @@ Released 2.0.0pre02 2002-02-01 ---------------------------------------------------------------- Released 1.10alpha3 2000-09-19 -$Id: CHANGES,v 1.366 2016/01/16 19:08:34 stroeder Exp $ +$Id: CHANGES,v 1.367 2016/01/17 20:30:43 stroeder Exp $ diff --git a/Lib/dsml.py b/Lib/dsml.py index 007ca48..e056016 100644 --- a/Lib/dsml.py +++ b/Lib/dsml.py @@ -4,13 +4,13 @@ dsml - generate and parse DSMLv1 data See http://www.python-ldap.org/ for details. -$Id: dsml.py,v 1.40 2016/01/16 19:00:47 stroeder Exp $ +$Id: dsml.py,v 1.41 2016/01/17 20:29:41 stroeder Exp $ Python compability note: Tested with Python 2.0+. """ -__version__ = '2.4.23' +__version__ = '2.4.24' import string,base64 diff --git a/Lib/ldap/__init__.py b/Lib/ldap/__init__.py index b453dfd..5b0ddaf 100644 --- a/Lib/ldap/__init__.py +++ b/Lib/ldap/__init__.py @@ -3,12 +3,12 @@ ldap - base module See http://www.python-ldap.org/ for details. -$Id: __init__.py,v 1.100 2016/01/16 19:00:47 stroeder Exp $ +$Id: __init__.py,v 1.101 2016/01/17 20:29:41 stroeder Exp $ """ # This is also the overall release version number -__version__ = '2.4.23' +__version__ = '2.4.24' import sys diff --git a/Lib/ldapurl.py b/Lib/ldapurl.py index 36a26f8..2485867 100644 --- a/Lib/ldapurl.py +++ b/Lib/ldapurl.py @@ -3,7 +3,7 @@ ldapurl - handling of LDAP URLs as described in RFC 4516 See http://www.python-ldap.org/ for details. -\$Id: ldapurl.py,v 1.75 2016/01/16 19:00:47 stroeder Exp $ +\$Id: ldapurl.py,v 1.76 2016/01/17 20:29:41 stroeder Exp $ Python compability note: This module only works with Python 2.0+ since @@ -11,7 +11,7 @@ This module only works with Python 2.0+ since 2. list comprehensions are used. """ -__version__ = '2.4.23' +__version__ = '2.4.24' __all__ = [ # constants diff --git a/Lib/ldif.py b/Lib/ldif.py index 1739394..183394a 100644 --- a/Lib/ldif.py +++ b/Lib/ldif.py @@ -3,13 +3,13 @@ ldif - generate and parse LDIF data (see RFC 2849) See http://www.python-ldap.org/ for details. -$Id: ldif.py,v 1.88 2016/01/16 19:00:47 stroeder Exp $ +$Id: ldif.py,v 1.89 2016/01/17 20:29:41 stroeder Exp $ Python compability note: Tested with Python 2.0+, but should work with Python 1.5.2+. """ -__version__ = '2.4.23' +__version__ = '2.4.24' __all__ = [ # constants From 1d4bdc5b88581567f7d0961fd7906861a8637fed Mon Sep 17 00:00:00 2001 From: stroeder Date: Sun, 17 Jan 2016 20:31:54 +0000 Subject: [PATCH 09/12] Work-around for attrlist=None regression introduced in 2.4.23 by ref count patch --- CHANGES | 6 +++++- Lib/ldap/ldapobject.py | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 8bc3f96..198578a 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,10 @@ Released 2.4.24 2016-01-18 Changes since 2.4.23: +Lib/ +* Work-around for attrlist=None regression introduced in 2.4.23 + by ref count patch + ---------------------------------------------------------------- Released 2.4.23 2016-01-17 @@ -1230,4 +1234,4 @@ Released 2.0.0pre02 2002-02-01 ---------------------------------------------------------------- Released 1.10alpha3 2000-09-19 -$Id: CHANGES,v 1.367 2016/01/17 20:30:43 stroeder Exp $ +$Id: CHANGES,v 1.368 2016/01/17 20:31:54 stroeder Exp $ diff --git a/Lib/ldap/ldapobject.py b/Lib/ldap/ldapobject.py index 8205bd4..e8e0b5d 100644 --- a/Lib/ldap/ldapobject.py +++ b/Lib/ldap/ldapobject.py @@ -3,7 +3,7 @@ ldapobject.py - wraps class _ldap.LDAPObject See http://www.python-ldap.org/ for details. -\$Id: ldapobject.py,v 1.149 2015/10/24 15:46:12 stroeder Exp $ +\$Id: ldapobject.py,v 1.150 2016/01/17 20:31:54 stroeder Exp $ Compability: - Tested with Python 2.0+ but should work with Python 1.5.x @@ -580,7 +580,7 @@ class SimpleLDAPObject: return self._ldap_call( self._l.search_ext, base,scope,filterstr, - attrlist,attrsonly, + attrlist or [],attrsonly, RequestControlTuples(serverctrls), RequestControlTuples(clientctrls), timeout,sizelimit, From 6bc49775e8e7adfcc72f003a47353f89dd941a20 Mon Sep 17 00:00:00 2001 From: stroeder Date: Mon, 18 Jan 2016 10:38:26 +0000 Subject: [PATCH 10/12] Real fix for attrlist=None regression introduced in 2.4.23 by ref count patch --- CHANGES | 4 ++-- Lib/ldap/ldapobject.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 198578a..b712599 100644 --- a/CHANGES +++ b/CHANGES @@ -4,7 +4,7 @@ Released 2.4.24 2016-01-18 Changes since 2.4.23: Lib/ -* Work-around for attrlist=None regression introduced in 2.4.23 +* Fix for attrlist=None regression introduced in 2.4.23 by ref count patch ---------------------------------------------------------------- @@ -1234,4 +1234,4 @@ Released 2.0.0pre02 2002-02-01 ---------------------------------------------------------------- Released 1.10alpha3 2000-09-19 -$Id: CHANGES,v 1.368 2016/01/17 20:31:54 stroeder Exp $ +$Id: CHANGES,v 1.369 2016/01/18 10:38:26 stroeder Exp $ diff --git a/Lib/ldap/ldapobject.py b/Lib/ldap/ldapobject.py index e8e0b5d..76b5c70 100644 --- a/Lib/ldap/ldapobject.py +++ b/Lib/ldap/ldapobject.py @@ -3,7 +3,7 @@ ldapobject.py - wraps class _ldap.LDAPObject See http://www.python-ldap.org/ for details. -\$Id: ldapobject.py,v 1.150 2016/01/17 20:31:54 stroeder Exp $ +\$Id: ldapobject.py,v 1.151 2016/01/18 10:38:26 stroeder Exp $ Compability: - Tested with Python 2.0+ but should work with Python 1.5.x @@ -580,7 +580,7 @@ class SimpleLDAPObject: return self._ldap_call( self._l.search_ext, base,scope,filterstr, - attrlist or [],attrsonly, + attrlist,attrsonly, RequestControlTuples(serverctrls), RequestControlTuples(clientctrls), timeout,sizelimit, From ad35a27f6192e67449b8bbd3f0d2cc67beddca73 Mon Sep 17 00:00:00 2001 From: stroeder Date: Mon, 18 Jan 2016 12:33:07 +0000 Subject: [PATCH 11/12] Real fix for attrlist=None regression introduced in 2.4.23 by ref count patch --- Modules/LDAPObject.c | 47 ++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/Modules/LDAPObject.c b/Modules/LDAPObject.c index b8c4795..725ab37 100644 --- a/Modules/LDAPObject.c +++ b/Modules/LDAPObject.c @@ -1,5 +1,5 @@ /* See http://www.python-ldap.org/ for details. - * $Id: LDAPObject.c,v 1.92 2016/01/16 19:08:34 stroeder Exp $ */ + * $Id: LDAPObject.c,v 1.93 2016/01/18 12:33:07 stroeder Exp $ */ #include "common.h" #include "patchlevel.h" @@ -270,32 +270,31 @@ attrs_from_List( PyObject *attrlist, char***attrsp, PyObject** seq) { PyErr_SetObject( PyExc_TypeError, Py_BuildValue("sO", "expected *list* of strings, not a string", attrlist )); goto error; - } - - *seq = PySequence_Fast(attrlist, "expected list of strings or None"); - - if (*seq == NULL) - goto error; - len = PySequence_Length(attrlist); - - attrs = PyMem_NEW(char *, len + 1); - if (attrs == NULL) - goto nomem; - - - for (i = 0; i < len; i++) { - attrs[i] = NULL; - item = PySequence_Fast_GET_ITEM(*seq, i); - if (item == NULL) - goto error; - if (!PyString_Check(item)) { - PyErr_SetObject(PyExc_TypeError, Py_BuildValue("sO", - "expected string in list", item)); + } else { + *seq = PySequence_Fast(attrlist, "expected list of strings or None"); + if (*seq == NULL) goto error; + + len = PySequence_Length(attrlist); + + attrs = PyMem_NEW(char *, len + 1); + if (attrs == NULL) + goto nomem; + + for (i = 0; i < len; i++) { + attrs[i] = NULL; + item = PySequence_Fast_GET_ITEM(*seq, i); + if (item == NULL) + goto error; + if (!PyString_Check(item)) { + PyErr_SetObject(PyExc_TypeError, Py_BuildValue("sO", + "expected string in list", item)); + goto error; + } + attrs[i] = PyString_AsString(item); } - attrs[i] = PyString_AsString(item); + attrs[len] = NULL; } - attrs[len] = NULL; *attrsp = attrs; return 1; From e1c8ad032094cff9f357c792119af3a63843d3c5 Mon Sep 17 00:00:00 2001 From: stroeder Date: Mon, 18 Jan 2016 15:16:29 +0000 Subject: [PATCH 12/12] Prepare release 2.4.25 --- CHANGES | 5 +++-- Lib/dsml.py | 4 ++-- Lib/ldap/__init__.py | 4 ++-- Lib/ldapurl.py | 4 ++-- Lib/ldif.py | 4 ++-- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CHANGES b/CHANGES index b712599..53df95a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,7 +1,8 @@ ---------------------------------------------------------------- -Released 2.4.24 2016-01-18 +Released 2.4.25 2016-01-18 Changes since 2.4.23: +(2.4.24 is missing because of foolish pypi version madness) Lib/ * Fix for attrlist=None regression introduced in 2.4.23 @@ -1234,4 +1235,4 @@ Released 2.0.0pre02 2002-02-01 ---------------------------------------------------------------- Released 1.10alpha3 2000-09-19 -$Id: CHANGES,v 1.369 2016/01/18 10:38:26 stroeder Exp $ +$Id: CHANGES,v 1.370 2016/01/18 15:16:29 stroeder Exp $ diff --git a/Lib/dsml.py b/Lib/dsml.py index e056016..5961931 100644 --- a/Lib/dsml.py +++ b/Lib/dsml.py @@ -4,13 +4,13 @@ dsml - generate and parse DSMLv1 data See http://www.python-ldap.org/ for details. -$Id: dsml.py,v 1.41 2016/01/17 20:29:41 stroeder Exp $ +$Id: dsml.py,v 1.42 2016/01/18 15:16:29 stroeder Exp $ Python compability note: Tested with Python 2.0+. """ -__version__ = '2.4.24' +__version__ = '2.4.25' import string,base64 diff --git a/Lib/ldap/__init__.py b/Lib/ldap/__init__.py index 5b0ddaf..2b5f438 100644 --- a/Lib/ldap/__init__.py +++ b/Lib/ldap/__init__.py @@ -3,12 +3,12 @@ ldap - base module See http://www.python-ldap.org/ for details. -$Id: __init__.py,v 1.101 2016/01/17 20:29:41 stroeder Exp $ +$Id: __init__.py,v 1.102 2016/01/18 15:17:30 stroeder Exp $ """ # This is also the overall release version number -__version__ = '2.4.24' +__version__ = '2.4.25' import sys diff --git a/Lib/ldapurl.py b/Lib/ldapurl.py index 2485867..b41173f 100644 --- a/Lib/ldapurl.py +++ b/Lib/ldapurl.py @@ -3,7 +3,7 @@ ldapurl - handling of LDAP URLs as described in RFC 4516 See http://www.python-ldap.org/ for details. -\$Id: ldapurl.py,v 1.76 2016/01/17 20:29:41 stroeder Exp $ +\$Id: ldapurl.py,v 1.77 2016/01/18 15:16:29 stroeder Exp $ Python compability note: This module only works with Python 2.0+ since @@ -11,7 +11,7 @@ This module only works with Python 2.0+ since 2. list comprehensions are used. """ -__version__ = '2.4.24' +__version__ = '2.4.25' __all__ = [ # constants diff --git a/Lib/ldif.py b/Lib/ldif.py index 183394a..6ef97cd 100644 --- a/Lib/ldif.py +++ b/Lib/ldif.py @@ -3,13 +3,13 @@ ldif - generate and parse LDIF data (see RFC 2849) See http://www.python-ldap.org/ for details. -$Id: ldif.py,v 1.89 2016/01/17 20:29:41 stroeder Exp $ +$Id: ldif.py,v 1.90 2016/01/18 15:16:29 stroeder Exp $ Python compability note: Tested with Python 2.0+, but should work with Python 1.5.2+. """ -__version__ = '2.4.24' +__version__ = '2.4.25' __all__ = [ # constants