dbus获取调用者信息
This commit is contained in:
parent
d16f036e08
commit
80784676e2
|
@ -716,13 +716,13 @@ def get_proc_from_dbus_name(dbus_name, bus=None):
|
|||
dbus_interface="org.freedesktop.DBus")
|
||||
proc = psutil.Process(int(pid))
|
||||
|
||||
with open("/proc/%s/status" % pid) as process:
|
||||
values = [v for v in process.readlines() if v.startswith("Uid:")]
|
||||
uid = int(values[0].split()[1])
|
||||
# with open("/proc/%s/status" % pid) as process:
|
||||
# values = [v for v in process.readlines() if v.startswith("Uid:")]
|
||||
# uid = int(values[0].split()[1])
|
||||
|
||||
#检查是否root用户执行
|
||||
if uid == 0:
|
||||
return "root"
|
||||
# #检查是否root用户执行
|
||||
# if uid == 0:
|
||||
# return "root"
|
||||
|
||||
return proc.name()
|
||||
|
||||
|
|
|
@ -1047,7 +1047,7 @@ class UpdateInstallMode():
|
|||
'org.freedesktop.login1', '/org/freedesktop/login1',
|
||||
'org.freedesktop.login1.Manager', 'Inhibit',
|
||||
GLib.Variant('(ssss)',
|
||||
('shutdown',
|
||||
('shutdown:sleep',
|
||||
'Kylin System Updater', 'Updating System',
|
||||
'delay')),
|
||||
None, 0, -1, None, None)
|
||||
|
|
Loading…
Reference in New Issue