From 641e55da3ba9f73d74dd7b67876a9f5024ba4898 Mon Sep 17 00:00:00 2001 From: tanyulong2021 Date: Wed, 3 Aug 2022 14:49:44 +0800 Subject: [PATCH] can't exit with ctrl c using biometric autentication --- pam-biometric/pam_biometric.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pam-biometric/pam_biometric.c b/pam-biometric/pam_biometric.c index 61f3dd6..c235d00 100755 --- a/pam-biometric/pam_biometric.c +++ b/pam-biometric/pam_biometric.c @@ -139,6 +139,12 @@ void child(char *service, char *username, char *xdisp) _exit(BIO_IGNORE); } +void handler() +{ + return; +} + + /* PAM parent process */ int parent(int pid, pam_handle_t *pamh, int need_call_conv) { @@ -181,8 +187,15 @@ int parent(int pid, pam_handle_t *pamh, int need_call_conv) waitpid(pid, &child_status, 0); } else { logger("Waiting for the GUI child process to exit...\n"); - waitpid(pid, &child_status, 0); + sigset_t mask; + sigprocmask(SIG_BLOCK,NULL,&mask); + sigprocmask(SIG_UNBLOCK,&mask,NULL); + + sinal(SIGINT,handler); + + waitpid(pid, &child_status, 0); logger("GUI child process has exited.\n"); + sigprocmask(SIG_SETMASK,&mask,NULL); } /* -- 2.33.0