Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pam: Allow SIGINT (Ctrl+C) while waiting for device press [proof of concept] #315

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions util.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <unistd.h>
#include <string.h>
#include <arpa/inet.h>
#include <signal.h>

#include "b64.h"
#include "debug.h"
Expand Down Expand Up @@ -1146,6 +1147,7 @@ int do_authentication(const cfg_t *cfg, const device_t *devices,
struct opts opts;
struct pk pk;
char *pin = NULL;
sigset_t mask, omask;

init_opts(&opts);
#ifndef WITH_FUZZING
Expand Down Expand Up @@ -1238,7 +1240,16 @@ int do_authentication(const cfg_t *cfg, const device_t *devices,
cfg->cue_prompt != NULL ? cfg->cue_prompt : DEFAULT_CUE);
}
}

sigemptyset(&mask);
sigaddset(&mask, SIGINT);
sigaddset(&mask, SIGQUIT);
(void) sigprocmask(SIG_UNBLOCK, &mask, &omask);

r = fido_dev_get_assert(authlist[j], assert, pin);

(void) sigprocmask(SIG_SETMASK, &omask, NULL);

if (pin) {
explicit_bzero(pin, strlen(pin));
free(pin);
Expand Down