[evolution-patches][Contacts] Fix for bug#325742



hi,
        If Os is solaris10 for x86, and LDAP libraries is SUN LDAP. 

        It cause by eabc_details_search() in
addressbook/gui/component/addressbook-config.c. In Linux, because we use
Openldap libraries, ldap_url_parse("ldap://:389/??one";, &lud) would
return LDAP_SUCCESS when url's host==NULL. But in Sun LDAP libraries(or
mozilla ldap libs) ldap_url_parse() would not return LDAP_SUCCESS if
url's host==NULL, so lud would be NULL and lud should be checked before
using it. But when using lud->lud_scope, it don't do this way.
        
        this patch adds a check before using lud->scope.

regards,

jerry
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.2026
diff -u -p -r1.2026 ChangeLog
--- ChangeLog	22 Dec 2005 07:55:15 -0000	1.2026
+++ ChangeLog	4 Jan 2006 09:51:26 -0000
@@ -1,3 +1,8 @@
+2006-01-04  Shi Pu  <shi pu sun com>
+
+	* gui/component/addressbook-config.c (eabc_details_search): add a not
+	NULL-pointer check before using lud->scope.
+
 2005-12-22  Srinivasa Ragavan <sragavan novell com>
 
 	* gui/search/addresstypes.xml: Modified the categories to option menu
Index: gui/component/addressbook-config.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/addressbook-config.c,v
retrieving revision 1.105
diff -u -p -r1.105 addressbook-config.c
--- gui/component/addressbook-config.c	25 Nov 2005 20:32:35 -0000	1.105
+++ gui/component/addressbook-config.c	4 Jan 2006 09:51:26 -0000
@@ -57,7 +57,9 @@
 #ifdef HAVE_LDAP
 #ifndef G_OS_WIN32
 #include <ldap.h>
 #include <ldap_schema.h>
 #else
 #include <winldap.h>
 #include "openldap-extract.h"
@@ -890,17 +892,19 @@ eabc_details_search(EConfig *ec, EConfig
 	g_signal_connect (sdialog->rootdn, "changed", G_CALLBACK (rootdn_changed_cb), sdialog);
 
 	sdialog->scope_optionmenu = glade_xml_get_widget (gui, "scope-optionmenu");
-	switch (lud->lud_scope) {
-	case LDAP_SCOPE_BASE:
-		sdialog->scope = ADDRESSBOOK_LDAP_SCOPE_BASE;
-		break;
-	default:
-	case LDAP_SCOPE_ONELEVEL:
-		sdialog->scope = ADDRESSBOOK_LDAP_SCOPE_ONELEVEL;
-		break;
-	case LDAP_SCOPE_SUBTREE:
-		sdialog->scope = ADDRESSBOOK_LDAP_SCOPE_SUBTREE;
-		break;
+	if(lud){
+		switch (lud->lud_scope) {
+		case LDAP_SCOPE_BASE:
+			sdialog->scope = ADDRESSBOOK_LDAP_SCOPE_BASE;
+			break;
+		default:
+		case LDAP_SCOPE_ONELEVEL:
+			sdialog->scope = ADDRESSBOOK_LDAP_SCOPE_ONELEVEL;
+			break;
+		case LDAP_SCOPE_SUBTREE:
+			sdialog->scope = ADDRESSBOOK_LDAP_SCOPE_SUBTREE;
+			break;
+		}
 	}
 	gtk_option_menu_set_history (GTK_OPTION_MENU(sdialog->scope_optionmenu), sdialog->scope);
 	g_signal_connect(sdialog->scope_optionmenu, "changed", G_CALLBACK(scope_optionmenu_changed_cb), sdialog);


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