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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Boxiang Sun
slapos.core
Commits
e8c3cd5f
Commit
e8c3cd5f
authored
Sep 25, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
grid: updated privilege dropping under cygwin
parent
9011abf3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
slapos/grid/utils.py
slapos/grid/utils.py
+7
-1
No files found.
slapos/grid/utils.py
View file @
e8c3cd5f
...
@@ -184,7 +184,7 @@ def dropPrivileges(uid, gid, logger):
...
@@ -184,7 +184,7 @@ def dropPrivileges(uid, gid, logger):
if
uid
==
0
or
gid
==
0
:
if
uid
==
0
or
gid
==
0
:
raise
OSError
(
'Dropping privileges to uid = %r or '
raise
OSError
(
'Dropping privileges to uid = %r or '
'gid = %r is too dangerous'
%
(
uid
,
gid
))
'gid = %r is too dangerous'
%
(
uid
,
gid
))
if
current_uid
or
current_gid
:
if
(
current_uid
or
current_gid
)
and
sys
.
platform
!=
'cygwin'
:
logger
.
debug
(
'Running as uid = %r, gid = %r, dropping '
logger
.
debug
(
'Running as uid = %r, gid = %r, dropping '
'not needed and not possible'
%
(
current_uid
,
current_gid
))
'not needed and not possible'
%
(
current_uid
,
current_gid
))
return
return
...
@@ -194,6 +194,12 @@ def dropPrivileges(uid, gid, logger):
...
@@ -194,6 +194,12 @@ def dropPrivileges(uid, gid, logger):
group_list
.
add
(
gid
)
group_list
.
add
(
gid
)
os
.
initgroups
(
pwd
.
getpwuid
(
uid
)[
0
],
gid
)
os
.
initgroups
(
pwd
.
getpwuid
(
uid
)[
0
],
gid
)
os
.
setgid
(
gid
)
os
.
setgid
(
gid
)
if
sys
.
platform
==
'cygwin'
:
os
.
setreuid
(
-
1
,
uid
)
logger
.
debug
(
'Privileges dropped from Cygwin to uid=%r gid=%r'
%
(
uid
,
gid
))
# skip further checks
return
os
.
setuid
(
uid
)
os
.
setuid
(
uid
)
# assert that privileges are dropped
# assert that privileges are dropped
...
...
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