diff -ur tmp/libnss-ldap-261/nss_ldap-261/ldap-nss.c nss_ldap-261-miek/ldap-nss.c --- tmp/libnss-ldap-261/nss_ldap-261/ldap-nss.c 2008-07-03 04:32:10.000000000 +0200 +++ nss_ldap-261-miek/ldap-nss.c 2009-09-29 20:50:58.068881293 +0200 @@ -2578,7 +2578,17 @@ syslog (LOG_INFO, "nss_ldap: reconnecting to LDAP server (sleeping %d seconds)...", backoff); - (void) sleep (backoff); + /* if our reconnect policy is 'medium' then we don't want to + * use the backoff, just do the retry and failover to other + * uris. The 'soft' policy just quits and doesn't try the + * failover. Fix this here in this semi ugly manner + * Miek Gieben - 2009 + */ + if (__session.ls_config->ldc_reconnect_pol != LP_RECONNECT_MEDIUM) + (void) sleep (backoff); + else + (void) sleep (__session.ls_config->ldc_reconnect_sleeptime); + } else if (tries > 1) { diff -ur tmp/libnss-ldap-261/nss_ldap-261/ldap-nss.h nss_ldap-261-miek/ldap-nss.h --- tmp/libnss-ldap-261/nss_ldap-261/ldap-nss.h 2008-07-03 04:32:10.000000000 +0200 +++ nss_ldap-261-miek/ldap-nss.h 2009-09-29 19:42:09.060573000 +0200 @@ -253,7 +253,8 @@ { LP_RECONNECT_HARD_INIT, LP_RECONNECT_HARD_OPEN, - LP_RECONNECT_SOFT + LP_RECONNECT_SOFT, + LP_RECONNECT_MEDIUM }; typedef enum ldap_reconnect_policy ldap_reconnect_policy_t; diff -ur tmp/libnss-ldap-261/nss_ldap-261/nss_ldap.5 nss_ldap-261-miek/nss_ldap.5 --- tmp/libnss-ldap-261/nss_ldap-261/nss_ldap.5 2008-07-03 04:32:10.000000000 +0200 +++ nss_ldap-261-miek/nss_ldap.5 2009-09-29 20:00:05.403997584 +0200 @@ -286,7 +286,7 @@ .TP The following configuration options apply to nss_ldap only: .TP -.B bind_policy +.B bind_policy Specifies the policy to use for reconnecting to an unavailable .I LDAP @@ -303,6 +303,11 @@ .B nss_ldap will return immediately on server failure. All "hard" reconnect policies block with exponential backoff before retrying. +Further more a +.B medium +policy is available. This policy follows the "soft" policy, but +will try all available LDAP servers; thus giving a best of +both worlds. .TP .B nss_connect_policy Determines whether nss_ldap persists connections. The default diff -ur tmp/libnss-ldap-261/nss_ldap-261/util.c nss_ldap-261-miek/util.c --- tmp/libnss-ldap-261/nss_ldap-261/util.c 2008-07-03 04:32:10.000000000 +0200 +++ nss_ldap-261-miek/util.c 2009-09-29 19:46:05.435971000 +0200 @@ -1006,6 +1006,10 @@ { result->ldc_reconnect_pol = LP_RECONNECT_SOFT; } + else if (!strcasecmp (v, "medium")) + { + result->ldc_reconnect_pol = LP_RECONNECT_MEDIUM; + } } else if (!strcasecmp (k, NSS_LDAP_KEY_RECONNECT_TRIES)) {