3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 14:49:24 +01:00

client: Cancel agent prompt with CTRL+D

Previously, CTRL+D used to cause termination of the client. Now, the
command will cancel the agent’s prompts in agent mod. In regular mode
the behavior is unchanged.
This commit is contained in:
Tim Kourt 2019-10-28 10:21:59 -07:00 committed by Denis Kenzior
parent fea262c2aa
commit 37e6f6f08b
2 changed files with 23 additions and 13 deletions

View File

@ -366,14 +366,17 @@ static void process_input_username_password(const char *prompt)
struct l_dbus_message *reply;
char *username;
if (!prompt || !strlen(prompt)) {
reply = agent_reply_canceled(pending_message,
"Canceled by user");
l_queue_clear(pending_op.saved_input, l_free);
goto send_reply;
}
if (l_queue_isempty(pending_op.saved_input)) {
/* received username */
if (!strlen(prompt)) {
reply = agent_reply_canceled(pending_message,
"Canceled by user");
goto send_reply;
}
l_queue_push_tail(pending_op.saved_input, l_strdup(prompt));
display_agent_prompt(PROMPT_PASSWORD, true);
@ -397,7 +400,7 @@ static void process_input_passphrase(const char *prompt)
{
struct l_dbus_message *reply;
if (!strlen(prompt)) {
if (!prompt || !strlen(prompt)) {
reply = agent_reply_canceled(pending_message,
"Canceled by user");
goto send_reply;
@ -412,11 +415,18 @@ send_reply:
static void process_input_password(const char *prompt)
{
struct l_dbus_message *reply =
l_dbus_message_new_method_return(pending_message);
struct l_dbus_message *reply;
if (!prompt || !strlen(prompt)) {
reply = agent_reply_canceled(pending_message,
"Canceled by user");
goto send_reply;
}
reply = l_dbus_message_new_method_return(pending_message);
l_dbus_message_set_arguments(reply, "s", prompt);
send_reply:
agent_send_reply(reply);
}

View File

@ -465,6 +465,10 @@ static void readline_callback(char *prompt)
HIST_ENTRY *previous_prompt;
if (agent_prompt(masked_input.use_mask ?
masked_input.passphrase : prompt))
goto done;
if (!prompt) {
display_quit();
@ -473,10 +477,6 @@ static void readline_callback(char *prompt)
return;
}
if (agent_prompt(masked_input.use_mask ?
masked_input.passphrase : prompt))
goto done;
if (!strlen(prompt))
goto done;