From e0d918bc397350aa21af3dab9faa6e21748f6373 Mon Sep 17 00:00:00 2001 From: Ed Tanous Date: Tue, 27 Mar 2018 17:41:04 -0700 Subject: Boost beast This commit is the beginings of attempting to transition away from crow, and toward boost::beast. Unit tests are passing, and implementation appears to be slightly faster than crow. Change-Id: Ic8d946dc7a04f514c67b1098f181eee1ced69171 --- include/pam_authenticate.hpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'include/pam_authenticate.hpp') diff --git a/include/pam_authenticate.hpp b/include/pam_authenticate.hpp index 5b4b454ab4..997c2974bd 100644 --- a/include/pam_authenticate.hpp +++ b/include/pam_authenticate.hpp @@ -1,8 +1,9 @@ #pragma once #include -#include #include +#include +#include // function used to get user input inline int pam_function_conversation(int num_msg, @@ -32,13 +33,15 @@ inline int pam_function_conversation(int num_msg, return PAM_SUCCESS; } -inline bool pam_authenticate_user(const std::string& username, - const std::string& password) { +inline bool pam_authenticate_user(const boost::string_view username, + const boost::string_view password) { + std::string user_str(username); + std::string pass_str(password); const struct pam_conv local_conversation = { - pam_function_conversation, const_cast(password.c_str())}; + pam_function_conversation, const_cast(pass_str.c_str())}; pam_handle_t* local_auth_handle = NULL; // this gets set by pam_start - if (pam_start("dropbear", username.c_str(), &local_conversation, + if (pam_start("dropbear", user_str.c_str(), &local_conversation, &local_auth_handle) != PAM_SUCCESS) { return false; } -- cgit v1.2.3