autofs-5.0.3 - renew sasl creds upon reconnect fail From: Ian Kent If a server re-connect fails it could be due to the authentication credentail having timed out. So we need to dispose of this and retry the connection including refreshing re-authenticating. --- modules/lookup_ldap.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) --- autofs-5.0.3.orig/modules/lookup_ldap.c +++ autofs-5.0.3/modules/lookup_ldap.c @@ -675,6 +675,13 @@ static LDAP *do_reconnect(unsigned logop if (ctxt->server || !ctxt->uris) { ldap = do_connect(logopt, ctxt->server, ctxt); +#ifdef WITH_SASL + /* Dispose of the sasl authentication connection and try again. */ + if (!ldap) { + autofs_sasl_dispose(ctxt); + ldap = connect_to_server(logopt, ctxt->server, ctxt); + } +#endif return ldap; } @@ -682,6 +689,16 @@ static LDAP *do_reconnect(unsigned logop this = ctxt->uri; uris_mutex_unlock(ctxt); ldap = do_connect(logopt, this->uri, ctxt); +#ifdef WITH_SASL + /* + * Dispose of the sasl authentication connection and try the + * current server again before trying other servers in the list. + */ + if (!ldap) { + autofs_sasl_dispose(ctxt); + ldap = connect_to_server(logopt, this->uri, ctxt); + } +#endif if (ldap) return ldap;