Package: pdns
Version: 2.9.21-4
Severity: serious

Hi guys,

pdns now fails to build in unstable and testing, because libldap2-dev has
been updated to the openldap 2.4 version and several functions are
deprecated:

[...]
 alpha-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I. -I../.. -pthread -D_GNU_SOURCE
-Wall -g -O2 -Wall -O2 -MT powerldap.lo -MD -MP -MF .deps/powerldap.Tpo -c
powerldap.cc  -fPIC -DPIC -o .libs/powerldap.o
powerldap.cc: In constructor 'PowerLDAP::PowerLDAP(const std::string&, 
uint16_t, bool)':
powerldap.cc:12: error: 'ldap_init' was not declared in this scope
powerldap.cc:19: error: 'ldap_unbind' was not declared in this scope
powerldap.cc:29: error: 'ldap_unbind' was not declared in this scope
powerldap.cc: In destructor 'PowerLDAP::~PowerLDAP()':
powerldap.cc:38: error: 'ldap_unbind' was not declared in this scope
powerldap.cc: In member function 'void PowerLDAP::simpleBind(const 
std::string&, const std::string&)':
powerldap.cc:63: error: 'ldap_simple_bind_s' was not declared in this scope
powerldap.cc: In member function 'int PowerLDAP::search(const std::string&, 
int, const std::string&, const char**)':
powerldap.cc:73: error: 'ldap_search' was not declared in this scope
make[3]: *** [powerldap.lo] Error 1
make[3]: Leaving directory `/build/buildd/pdns-2.9.21/modules/ldapbackend'
make[2]: *** [install-recursive] Error 1
[...]

A full build log is available at
<http://buildd.debian.org/fetch.cgi?pkg=pdns&arch=alpha&ver=2.9.21-4%2Bb1&stamp=1201322902&file=log&as=raw>.

According to ldap.h, these functions are each deprecated.  The attached
patch updates the code so that it builds with openldap 2.4; I haven't
verified that it runs correctly.  Alternatively, you can build with
-DLDAP_DEPRECATED to get the prototypes for these deprecated functions.

Cheers,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
[EMAIL PROTECTED]                                     [EMAIL PROTECTED]
diff -u pdns-2.9.21/debian/changelog pdns-2.9.21/debian/changelog
--- pdns-2.9.21/debian/changelog
+++ pdns-2.9.21/debian/changelog
@@ -1,3 +1,10 @@
+pdns (2.9.21-4.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Patch to build with openldap 2.4.
+
+ -- Steve Langasek <[EMAIL PROTECTED]>  Mon, 28 Jan 2008 00:11:44 +0000
+
 pdns (2.9.21-4) unstable; urgency=low
 
   * New portuguese translation included (closes: #444219).
only in patch2:
unchanged:
--- pdns-2.9.21.orig/modules/ldapbackend/powerldap.cc
+++ pdns-2.9.21/modules/ldapbackend/powerldap.cc
@@ -9,16 +9,7 @@
 
 	if( ldap_initialize( &d_ld, hosts.c_str() ) != LDAP_SUCCESS )
 	{
-		if( ( d_ld = ldap_init( hosts.c_str(), port ) ) == NULL )
-		{
-			throw LDAPException( "Error initializing LDAP connection: " + string( strerror( errno ) ) );
-		}
-
-		if( tls && ldap_start_tls_s( d_ld, NULL, NULL ) != LDAP_SUCCESS )
-		{
-			ldap_unbind( d_ld );
-			throw( LDAPException( "Couldn't perform STARTTLS" ) );
-		}
+		throw LDAPException( "Error initializing LDAP connection: " + string( strerror( errno ) ) );
 	}
 
 	if( ldap_set_option( d_ld, LDAP_OPT_PROTOCOL_VERSION, &protocol ) != LDAP_OPT_SUCCESS )
@@ -26,7 +17,7 @@
 		protocol = LDAP_VERSION2;
 		if( ldap_set_option( d_ld, LDAP_OPT_PROTOCOL_VERSION, &protocol ) != LDAP_OPT_SUCCESS )
 		{
-			ldap_unbind( d_ld );
+			ldap_unbind_ext( d_ld, NULL, NULL );
 			throw LDAPException( "Couldn't set protocol version to LDAPv3 or LDAPv2" );
 		}
 	}
@@ -35,7 +26,7 @@
 
 PowerLDAP::~PowerLDAP()
 {
-	ldap_unbind( d_ld );
+	ldap_unbind_ext( d_ld, NULL, NULL );
 }
 
 
@@ -60,7 +51,10 @@
 void PowerLDAP::simpleBind( const string& ldapbinddn, const string& ldapsecret )
 {
 	int err;
-	if( ( err = ldap_simple_bind_s( d_ld, ldapbinddn.c_str(), ldapsecret.c_str() ) ) != LDAP_SUCCESS )
+	struct berval passwd;
+	passwd.bv_val = (char *)ldapsecret.c_str();
+	passwd.bv_len = strlen(passwd.bv_val);
+	if( ( err = ldap_sasl_bind_s( d_ld, ldapbinddn.c_str(), LDAP_SASL_SIMPLE, &passwd, NULL, NULL, NULL ) ) != LDAP_SUCCESS )
 	{
 		throw LDAPException( "Failed to bind to LDAP server: " + getError( err ) );
 	}
@@ -69,10 +63,10 @@
 
 int PowerLDAP::search( const string& base, int scope, const string& filter, const char** attr )
 {
-	int msgid;
-	if( ( msgid = ldap_search( d_ld, base.c_str(), scope, filter.c_str(), const_cast<char**> (attr), 0 ) ) == -1 )
+	int msgid, rc;
+	if( ( rc = ldap_search_ext( d_ld, base.c_str(), scope, filter.c_str(), const_cast<char**> (attr), 0, NULL, NULL, NULL, LDAP_NO_LIMIT, &msgid ) ) != LDAP_SUCCESS )
 	{
-		throw LDAPException( "Starting LDAP search: " + getError() );
+		throw LDAPException( "Starting LDAP search: " + getError(rc) );
 	}
 
 	return msgid;

Reply via email to