diff --git a/src/pam/main.cc b/src/pam/main.cc index e0eccce..d002e77 100644 --- a/src/pam/main.cc +++ b/src/pam/main.cc @@ -129,25 +129,6 @@ auto howdy_msg(char *username, int status, INIReader &reader, return PAM_SUCCESS; } -/** - * Format and send a message to PAM - * @param conv PAM conversation function - * @param type Type of PAM message - * @param message String to show the user - * @return Returns the conversation function return code - */ -auto send_message(struct pam_conv *conv, int type, const char *message) -> int { - // 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; - - // Call the conversation function with the constructed arguments - return conv->conv(1, &msgp, &resp, conv->appdata_ptr); -} - /** * The main function, runs the identification and authentication * @param pamh The handle to interface directly with PAM @@ -185,9 +166,16 @@ auto 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 = [conv](int msg_type, const char *msg) { - return send_message(conv, std::forward(msg_type), - std::forward(msg)); + auto conv_function = [conv](int msg_type, const char *msg_str) { + // No need to free this, it's allocated on the stack + const struct pam_message msg = {.msg_style = msg_type, .msg = msg_str}; + const struct pam_message *msgp = &msg; + + struct pam_response res = {}; + struct pam_response *resp = &res; + + // Call the conversation function with the constructed arguments + return conv->conv(1, &msgp, &resp, conv->appdata_ptr); }; // Error out if we could not ready the config file