Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc

Issue 2578483002: Namespace sandbox: add check for unprivileged use of CLONE_NEWUSER (Closed)
Patch Set: getuid -> geteuid Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views.h" 5 #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" 8 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h"
9 #include "chrome/browser/ui/views/chrome_views_delegate.h" 9 #include "chrome/browser/ui/views/chrome_views_delegate.h"
10 #include "chrome/browser/ui/views/ime_driver/ime_driver_mus.h" 10 #include "chrome/browser/ui/views/ime_driver/ime_driver_mus.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 #if defined(USE_AURA) 67 #if defined(USE_AURA)
68 // IME driver must be available at login screen, so initialize before profile. 68 // IME driver must be available at login screen, so initialize before profile.
69 if (service_manager::ServiceManagerIsRemote()) 69 if (service_manager::ServiceManagerIsRemote())
70 IMEDriver::Register(); 70 IMEDriver::Register();
71 #endif 71 #endif
72 72
73 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 73 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
74 // On the Linux desktop, we want to prevent the user from logging in as root, 74 // On the Linux desktop, we want to prevent the user from logging in as root,
75 // so that we don't destroy the profile. Now that we have some minimal ui 75 // so that we don't destroy the profile. Now that we have some minimal ui
76 // initialized, check to see if we're running as root and bail if we are. 76 // initialized, check to see if we're running as root and bail if we are.
77 if (getuid() != 0) 77 if (geteuid() != 0)
78 return;
79
80 const base::CommandLine& command_line =
81 *base::CommandLine::ForCurrentProcess();
82 if (command_line.HasSwitch(switches::kUserDataDir))
83 return; 78 return;
84 79
85 base::string16 title = l10n_util::GetStringFUTF16( 80 base::string16 title = l10n_util::GetStringFUTF16(
86 IDS_REFUSE_TO_RUN_AS_ROOT, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); 81 IDS_REFUSE_TO_RUN_AS_ROOT, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
87 base::string16 message = l10n_util::GetStringFUTF16( 82 base::string16 message = l10n_util::GetStringFUTF16(
88 IDS_REFUSE_TO_RUN_AS_ROOT_2, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); 83 IDS_REFUSE_TO_RUN_AS_ROOT_2, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
89 84
90 chrome::ShowWarningMessageBox(NULL, title, message); 85 chrome::ShowWarningMessageBox(NULL, title, message);
91 86
92 // Avoids gpu_process_transport_factory.cc(153)] Check failed: 87 // Avoids gpu_process_transport_factory.cc(153)] Check failed:
(...skipping 23 matching lines...) Expand all
116 // WMState is owned as a member, so don't have MusClient create it. 111 // WMState is owned as a member, so don't have MusClient create it.
117 const bool create_wm_state = false; 112 const bool create_wm_state = false;
118 mus_client_ = base::MakeUnique<views::MusClient>( 113 mus_client_ = base::MakeUnique<views::MusClient>(
119 connection->GetConnector(), connection->GetIdentity(), 114 connection->GetConnector(), connection->GetIdentity(),
120 content::BrowserThread::GetTaskRunnerForThread( 115 content::BrowserThread::GetTaskRunnerForThread(
121 content::BrowserThread::IO), 116 content::BrowserThread::IO),
122 create_wm_state); 117 create_wm_state);
123 } 118 }
124 #endif // defined(USE_AURA) 119 #endif // defined(USE_AURA)
125 } 120 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698