[network-manager-applet/lr/no-keyring] applet: avoid a crash on failure to get the secrets



commit fe74f80d49a3063ddba97a5a024ab85ed217e02d
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Thu Jun 7 20:55:54 2018 +0200

    applet: avoid a crash on failure to get the secrets
    
    If getting old secrets fails for whichever reason, get_existing_secrets_cb()
    is called with error set and NULL settings (by keyring_find_secrets_cb()).

 src/applet.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/applet.c b/src/applet.c
index 17972945..1c489b6d 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -2866,8 +2866,10 @@ get_existing_secrets_cb (NMSecretAgentOld *agent,
        NMADeviceClass *dclass;
        GError *error = NULL;
 
-       /* Merge existing secrets into connection; ignore errors */
-       nm_connection_update_secrets (connection, req->setting_name, secrets, NULL);
+       if (secrets)
+               nm_connection_update_secrets (connection, req->setting_name, secrets, NULL);
+       else
+               nm_connection_clear_secrets (connection);
 
        dclass = get_device_class_from_connection (connection, req->applet);
        g_assert (dclass);


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