summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2021-05-26 23:44:30 +0200
committerThomas Haller <thaller@redhat.com>2021-05-27 00:02:19 +0200
commitf1a1921edc7247c28a9e4baf60d20b57987503ac (patch)
tree354a5cfdb3ca0cd6ee3da28e14e06c6645c0cf79 /examples
parent6365d8c67a4daf8f3ea52bc2029885c6821e193e (diff)
downloadNetworkManager-f1a1921edc7247c28a9e4baf60d20b57987503ac.tar.gz
examples: drop confusing UID handling in "vpn.py" example
First of all, the "os.setuid()" call is never reached. lgtm.com warns about that, and warnings are annoying because they require investigation. This code is only in the example, so that the user would understand that they should edit the source and set the desired UID. But you can only call setuid() if you have CAP_SETUID, so commonly this anyway doesn't work -- unless you are root already, and then you actually don't need it either. Let's drop this code from the example. Maybe this example really should be dropped. Does the "dbus" python module even still work? Doesn't for me...
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/python/dbus/vpn.py8
1 files changed, 0 insertions, 8 deletions
diff --git a/examples/python/dbus/vpn.py b/examples/python/dbus/vpn.py
index f86bf1adb1..dbe56796a0 100755
--- a/examples/python/dbus/vpn.py
+++ b/examples/python/dbus/vpn.py
@@ -10,10 +10,6 @@
# The uuid of the connection to activate
CONNECTION_UUID = "c08142a4-00d9-45bd-a3b1-7610fe146374"
-# UID to use. Note that NM only allows the owner of the connection to activate it.
-# UID=1000
-UID = 0
-
import sys, os, dbus
from dbus.mainloop.glib import DBusGMainLoop
from gi.repository import GLib
@@ -127,10 +123,6 @@ def activate_connection(connection_path, device_path):
)
-# Change the UID first if required
-if UID != 0:
- os.setuid(UID)
-
# Are we configured?
if not len(CONNECTION_UUID):
print("missing connection UUID")