mirror of
https://github.com/arcan1s/ahriman.git
synced 2026-03-14 05:53:39 +00:00
fix: use effective uid instead of uid
This commit is contained in:
@@ -192,7 +192,7 @@ def check_user(root: Path, *, unsafe: bool) -> None:
|
||||
if unsafe:
|
||||
return # unsafe flag is enabled, no check performed
|
||||
|
||||
current_uid = os.getuid()
|
||||
current_uid = os.geteuid()
|
||||
root_uid, _ = owner(root)
|
||||
|
||||
if current_uid != root_uid:
|
||||
|
||||
@@ -239,7 +239,7 @@ class RepositoryPaths(LazyLogging):
|
||||
# the reason we do this is that it only works if permissions can be actually changed. Hence,
|
||||
# non-privileged user (e.g. personal user or ahriman user) can't change permissions.
|
||||
# The only one who can do so is root, so if user is not root we just terminate function
|
||||
current_uid, current_gid = os.getuid(), os.getgid()
|
||||
current_uid, current_gid = os.geteuid(), os.getegid()
|
||||
if current_uid != 0:
|
||||
yield
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user