This file is indexed.

/usr/share/ofono/scripts/set-context-property is in ofono-scripts 1.17.bzr6912+16.04.20160314.3-0ubuntu1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/python3

import sys
import dbus

bus = dbus.SystemBus()

manager = dbus.Interface(bus.get_object('org.ofono', '/'), 'org.ofono.Manager')

if (len(sys.argv) == 3):
	modems = manager.GetModems()
	modem = modems[0][0]
	context_idx = 0
	property = sys.argv[1]
	value = sys.argv[2]

	if property.startswith("/"):
		print("name can't start with '/'")
		exit(1)

elif (len(sys.argv) == 4):
	modems = manager.GetModems()
	modem = modems[0][0]
	context_idx = int(sys.argv[1]) - 1
	property = sys.argv[2]
	value = sys.argv[3]
elif (len(sys.argv) == 5):
	modem = sys.argv[1]
	context_idx = int(sys.argv[2]) - 1
	property = sys.argv[3]
	value = sys.argv[4]
else:
	print("Usage: set-context-property [modem] [context_number] <name> <value>")
	sys.exit(1)

if property == "Active" or property == "Preferred":
	if value == "false" or value == "0":
		value = dbus.Boolean(False, variant_level=1)
	elif value == "true" or value == "1":
		value = dbus.Boolean(True, variant_level=1)
	else:
		print("Must specify 0|1 or false|true for property %s"
			% property)
		sys.exit(1)

modemapi = dbus.Interface(bus.get_object('org.ofono', modem), 'org.ofono.Modem')
properties = modemapi.GetProperties()

if "org.ofono.ConnectionManager" not in properties["Interfaces"]:
	print("org.ofono.ConnectionManager not found")
	exit(2)

connman = dbus.Interface(bus.get_object('org.ofono', modem),
					'org.ofono.ConnectionManager')

contexts = connman.GetContexts()

if (len(contexts) == 0):
	print("No context available")
	sys.exit(1)

path = contexts[context_idx][0]

context = dbus.Interface(bus.get_object('org.ofono', path),
				'org.ofono.ConnectionContext')

try:
	context.SetProperty(property, value)
except dbus.DBusException as e:
	print("Error setting context %s property %s: %s" %\
			(path, property, str(e)))
	exit(2)