sway

i3-compatible Wayland compositor
git clone https://git.awy.one/sway
Log | Files | Refs | README | LICENSE

commit b116af629be03f4e44bca0adfe5f76eee278fbbc
parent 123de8600179feceb7f78fc246da69ee22f04ee3
Author: Christoph Gysin <christoph.gysin@gmail.com>
Date:   Sun, 24 Jan 2016 13:33:24 +0200

swaylock: remove global variable pam_reply

Diffstat:
Mswaylock/main.c | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git 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;