mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 06:29:23 +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:
parent
fea262c2aa
commit
37e6f6f08b
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user