[network-manager-openvpn] auth-dialog: always return found secrets



commit 531e84e4c28dd540e3fe2c2aedd46ee08e3e3a52
Author: Dan Williams <dcbw redhat com>
Date:   Fri Dec 13 16:20:13 2013 -0600

    auth-dialog: always return found secrets
    
    Always return any secrets which were found even if not strictly
    required.  For ExternalUiMode, if the secret doesn't need to be
    requested from the user, ensure that ShouldAsk is FALSE for
    secrets which are found, but for which the user doesn't need
    to enter, such as saved secrets.
    
    This fixes a problem with GNOME Shell when multiple secrets are
    stored by the user agent.  Since agents delete any saved secrets before
    saving new secrets, this could delete some secrets, but since
    that item was not included in the returned secrets, it wouldn't be
    re-saved, and would be lost.

 auth-dialog/main.c |   34 +++++++++++++++-------------------
 1 files changed, 15 insertions(+), 19 deletions(-)
---
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index ca330c1..55dcce0 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -176,23 +176,19 @@ eui_finish (const char *vpn_name,
        g_key_file_set_string (keyfile, UI_KEYFILE_GROUP, "Title", title);
        g_free (title);
 
-       if (need_password) {
-               keyfile_add_entry_info (keyfile,
-                                       NM_OPENVPN_KEY_PASSWORD,
-                                       existing_password ? existing_password : "",
-                                       _("Password:"),
-                                       TRUE,
-                                       allow_interaction);
-       }
-
-       if (need_certpass) {
-               keyfile_add_entry_info (keyfile,
-                                       NM_OPENVPN_KEY_CERTPASS,
-                                       existing_certpass ? existing_certpass : "",
-                                       _("Certificate password:"),
-                                       TRUE,
-                                       allow_interaction);
-       }
+       keyfile_add_entry_info (keyfile,
+                               NM_OPENVPN_KEY_PASSWORD,
+                               existing_password ? existing_password : "",
+                               _("Password:"),
+                               TRUE,
+                               need_password && allow_interaction);
+
+       keyfile_add_entry_info (keyfile,
+                               NM_OPENVPN_KEY_CERTPASS,
+                               existing_certpass ? existing_certpass : "",
+                               _("Certificate password:"),
+                               TRUE,
+                               need_certpass && allow_interaction);
 
        keyfile_print_stdout (keyfile);
        g_key_file_unref (keyfile);
@@ -296,9 +292,9 @@ std_finish (const char *vpn_name,
             const char *certpass)
 {
        /* Send the passwords back to our parent */
-       if (need_password && password)
+       if (password)
                printf ("%s\n%s\n", NM_OPENVPN_KEY_PASSWORD, password);
-       if (need_certpass && certpass)
+       if (certpass)
                printf ("%s\n%s\n", NM_OPENVPN_KEY_CERTPASS, certpass);
        printf ("\n\n");
 


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