[2024-01-27 21:18] Omar Polo <o...@omarpolo.com> > On 2024/01/27 11:49:52 +0100, Philipp <phil...@bureaucracy.de> wrote: > > Hi > > > > I have some smal patches for the table-ldap. These are based on the > > getaddrinfo patch from Olmar (and the two fixups from me). > > The seemed fine to me, all except the last one. > > Your fix is indeed correct, but I'd prefer to adjust also some lines > around your changes as well:
No problem, an updated version of the last patch is attached. Philipp
From c90ce1cdb151192af55aafbb3fe56532f885b599 Mon Sep 17 00:00:00 2001 From: Philipp Takacs <phil...@bureaucracy.de> Date: Tue, 23 Jan 2024 09:59:46 +0100 Subject: [PATCH 4/4] table-ldap fix reconnecting logic --- extras/tables/table-ldap/table_ldap.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/extras/tables/table-ldap/table_ldap.c b/extras/tables/table-ldap/table_ldap.c index 5a11e72..bb3aeb5 100644 --- a/extras/tables/table-ldap/table_ldap.c +++ b/extras/tables/table-ldap/table_ldap.c @@ -332,13 +332,13 @@ table_ldap_lookup(int service, struct dict *params, const char *key, char *dst, case K_MAILADDR: case K_MAILADDRMAP: case K_NETADDR: - if ((ret = ldap_run_query(service, key, dst, sz)) > 0) { + if ((ret = ldap_run_query(service, key, dst, sz)) >= 0) { return ret; } log_debug("debug: table-ldap: reconnecting"); - if (!(ret = ldap_open())) { + if (!ldap_open()) { log_warnx("warn: table-ldap: failed to connect"); - return ret; + return -1; } return ldap_run_query(service, key, dst, sz); default: @@ -502,10 +502,11 @@ table_ldap_check(int service, struct dict *params, const char *key) return ret; } log_debug("debug: table-ldap: reconnecting"); - if (!(ret = ldap_open())) { + if (!ldap_open()) { log_warnx("warn: table-ldap: failed to connect"); + return -1; } - return ret; + return ldap_run_query(service, key, NULL, 0); default: return -1; } -- 2.39.2