diff options
author | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-08 17:41:47 +0000 |
---|---|---|
committer | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-08 17:41:47 +0000 |
commit | 097a856b566ac0346fa50cee0fa6b69bc878ad3b (patch) | |
tree | 27fdcd6ef8a2a9eb6b92c6ac97f73aa6b771803a /chrome/installer/setup/main.cc | |
parent | 1d2eb13fa0a3e8b1e03a22b8dd4d2af38b85b626 (diff) | |
download | chromium_src-097a856b566ac0346fa50cee0fa6b69bc878ad3b.zip chromium_src-097a856b566ac0346fa50cee0fa6b69bc878ad3b.tar.gz chromium_src-097a856b566ac0346fa50cee0fa6b69bc878ad3b.tar.bz2 |
* Return error in case non admin user tries system level install.
BUG=5117,4973
TBR=huanr
Review URL: http://codereview.chromium.org/13200
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6514 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/setup/main.cc')
-rwxr-xr-x | chrome/installer/setup/main.cc | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/chrome/installer/setup/main.cc b/chrome/installer/setup/main.cc index 0a1ebc3..4aa4f37 100755 --- a/chrome/installer/setup/main.cc +++ b/chrome/installer/setup/main.cc @@ -482,14 +482,26 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, return RenameChromeExecutables(system_install); } - if (system_install && - win_util::GetWinVersion() == win_util::WINVERSION_VISTA && - !IsUserAnAdmin()) { - std::wstring exe = parsed_command_line.program(); - std::wstring params(command_line); - DWORD exit_code = installer_util::UNKNOWN_STATUS; - InstallUtil::ExecuteExeAsAdmin(exe, params, &exit_code); - return exit_code; + if (system_install && !IsUserAnAdmin()) { + if (win_util::GetWinVersion() == win_util::WINVERSION_VISTA && + !parsed_command_line.HasSwitch(installer_util::switches::kRunAsAdmin)) { + std::wstring exe = parsed_command_line.program(); + std::wstring params(command_line); + // Append --run-as-admin flag to let the new instance of setup.exe know + // that we already tried to launch ourselves as admin. + params.append(L" --"); + params.append(installer_util::switches::kRunAsAdmin); + DWORD exit_code = installer_util::UNKNOWN_STATUS; + InstallUtil::ExecuteExeAsAdmin(exe, params, &exit_code); + return exit_code; + } else { + LOG(ERROR) << "Non admin user can not install system level Chrome."; + InstallUtil::WriteInstallerResult(system_install, + installer_util::INSUFFICIENT_RIGHTS, + IDS_INSTALL_INSUFFICIENT_RIGHTS_BASE, + NULL); + return installer_util::INSUFFICIENT_RIGHTS; + } } // Check the existing version installed. |