Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions .coveragerc

This file was deleted.

8 changes: 3 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,16 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "pypy3.9"
- "pypy3.10"
image:
- "ubuntu-22.04"
include:
- python-version: "3.6"
image: "ubuntu-20.04"
steps:
- name: Checkout
uses: "actions/checkout@v4"
Expand All @@ -43,7 +41,7 @@ jobs:
- name: Disable AppArmor
run: sudo aa-disable /usr/sbin/slapd
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/tox-fedora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,28 @@ jobs:
tox_test:
name: Tox env "${{matrix.tox_env}}" on Fedora
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Run Tox tests
uses: fedora-python/tox-github-action@main
with:
tox_env: ${{ matrix.tox_env }}
dnf_install: >
@c-development openldap-devel python3-devel
openldap-servers openldap-clients lcov clang-analyzer valgrind
enchant
enchant python3-setuptools
strategy:
matrix:
tox_env:
- py36
- py37
- py38
- py39
- py310
- py311
- py312
- c90-py36
- c90-py37
- py313
- py3-nosasltls
- py3-trace
- pypy3
- doc

# Use GitHub's Linux Docker host
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*.pyc
__pycache__/
.tox
.coverage*
!.coveragerc
/.cache
/.pytest_cache

Expand Down
22 changes: 22 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: Doc/conf.py

# We recommend specifying your dependencies to enable reproducible builds:
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: Doc/requirements.txt
29 changes: 29 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
Released 3.4.5 2025-10-10

Security fixes:
* CVE-2025-61911 (GHSA-r7r6-cc7p-4v5m): Enforce ``str`` input in
``ldap.filter.escape_filter_chars`` with ``escape_mode=1``; ensure proper
escaping. (thanks to lukas-eu)
* CVE-2025-61912 (GHSA-p34h-wq7j-h5v6): Correct NUL escaping in
``ldap.dn.escape_dn_chars`` to ``\00`` per RFC 4514. (thanks to aradona91)

Fixes:
* ReconnectLDAPObject now properly reconnects on UNAVAILABLE, CONNECT_ERROR
and TIMEOUT exceptions (previously only SERVER_DOWN), fixing reconnection
issues especially during server restarts
* Fixed syncrepl.py to use named constants instead of raw decimal values
for result types
* Fixed error handling in SearchNoOpMixIn to prevent a undefined variable error

Tests:
* Added comprehensive reconnection test cases including concurrent operation
handling and server restart scenarios

Doc/
* Updated installation docs and fixed various documentation typos
* Added ReadTheDocs configuration file

Infrastructure:
* Add testing and document support for Python 3.13

----------------------------------------------------------------
Released 3.4.4 2022-11-17

