mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-04 15:21:12 +00:00
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...
This commit is contained in:
parent
6365d8c67a
commit
f1a1921edc
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue