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