diff options
| author | Robin Ebert <ebertrobin2002@gmail.com> | 2022-05-30 11:50:30 +0200 |
|---|---|---|
| committer | Simon Ser <contact@emersion.fr> | 2022-06-15 10:49:32 +0200 |
| commit | bdeb891378bfcb2dc79de41cfeb6a62807d09b20 (patch) | |
| tree | a9eef0cdb2d2fba56404291ab25a0ce48402b79b /pam.c | |
| parent | fad5bc2f615bcee37b653887af0aebb334ec94b5 (diff) | |
Use mlock for password buffer
Diffstat (limited to 'pam.c')
| -rw-r--r-- | pam.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -7,6 +7,7 @@ #include <unistd.h> #include "comm.h" #include "log.h" +#include "password-buffer.h" #include "swaylock.h" static char *pw_buf = NULL; @@ -96,6 +97,9 @@ void run_pw_backend_child(void) { } int pam_status = pam_authenticate(auth_handle, 0); + password_buffer_destroy(pw_buf, size); + pw_buf = NULL; + bool success = pam_status == PAM_SUCCESS; if (!success) { swaylock_log(LOG_ERROR, "pam_authenticate failed: %s", @@ -103,13 +107,8 @@ void run_pw_backend_child(void) { } if (!write_comm_reply(success)) { - clear_buffer(pw_buf, size); exit(EXIT_FAILURE); } - - clear_buffer(pw_buf, size); - free(pw_buf); - pw_buf = NULL; } pam_setcred(auth_handle, PAM_REFRESH_CRED); |
