From fa2607db7d9d897669d4d99fb4c9d673a2e3b927 Mon Sep 17 00:00:00 2001 From: MusiKid Date: Thu, 20 Jan 2022 14:22:01 +0100 Subject: [PATCH] fix: add appdata_ptr for conv function --- src/pam/main.cc | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/pam/main.cc b/src/pam/main.cc index c4a675a..ab8179e 100644 --- a/src/pam/main.cc +++ b/src/pam/main.cc @@ -100,19 +100,16 @@ int on_howdy_auth(int code, function conv_function) { * @param message String to show the user * @return Returns the conversation function return code */ -int send_message(function - conv, - int type, const char *message) { +int send_message(struct pam_conv *conv, int type, const char *message) { // No need to free this, it's allocated on the stack const struct pam_message msg = {.msg_style = type, .msg = message}; const struct pam_message *msgp = &msg; - struct pam_response res_ = {}; - struct pam_response *resp_ = &res_; + struct pam_response res = {}; + struct pam_response *resp = &res; // Call the conversation function with the constructed arguments - return conv(1, &msgp, &resp_, nullptr); + return conv->conv(1, &msgp, &resp, conv->appdata_ptr); } /** @@ -150,7 +147,7 @@ int identify(pam_handle_t *pamh, int flags, int argc, const char **argv, // Wrap the PAM conversation function in our own, easier function auto conv_function = - bind(send_message, conv->conv, placeholders::_1, placeholders::_2); + bind(send_message, conv, placeholders::_1, placeholders::_2); // Error out if we could not ready the config file if (reader.ParseError() < 0) {