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