>
> The way you're fixing the issue works but it should be handled
> differently, I'm willing to discuss this with you if you want to work
> on the diff.
>
> Gilles
I ran into this yesterday and made a diff with a different approach.
Maybe it is more to your liking.
It worked for me, but i couldn't see any messages in the log related
to the table api. I expected to see at least some log_warnx generated
messages, but nothing came up.
===================================================================
--- table_ldap.c.orig Wed Jul 9 10:38:08 2014
+++ table_ldap.c.fix Fri Feb 27 10:48:53 2015
@@ -137,13 +137,23 @@ table_ldap_update(void)
static int
table_ldap_check(int service, struct dict *params, const char *key)
{
+ int ret;
+
switch(service) {
case K_ALIAS:
case K_DOMAIN:
case K_CREDENTIALS:
case K_USERINFO:
case K_MAILADDR:
- return ldap_run_query(service, key, NULL, 0);
+ if ((ret = ldap_run_query(service, key, NULL, 0)) >= 0) {
+ return ret;
+ }
+
+ log_debug("debug: table-ldap: reconnecting");
+ if (!(ret = ldap_open())) {
+ log_warnx("warn: table-ldap: failed to connect");
+ }
+ return ret;
default:
return (-1);
}
@@ -391,6 +401,11 @@ static int
ldap_open(void)
{
struct aldap_message *amsg = NULL;
+
+ if (aldap) {
+ aldap_close(aldap);
+ log_debug("debug: table-ldap: closed previous connection");
+ }
aldap = ldap_connect(url);
if (aldap == NULL) {
--
You received this mail because you are subscribed to [email protected]
To unsubscribe, send a mail to: [email protected]