diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2009-12-29 13:44:56 +0100 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2009-12-29 13:44:56 +0100 |
commit | 30cce6d17951e5832982c0e3f042c8b75c6d5ca9 (patch) | |
tree | 2ec9914f60bf583c3411f07ca610367da8227edc | |
parent | 53d1704ce8b374454cb9f1399e2f0cdc0f47b1ef (diff) |
some small simplifcations and clarifications
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1046 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r-- | nslcd/cfg.h | 4 | ||||
-rw-r--r-- | nslcd/myldap.c | 23 |
2 files changed, 9 insertions, 18 deletions
diff --git a/nslcd/cfg.h b/nslcd/cfg.h index 02a8152..8c74276 100644 --- a/nslcd/cfg.h +++ b/nslcd/cfg.h @@ -70,9 +70,9 @@ enum ldap_map_selector struct myldap_uri { char *uri; - /* timestamp of last ok search */ + /* time of last successful operation */ time_t lastok; - /* timestamp of last ok search */ + /* time of last failed operation */ time_t lastfail; }; diff --git a/nslcd/myldap.c b/nslcd/myldap.c index 8118464..929cd23 100644 --- a/nslcd/myldap.c +++ b/nslcd/myldap.c @@ -569,7 +569,6 @@ static void do_close(MYLDAP_SESSION *session) static void myldap_session_check(MYLDAP_SESSION *session) { int i; - int runningsearches=0; time_t current_time; /* check parameters */ if (!is_valid_session(session)) @@ -581,24 +580,16 @@ static void myldap_session_check(MYLDAP_SESSION *session) /* check if we should time out the connection */ if ((session->ld!=NULL)&&(nslcd_cfg->ldc_idle_timelimit>0)) { - /* check if we have any running searches */ + /* if we have any running searches, don't time out */ for (i=0;i<MAX_SEARCHES_IN_SESSION;i++) - { if ((session->searches[i]!=NULL)&&(session->searches[i]->valid)) - { - runningsearches=1; - break; - } - } - /* only consider timeout if we have no running searches */ - if (!runningsearches) + return; + /* consider timeout (there are no running searches) */ + time(¤t_time); + if ((session->lastactivity+nslcd_cfg->ldc_idle_timelimit)<current_time) { - time(¤t_time); - if ((session->lastactivity+nslcd_cfg->ldc_idle_timelimit)<current_time) - { - log_log(LOG_DEBUG,"do_open(): idle_timelimit reached"); - do_close(session); - } + log_log(LOG_DEBUG,"myldap_session_check(): idle_timelimit reached"); + do_close(session); } } } |