diff options
author | Ed Tanous <ed.tanous@intel.com> | 2018-03-28 03:41:04 +0300 |
---|---|---|
committer | Ed Tanous <ed.tanous@intel.com> | 2018-06-29 21:18:14 +0300 |
commit | e0d918bc397350aa21af3dab9faa6e21748f6373 (patch) | |
tree | bdc13d1e9937c0f153e89f3ab1be050d4bf52ee7 /include/pam_authenticate.hpp | |
parent | 77dd8813e9a1f2baec63d959de15af39a8cd12d0 (diff) | |
download | bmcweb-e0d918bc397350aa21af3dab9faa6e21748f6373.tar.xz |
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
Diffstat (limited to 'include/pam_authenticate.hpp')
-rw-r--r-- | include/pam_authenticate.hpp | 13 |
1 files changed, 8 insertions, 5 deletions
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 <security/pam_appl.h> -#include <memory> #include <cstring> +#include <memory> +#include <boost/utility/string_view.hpp> // 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<char*>(password.c_str())}; + pam_function_conversation, const_cast<char*>(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; } |