summaryrefslogtreecommitdiff
path: root/nslcd/hackers.c
diff options
context:
space:
mode:
Diffstat (limited to 'nslcd/hackers.c')
-rw-r--r--nslcd/hackers.c42
1 files changed, 30 insertions, 12 deletions
diff --git a/nslcd/hackers.c b/nslcd/hackers.c
index e7b2525..8f3e6f4 100644
--- a/nslcd/hackers.c
+++ b/nslcd/hackers.c
@@ -6,38 +6,56 @@
#include "hackers_watch.h"
#include "log.h"
-void *hackers_session_worker(void *sess) {
- hackers_worker(sess);
+static
+void *
+session_worker(void *sess) {
+ hackers_session_worker(sess);
return NULL;
}
-struct session *hackers_session_create(pthread_t *thread, const char *yamldir) {
- struct session *session = malloc(sizeof(struct session));
+struct session *
+session_create(const struct nslcd_config *cfg, pthread_t *thread) {
+ struct session *session = hackers_session_allocate();
if (session == NULL) {
- log_log(LOG_CRIT, "hackers_session_create(): malloc() failed to allocate memory");
exit(EXIT_FAILURE);
}
- hackers_init(yamldir, session);
- if (pthread_create(thread, NULL, hackers_session_worker, (void*)session)) {
+
+ if (hackers_session_open(session, cfg->yamldir) != 0) {
+ exit(EXIT_FAILURE);
+ }
+
+ if (pthread_create(thread, NULL, session_worker, (void*)session)) {
log_log(LOG_ERR, "unable to start hackers worker thread: %s",
strerror(errno));
exit(EXIT_FAILURE);
}
+
return session;
}
-void hackers_session_check(struct session *sess) {
+void
+session_check(struct session *sess) {
/* do nothing */
}
-void hackers_session_close(struct session *sess) {
- /* do nothing */
+void
+session_close(struct session *sess) {
+ /*hackers_session_close(sess);*/
+}
+
+void
+session_refresh(struct session *sess, const struct nslcd_config *cfg) {
+ if (hackers_session_open(sess, cfg->yamldir) != 0) {
+ exit(EXIT_FAILURE);
+ }
}
-void hackers_session_messup(struct session *sess) {
+void
+session_messup(struct session *sess) {
pthread_rwlock_rdlock(&(sess->lock));
}
-void hackers_session_cleanup(struct session *sess) {
+void
+session_cleanup(struct session *sess) {
pthread_rwlock_unlock(&(sess->lock));
}