[Commits] ldap-plugin.c 1.6 1.7

miras at claws-mail.org miras at claws-mail.org
Mon Nov 21 00:32:55 CET 2011


Update of /home/claws-mail/contacts/plugins/ldap
In directory claws-mail:/tmp/cvs-serv1830/plugins/ldap

Modified Files:
	ldap-plugin.c 
Log Message:
2011-11-20 [mir]	0.6.0cvs24

	* plugins/ldap/ldap-plugin.c
	    Forgot to free LDAPMessage in case of en error.
	    More clever handling of AbookConnection structure
	    when writing new configuration. 

Index: ldap-plugin.c
===================================================================
RCS file: /home/claws-mail/contacts/plugins/ldap/ldap-plugin.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ldap-plugin.c	20 Nov 2011 21:24:20 -0000	1.6
+++ ldap-plugin.c	20 Nov 2011 23:32:53 -0000	1.7
@@ -843,6 +843,8 @@
         	0, NULL, NULL, &timeOut, max_size, &res);
         if (rc == LDAP_SUCCESS || rc == LDAP_TIMELIMIT_EXCEEDED || LDAP_SIZELIMIT_EXCEEDED)
         	response = g_slist_append(response, res);
+        else
+        	ldap_msgfree(res);
 	}
 	else {
 	    for (cur = server->baseDN; cur; cur = g_slist_next(cur)) {
@@ -852,6 +854,8 @@
 	        if (rc == LDAP_SUCCESS || rc == LDAP_TIMELIMIT_EXCEEDED || LDAP_SIZELIMIT_EXCEEDED) {
 				response = g_slist_append(response, res);
 	        }
+	        else
+	        	ldap_msgfree(res);
 	    }
 	}
 
@@ -1437,7 +1441,7 @@
 								 AddressBook* new,
 								 gchar** error) {
 	AddressBook* abook;
-	AbookConnection* ac;
+	AbookConnection* ac = NULL;
 	GSList* cur;
 	
 	if (! config) {
@@ -1447,7 +1451,6 @@
 		return TRUE;
 	}
 	
-	ac = abook_connection_new();
 	if (new) {
 		/* Update config for existing address book */
 		self->abook_delete(old, error);
@@ -1457,6 +1460,7 @@
 			*error = NULL;
 		}
 		abook = new;
+		ac = get_abook_connection(abook);
 	}
 	else {
 		/* Write config for new address book */
@@ -1467,11 +1471,20 @@
 		if (error) {
 			*error = g_strdup(_("Missing name for address book"));
 		}
-		abook_connection_free(ac);
-		ac = NULL;
 		return FALSE;
 	}
-	
+
+	if (! ac) {
+		ac = abook_connection_new();
+		abook_connection = g_slist_prepend(abook_connection, ac);
+	}
+
+	gchar* plain = g_strconcat(abook->abook_name, abook->URL, NULL);
+	gchar* id = sha256(plain);
+	g_free(plain);
+	ac->id = g_strdup(id);
+	g_free(id);
+		
 	g_key_file_set_string(config->key_file, abook->abook_name, "url", abook->URL);
 	g_key_file_set_string(config->key_file, abook->abook_name, "username", abook->username);
 	g_key_file_set_string(config->key_file, abook->abook_name,
@@ -1496,16 +1509,8 @@
 			}
 		}
 	}
-		
-	abook->dirty = TRUE;
 
-	gchar* plain = g_strconcat(abook->abook_name, abook->URL, NULL);
-	gchar* id = sha256(plain);
-	g_free(plain);
-	if (ac->id)
-		g_free(ac->id);
-	ac->id = g_strdup(id);
-	g_free(id);
+	abook->dirty = TRUE;
 	
 	return (*error) ? TRUE : FALSE;
 }



More information about the Commits mailing list