diff options
Diffstat (limited to 'nslcd/nslcd.c')
-rw-r--r-- | nslcd/nslcd.c | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/nslcd/nslcd.c b/nslcd/nslcd.c index f402e01..62d67d5 100644 --- a/nslcd/nslcd.c +++ b/nslcd/nslcd.c @@ -225,7 +225,7 @@ static int read_header(TFILE *fp, int32_t *action) /* read a request message, returns <0 in case of errors, this function closes the socket */ -static void handleconnection(int sock, MYLDAP_SESSION *session) +static void handleconnection(int sock, struct session *session) { TFILE *fp; int32_t action; @@ -280,19 +280,18 @@ static void install_sighandler(int signum, void (*handler) (int)) static void worker_cleanup(void *arg) { - MYLDAP_SESSION *session = (MYLDAP_SESSION *)arg; + struct session *session = (struct session *)arg; myldap_session_close(session); } static void *worker(void UNUSED(*arg)) { - MYLDAP_SESSION *session; + struct session *session; int csock; int j; struct sockaddr_storage addr; socklen_t alen; fd_set fds; - struct timeval tv; /* create a new LDAP session */ session = myldap_create_session(); /* clean up the session if we're done */ @@ -305,12 +304,8 @@ static void *worker(void UNUSED(*arg)) /* set up the set of fds to wait on */ FD_ZERO(&fds); FD_SET(nslcd_serversocket, &fds); - /* set up our timeout value */ - tv.tv_sec = nslcd_cfg->idle_timelimit; - tv.tv_usec = 0; /* wait for a new connection */ - j = select(nslcd_serversocket + 1, &fds, NULL, NULL, - nslcd_cfg->idle_timelimit > 0 ? &tv : NULL); + j = select(nslcd_serversocket + 1, &fds, NULL, NULL, NULL); /* check result of select() */ if (j < 0) { @@ -360,9 +355,9 @@ static void *worker(void UNUSED(*arg)) return NULL; } -/* function to disable lookups through the nss_ldap module to avoid lookup - loops */ -static void disable_nss_nslcd(void) +/* function to disable lookups through the associated NSS module to + avoid lookup loops */ +static void disable_nss_module(void) { void *handle; char *error; @@ -370,28 +365,28 @@ static void disable_nss_nslcd(void) int *enable_flag; /* try to load the NSS module */ #ifdef RTLD_NODELETE - handle = dlopen(NSS_LDAP_SONAME, RTLD_LAZY | RTLD_NODELETE); + handle = dlopen(NSS_MODULE_SONAME, RTLD_LAZY | RTLD_NODELETE); #else /* not RTLD_NODELETE */ - handle = dlopen(NSS_LDAP_SONAME, RTLD_LAZY); + handle = dlopen(NSS_MODULE_SONAME, RTLD_LAZY); #endif /* RTLD_NODELETE */ if (handle == NULL) { - log_log(LOG_WARNING, "Warning: NSS_LDAP module not loaded: %s", dlerror()); + log_log(LOG_WARNING, "Warning: NSS " NSS_MODULE_NAME " module not loaded: %s", dlerror()); return; } /* clear any existing errors */ dlerror(); /* lookup the NSS version if possible */ - version_info = (char **)dlsym(handle, "_nss_ldap_version"); + version_info = (char **)dlsym(handle, NSS_MODULE_ID_VERSION); error = dlerror(); if ((version_info != NULL) && (error == NULL)) - log_log(LOG_DEBUG, "NSS_LDAP %s %s", version_info[0], version_info[1]); + log_log(LOG_DEBUG, "NSS " NSS_MODULE_NAME " %s %s", version_info[0], version_info[1]); else - log_log(LOG_WARNING, "Warning: NSS_LDAP version missing: %s", error); + log_log(LOG_WARNING, "Warning: " NSS_MODULE_NAME " version missing: %s", error); /* clear any existing errors */ dlerror(); /* try to look up the flag */ - enable_flag = (int *)dlsym(handle, "_nss_ldap_enablelookups"); + enable_flag = (int *)dlsym(handle, NSS_MODULE_ID_ENABLELOOKUPS); error = dlerror(); if ((enable_flag == NULL) || (error != NULL)) { @@ -406,7 +401,7 @@ static void disable_nss_nslcd(void) dlclose(handle); return; } - /* disable nss_ldap */ + /* disable the module */ *enable_flag = 0; #ifdef RTLD_NODELETE /* only close the handle if RTLD_NODELETE was used */ @@ -423,8 +418,8 @@ int main(int argc, char *argv[]) /* parse the command line */ parse_cmdline(argc, argv); - /* disable the nss_ldap module for this process */ - disable_nss_nslcd(); + /* disable the associated NSS module for this process */ + disable_nss_module(); /* read configuration file */ cfg_init(NSLCD_CONF_PATH); |