summaryrefslogtreecommitdiff
path: root/include/pam_authenticate.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/pam_authenticate.hpp')
-rw-r--r--include/pam_authenticate.hpp13
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;
}