Merge from CVS

This commit is contained in:
Petr Viktorin 2016-01-21 15:46:46 +01:00
commit 29951f3723
11 changed files with 80 additions and 51 deletions

27
CHANGES
View File

@ -1,3 +1,22 @@
----------------------------------------------------------------
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
by ref count patch
----------------------------------------------------------------
Released 2.4.23 2016-01-17
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 Released 2.4.22 2015-10-25
@ -12,9 +31,9 @@ Lib/
* Hmmpf! Added missing self to LDAPObject.fileno(). * Hmmpf! Added missing self to LDAPObject.fileno().
* ReconnectLDAPObject.sasl_bind_s() now correctly uses * ReconnectLDAPObject.sasl_bind_s() now correctly uses
generic wrapper arguments *args,**kwargs generic wrapper arguments *args,**kwargs
* LDIFParser.parse_change_records() now correctly calls * Correct method name LDIFParser.handle_modify()
LDIFParser.handle_change_modify() * Corrected __all__ in modules ldap.controls.pwdpolicy and
* Corrected ldap.controls.pwdpolicy.__all__ ldap.controls.openldap
Doc/ Doc/
* Started missing docs for sub-module ldap.sasl. * Started missing docs for sub-module ldap.sasl.
@ -1216,4 +1235,4 @@ Released 2.0.0pre02 2002-02-01
---------------------------------------------------------------- ----------------------------------------------------------------
Released 1.10alpha3 2000-09-19 Released 1.10alpha3 2000-09-19
$Id: CHANGES,v 1.363 2015/10/24 15:55:07 stroeder Exp $ $Id: CHANGES,v 1.370 2016/01/18 15:16:29 stroeder Exp $

View File

@ -11,7 +11,7 @@
# All configuration values have a default value; values that are commented out # All configuration values have a default value; values that are commented out
# serve to show the default value. # 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 import sys
@ -44,7 +44,7 @@ copyright = '2008-2015, python-ldap project team'
# The short X.Y version. # The short X.Y version.
version = '2.4' version = '2.4'
# The full version, including alpha/beta/rc tags. # 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 # There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used: # 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 # 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 # must exist either in Sphinx' static/ path, or in one of the custom paths
# given in html_static_path. # 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, # 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, # relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css". # 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, # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format. # using the given strftime format.

View File

@ -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 Building and installing
@ -95,14 +95,14 @@ Example
The following example is for a full-featured build (including SSL and SASL support) 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 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. Debugging symbols are preserved with compile option -g.
:: ::
[_ldap] [_ldap]
library_dirs = /opt/openldap-2.3/lib library_dirs = /opt/openldap-2.4/lib
include_dirs = /opt/openldap-2.3/include /usr/include/sasl include_dirs = /opt/openldap-2.4/include /usr/include/sasl
extra_compile_args = -g extra_compile_args = -g
extra_objects = extra_objects =

View File

@ -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:: .. seealso::
http://tools.ietf.org/draft/draft-zeilenga-ldap-relax/ `draft-zeilenga-ldap-relax <https://tools.ietf.org/html/draft-zeilenga-ldap-relax>`_
.. autoclass:: ldap.controls.simple.ProxyAuthzControl .. autoclass:: ldap.controls.simple.ProxyAuthzControl
:members: :members:
@ -165,7 +165,7 @@ search.
.. seealso:: .. seealso::
http://tools.ietf.org/html/draft-ietf-ldapext-psearch `draft-ietf-ldapext-psearch <https://tools.ietf.org/html/draft-ietf-ldapext-psearch>`_
.. autoclass:: ldap.controls.psearch.PersistentSearchControl .. autoclass:: ldap.controls.psearch.PersistentSearchControl
@ -183,7 +183,7 @@ search.
.. seealso:: .. seealso::
http://tools.ietf.org/html/draft-wahl-ldap-session `draft-wahl-ldap-session <https://tools.ietf.org/html/draft-wahl-ldap-session>`_
.. autoclass:: ldap.controls.sessiontrack.SessionTrackingControl .. autoclass:: ldap.controls.sessiontrack.SessionTrackingControl

View File

