gconf r2550 - in trunk: . backends



Author: jmouette
Date: Tue Feb 19 18:42:42 2008
New Revision: 2550
URL: http://svn.gnome.org/viewvc/gconf?rev=2550&view=rev

Log:
2008-02-19  Josselin Mouette  <joss malsain org>

        reviewed by: Mark McLoughlin.

        * backends/evoldap-backend.c: (get_variable),
        (get_ldap_connection), (lookup_values_from_ldap): replace
        functions that have been deprecated in OpenLDAP 2.4 by
        up-to-date ones. Closes bug#516877.


Modified:
   trunk/ChangeLog
   trunk/backends/evoldap-backend.c

Modified: trunk/backends/evoldap-backend.c
==============================================================================
--- trunk/backends/evoldap-backend.c	(original)
+++ trunk/backends/evoldap-backend.c	Tue Feb 19 18:42:42 2008
@@ -258,14 +258,14 @@
   attr = ldap_first_attribute (connection, entry, &berptr);
   while (attr != NULL && retval == NULL)
     {
-      char **values;
+      struct berval **values;
 
       if (strcmp (attr, varname) == 0)
 	{
-	  values = ldap_get_values (connection, entry, attr);
-	  if (values != NULL)
-	    retval = g_strdup (values[0]);
-	  ldap_value_free (values);
+	  values = ldap_get_values_len (connection, entry, attr);
+	  if (values != NULL && values[0] != NULL)
+	    retval = g_strdup (values[0]->bv_val);
+	  ldap_value_free_len (values);
 	}
 
       attr = ldap_next_attribute (connection, entry, berptr);
@@ -560,6 +560,7 @@
 		     GError    **err)
 {
   LDAP *connection;
+  char *url;
 
   g_assert (esource->conf_file_parsed);
 
@@ -576,13 +577,15 @@
 	     _("Contacting LDAP server: host '%s', port '%d', base DN '%s'"),
 	     esource->ldap_host, esource->ldap_port, esource->base_dn);
 
-  if ((connection = ldap_init (esource->ldap_host, esource->ldap_port)) == NULL)
+  url = g_strdup_printf ("ldap://%s:%i";, esource->ldap_host, esource->ldap_port);
+  if (ldap_initialize (&connection, url) != LDAP_SUCCESS)
     {
       gconf_log (GCL_ERR,
 		 _("Failed to contact LDAP server: %s"),
 		 g_strerror (errno));
       return NULL;
     }
+  g_free (url);
 
   esource->connection = connection;
 
@@ -670,12 +673,13 @@
 	     esource->filter_str);
 
   entries = NULL;
-  ret = ldap_search_s (connection,
-		       esource->base_dn,
-		       LDAP_SCOPE_ONELEVEL,
-		       esource->filter_str,
-		       NULL, 0,
-		       &entries);
+  ret = ldap_search_ext_s (connection,
+			   esource->base_dn,
+			   LDAP_SCOPE_ONELEVEL,
+			   esource->filter_str,
+			   NULL, 0,
+			   NULL, NULL, NULL, 0,
+			   &entries);
   if (ret != LDAP_SUCCESS)
     {
       gconf_log (GCL_ERR,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]