Skip to content

Commit

Permalink
console: pam credentials file line by line
Browse files Browse the repository at this point in the history
- on separate lines: username password
  • Loading branch information
franku committed Oct 29, 2018
1 parent 8187527 commit cb73560
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/src/console/console.cc
Expand Up @@ -865,15 +865,17 @@ static bool SelectDirector(const char *director, DirectorResource **ret_dir, Con
static bool ExaminePamAuthentication(bool use_pam_credentials_file, const std::string &pam_credentials_filename)
{
if (use_pam_credentials_file) {
std::fstream s(pam_credentials_filename, s.in);
std::ifstream s(pam_credentials_filename);
if (!s.is_open()) {
Emsg0(M_ERROR_TERM, 0, _("Could not open PAM credentials file.\n"));
return false;
} else {
std::string user, pw;
s >> user >> pw;
std::getline(s, user);
std::getline(s, pw);
if (user.empty() || pw.empty()) {
Emsg0(M_ERROR_TERM, 0, _("Could not read user or password.\n"));
return false;
}
BStringList args;
args << user << pw;
Expand Down

0 comments on commit cb73560

Please sign in to comment.