2011-11-20 [mir] 0.6.0cvs24
authorMichael Rasmussen <mir@datanom.net>
Sun, 20 Nov 2011 23:32:53 +0000 (23:32 +0000)
committerMichael Rasmussen <mir@datanom.net>
Sun, 20 Nov 2011 23:32:53 +0000 (23:32 +0000)
* plugins/ldap/ldap-plugin.c
    Forgot to free LDAPMessage in case of en error.
    More clever handling of AbookConnection structure
    when writing new configuration.

ChangeLog
PATCHSETS
configure.ac
plugins/ldap/ldap-plugin.c

index f5a7c6a409519600cd2b60ca6ecba5ca5e4b11b7..7a23cec0a26ca93e5245021186078f38d1e503e6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+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.
+
 2011-11-20 [mir]       0.6.0cvs23
 
        * src/callbacks.c
index 68186703a57ff3f6147e25275f8d8fbf76a43dd3..970701524214d47412c9c1c77984a3c6b01777b0 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
@@ -21,3 +21,4 @@
 ( cvs diff -u -r 1.4 -r 1.5 plugins/ldap/ldap-plugin.c;  ) > 0.6.0cvs21.patchset
 ( cvs diff -u -r 1.5 -r 1.6 plugins/example/example-plugin.c;  cvs diff -u -r 1.5 -r 1.6 plugins/ldap/ldap-plugin.c;  cvs diff -u -r 1.6 -r 1.7 plugins/xml/xml-plugin.c;  cvs diff -u -r 1.6 -r 1.7 src/callbacks.c;  cvs diff -u -r 1.1 -r 1.2 src/callbacks.h;  cvs diff -u -r 1.4 -r 1.5 src/contactwindow.c;  cvs diff -u -r 1.1 -r 1.2 src/mainwindow.h;  cvs diff -u -r 1.7 -r 1.8 src/plugin-loader.c;  cvs diff -u -r 1.5 -r 1.6 src/plugin-loader.h;  cvs diff -u -r 1.6 -r 1.7 src/plugin.h;  cvs diff -u -r 1.5 -r 1.6 src/utils.c;  cvs diff -u -r 1.5 -r 1.6 src/utils.h;  ) > 0.6.0cvs22.patchset
 ( cvs diff -u -r 1.7 -r 1.8 src/callbacks.c;  ) > 0.6.0cvs23.patchset
+( cvs diff -u -r 1.6 -r 1.7 plugins/ldap/ldap-plugin.c;  ) > 0.6.0cvs24.patchset
index e75a576594337c2b3ddfe9da7b0a1b7e11345f5b..b6f89ae06047137a64ca19b805b5218ceda888de 100644 (file)
@@ -12,7 +12,7 @@ MINOR_VERSION=6
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=23
+EXTRA_VERSION=24
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index e1b9be1842c0ff37e138d4776d6f9c2db63d49ae..519b4d2ce8385e6f19a9da25d7ae25dce2f78410 100644 (file)
@@ -843,6 +843,8 @@ static GSList* call_server(Server* server,
                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 @@ static GSList* call_server(Server* server,
                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 @@ gboolean plugin_abook_set_config(AddressBook* old,
                                                                 AddressBook* new,
                                                                 gchar** error) {
        AddressBook* abook;
-       AbookConnection* ac;
+       AbookConnection* ac = NULL;
        GSList* cur;
        
        if (! config) {
@@ -1447,7 +1451,6 @@ gboolean plugin_abook_set_config(AddressBook* old,
                return TRUE;
        }
        
-       ac = abook_connection_new();
        if (new) {
                /* Update config for existing address book */
                self->abook_delete(old, error);
@@ -1457,6 +1460,7 @@ gboolean plugin_abook_set_config(AddressBook* old,
                        *error = NULL;
                }
                abook = new;
+               ac = get_abook_connection(abook);
        }
        else {
                /* Write config for new address book */
@@ -1467,11 +1471,20 @@ gboolean plugin_abook_set_config(AddressBook* old,
                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 @@ gboolean plugin_abook_set_config(AddressBook* old,
                        }
                }
        }
-               
-       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;
 }