Skip to content

Commit

Permalink
mportexec: restore privileges before returning
Browse files Browse the repository at this point in the history
  • Loading branch information
jmroot committed Oct 4, 2024
1 parent dd194bd commit be64ebf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/macports1.0/macports.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -2833,6 +2833,10 @@ proc mportexec {mport target} {
# install them
set result [dlist_eval $dlist _mportactive [list _mportexec activate]]

if {[getuid] == 0 && [geteuid] != 0} {
seteuid 0; setegid 0
}

registry::exclusive_unlock

if {$result ne ""} {
Expand Down Expand Up @@ -2902,6 +2906,11 @@ proc mportexec {mport target} {
macports::pop_log
}

# Regain privileges that may have been dropped while running the target.
if {[getuid] == 0 && [geteuid] != 0} {
seteuid 0; setegid 0
}

return $result
}

Expand Down

0 comments on commit be64ebf

Please sign in to comment.