<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">From 03f69f8fff3711c925b98f6e17aec4c8321f02b7 Mon Sep 17 00:00:00 2001
From: Jay Soffian &lt;jaysoffian@gmail.com&gt;
Date: Fri, 13 Mar 2009 02:12:43 -0400
Subject: [PATCH] Add auth.backend.ldap.port option
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/http_auth.c |    2 +-
 src/http_auth.h |    1 +
 src/mod_auth.c  |    8 +++++++-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/http_auth.c b/src/http_auth.c
index ccd087e..ae1a8da 100644
--- a/src/http_auth.c
+++ b/src/http_auth.c
@@ -786,7 +786,7 @@ static int http_auth_basic_password_compare(server *srv, mod_auth_plugin_data *p
 
 
 		/* 3. */
-		if (NULL == (ldap = ldap_init(p-&gt;conf.auth_ldap_hostname-&gt;ptr, LDAP_PORT))) {
+		if (NULL == (ldap = ldap_init(p-&gt;conf.auth_ldap_hostname-&gt;ptr, p-&gt;conf.auth_ldap_port))) {
 			log_error_write(srv, __FILE__, __LINE__, "ss", "ldap ...", strerror(errno));
 			return -1;
 		}
diff --git a/src/http_auth.h b/src/http_auth.h
index 5828a7e..16719fc 100644
--- a/src/http_auth.h
+++ b/src/http_auth.h
@@ -35,6 +35,7 @@ typedef struct {
 	buffer *auth_ldap_bindpw;
 	buffer *auth_ldap_filter;
 	buffer *auth_ldap_cafile;
+	unsigned short auth_ldap_port;
 	unsigned short auth_ldap_starttls;
 	unsigned short auth_ldap_allow_empty_pw;
 
diff --git a/src/mod_auth.c b/src/mod_auth.c
index 77d30f2..6886779 100644
--- a/src/mod_auth.c
+++ b/src/mod_auth.c
@@ -107,6 +107,7 @@ static int mod_auth_patch_connection(server *srv, connection *con, mod_auth_plug
 	PATCH(auth_require);
 	PATCH(auth_debug);
 	PATCH(auth_ldap_hostname);
+	PATCH(auth_ldap_port);
 	PATCH(auth_ldap_basedn);
 	PATCH(auth_ldap_binddn);
 	PATCH(auth_ldap_bindpw);
@@ -151,6 +152,8 @@ static int mod_auth_patch_connection(server *srv, connection *con, mod_auth_plug
 #ifdef USE_LDAP
 				p-&gt;anon_conf = s;
 #endif
+			} else if (buffer_is_equal_string(du-&gt;key, CONST_STR_LEN("auth.backend.ldap.port"))) {
+				PATCH(auth_ldap_port);
 			} else if (buffer_is_equal_string(du-&gt;key, CONST_STR_LEN("auth.backend.ldap.base-dn"))) {
 				PATCH(auth_ldap_basedn);
 			} else if (buffer_is_equal_string(du-&gt;key, CONST_STR_LEN("auth.backend.ldap.filter"))) {
@@ -341,6 +341,7 @@
 		{ "auth.backend.htdigest.userfile", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 12 */
 		{ "auth.backend.htpasswd.userfile", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 13 */
 		{ "auth.debug",                     NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION },  /* 14 */
+		{ "auth.backend.ldap.port",         NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION },
 		{ NULL,                             NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
 	};
 
@@ -346,6 +350,7 @@ SETDEFAULTS_FUNC(mod_auth_set_defaults) {
 		s-&gt;auth_backend_conf = buffer_init();
 
 		s-&gt;auth_ldap_hostname = buffer_init();
+		s-&gt;auth_ldap_port = LDAP_PORT;
 		s-&gt;auth_ldap_basedn = buffer_init();
 		s-&gt;auth_ldap_binddn = buffer_init();
 		s-&gt;auth_ldap_bindpw = buffer_init();
@@ -377,6 +382,7 @@ SETDEFAULTS_FUNC(mod_auth_set_defaults) {
 		cv[12].destination = s-&gt;auth_htdigest_userfile;
 		cv[13].destination = s-&gt;auth_htpasswd_userfile;
 		cv[14].destination = &amp;(s-&gt;auth_debug);
+		cv[15].destination = &amp;(s-&gt;auth_ldap_port);
 
 		p-&gt;config_storage[i] = s;
 		ca = ((data_config *)srv-&gt;config_context-&gt;data[i])-&gt;value;
@@ -557,7 +563,7 @@ handler_t auth_ldap_init(server *srv, mod_auth_plugin_config *s) {
 		/* free old context */
 		if (NULL != s-&gt;ldap) ldap_unbind_s(s-&gt;ldap);
 
-		if (NULL == (s-&gt;ldap = ldap_init(s-&gt;auth_ldap_hostname-&gt;ptr, LDAP_PORT))) {
+		if (NULL == (s-&gt;ldap = ldap_init(s-&gt;auth_ldap_hostname-&gt;ptr, s-&gt;auth_ldap_port))) {
 			log_error_write(srv, __FILE__, __LINE__, "ss", "ldap ...", strerror(errno));
 
 			return HANDLER_ERROR;
-- 
</pre></body></html>