Package: xfmail
Version: 1.5.5-4.1
Severity: serious
Justification: FTBFS

Hi Florian,

xfmail now fails to build in unstable and testing, because libldap2-dev has
been updated to the openldap 2.4 version and various ldap_*() functions are
deprecated:

[...]
 alpha-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I. -I../../src/include -DWITH_FACES 
-I../compface -I/usr/include/glib-1.2 -I/usr/lib/glib/include -DWITH_LDAP -Wall 
-g -O2 -I/usr/local/include -MT ldap.lo -MD -MP -MF .deps/ldap.Tpo -c ldap.cpp  
-fPIC -DPIC -o .libs/ldap.o
ldap.cpp: In function 'int init_LDAP()':
ldap.cpp:166: error: 'ldap_init' was not declared in this scope
ldap.cpp:175: error: 'ldap_simple_bind_s' was not declared in this scope
ldap.cpp: In function 'void close_LDAP()':
ldap.cpp:188: error: 'ldap_unbind' was not declared in this scope
ldap.cpp: In function '_mail_addr* find_ldap_expansion(char*)':
ldap.cpp:198: warning: deprecated conversion from string constant to 'char*'
ldap.cpp:198: warning: deprecated conversion from string constant to 'char*'
ldap.cpp:230: error: 'ldap_search' was not declared in this scope
ldap.cpp:273: error: 'ldap_get_values' was not declared in this scope
ldap.cpp:275: error: 'ldap_count_values' was not declared in this scope
ldap.cpp:283: error: 'ldap_value_free' was not declared in this scope
make[3]: *** [ldap.lo] Error 1
make[3]: Leaving directory `/build/buildd/xfmail-1.5.5/src/mail'
make[2]: *** [all-recursive] Error 1
[...]

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

These functions are all listed as deprecated in ldap.h, and are only
available if you build with -DLDAP_DEPRECATED.  Since they may be dropped
completely in some future version, it would probably be better to port to
the new functions now, as documented in ldap.h.

The attached patch attempts to implement this.  I've verified that it
builds, but haven't tested that it works.

Thanks,
-- 
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 xfmail-1.5.5/debian/changelog xfmail-1.5.5/debian/changelog
--- xfmail-1.5.5/debian/changelog
+++ xfmail-1.5.5/debian/changelog
@@ -1,3 +1,10 @@
+xfmail (1.5.5-4.2) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Patch to build with openldap 2.4.
+
+ -- Steve Langasek <[EMAIL PROTECTED]>  Mon, 28 Jan 2008 19:04:13 -0800
+
 xfmail (1.5.5-4.1) unstable; urgency=low
 
   * Non-maintainer upload.
only in patch2:
unchanged:
--- xfmail-1.5.5.orig/src/mail/ldap.cpp
+++ xfmail-1.5.5/src/mail/ldap.cpp
@@ -163,21 +163,21 @@
             sHost.append(":" + sPort);
         }
 
-		ld = ldap_init(sHost.c_str(), LDAP_PORT);
+		ldap_initialize(&ld,sHost.c_str());
 		if (ld == NULL) {
-			//cerr << "ldap_init failure" << endl;
-			display_msg(MSG_WARN, "LDAP", "Failure in ldap_init! Bad options?");
+			//cerr << "ldap_initialize failure" << endl;
+			display_msg(MSG_WARN, "LDAP", "Failure in ldap_initialize! Bad options?");
 			return -1;
 		}
 	}
 
 	if (!ldap_bound) {
-		if (ldap_simple_bind_s(ld, NULL, NULL) != LDAP_SUCCESS) {
-			//cerr << "ldap_simple_bind_s failure" << endl;
+		if (ldap_sasl_bind_s(ld, NULL, LDAP_SASL_SIMPLE, NULL, NULL, NULL, NULL) != LDAP_SUCCESS) {
+			//cerr << "ldap_sasl_bind_s failure" << endl;
 			return -1;
 		}
 		ldap_bound = 1;
-		//cerr << "ldap_simple_bind_s: ldap is now bound" << endl;
+		//cerr << "ldap_sasl_bind_s: ldap is now bound" << endl;
 	}
 	
 	return (ldap_bound);
@@ -185,7 +185,7 @@
 
 void close_LDAP(void) {
 	if (ld != NULL && ldap_bound) {
-		ldap_unbind(ld);
+		ldap_unbind_ext(ld, NULL, NULL);
 		ldap_bound = 0;
 		ld = NULL;
 	}
@@ -227,10 +227,10 @@
 		return NULL;
 	}
 	
-	searchRes = ldap_search(ld, sBase.c_str(), LDAP_SCOPE_SUBTREE, filter, attributes, 0);
+	rc = ldap_search_ext(ld, sBase.c_str(), LDAP_SCOPE_SUBTREE, filter, attributes, 0, NULL, NULL, NULL, LDAP_NO_LIMIT, &searchRes);
 	free(filter);
-	if ( searchRes == -1 ) {
-		//cerr << "find_ldap_expansion: ldap_search returned -1" << endl;
+	if ( rc != LDAP_SUCCESS ) {
+		//cerr << "find_ldap_expansion: ldap_search_ext returned -1" << endl;
 		return NULL;
 	}
 
@@ -266,13 +266,13 @@
 			for (attrib = ldap_first_attribute(ld, entry, &ber);
 				attrib != NULL;
 				attrib = ldap_next_attribute(ld, entry, ber)) {
-				char ** values;
+				struct berval ** values;
 
 				//cerr << "\t\t\tsearching attrib " << noResults << endl;
 
-				values = ldap_get_values(ld, entry, attrib);
+				values = ldap_get_values_len(ld, entry, attrib);
 				if ( values != NULL) {
-					char * last_val = values[ldap_count_values(values) - 1];
+					char * last_val = values[ldap_count_values_len(values) - 1]->bv_val;
 
 					if (strcmp(attrib, "mail") == 0)
 						ma->addr = strdup(last_val);
@@ -280,7 +280,7 @@
 						ma->name = copy_and_quote_name(last_val);
 				}
 
-				ldap_value_free(values);
+				ldap_value_free_len(values);
 			}
 
 		  	/*

Reply via email to