summaryrefslogtreecommitdiff
path: root/mail/dbmail/files/patch-0022-Clear-the-ldap-connection
blob: cf6ffcbf62bf25222aff71c92a1d37ea1346d78a (plain) (blame)
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
From 24869db9c10be2eb90ba2ca9095d92c5645b6320 Mon Sep 17 00:00:00 2001
From: Alan Hicks <ahicks@p-o.co.uk>
Date: Mon, 24 Oct 2016 15:12:09 +0100
Subject: [PATCH 22/33] Clear the ldap connection

---
 src/modules/authldap.c | 4 ++++
 src/server.c           | 2 ++
 2 files changed, 6 insertions(+)

diff --git src/modules/authldap.c src/modules/authldap.c
index 11c1305..7fa3a73 100644
--- src/modules/authldap.c
+++ src/modules/authldap.c
@@ -638,6 +638,10 @@ int auth_connect(void)
 }
 int auth_disconnect(void)
 {
+	// Just free the pointer,
+        // G_PRIVATE_INIT calls GDestroyNotify
+	// which calls authldap_free()
+	g_private_replace(&ldap_conn_key, NULL)
 	return 0;
 }
 
diff --git src/server.c src/server.c
index 72fab52..ba3ce10 100644
--- src/server.c
+++ src/server.c
@@ -282,6 +282,8 @@ static int server_start_cli(ServerConfig_T *conf)
 		TRACE(TRACE_ERR, "could not connect to authentication");
 		return -1;
 	}
+	// Disconnect this connection as threads will create their own
+	auth_disconnect();
 
 	srand((int) ((int) time(NULL) + (int) getpid()));
 
-- 
2.10.1 (Apple Git-78)