summary refs log tree commit diff
path: root/clients/cli/polkit-agent.c
diff options
context:
space:
mode:
Diffstat (limited to 'clients/cli/polkit-agent.c')
-rw-r--r--clients/cli/polkit-agent.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/clients/cli/polkit-agent.c b/clients/cli/polkit-agent.c
index a163b824..b1fcaad8 100644
--- a/clients/cli/polkit-agent.c
+++ b/clients/cli/polkit-agent.c
@@ -25,11 +25,8 @@
 #include <string.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <termios.h>
-
-#include <glib.h>
-#include <glib/gi18n-lib.h>
 
+#include "nm-default.h"
 #include "polkit-agent.h"
 #include "nm-polkit-listener.h"
 #include "common.h"
@@ -44,18 +41,10 @@ polkit_request (const char *request,
 		gpointer user_data)
 {
 	char *response, *tmp, *p;
-	struct termios termios_orig, termios_new;
 
 	g_print ("%s\n", message);
 	g_print ("(action_id: %s)\n", action_id);
 
-	if (!echo_on) {
-		tcgetattr (STDIN_FILENO, &termios_orig);
-		termios_new = termios_orig;
-		termios_new.c_lflag &= ~(ECHO);
-		tcsetattr (STDIN_FILENO, TCSADRAIN, &termios_new);
-	}
-
 	/* Ask user for polkit authorization password */
 	if (user) {
 		/* chop of ": " if present */
@@ -63,16 +52,12 @@ polkit_request (const char *request,
 		p = strrchr (tmp, ':');
 		if (p && !strcmp (p, ": "))
 			*p = '\0';
-		response = nmc_readline ("%s (%s): ", tmp, user);
+		response = nmc_readline_echo (echo_on, "%s (%s): ", tmp, user);
 		g_free (tmp);
 	} else
-		response = nmc_readline ("%s", request);
+		response = nmc_readline_echo (echo_on, "%s", request);
 	g_print ("\n");
 
-	/* Restore original terminal settings */
-	if (!echo_on)
-		tcsetattr (STDIN_FILENO, TCSADRAIN, &termios_orig);
-
 	return response;
 }
 
@@ -142,7 +127,7 @@ nmc_start_polkit_agent_start_try (NmCli *nmc)
 #else
 /* polkit agent is not avalable; implement stub functions. */
 
-#include <glib.h>
+#include "nm-default.h"
 #include "nmcli.h"
 #include "polkit-agent.h"