[PATCH] smbldap: allow alternative port definitions

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] smbldap: allow alternative port definitions

Samba - samba-technical mailing list
From: Bjoern Jacke <[hidden email]>

on ldap libraries without ldap_initialize() it was not possible to define an
alternative connection port.

Signed-off-by: Bjoern Jacke <[hidden email]>
---
 source3/lib/smbldap.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c
index ebefd04..e6fc42e 100644
--- a/source3/lib/smbldap.c
+++ b/source3/lib/smbldap.c
@@ -682,14 +682,16 @@ static int smb_ldap_setup_conn(LDAP **ldap_struct, const char *uri)
 
  sscanf(uri, "%10[^:]://%254[^:/]:%d", protocol, host, &port);
 
- if (port == 0) {
- if (strequal(protocol, "ldap")) {
+ if (strequal(protocol, "ldap")) {
+ if (port == 0) {
  port = LDAP_PORT;
- } else if (strequal(protocol, "ldaps")) {
+ }
+ } else if (strequal(protocol, "ldaps")) {
+ if (port == 0) {
  port = LDAPS_PORT;
- } else {
- DEBUG(0, ("unrecognised protocol (%s)!\n", protocol));
  }
+ } else {
+ DEBUG(0, ("unrecognised protocol (%s)!\n", protocol));
  }
 
  if ((*ldap_struct = ldap_init(host, port)) == NULL) {
--
2.7.4