diff --git a/core/src/console/console.cc b/core/src/console/console.cc index c0324e8a4c4..b429db6098c 100644 --- a/core/src/console/console.cc +++ b/core/src/console/console.cc @@ -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;