| Index: remoting/host/linux/remoting_user_session.cc
|
| diff --git a/remoting/host/linux/remoting_user_session.cc b/remoting/host/linux/remoting_user_session.cc
|
| index 06b678c551e28dd7de99fe90a94bcc5696824abe..5293e8969bdf9f34f4f16b5dc34ab70859deecde 100644
|
| --- a/remoting/host/linux/remoting_user_session.cc
|
| +++ b/remoting/host/linux/remoting_user_session.cc
|
| @@ -253,7 +253,8 @@ void ExecuteSession(std::string user, base::StringPiece script_path,
|
| //////////////////////////////////////////////////////////////////////////////
|
|
|
| PamHandle pam_handle(kPamName, user.c_str(), &kPamConversation);
|
| - CHECK(pam_handle.IsInitialized()) << "Failed to initialize PAM";
|
| + // Failed to initialize PAM
|
| + CHECK(pam_handle.IsInitialized());
|
|
|
| // Make sure the account is valid and enabled.
|
| pam_handle.CheckReturnCode(pam_handle.AccountManagement(0), "Account check");
|
| @@ -267,10 +268,12 @@ void ExecuteSession(std::string user, base::StringPiece script_path,
|
| // PAM call.
|
| errno = 0;
|
| struct passwd* pwinfo = getpwnam(user.c_str());
|
| - PCHECK(pwinfo != nullptr) << "getpwnam failed";
|
| - PCHECK(setgid(pwinfo->pw_gid) == 0) << "setgid failed";
|
| - PCHECK(initgroups(pwinfo->pw_name, pwinfo->pw_gid) == 0)
|
| - << "initgroups failed";
|
| + // getpwnam failed
|
| + CHECK(pwinfo != nullptr);
|
| + // setgid failed
|
| + CHECK(setgid(pwinfo->pw_gid) == 0);
|
| + // initgroups failed
|
| + CHECK(initgroups(pwinfo->pw_name, pwinfo->pw_gid) == 0);
|
|
|
| // The documentation states that setcred should be called before open_session,
|
| // as done here, but it may be worth noting that `login` calls open_session
|
| @@ -285,7 +288,8 @@ void ExecuteSession(std::string user, base::StringPiece script_path,
|
|
|
| base::Optional<base::EnvironmentMap> pam_environment =
|
| pam_handle.GetEnvironment();
|
| - CHECK(pam_environment) << "Failed to get environment from PAM";
|
| + // Failed to get environment from PAM
|
| + CHECK(pam_environment);
|
|
|
| //////////////////////////////////////////////////////////////////////////////
|
| // Prepare to execute remoting session process
|
| @@ -313,7 +317,8 @@ void ExecuteSession(std::string user, base::StringPiece script_path,
|
| // Fetch pwinfo again, as it may have been invalidated or the user name might
|
| // have been remapped.
|
| pwinfo = getpwnam(user.c_str());
|
| - PCHECK(pwinfo != nullptr) << "getpwnam failed";
|
| + // getpwnam failed
|
| + CHECK(pwinfo != nullptr);
|
|
|
| if (chown_log) {
|
| int result = fchown(STDOUT_FILENO, pwinfo->pw_uid, pwinfo->pw_gid);
|
| @@ -349,7 +354,8 @@ void ExecuteSession(std::string user, base::StringPiece script_path,
|
| base::Optional<std::string> escaped_script_path =
|
| ShellEscapeArgument(script_path);
|
|
|
| - CHECK(escaped_script_path) << "Could not escape script path";
|
| + // Could not escape script path
|
| + CHECK(escaped_script_path);
|
|
|
| command_line.AppendSwitch("-c");
|
| command_line.AppendArg(*escaped_script_path +
|
| @@ -369,7 +375,8 @@ void ExecuteSession(std::string user, base::StringPiece script_path,
|
| int exit_code = 0;
|
| // Die if wait fails so we don't close the PAM session while the child is
|
| // still running.
|
| - CHECK(child.WaitForExit(&exit_code)) << "Failed to wait for child process";
|
| + // Failed to wait for child process
|
| + CHECK(child.WaitForExit(&exit_code));
|
| LOG_IF(WARNING, exit_code != 0) << "Child did not exit normally";
|
| }
|
|
|
|
|