mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-02 23:38:11 +02:00
cli: use new nmc_readline_echo() in polkit agent
This commit is contained in:
parent
a14306c2ce
commit
02388060c1
1 changed files with 2 additions and 15 deletions
|
|
@ -25,7 +25,6 @@
|
|||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <termios.h>
|
||||
|
||||
#include "nm-default.h"
|
||||
#include "polkit-agent.h"
|
||||
|
|
@ -42,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 */
|
||||
|
|
@ -61,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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue