|
|
57672d |
From 69709289b083c53ba41d2cef7d65120220f8c59b Mon Sep 17 00:00:00 2001
|
|
|
57672d |
From: Sumit Bose <sbose@redhat.com>
|
|
|
57672d |
Date: Tue, 7 May 2013 17:02:57 +0200
|
|
|
57672d |
Subject: [PATCH] LDAPI SASL fix
|
|
|
57672d |
|
|
|
57672d |
Resolves: #960222
|
|
|
57672d |
---
|
|
|
57672d |
libraries/libldap/cyrus.c | 19 ++++++++++++++++---
|
|
|
57672d |
1 Datei geändert, 16 Zeilen hinzugefügt(+), 3 Zeilen entfernt(-)
|
|
|
57672d |
|
|
|
57672d |
diff --git a/libraries/libldap/cyrus.c b/libraries/libldap/cyrus.c
|
|
|
57672d |
index 28c241b..a9acf36 100644
|
|
|
57672d |
--- a/libraries/libldap/cyrus.c
|
|
|
57672d |
+++ b/libraries/libldap/cyrus.c
|
|
|
57672d |
@@ -394,6 +394,8 @@ ldap_int_sasl_bind(
|
|
|
57672d |
struct berval ccred = BER_BVNULL;
|
|
|
57672d |
int saslrc, rc;
|
|
|
57672d |
unsigned credlen;
|
|
|
57672d |
+ char my_hostname[HOST_NAME_MAX + 1];
|
|
|
57672d |
+ int free_saslhost = 0;
|
|
|
57672d |
|
|
|
57672d |
Debug( LDAP_DEBUG_TRACE, "ldap_int_sasl_bind: %s\n",
|
|
|
57672d |
mechs ? mechs : "<null>", 0, 0 );
|
|
|
57672d |
@@ -454,14 +456,25 @@ ldap_int_sasl_bind(
|
|
|
57672d |
|
|
|
57672d |
/* If we don't need to canonicalize just use the host
|
|
|
57672d |
* from the LDAP URI.
|
|
|
57672d |
+ * Always use the result of gethostname() for LDAPI.
|
|
|
57672d |
*/
|
|
|
57672d |
- if ( nocanon )
|
|
|
57672d |
+ if (ld->ld_defconn->lconn_server->lud_scheme != NULL &&
|
|
|
57672d |
+ strcmp("ldapi", ld->ld_defconn->lconn_server->lud_scheme) == 0) {
|
|
|
57672d |
+ rc = gethostname(my_hostname, HOST_NAME_MAX + 1);
|
|
|
57672d |
+ if (rc == 0) {
|
|
|
57672d |
+ saslhost = my_hostname;
|
|
|
57672d |
+ } else {
|
|
|
57672d |
+ saslhost = "localhost";
|
|
|
57672d |
+ }
|
|
|
57672d |
+ } else if ( nocanon )
|
|
|
57672d |
saslhost = ld->ld_defconn->lconn_server->lud_host;
|
|
|
57672d |
- else
|
|
|
57672d |
+ else {
|
|
|
57672d |
saslhost = ldap_host_connected_to( ld->ld_defconn->lconn_sb,
|
|
|
57672d |
"localhost" );
|
|
|
57672d |
+ free_saslhost = 1;
|
|
|
57672d |
+ }
|
|
|
57672d |
rc = ldap_int_sasl_open( ld, ld->ld_defconn, saslhost );
|
|
|
57672d |
- if ( !nocanon )
|
|
|
57672d |
+ if ( free_saslhost )
|
|
|
57672d |
LDAP_FREE( saslhost );
|
|
|
57672d |
}
|
|
|
57672d |
|
|
|
57672d |
--
|
|
|
57672d |
1.7.11.7
|
|
|
57672d |
|