From: Arran Cudbard-Bell Date: Tue, 30 Jun 2015 20:23:00 +0000 (-0400) Subject: Ignore port if we're connecting to a unix socket X-Git-Tag: release_3_0_9~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=554b9333ac6fb508e5ce2c959fdd359e87cfb81d;p=thirdparty%2Ffreeradius-server.git Ignore port if we're connecting to a unix socket --- diff --git a/src/modules/rlm_ldap/rlm_ldap.c b/src/modules/rlm_ldap/rlm_ldap.c index e8e6afcaf60..2fc924b902f 100644 --- a/src/modules/rlm_ldap/rlm_ldap.c +++ b/src/modules/rlm_ldap/rlm_ldap.c @@ -894,26 +894,33 @@ static int mod_instantiate(CONF_SECTION *conf, void *instance) /* * Figure out the default port from the URL */ - if (ldap_url->lud_scheme && (strcmp(ldap_url->lud_scheme, "ldaps") == 0)) { - if (inst->start_tls == true) { - cf_log_err_cs(conf, "ldaps:// scheme is not compatible " - "with 'start_tls'"); - goto ldap_url_error; + if (ldap_url->lud_scheme) { + if (strcmp(ldap_url->lud_scheme, "ldaps") == 0) { + if (inst->start_tls == true) { + cf_log_err_cs(conf, "ldaps:// scheme is not compatible " + "with 'start_tls'"); + goto ldap_url_error; + } + default_port = LDAPS_PORT; + } else if (strcmp(ldap_url->lud_scheme, "ldapi") == 0) { + default_port = -1; } - default_port = LDAPS_PORT; } - /* - * Configured port overrides URL port - */ - if (inst->port) ldap_url->lud_port = inst->port; + if (default_port > 0) { + /* + * Configured port overrides URL port + */ + if (inst->port) ldap_url->lud_port = inst->port; - /* - * If there's no URL port, then set it to the default - * this is so debugging messages show explicitly - * the port we're connecting to. - */ - if (!ldap_url->lud_port) ldap_url->lud_port = default_port; + /* + * If there's no URL port, then set it to the default + * this is so debugging messages show explicitly + * the port we're connecting to. + */ + if (!ldap_url->lud_port) ldap_url->lud_port = default_port; + + } url = ldap_url_desc2str(ldap_url); if (!url) {