[network-manager-applet/rm-userset] applet: pass '-i' flag to VPN auth dialogs to signal interaction is allowed



commit 4c2a04c5b4611554390f7ea5caed1dc497e50552
Author: Dan Williams <dcbw redhat com>
Date:   Thu Feb 10 11:46:28 2011 -0600

    applet: pass '-i' flag to VPN auth dialogs to signal interaction is allowed
    
    Sometimes we just want the auth dialog to return any existing secrets
    it knows about, but not prompt the user for anything, which is what
    should happen if this flag is not passed.  Only if the flag is passed
    should the VPN prompt the user for any input.
    
    To clarify "interaction allowed vs. retry", retry means that the old
    secrets aren't good and completely new ones should be requested, but
    retry still requires "interaction allowed" before the user should
    be prompted for anything.  The applet should never pass "retry"
    without "interaction allowed".

 src/applet-vpn-request.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/src/applet-vpn-request.c b/src/applet-vpn-request.c
index 2226f40..a6549df 100644
--- a/src/applet-vpn-request.c
+++ b/src/applet-vpn-request.c
@@ -340,8 +340,9 @@ applet_vpn_request_get_secrets (SecretsRequest *req, GError **error)
 	const char *connection_type;
 	const char *service_type;
 	char *bin_path;
-	const char *argv[9] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
+	const char *argv[10];
 	gboolean success = FALSE;
+	guint i = 0;
 
 	applet_secrets_request_set_free_func (req, free_vpn_secrets_info);
 
@@ -374,15 +375,18 @@ applet_vpn_request_get_secrets (SecretsRequest *req, GError **error)
 
 	priv = APPLET_VPN_REQUEST_GET_PRIVATE (info->vpn);
 
-	argv[0] = bin_path;
-	argv[1] = "-u";
-	argv[2] = nm_setting_connection_get_uuid (s_con);
-	argv[3] = "-n";
-	argv[4] = nm_setting_connection_get_id (s_con);
-	argv[5] = "-s";
-	argv[6] = service_type;
+	memset (argv, 0, sizeof (argv));
+	argv[i++] = bin_path;
+	argv[i++] = "-u";
+	argv[i++] = nm_setting_connection_get_uuid (s_con);
+	argv[i++] = "-n";
+	argv[i++] = nm_setting_connection_get_id (s_con);
+	argv[i++] = "-s";
+	argv[i++] = service_type;
+	if (req->flags & NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION)
+		argv[i++] = "-i";
 	if (req->flags & NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW)
-		argv[7] = "-r";
+		argv[i++] = "-r";
 
 	if (!g_spawn_async_with_pipes (NULL,                       /* working_directory */
 	                               (gchar **) argv,            /* argv */



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