table-ldap fix reconnection logic

2024-01-29 Thread Philipp
Hi

In my last patch I have missed that ldap_query() returns 0 even when
aldap doesn't return a message. A fix is attached.

Philipp
From d9fbbd077cd72cf75105193d75d9d3779b865f42 Mon Sep 17 00:00:00 2001
From: Philipp Takacs 
Date: Mon, 29 Jan 2024 15:53:12 +0100
Subject: [PATCH] table-ldap ldap_query() return -1 when the ldap server don't
 response

---
 extras/tables/table-ldap/table_ldap.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/extras/tables/table-ldap/table_ldap.c b/extras/tables/table-ldap/table_ldap.c
index 29cc15a..772a1a5 100644
--- a/extras/tables/table-ldap/table_ldap.c
+++ b/extras/tables/table-ldap/table_ldap.c
@@ -413,7 +413,7 @@ ldap_query(const char *filter, const char *key, char **attributes, char ***outp,
 		return -1;
 	if (strlcpy(key__, key, sizeof key__) >= sizeof key__)
 		return -1;
-	found = 0;
+	found = -1;
 	do {
 		if ((ret = aldap_search(aldap, basedn__, LDAP_SCOPE_SUBTREE,
 		filter__, key__, NULL, 0, 0, 0, pg)) == -1) {
@@ -433,6 +433,8 @@ ldap_query(const char *filter, const char *key, char **attributes, char ***outp,
 	pg = m->page;
 aldap_freemsg(m);
 m = NULL;
+if (found == -1)
+	found = 0;
 break;
 			}
 			if (m->message_type != LDAP_RES_SEARCH_ENTRY)
@@ -447,7 +449,7 @@ ldap_query(const char *filter, const char *key, char **attributes, char ***outp,
 		}
 	} while (pg != NULL);
 
-	ret = found ? 1 : 0;
+	ret = found;
 	goto end;
 
 error:
-- 
2.39.2



Re: Status of filter-spf

2024-01-29 Thread Kirill A . Korinsky
On Mon, 29 Jan 2024 13:55:07 +0100,
Martijn van Duren wrote:
> 
> I've started filter-spf, but never gotten to finish it. No clue when
> or if I want to continue with it. At the moment my priorities are
> somewhere else.
> 

Got it.

Meanwhile I've discovered spfwalk.c which should speed up my work dramatically.

-- 
wbr, Kirill



Re: Status of filter-spf

2024-01-29 Thread Martijn van Duren
I've started filter-spf, but never gotten to finish it. No clue when
or if I want to continue with it. At the moment my priorities are
somewhere else.

martijn@

On Sun, 2024-01-28 at 14:04 +0100, Kirill A.Korinsky wrote:
> Greetings,
> 
> This list seems as the right place to discuss
> about http://imperialat.at/dev/filter-spf
> 
> So, here I'm asking about the status of this project.
> 
> As far as I can see it has only one import to svn from some code.
> 
> I've read that code and I doubt that it can be compiled.
> 
> Does anyone know how far away it from ready to use filter?
> 
> I have an idea to make a filter-auth on reusing a filter-dkimverify and
> filter-spf to produce one nice header with result of authication.
> 
> If it works, moving future to timplement DMARC as OpenSMTPd filters won't be
> such a big deal :)
> 
> Anyway, SPF in term of DNS resolution with all that include:, a:, ptr: and so 
> on
> is quite large, and I'd like to avoid implementing it from scratch to avoid 
> tons
> of bugs.
> 
> And before I jump into that black hole, I'd like to guess how deep it is.
> 
> Any ideas?
> 
> --
> wbr, Kirill
>