git: e297efc8850c - main - net/py-lib389: Fix instance creation on FreeBSD

Jochen Neumeister <[email protected]> Thu, 06 Aug 2026 16:42:48 +0000
Newsgroups gmane.os.freebsd.devel.cvs.ports
Message-ID <[email protected]>
The branch main has been updated by joneum:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e297efc8850c237df2593bc23137fca36787d8b3

commit e297efc8850c237df2593bc23137fca36787d8b3
Author:     Jochen Neumeister <[email protected]>
AuthorDate: 2026-08-06 16:21:19 +0000
Commit:     Jochen Neumeister <[email protected]>
CommitDate: 2026-08-06 16:42:38 +0000

    net/py-lib389: Fix instance creation on FreeBSD
    
    Adjust the FreeBSD patch for lib389's instance setup code.
    
    Guard the container detection against a missing systemd-detect-virt
    binary.  Upstream initializes container_result to an integer and then
    unconditionally executes systemd-detect-virt on non-containerised
    systems, which aborts instance creation with a FileNotFoundError on
    FreeBSD.  The check now only runs when the binary is present and
    falls back to the non-container code path otherwise.
    
    Use a plain localhost LDAP connection with the generated temporary
    Directory Manager password for the authenticated setup session, as
    LDAPI autobind via SASL EXTERNAL did not work reliably during setup
    on FreeBSD.
    
    Sponsored by:   Netzkommune GmbH
---
 net/py-lib389/Makefile                             |  1 +
 net/py-lib389/files/patch-lib389_instance_setup.py | 33 +++++++++++++++++++++-
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/net/py-lib389/Makefile b/net/py-lib389/Makefile
index 0f35f79c3da0..00bd83106661 100644
--- a/net/py-lib389/Makefile
+++ b/net/py-lib389/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	lib389
 DISTVERSION=	3.2.1
+PORTREVISION=	1
 CATEGORIES=	net python
 MASTER_SITES=	https://github.com/389ds/389-ds-base/releases/download/389-ds-base-${DISTVERSION}/
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/net/py-lib389/files/patch-lib389_instance_setup.py b/net/py-lib389/files/patch-lib389_instance_setup.py
index 9b7516a33ca0..bef3ee364e89 100644
--- a/net/py-lib389/files/patch-lib389_instance_setup.py
+++ b/net/py-lib389/files/patch-lib389_instance_setup.py
@@ -1,4 +1,4 @@
---- lib389/instance/setup.py.orig	2026-06-29 17:03:20 UTC
+--- lib389/instance/setup.py.orig	2026-04-30 12:45:04 UTC
 +++ lib389/instance/setup.py
 @@ -826,10 +826,10 @@ class SetupDs(object):
          # which subsequently breaks containers starting as instance.start then believes
@@ -14,3 +14,34 @@
              # In a container, set the db_home_dir to the db path
              self.log.debug("Container detected setting db home directory to db directory.")
              slapd['db_home_dir'] = slapd['db_dir']
+@@ -962,14 +962,10 @@ class SetupDs(object):
+         if self.containerised:
+             ds_instance.systemd_override = general['systemd']
+ 
+-        # By default SUSE does something extremely silly - it creates a hostname
+-        # that CANT be resolved by DNS. As a result this causes all installs to
+-        # fail. We need to guarantee that we only connect to localhost here, as
+-        # it's the only stable and guaranteed way to connect to the instance
+-        # at this point.
+-        #
+-        # Use ldapi which would prevent the need
+-        # to configure a temp root pw in the setup phase.
++        # Use a local LDAP connection for the temporary authenticated setup session.
++        # FreeBSD's OpenLDAP client stack rejects SASL EXTERNAL over LDAPI here,
++        # while the generated temporary Directory Manager password provides the
++        # required authenticated connection over localhost LDAP.
+         args = {
+             SER_HOST: "localhost",
+             SER_PORT: slapd['port'],
+@@ -977,9 +973,9 @@ class SetupDs(object):
+             SER_ROOT_DN: slapd['root_dn'],
+             SER_ROOT_PW: self._raw_secure_password,
+             SER_DEPLOYED_DIR: slapd['prefix'],
+-            SER_LDAPI_ENABLED: 'on',
++            SER_LDAPI_ENABLED: 'off',
+             SER_LDAPI_SOCKET: slapd['ldapi'],
+-            SER_LDAPI_AUTOBIND: 'on'
++            SER_LDAPI_AUTOBIND: 'off'
+         }
+ 
+         ds_instance.allocate(args)