@ -1,4 +1,4 @@
.. % $Id: ldap.rst,v 1.29 2015/11/19 05:16:46 stroeder Exp $ .. % $Id: ldap.rst,v 1.31 2015/12/09 17:57:18 stroeder Exp $
******************************************** ********************************************
:py:mod:`ldap` LDAP library interface module :py:mod:`ldap` LDAP library interface module
@ -10,13 +10,20 @@
.. moduleauthor:: python-ldap project (see http://www.python-ldap.org/) .. moduleauthor:: python-ldap project (see http://www.python-ldap.org/)
This module provides access to the LDAP (Lightweight Directory Access Protocol) 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 C API implemented in OpenLDAP. It is similar to the C API, with
the notable differences that lists are manipulated via Python list operations the notable differences that lists are manipulated via Python list operations
and errors appear as exceptions. For far more detailed information on the C and errors appear as exceptions.
interface, please see the (expired) draft-ietf-ldapext-ldap-c-api-04. This
documentation is current for the Python LDAP module, version |release|. Source .. seealso::
and binaries are available from http://www.python-ldap.org/.
For more detailed information on the C interface, please see the (expired)
`draft-ietf-ldapext-ldap-c-api <https://tools.ietf.org/html/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 Functions
@ -961,7 +968,7 @@ and wait for and return with the server's result, or with
values are lists of strings. values are lists of strings.
The DN in *dn* is automatically extracted using the underlying libldap 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. DN is malformed.
If *attrsonly* is non-zero, the values of *attrs* will be meaningless If *attrsonly* is non-zero, the values of *attrs* will be meaningless

View File

@ -4,13 +4,13 @@ dsml - generate and parse DSMLv1 data
See http://www.python-ldap.org/ for details. 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.42 2016/01/18 15:16:29 stroeder Exp $
Python compability note: Python compability note:
Tested with Python 2.0+. Tested with Python 2.0+.
""" """
__version__ = '2.4.22' __version__ = '2.4.25'
import string,base64 import string,base64

View File

@ -3,12 +3,12 @@ ldap - base module
See http://www.python-ldap.org/ for details. 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.102 2016/01/18 15:17:30 stroeder Exp $
""" """
# This is also the overall release version number # This is also the overall release version number
__version__ = '2.4.22' __version__ = '2.4.25'
import sys import sys

View File

@ -3,7 +3,7 @@ ldapobject.py - wraps class _ldap.LDAPObject
See http://www.python-ldap.org/ for details. 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.151 2016/01/18 10:38:26 stroeder Exp $
Compability: Compability:
- Tested with Python 2.0+ but should work with Python 1.5.x - Tested with Python 2.0+ but should work with Python 1.5.x

View File

@ -3,7 +3,7 @@ ldapurl - handling of LDAP URLs as described in RFC 4516
See http://www.python-ldap.org/ for details. 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.77 2016/01/18 15:16:29 stroeder Exp $
Python compability note: Python compability note:
This module only works with Python 2.0+ since 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. 2. list comprehensions are used.
""" """
__version__ = '2.4.22' __version__ = '2.4.25'
__all__ = [ __all__ = [
# constants # constants

View File

@ -3,13 +3,13 @@ ldif - generate and parse LDIF data (see RFC 2849)
See http://www.python-ldap.org/ for details. 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.90 2016/01/18 15:16:29 stroeder Exp $
Python compability note: Python compability note:
Tested with Python 2.0+, but should work with Python 1.5.2+. Tested with Python 2.0+, but should work with Python 1.5.2+.
""" """
__version__ = '2.4.22' __version__ = '2.4.25'
__all__ = [ __all__ = [
# constants # constants

View File

@ -1,5 +1,5 @@
/* See http://www.python-ldap.org/ for details. /* 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.93 2016/01/18 12:33:07 stroeder Exp $ */
#include "common.h" #include "common.h"
#include "patchlevel.h" #include "patchlevel.h"
@ -18,7 +18,7 @@
#include <sasl.h> #include <sasl.h>
#endif #endif
static void free_attrs(char***); static void free_attrs(char***, PyObject*);
/* constructor */ /* constructor */
@ -252,16 +252,17 @@ error:
/* /*
* convert a python list of strings into an attr list (char*[]). * convert a python list of strings into an attr list (char*[]).
* returns 1 if successful, 0 if not (with exception set) * returns 1 if successful, 0 if not (with exception set)
* XXX the strings should live longer than the resulting attrs pointer.
*/ */
int int
attrs_from_List( PyObject *attrlist, char***attrsp ) { attrs_from_List( PyObject *attrlist, char***attrsp, PyObject** seq) {
char **attrs = NULL; char **attrs = NULL;
Py_ssize_t i, len; Py_ssize_t i, len;
PyObject *item, *bytes; PyObject *item, *bytes;
*seq = NULL;
if (attrlist == Py_None) { if (attrlist == Py_None) {
/* None means a NULL attrlist */ /* None means a NULL attrlist */
} else if (PyUnicode_Check(attrlist)) { } else if (PyUnicode_Check(attrlist)) {
@ -269,32 +270,31 @@ attrs_from_List( PyObject *attrlist, char***attrsp ) {
PyErr_SetObject( PyExc_TypeError, Py_BuildValue("sO", PyErr_SetObject( PyExc_TypeError, Py_BuildValue("sO",
"expected *list* of strings, not a string", attrlist )); "expected *list* of strings, not a string", attrlist ));
goto error; goto error;
} else if (PySequence_Check(attrlist)) { } else {
*seq = PySequence_Fast(attrlist, "expected list of strings or None");
if (*seq == NULL)
goto error;
len = PySequence_Length(attrlist); len = PySequence_Length(attrlist);
attrs = PyMem_NEW(char *, len + 1); attrs = PyMem_NEW(char *, len + 1);
if (attrs == NULL) if (attrs == NULL)
goto nomem; goto nomem;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
attrs[i] = NULL; attrs[i] = NULL;
item = PySequence_GetItem(attrlist, i); item = PySequence_Fast_GET_ITEM(*seq, i);
if (item == NULL) if (item == NULL)
goto error; goto error;
if (!PyUnicode_Check(item)) { if (!PyUnicode_Check(item)) {
PyErr_SetObject(PyExc_TypeError, Py_BuildValue("sO", PyErr_SetObject(PyExc_TypeError, Py_BuildValue("sO",
"expected string in list", item)); "expected string in list", item));
Py_DECREF(item);
goto error; goto error;
} }
bytes = PyUnicode_AsUTF8String(item); bytes = PyUnicode_AsUTF8String(item);
attrs[i] = PyBytes_AsString(bytes); attrs[i] = PyBytes_AsString(bytes);
Py_DECREF(item);
} }
attrs[len] = NULL; attrs[len] = NULL;
} else {
PyErr_SetObject( PyExc_TypeError, Py_BuildValue("sO",
"expected list of strings or None", attrlist ));
goto error;
} }
*attrsp = attrs; *attrsp = attrs;
@ -303,20 +303,22 @@ attrs_from_List( PyObject *attrlist, char***attrsp ) {
nomem: nomem:
PyErr_NoMemory(); PyErr_NoMemory();
error: error:
free_attrs(&attrs); free_attrs(&attrs, *seq);
return 0; return 0;
} }
/* free memory allocated from above routine */ /* free memory allocated from above routine */
static void static void
free_attrs( char*** attrsp ) { free_attrs( char*** attrsp, PyObject* seq ) {
char **attrs = *attrsp; char **attrs = *attrsp;
if (attrs != NULL) { if (attrs != NULL) {
PyMem_DEL(attrs); PyMem_DEL(attrs);
*attrsp = NULL; *attrsp = NULL;
} }
Py_XDECREF(seq);
} }
/*------------------------------------------------------------ /*------------------------------------------------------------
@ -1108,6 +1110,7 @@ l_ldap_search_ext( LDAPObject* self, PyObject* args )
PyObject *serverctrls = Py_None; PyObject *serverctrls = Py_None;
PyObject *clientctrls = Py_None; PyObject *clientctrls = Py_None;
PyObject *attrs_seq = NULL;
LDAPControl** server_ldcs = NULL; LDAPControl** server_ldcs = NULL;
LDAPControl** client_ldcs = NULL; LDAPControl** client_ldcs = NULL;
@ -1125,7 +1128,7 @@ l_ldap_search_ext( LDAPObject* self, PyObject* args )
&serverctrls, &clientctrls, &timeout, &sizelimit )) return NULL; &serverctrls, &clientctrls, &timeout, &sizelimit )) return NULL;
if (not_valid(self)) return NULL; if (not_valid(self)) return NULL;
if (!attrs_from_List( attrlist, &attrs )) if (!attrs_from_List( attrlist, &attrs, &attrs_seq ))
return NULL; return NULL;
if (timeout >= 0) { if (timeout >= 0) {
@ -1150,7 +1153,7 @@ l_ldap_search_ext( LDAPObject* self, PyObject* args )
server_ldcs, client_ldcs, tvp, sizelimit, &msgid ); server_ldcs, client_ldcs, tvp, sizelimit, &msgid );
LDAP_END_ALLOW_THREADS( self ); LDAP_END_ALLOW_THREADS( self );
free_attrs( &attrs ); free_attrs( &attrs, attrs_seq);
LDAPControl_List_DEL( server_ldcs ); LDAPControl_List_DEL( server_ldcs );
LDAPControl_List_DEL( client_ldcs ); LDAPControl_List_DEL( client_ldcs );