void
ply_boot_client_ask_daemon_for_password (ply_boot_client_t *client,
+
+ const char *prompt,
ply_boot_client_answer_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data)
assert (client != NULL);
ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_PASSWORD,
- NULL, (ply_boot_client_response_handler_t)
+ prompt, (ply_boot_client_response_handler_t)
handler, failed_handler, user_data);
}
{
state_t *state;
char *command;
+ char *prompt;
} answer_state_t;
static char **
close (command_input_sender_fd);
dup2 (command_input_receiver_fd, STDIN_FILENO);
}
+
execvp (args[0], args);
ply_trace ("could not run command: %m");
_exit (127);
WEXITSTATUS (exit_status) != 0))
{
ply_boot_client_ask_daemon_for_password (answer_state->state->client,
+ answer_state->prompt,
(ply_boot_client_answer_handler_t)
on_answer,
(ply_boot_client_response_handler_t)
if (need_to_ask_user)
{
ply_boot_client_ask_daemon_for_password (answer_state->state->client,
+ answer_state->prompt,
(ply_boot_client_answer_handler_t)
on_answer,
(ply_boot_client_response_handler_t)
program = NULL;
ply_command_parser_get_command_options (state->command_parser,
command,
- "command", &program, NULL);
+ "command", &program,
+ "prompt", &prompt,
+ NULL);
answer_state = calloc (1, sizeof (answer_state_t));
answer_state->state = state;
answer_state->command = program;
+ answer_state->prompt = prompt;
if (answer_state->command != NULL)
{
else
{
ply_boot_client_ask_daemon_for_password (state->client,
+ answer_state->prompt,
(ply_boot_client_answer_handler_t)
on_answer,
(ply_boot_client_response_handler_t)
(ply_command_handler_t)
on_password_request, &state,
"command", "Command to send password to via standard input",
+ PLY_COMMAND_OPTION_TYPE_STRING,
+ "prompt", "Message to display when asking for password",
PLY_COMMAND_OPTION_TYPE_STRING, NULL);
if (!ply_command_parser_parse_arguments (state.command_parser, state.loop, argv, argc))
answer_state.state = &state;
ply_boot_client_ask_daemon_for_password (state.client,
+ NULL,
(ply_boot_client_answer_handler_t)
on_answer,
(ply_boot_client_response_handler_t)