nss-pam-ldapd branch master updated. 0.9.1-35-g1d8db24
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
nss-pam-ldapd branch master updated. 0.9.1-35-g1d8db24
- From: Commits of the nss-pam-ldapd project <nss-pam-ldapd-commits [at] lists.arthurdejong.org>
- To: nss-pam-ldapd-commits [at] lists.arthurdejong.org
- Reply-to: nss-pam-ldapd-users [at] lists.arthurdejong.org
- Subject: nss-pam-ldapd branch master updated. 0.9.1-35-g1d8db24
- Date: Fri, 25 Oct 2013 23:59:17 +0200 (CEST)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "nss-pam-ldapd".
The branch, master has been updated
via 1d8db24de6fce25997b1e672c497daf9b60ac725 (commit)
from ee8737f1a1d048f5b06ce479337e72382e36bf8f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://arthurdejong.org/git/nss-pam-ldapd/commit/?id=1d8db24de6fce25997b1e672c497daf9b60ac725
commit 1d8db24de6fce25997b1e672c497daf9b60ac725
Author: Arthur de Jong <arthur@arthurdejong.org>
Date: Fri Oct 25 23:25:00 2013 +0200
Also run invalidators on initial connect
This also invalidates the caches configured with reconnect_invalidate on
the first successful search. This should handle the case more gracefully
where caches were filled with negative hits before nslcd was running.
diff --git a/nslcd/myldap.c b/nslcd/myldap.c
index 959669b..235c3c6 100644
--- a/nslcd/myldap.c
+++ b/nslcd/myldap.c
@@ -150,6 +150,9 @@ struct myldap_entry {
char **rangedattributevalues[MAX_RANGED_ATTRIBUTES_PER_ENTRY];
};
+/* Flag to record first search operation */
+int first_search = 1;
+
static void myldap_err(int pri, LDAP *ld, int rc, const char *format, ...)
{
char message[200];
@@ -1159,6 +1162,7 @@ static int do_retry_search(MYLDAP_SEARCH *search)
int rc = LDAP_UNAVAILABLE;
struct myldap_uri *current_uri;
int dotry[NSS_LDAP_CONFIG_MAX_URIS];
+ int do_invalidate = 0;
/* clear time stamps */
for (start_uri = 0; start_uri < NSS_LDAP_CONFIG_MAX_URIS; start_uri++)
dotry[start_uri] = 1;
@@ -1197,8 +1201,12 @@ static int do_retry_search(MYLDAP_SEARCH *search)
if ((current_uri->lastfail > 0) || (search->session->current_uri !=
start_uri))
{
log_log(LOG_INFO, "connected to LDAP server %s", current_uri->uri);
- /* signal external invalidation of configured caches */
- invalidator_do(LM_NONE);
+ do_invalidate = 1;
+ }
+ if (first_search)
+ {
+ do_invalidate = 1;
+ first_search = 0;
}
/* update ok time */
current_uri->firstfail = 0;
@@ -1206,6 +1214,9 @@ static int do_retry_search(MYLDAP_SEARCH *search)
pthread_mutex_unlock(&uris_mutex);
/* flag the search as valid */
search->valid = 1;
+ /* signal external invalidation of configured caches */
+ if (do_invalidate)
+ invalidator_do(LM_NONE);
return LDAP_SUCCESS;
}
/* close the current connection */
diff --git a/pynslcd/search.py b/pynslcd/search.py
index 4c6f243..4a57ab3 100644
--- a/pynslcd/search.py
+++ b/pynslcd/search.py
@@ -30,6 +30,9 @@ import cfg
# global indicator that there was some error connection to an LDAP server
server_error = False
+# global indicator of first search operation
+first_search = True
+
class Connection(ldap.ldapobject.ReconnectLDAPObject):
@@ -65,15 +68,16 @@ class Connection(ldap.ldapobject.ReconnectLDAPObject):
def search_s(self, *args, **kwargs):
# wrapper function to keep the global server_error state
- global server_error
+ global server_error, first_search
try:
res = ldap.ldapobject.ReconnectLDAPObject.search_s(self, *args,
**kwargs)
except ldap.SERVER_DOWN:
server_error = True
raise
- if server_error:
+ if server_error or first_search:
self.reconnect_after_fail()
server_error = False
+ first_search = False
return res
-----------------------------------------------------------------------
Summary of changes:
nslcd/myldap.c | 15 +++++++++++++--
pynslcd/search.py | 8 ++++++--
2 files changed, 19 insertions(+), 4 deletions(-)
hooks/post-receive
--
nss-pam-ldapd
--
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/
- nss-pam-ldapd branch master updated. 0.9.1-35-g1d8db24,
Commits of the nss-pam-ldapd project