summaryrefslogtreecommitdiff
path: root/mail/dbmail/files/patch-0015-Get-timeout-from-config
diff options
context:
space:
mode:
Diffstat (limited to 'mail/dbmail/files/patch-0015-Get-timeout-from-config')
-rw-r--r--mail/dbmail/files/patch-0015-Get-timeout-from-config61
1 files changed, 61 insertions, 0 deletions
diff --git a/mail/dbmail/files/patch-0015-Get-timeout-from-config b/mail/dbmail/files/patch-0015-Get-timeout-from-config
new file mode 100644
index 000000000000..b0f879c4da2b
--- /dev/null
+++ b/mail/dbmail/files/patch-0015-Get-timeout-from-config
@@ -0,0 +1,61 @@
+From af47f87dec649ad495a704926d5e0e004ad17301 Mon Sep 17 00:00:00 2001
+From: Alan Hicks <ahicks@p-o.co.uk>
+Date: Wed, 12 Oct 2016 18:23:40 +0100
+Subject: [PATCH 15/33] Get timeout from config
+
+---
+ src/modules/authldap.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git src/modules/authldap.c src/modules/authldap.c
+index bbe553b..2bf3b95 100644
+--- src/modules/authldap.c
++++ src/modules/authldap.c
+@@ -59,7 +59,9 @@ typedef struct _ldap_cfg {
+ Field_T field_members;
+ Field_T query_string;
+ Field_T referrals;
++ Field_T query_timeout;
+ int scope_int, port_int, version_int;
++ int query_timeout_int;
+ } _ldap_cfg_t;
+
+ static _ldap_cfg_t _ldap_cfg;
+@@ -90,6 +92,7 @@ static void __auth_get_config(void)
+ GETCONFIGVALUE("QUERY_STRING", "LDAP", _ldap_cfg.query_string);
+ GETCONFIGVALUE("SCOPE", "LDAP", _ldap_cfg.scope);
+ GETCONFIGVALUE("REFERRALS", "LDAP", _ldap_cfg.referrals);
++ GETCONFIGVALUE("QUERY_TIMEOUT", "LDAP", _ldap_cfg.query_timeout);
+
+ /* Store the port as an integer for later use. */
+ _ldap_cfg.port_int = atoi(_ldap_cfg.port);
+@@ -113,6 +116,8 @@ static void __auth_get_config(void)
+ else
+ _ldap_cfg.scope_int = LDAP_SCOPE_SUBTREE;
+ }
++ /* Store the timeout as an integer. */
++ _ldap_cfg.query_timeout_int = atoi(_ldap_cfg.query_timeout);
+ TRACE(TRACE_DEBUG, "integer ldap scope is [%d]", _ldap_cfg.scope_int);
+ }
+
+@@ -141,7 +146,7 @@ static LDAP * ldap_con_get(void)
+ return ld;
+ }
+ int c = 0;
+- int c_tries = 600;
++ int c_tries = _ldap_cfg.query_timeout_int;
+ int err = -1; // Start wanting success
+ while (err != 0 && c++ < c_tries) {
+ // Loop until success or too many retries
+@@ -264,7 +269,7 @@ static LDAPMessage * authldap_search(const gchar *query)
+ char **_ldap_attrs = NULL;
+ int err = -1; // Start wanting success
+ int c = 0;
+- int c_tries = 600;
++ int c_tries = _ldap_cfg.query_timeout_int;
+ LDAP *_ldap_conn;
+
+ g_return_val_if_fail(query!=NULL, NULL);
+--
+2.10.1 (Apple Git-78)
+