66 lines
2.3 KiB
Diff
66 lines
2.3 KiB
Diff
autofs-5.0.6 - dont retry ldap connect if not required
|
|
|
|
From: Ian Kent <ikent@redhat.com>
|
|
|
|
When using LDAP and the server is not available autofs retries the
|
|
connection when it fails in case the SASL credentail has expired.
|
|
But this is done even when not using SASL, so change it check if
|
|
SASL authentication is required.
|
|
---
|
|
|
|
CHANGELOG | 1 +
|
|
include/lookup_ldap.h | 1 +
|
|
modules/lookup_ldap.c | 6 +++---
|
|
3 files changed, 5 insertions(+), 3 deletions(-)
|
|
|
|
|
|
--- autofs-5.0.6.orig/CHANGELOG
|
|
+++ autofs-5.0.6/CHANGELOG
|
|
@@ -47,6 +47,7 @@
|
|
- update ->timeout() function to not return timeout.
|
|
- move timeout to map_source (allow per direct map timeout).
|
|
- fix kernel verion check of version components.
|
|
+- dont retry ldap connect if not required.
|
|
|
|
28/06/2011 autofs-5.0.6
|
|
-----------------------
|
|
--- autofs-5.0.6.orig/include/lookup_ldap.h
|
|
+++ autofs-5.0.6/include/lookup_ldap.h
|
|
@@ -104,6 +104,7 @@ struct lookup_context {
|
|
#define LDAP_AUTH_NOTREQUIRED 0x0001
|
|
#define LDAP_AUTH_REQUIRED 0x0002
|
|
#define LDAP_AUTH_AUTODETECT 0x0004
|
|
+#define LDAP_NEED_AUTH (LDAP_AUTH_REQUIRED|LDAP_AUTH_AUTODETECT)
|
|
#endif
|
|
|
|
#define LDAP_AUTH_USESIMPLE 0x0008
|
|
--- autofs-5.0.6.orig/modules/lookup_ldap.c
|
|
+++ autofs-5.0.6/modules/lookup_ldap.c
|
|
@@ -511,7 +511,7 @@ static int do_bind(unsigned logopt, LDAP
|
|
debug(logopt, MODPREFIX "auth_required: %d, sasl_mech %s",
|
|
ctxt->auth_required, ctxt->sasl_mech);
|
|
|
|
- if (ctxt->auth_required & (LDAP_AUTH_REQUIRED|LDAP_AUTH_AUTODETECT)) {
|
|
+ if (ctxt->auth_required & LDAP_NEED_AUTH) {
|
|
rv = autofs_sasl_bind(logopt, ldap, ctxt);
|
|
debug(logopt, MODPREFIX "autofs_sasl_bind returned %d", rv);
|
|
} else {
|
|
@@ -731,7 +731,7 @@ static LDAP *do_reconnect(unsigned logop
|
|
ldap = do_connect(logopt, ctxt->server, ctxt);
|
|
#ifdef WITH_SASL
|
|
/* Dispose of the sasl authentication connection and try again. */
|
|
- if (!ldap) {
|
|
+ if (!ldap && ctxt->auth_required & LDAP_NEED_AUTH) {
|
|
autofs_sasl_dispose(ctxt);
|
|
ldap = connect_to_server(logopt, ctxt->server, ctxt);
|
|
}
|
|
@@ -767,7 +767,7 @@ static LDAP *do_reconnect(unsigned logop
|
|
* Dispose of the sasl authentication connection and try the
|
|
* current server again before trying other servers in the list.
|
|
*/
|
|
- if (!ldap) {
|
|
+ if (!ldap && ctxt->auth_required & LDAP_NEED_AUTH) {
|
|
autofs_sasl_dispose(ctxt);
|
|
ldap = connect_to_server(logopt, ctxt->uri->uri, ctxt);
|
|
}
|