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