diff options
author | Christoph Gysin <christoph.gysin@gmail.com> | 2016-01-24 13:33:24 +0200 |
---|---|---|
committer | Christoph Gysin <christoph.gysin@gmail.com> | 2016-01-25 19:43:51 +0200 |
commit | b116af629be03f4e44bca0adfe5f76eee278fbbc (patch) | |
tree | c89a298c997e680210d2e9a53ea604390a21b3a4 | |
parent | 123de8600179feceb7f78fc246da69ee22f04ee3 (diff) |
swaylock: remove global variable pam_reply
-rw-r--r-- | swaylock/main.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/swaylock/main.c b/swaylock/main.c index c01445e7..e04d0d62 100644 --- a/swaylock/main.c +++ b/swaylock/main.c @@ -36,11 +36,15 @@ void sway_terminate(void) { } char *password; -struct pam_response *pam_reply; int function_conversation(int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr) { + + struct pam_response *pam_reply = malloc(sizeof(struct pam_response)); + pam_reply[0].resp = password; + pam_reply[0].resp_retcode = 0; *resp = pam_reply; + return PAM_SUCCESS; } @@ -57,9 +61,6 @@ bool verify_password(char *password) { if ((pam_err = pam_start("swaylock", username, &local_conversation, &local_auth_handle)) != PAM_SUCCESS) { sway_abort("PAM returned %d\n", pam_err); } - pam_reply = (struct pam_response *)malloc(sizeof(struct pam_response)); - pam_reply[0].resp = password; - pam_reply[0].resp_retcode = 0; if ((pam_err = pam_authenticate(local_auth_handle, 0)) != PAM_SUCCESS) { memset(password, 0, strlen(password)); return false; |