postgresql/src/test/ldap
Andres Freund a9b716c33d tests: Prevent syslog activity by slapd, take 2
Unfortunately it turns out that the logfile-only option added in b9f8d1cbad
is only available in openldap starting in 2.6.

Luckily the option to control the log level (loglevel/-s) have been around for
much longer. As it turns out loglevel/-s only control what goes into syslog,
not what ends up in the file specified with 'logfile' and stderr.

While we currently are specifying 'logfile', nothing ends up in it, as the
option only controls debug messages, and we didn't set a debug level. The
debug level can only be configured on the commandline and also prevents
forking. That'd require larger changes, so this commit doesn't tackle that
issue.

Specify the syslog level when starting slapd using -s, as that allows to
prevent all syslog messages if one uses '0' instead of 'none', while loglevel
doesn't prevent the first message.

Discussion: https://postgr.es/m/20230311233708.3yjdbjkly2q4gq2j@awork3.anarazel.de
Backpatch: 11-
2023-03-16 23:18:28 -07:00
..
t tests: Prevent syslog activity by slapd, take 2 2023-03-16 23:18:28 -07:00
.gitignore Add LDAP authentication test suite 2017-09-15 11:44:29 -04:00
Makefile Update copyright for 2021 2021-01-02 13:06:25 -05:00
README Add MacPorts support to src/test/ldap tests. 2019-03-26 11:44:18 +13:00
authdata.ldif Add LDAP authentication test suite 2017-09-15 11:44:29 -04:00

README

src/test/ldap/README

Tests for LDAP functionality
============================

This directory contains a test suite for LDAP functionality.  This
requires a full OpenLDAP installation, including server and client
tools, and is therefore kept separate and not run by default.  You
might need to adjust some paths in the test file to have it find
OpenLDAP in a place that hadn't been thought of yet.

Also, this test suite creates an LDAP server that listens for TCP/IP
connections on localhost without any real access control, so it is not
safe to run this on a system where there might be untrusted local
users.

Running the tests
=================

NOTE: You must have given the --enable-tap-tests argument to configure.

Run
    make check
or
    make installcheck
You can use "make installcheck" if you previously did "make install".
In that case, the code in the installation tree is tested.  With
"make check", a temporary installation tree is built from the current
sources and then tested.

Either way, this test initializes, starts, and stops a test Postgres
cluster, as well as a test LDAP server.

Requirements
============

LDAP server and client tools are required.

Debian/Ubuntu packages: slapd ldap-utils

RHEL/CentOS/Fedora packages: openldap-clients openldap-servers
(You will already have needed openldap and openldap-devel to build.)

FreeBSD: openldap-server
(You will already have needed openldap-client to build.  If building
from the ports source tree, you want to build net/openldap24-client
and net/openldap24-server.)

macOS: We do not recommend trying to use the Apple-provided version of
OpenLDAP; it's very old, plus Apple seem to have changed the launching
conventions for slapd.  The paths in the test file are set on the
assumption that you installed OpenLDAP using Homebrew or MacPorts.