Skip to content

Async handler broke on OpenBSD #3

Description

@Tachi107

Hi!

While working on the K_AUTH implementation (which now works!), I've noticed that the table seems to be broken on OpenBSD since commit f75d976, which introduced the async handler code (or, that's where a git bisect led me to). Upon start, table-ldap just hangs.

This effectively means that the table is unusable on OpenBSD. Quite ironically, it works on Linux just fine.

As I'm not that comfortable with writing libevent code, I cannot really tell why it works on Linux but not on OpenBSD.

Reproducing is quite easy; just send config|ready via stdin and see what happens. On tag 1.0:

# echo 'config|ready' | ./table-ldap ../ldap_users.conf     
table-ldap[62792]: debug: reading key "url" -> "ldap://192.168.122.180"
table-ldap[62792]: debug: reading key "username" -> "cn=smtpd,ou=services,dc=pappacoda,dc=it"
table-ldap[62792]: debug: reading key "password" -> "test"
table-ldap[62792]: debug: reading key "basedn" -> "ou=users,dc=pappacoda,dc=it"
table-ldap[62792]: warn: bogus entry "auth_attributes"
table-ldap[62792]: debug: done reading config
table-ldap[62792]: debug: ldap server accepted credentials
table-ldap[62792]: debug: connected
register|alias
register|domain
register|credentials
register|netaddr
register|userinfo
register|source
register|mailaddr
register|addrname
register|mailaddrmap
register|ready

While on latest main (commit 020c263):

# echo 'config|ready' | ./table-ldap ../ldap_users.conf 
table-ldap[23523]: debug: reading key "url" -> "ldap://192.168.122.180"
table-ldap[23523]: debug: reading key "username" -> "cn=smtpd,ou=services,dc=pappacoda,dc=it"
table-ldap[23523]: debug: reading key "password" -> "test"
table-ldap[23523]: debug: reading key "basedn" -> "ou=users,dc=pappacoda,dc=it"
table-ldap[23523]: warn: bogus entry "auth_attributes"
table-ldap[23523]: warn: no service registered
table-ldap[23523]: debug: done reading config
table-ldap[23523]: ldap connect to: 192.168.122.180:389

...and just hangs there.

P.S. to compile on OpenBSD I had to modify the autoconfig and automake build scripts to use pkg-config via PKG_CHECK_MODULES, as libevent was not found otherwise. I've used this patch:

From e53494412184b5e6a58063e9a829ddfe48d1aa86 Mon Sep 17 00:00:00 2001
From: Andrea Pappacoda <andrea@pappacoda.it>
Date: Sun, 21 Jun 2026 17:15:11 +0200
Subject: [PATCH] Find libevent with pkg-config

Needed to solve build on OpenBSD
---
 Makefile.am  | 3 ++-
 configure.ac | 4 +---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 1889685..1b87bfb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,7 +4,8 @@ noinst_PROGRAMS =	table-ldap
 
 table_ldap_SOURCES =	table_ldap.c aldap.c ber.c dict.c log.c table_api.c util.c
 
-LDADD =			$(LIBOBJS)
+AM_CFLAGS =		$(LIBEVENT_CFLAGS)
+LDADD =			$(LIBEVENT_LIBS) $(LIBOBJS)
 
 dist_man5_MANS =	table-ldap.5
 
diff --git a/configure.ac b/configure.ac
index 2b4e852..94a2594 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,9 +15,7 @@ AC_REPLACE_FUNCS([ \
 	strtonum \
 ])
 
-AC_SEARCH_LIBS([evbuffer_pullup], [event_core], [], [
-	AC_MSG_ERROR([requires libevent])
-])
+PKG_CHECK_MODULES([LIBEVENT], [libevent_core])
 
 AC_SEARCH_LIBS([tls_init], [tls], [], [
 	AC_MSG_ERROR([requires libtls])
-- 
2.53.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions