<pre style='margin:0'>
Joshua Root (jmroot) pushed a commit to branch master
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/4b36e605d76fa3a423b4e35a6722ade4185ffa4f">https://github.com/macports/macports-base/commit/4b36e605d76fa3a423b4e35a6722ade4185ffa4f</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new 4b36e60 Fix restoring previous euid in exec_as_uid
</span>4b36e60 is described below
<span style='display:block; white-space:pre;color:#808000;'>commit 4b36e605d76fa3a423b4e35a6722ade4185ffa4f
</span>Author: Joshua Root <jmr@macports.org>
AuthorDate: Sun Jul 1 12:17:44 2018 +1000
<span style='display:block; white-space:pre;color:#404040;'> Fix restoring previous euid in exec_as_uid
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Fixes: https://trac.macports.org/ticket/56721
</span>---
src/port1.0/portutil.tcl | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/port1.0/portutil.tcl b/src/port1.0/portutil.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index eb1eac3..bfb96f9 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/port1.0/portutil.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/port1.0/portutil.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -2998,12 +2998,12 @@ proc validate_macportsuser {} {
</span> # run code as a specified user
proc exec_as_uid {uid code} {
global macportsuser
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set elevated 0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[geteuid] != $uid} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- elevateToRoot "exec_as_uid"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$uid == 0} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set elevated 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set oldeuid [geteuid]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$oldeuid != $uid} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$oldeuid != 0} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ elevateToRoot "exec_as_uid"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$uid != 0} {
</span> setegid [uname_to_gid [uid_to_name $uid]]
seteuid $uid
ui_debug "dropping privileges: euid changed to [geteuid], egid changed to [getegid]."
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -3015,14 +3015,15 @@ proc exec_as_uid {uid code} {
</span> set retcode error
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {!$elevated && [getuid] == 0 && [geteuid] != [name_to_uid $macportsuser]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # have to change to $macportsuser via root
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- elevateToRoot "exec_as_uid"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set elevated 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$elevated} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- dropPrivileges
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$oldeuid != $uid} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$uid != 0} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ elevateToRoot "exec_as_uid"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$oldeuid != 0} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dropPrivileges
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> return -code $retcode $result
}
</pre><pre style='margin:0'>
</pre>