Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Rafael Monnerat
slapos.core
Commits
ba5c3484
Commit
ba5c3484
authored
Jan 23, 2012
by
Łukasz Nowak
Committed by
Antoine Catton
Jan 23, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better check for group_list in slapgrid utils.
parent
235218d5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
slapos/grid/utils.py
slapos/grid/utils.py
+3
-4
No files found.
slapos/grid/utils.py
View file @
ba5c3484
...
@@ -178,9 +178,8 @@ def dropPrivileges(uid, gid):
...
@@ -178,9 +178,8 @@ def dropPrivileges(uid, gid):
return
return
# 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
=
set
([
x
.
gr_gid
for
x
in
grp
.
getgrall
()
if
user_name
in
x
.
gr_mem
])
if
gid
not
in
group_list
:
group_list
.
add
(
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
)
os
.
setuid
(
uid
)
os
.
setuid
(
uid
)
...
@@ -190,7 +189,7 @@ def dropPrivileges(uid, gid):
...
@@ -190,7 +189,7 @@ def dropPrivileges(uid, gid):
'and group_list = %s'
%
(
'and group_list = %s'
%
(
uid
,
gid
,
group_list
)
uid
,
gid
,
group_list
)
new_uid
,
new_gid
,
new_group_list
=
os
.
getuid
(),
os
.
getgid
(),
os
.
getgroups
()
new_uid
,
new_gid
,
new_group_list
=
os
.
getuid
(),
os
.
getgid
(),
os
.
getgroups
()
if
not
(
new_uid
==
uid
and
new_gid
==
gid
and
new_group_list
==
group_list
):
if
not
(
new_uid
==
uid
and
new_gid
==
gid
and
set
(
new_group_list
)
==
group_list
):
raise
OSError
(
'%s new_uid = %r and new_gid = %r and '
\
raise
OSError
(
'%s new_uid = %r and new_gid = %r and '
\
'new_group_list = %r which is fatal.'
'new_group_list = %r which is fatal.'
%
(
message_pre
,
%
(
message_pre
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment