Commit a22720d4 authored by Antoine Catton's avatar Antoine Catton

Bugfix on dropPrivileges.

Avoid having two same gid.
parent 714a191f
...@@ -179,6 +179,7 @@ def dropPrivileges(uid, gid): ...@@ -179,6 +179,7 @@ def dropPrivileges(uid, gid):
# drop privileges # drop privileges
user_name = pwd.getpwuid(uid)[0] user_name = pwd.getpwuid(uid)[0]
group_list = [x.gr_gid for x in grp.getgrall() if user_name in x.gr_mem] group_list = [x.gr_gid for x in grp.getgrall() if user_name in x.gr_mem]
if gid not in group_list:
group_list.append(gid) group_list.append(gid)
os.initgroups(pwd.getpwuid(uid)[0], gid) os.initgroups(pwd.getpwuid(uid)[0], gid)
os.setgid(gid) os.setgid(gid)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment