summaryrefslogtreecommitdiff
path: root/nslcd/hackers.c
blob: 57d4f97618c83a9b22ac413726a8e4b9649aeded (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <stdbool.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <pthread.h>
#include "hackers_watch.h"
#include "log.h"

void *hackers_session_worker(void *sess) {
	hackers_worker(sess);
	return NULL;
}

struct session *hackers_session_create(pthread_t *thread) {
	struct session *session = malloc(sizeof(struct session));
	if (session == NULL) {
		log_log(LOG_CRIT, "hackers_session_create(): malloc() failed to allocate memory");
		exit(EXIT_FAILURE);
	}
	if (pthread_create(thread, NULL, hackers_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) {
	/* do nothing */
}

void hackers_session_close(struct session *sess) {
	/* do nothing */
}

void hackers_session_messup(struct session *sess) {
	pthread_rwlock_rdlock(&(sess->lock));
}

void hackers_session_cleanup(struct session *sess) {
	pthread_rwlock_unlock(&(sess->lock));
}