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

Unified Diff: tools/telemetry/telemetry/core/forwarders/android_forwarder.py

Issue 703203004: [telemetry] When launching an application elevated, check if it has NOPASSWD in sudoers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use sudo -l. Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/telemetry/telemetry/core/platform/linux_platform_backend.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/core/forwarders/android_forwarder.py
diff --git a/tools/telemetry/telemetry/core/forwarders/android_forwarder.py b/tools/telemetry/telemetry/core/forwarders/android_forwarder.py
index a4c77cf92e07c48a2f85e14fd3d4f07f60ee1cc9..f5878968e65657d6639e94e4de1790dbac0c7543 100644
--- a/tools/telemetry/telemetry/core/forwarders/android_forwarder.py
+++ b/tools/telemetry/telemetry/core/forwarders/android_forwarder.py
@@ -240,7 +240,8 @@ class AndroidRndisConfigurator(object):
def _WriteProtectedFile(self, file_path, contents):
subprocess.check_call(
- ['sudo', 'bash', '-c', 'echo -e "%s" > %s' % (contents, file_path)])
+ ['/usr/bin/sudo', 'bash', '-c',
+ 'echo -e "%s" > %s' % (contents, file_path)])
def _InstallHorndis(self):
if 'HoRNDIS' in subprocess.check_output(['kextstat']):
@@ -250,7 +251,7 @@ class AndroidRndisConfigurator(object):
path.GetTelemetryDir(), 'bin', 'mac', 'HoRNDIS-rel5.pkg')
cloud_storage.GetIfChanged(pkg_path, bucket=cloud_storage.PUBLIC_BUCKET)
subprocess.check_call(
- ['sudo', 'installer', '-pkg', pkg_path, '-target', '/'])
+ ['/usr/bin/sudo', 'installer', '-pkg', pkg_path, '-target', '/'])
def _DisableRndis(self):
self._device.SetProp('sys.usb.config', 'adb')
@@ -397,10 +398,10 @@ doit &
if 'Telemetry' not in subprocess.check_output(
['networksetup', '-listallnetworkservices']):
subprocess.check_call(
- ['sudo', 'networksetup',
+ ['/usr/bin/sudo', 'networksetup',
'-createnetworkservice', 'Telemetry', host_iface])
subprocess.check_call(
- ['sudo', 'networksetup',
+ ['/usr/bin/sudo', 'networksetup',
'-setmanual', 'Telemetry', '192.168.123.1', '255.255.255.0'])
elif platform.GetHostPlatform().GetOSName() == 'linux':
with open(self._NETWORK_INTERFACES) as f:
@@ -416,8 +417,9 @@ doit &
if not os.path.exists(interface_conf_file):
interface_conf_dir = os.path.dirname(interface_conf_file)
if not interface_conf_dir:
- subprocess.call(['sudo', '/bin/mkdir', interface_conf_dir])
- subprocess.call(['sudo', '/bin/chmod', '755', interface_conf_dir])
+ subprocess.call(['/usr/bin/sudo', '/bin/mkdir', interface_conf_dir])
+ subprocess.call(
+ ['/usr/bin/sudo', '/bin/chmod', '755', interface_conf_dir])
interface_conf = '\n'.join([
'# Added by Telemetry for RNDIS forwarding.',
'allow-hotplug %s' % host_iface,
@@ -426,7 +428,7 @@ doit &
' netmask 255.255.255.0',
])
self._WriteProtectedFile(interface_conf_file, interface_conf)
- subprocess.check_call(['sudo', 'ifup', host_iface])
+ subprocess.check_call(['/usr/bin/sudo', 'ifup', host_iface])
logging.info('Waiting for RNDIS connectivity...')
util.WaitFor(HasHostAddress, 10)
« no previous file with comments | « no previous file | tools/telemetry/telemetry/core/platform/linux_platform_backend.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698