Fixes:
Expand Down
4 changes: 2 additions & 2 deletions Demo/pyasn1/syncrepl.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def syncrepl_entry(self, dn, attributes, uuid):
logger.debug('Detected %s of entry %r', change_type, 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:
if 'cookie' in self.__data:
self.perform_application_sync(dn, attributes, previous_attributes)

def syncrepl_delete(self,uuids):
Expand All @@ -98,7 +98,7 @@ def syncrepl_present(self,uuids,refreshDeletes=False):
deletedEntries = [
uuid
for uuid in self.__data.keys()
if uuid not in self.__presentUUIDs and uuid != 'ldap_cookie'
if uuid not in self.__presentUUIDs and uuid != 'cookie'
]
self.syncrepl_delete( deletedEntries )
# Phase is now completed, reset the list
Expand Down
2 changes: 1 addition & 1 deletion Doc/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Communication

Always keep in mind that python-ldap is developed and maintained by volunteers.
We're happy to share our work, and to work with you to make the library better,
but (until you pay someone), there's obligation to provide assistance.
but (until you pay someone), there's no obligation to provide assistance.

So, keep it friendly, respectful, and supportive!

Expand Down
43 changes: 31 additions & 12 deletions Doc/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ to get up to date information which versions are available.
Windows
-------

Unofficial packages for Windows are available on
`Christoph Gohlke's page <https://www.lfd.uci.edu/~gohlke/pythonlibs/>`_.
Unofficial binary builds for Windows are provided by Christoph Gohlke, available at
`python-ldap-build <https://github.com/cgohlke/python-ldap-build/releases>`_.


`FreeBSD <https://www.freebsd.org/>`_
Expand All @@ -76,12 +76,23 @@ The CVS repository of FreeBSD contains the package
macOS
-----

You can install directly with pip::
You can install directly with pip. First install Xcode command line tools::

$ xcode-select --install
$ pip install python-ldap \
--global-option=build_ext \
--global-option="-I$(xcrun --show-sdk-path)/usr/include/sasl"

Then install python-ldap::

$ pip install python-ldap

For custom installations, you may need to set environment variables::

$ export CPPFLAGS="-I$(xcrun --show-sdk-path)/usr/include/sasl"
$ pip install python-ldap

If using Homebrew::

$ brew install openldap
$ pip install python-ldap


.. _install-source:
Expand All @@ -90,11 +101,14 @@ Installing from Source
======================


python-ldap is built and installed using the Python setuptools.
From a source repository::
python-ldap is built and installed using modern Python packaging standards
with pyproject.toml configuration. From a source repository::

$ python -m pip install setuptools
$ python setup.py install
$ pip install .

For development installation with editable mode::

$ pip install -e .

If you have more than one Python interpreter installed locally, you should
use the same one you plan to use python-ldap with.
Expand Down Expand Up @@ -143,10 +157,15 @@ Packages for building::
Debian
------

Packages for building::

# apt-get install build-essential ldap-utils \
libldap2-dev libsasl2-dev

Packages for building and testing::

# apt-get install build-essential python3-dev \
libldap2-dev libsasl2-dev slapd ldap-utils tox \
# apt-get install build-essential ldap-utils \
libldap2-dev libsasl2-dev slapd python3-dev tox \
lcov valgrind

.. note::
Expand Down
6 changes: 3 additions & 3 deletions Doc/reference/ldap.rst
Original file line number Diff line number Diff line change
Expand Up @@ -604,13 +604,13 @@ The module defines the following exceptions:
.. py:exception:: COMPARE_FALSE

A compare operation returned false.
(This exception should only be seen asynchronous operations, because
(This exception should only be seen in asynchronous operations, because
:py:meth:`~LDAPObject.compare_s()` returns a boolean result.)

.. py:exception:: COMPARE_TRUE

A compare operation returned true.
(This exception should only be seen asynchronous operations, because
(This exception should only be seen in asynchronous operations, because
:py:meth:`~LDAPObject.compare_s()` returns a boolean result.)

.. py:exception:: CONFIDENTIALITY_REQUIRED
Expand Down Expand Up @@ -1364,7 +1364,7 @@ and wait for and return with the server's result, or with
This synchronous method implements the LDAP "Who Am I?"
extended operation.

It is useful for finding out to find out which identity
It is useful for finding out which identity
is assumed by the LDAP server after a SASL bind.

.. seealso::
Expand Down
6 changes: 6 additions & 0 deletions Doc/spelling_wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ changeNumber
changesOnly
changeType
changeTypes
Christoph
cidict
clientctrls
conf
Expand Down Expand Up @@ -56,8 +57,10 @@ filterstr
filterStr
formatOID
func
Gohlke
GPG
Heimdal
Homebrew
hostport
hrefTarget
hrefText
Expand Down Expand Up @@ -105,6 +108,7 @@ previousDN
processResultsCount
Proxied
py
pyproject
pytest
rdn
readthedocs
Expand Down Expand Up @@ -145,6 +149,7 @@ syncrepl
syntaxes
timelimit
TLS
toml
tracebacks
tuple
tuples
Expand All @@ -161,5 +166,6 @@ userPassword
usr
uuids
Valgrind
Xcode
whitespace
workflow
3 changes: 1 addition & 2 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Quick build instructions:

edit setup.cfg (see Build/ for platform-specific examples)
python setup.py build
python setup.py install
pip install .

Detailed instructions are in Doc/installing.rst, or online at:

Expand Down
6 changes: 3 additions & 3 deletions Lib/ldap/cidict.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def strlist_minus(a,b):
a,b are supposed to be lists of case-insensitive strings.
"""
warnings.warn(
"strlist functions are deprecated and will be removed in 3.5",
"strlist functions are deprecated and will be removed in 4.0",
category=DeprecationWarning,
stacklevel=2,
)
Expand All @@ -105,7 +105,7 @@ def strlist_intersection(a,b):
Return intersection of two lists of case-insensitive strings a,b.
"""
warnings.warn(
"strlist functions are deprecated and will be removed in 3.5",
"strlist functions are deprecated and will be removed in 4.0",
category=DeprecationWarning,
stacklevel=2,
)
Expand All @@ -125,7 +125,7 @@ def strlist_union(a,b):
Return union of two lists of case-insensitive strings a,b.
"""
warnings.warn(
"strlist functions are deprecated and will be removed in 3.5",
"strlist functions are deprecated and will be removed in 4.0",
category=DeprecationWarning,
stacklevel=2,
)
Expand Down
8 changes: 5 additions & 3 deletions Lib/ldap/controls/openldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class SearchNoOpMixIn:
"""

def noop_search_st(self,base,scope=ldap.SCOPE_SUBTREE,filterstr='(objectClass=*)',timeout=-1):
msg_id = None
try:
msg_id = self.search_ext(
base,
Expand All @@ -66,9 +67,10 @@ def noop_search_st(self,base,scope=ldap.SCOPE_SUBTREE,filterstr='(objectClass=*)
ldap.TIMELIMIT_EXCEEDED,
ldap.SIZELIMIT_EXCEEDED,
ldap.ADMINLIMIT_EXCEEDED
) as e:
self.abandon(msg_id)
raise e
):
if msg_id is not None:
self.abandon(msg_id)
raise
else:
noop_srch_ctrl = [
c
Expand Down
3 changes: 2 additions & 1 deletion Lib/ldap/dn.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def escape_dn_chars(s):
s = s.replace('>' ,'\\>')
s = s.replace(';' ,'\\;')
s = s.replace('=' ,'\\=')
s = s.replace('\000' ,'\\\000')
# RFC 4514 requires NULL (U+0000) to be escaped as hex pair "\00"
s = s.replace('\x00' ,'\\00')
if s[-1]==' ':
s = ''.join((s[:-1],'\\ '))
if s[0]=='#' or s[0]==' ':
Expand Down
Loading