[Bug 145501] cmake error on Solaris in kdepimlibs with ldap/lber

Szombathelyi György gyurco at freemail.hu
Wed May 23 19:27:07 BST 2007


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=145501         




------- Additional Comments From gyurco freemail hu  2007-05-23 20:27 -------
SVN commit 667726 by gyurco:

Another set of compatibility fixes with other client libs than OpenLDAP...

CCBUG: 145501


 M  +10 -1     CMakeLists.txt  
 M  +1 -1      ber.cpp  
 M  +3 -0      kldap_config.h.cmake  
 M  +18 -2     ldapconnection.cpp  


--- trunk/KDE/kdepimlibs/kldap/CMakeLists.txt #667725:667726
 @ -9,7 +9,6  @
 macro_log_feature(SASL2_FOUND "cyrus-sasl" "Cyrus SASL API" "http://asg.web.cmu.edu/sasl/sasl-library.html" FALSE "" "Needed to support authentication of logins" )
 
 check_include_files(sys/time.h    HAVE_SYS_TIME_H)
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/kldap_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kldap_config.h )
 
 set(kldap_EXTRA_LIBS)
 set(kldap_EXTRA_INCLUDES)
 @ -17,6 +16,14  @
 if (LDAP_FOUND)
 set(kldap_EXTRA_LIBS ${LDAP_LIBRARIES})
 set(klap_EXTRA_INCLUDES ${LDAP_INCLUDE_DIR})
+
+set(CMAKE_REQUIRED_INCLUDES lber.h ldap.h)
+set(CMAKE_REQUIRED_LIBRARIES ${LDAP_LIBRARIES})
+check_function_exists(ldap_start_tls_s HAVE_LDAP_START_TLS_S)
+check_function_exists(ldap_initialize HAVE_LDAP_INITIALIZE)
+check_function_exists(ber_memfree HAVE_BER_MEMFREE)
+
+
 endif (LDAP_FOUND)
 
 if (SASL2_FOUND)
 @ -24,6 +31,8  @
 set(kldap_EXTRA_INCLUDES ${kldap_EXTRA_INCLUDES} ${SASL2_INCLUDE_DIR})
 endif (SASL2_FOUND)
 
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/kldap_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kldap_config.h )
+
 add_subdirectory(tests)
 
 ########### next target ###############
--- trunk/KDE/kdepimlibs/kldap/ber.cpp #667725:667726
 @ -42,7 +42,7  @
 #define LBER_USE_DER 1
 #endif
 
-#ifndef ber_memfree
+#ifndef HAVE_BER_MEMFREE
 #define ber_memfree(x) ldap_memfree(x)
 #endif
 
--- trunk/KDE/kdepimlibs/kldap/kldap_config.h.cmake #667725:667726
 @ -1,3 +1,6  @
 #cmakedefine LDAP_FOUND
 #cmakedefine SASL2_FOUND
 #cmakedefine HAVE_SYS_TIME_H
+#cmakedefine HAVE_LDAP_START_TLS_S
+#cmakedefine HAVE_LDAP_INITIALIZE
+#cmakedefine HAVE_BER_MEMFREE
--- trunk/KDE/kdepimlibs/kldap/ldapconnection.cpp #667725:667726
 @ -34,8 +34,13  @
 #define LDAP_DEPRECATED 1 //for ldap_simple_bind_s
 #include <lber.h>
 #include <ldap.h>
+
+#ifndef LDAP_OPT_SUCCESS
+#define LDAP_OPT_SUCCESS 0
 #endif
 
+#endif
+
 using namespace KLDAP;
 
 class LdapConnection::LdapConnectionPrivate
 @ -263,7 +268,12  @
   url += ':';
   url += QString::number( d->mServer.port() );
   kDebug(5322) << "ldap url: " << url << endl;
+#ifdef HAVE_LDAP_INITIALIZE
   ret = ldap_initialize( &d->mLDAP, url.toLatin1() );
+#else
+  d->mLDAP = ldap_init( d->mServer.host().toLatin1().data(), d->mServer.port() );
+  if ( d->mLDAP == 0 ) ret = -1;
+#endif
   if ( ret != LDAP_SUCCESS ) {
     d->mConnectionError = i18n("An error occurred during the connection initialization phase.");
     return ret;
 @ -281,11 +291,17  @
   kDebug(5322) << "setting security to: " << d->mServer.security() << endl;
   if ( d->mServer.security() == LdapServer::TLS ) {
     kDebug(5322) << "start TLS" << endl;
+#ifdef HAVE_LDAP_START_TLS_S
     if ( ( ret = ldap_start_tls_s( d->mLDAP, NULL, NULL ) ) != LDAP_SUCCESS ) {
       close();
       d->mConnectionError = i18n("Cannot start TLS.");
       return ret;
     }
+#else
+    close();
+    d->mConnectionError = i18n("TLS support not available in the LDAP client libraries.");
+    return -1;
+#endif
   }
 
   kDebug(5322) << "setting sizelimit to: " << d->mServer.sizeLimit() << endl;
 @ -342,7 +358,7  @
       pass = d->mServer.password();
     }
     kDebug(5322) << "binding to server, bindname: " << bindname << " password: *****" << endl;
-    ret = ldap_simple_bind_s( d->mLDAP, bindname.toUtf8(), pass.toUtf8() );
+    ret = ldap_simple_bind_s( d->mLDAP, bindname.toUtf8().data(), pass.toUtf8().data() );
   }
   return ret;
 }
 @ -350,7 +366,7  @
 void LdapConnection::close()
 {
   if ( d->mLDAP ) {
-    ldap_unbind_ext_s( d->mLDAP, 0, 0 );
+    ldap_unbind_ext( d->mLDAP, 0, 0 );
   }
   d->mLDAP = 0;
   kDebug(5322) << "connection closed!" << endl;



More information about the Kdepim-bugs mailing list