Changeset 38144
- Timestamp:
- 07/08/2008 13:35:34 (4 years ago)
- Location:
- branches/gsoc08-privileges/base/src/port1.0
- Files:
-
- 2 modified
-
portextract.tcl (modified) (3 diffs)
-
portutil.tcl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/gsoc08-privileges/base/src/port1.0/portextract.tcl
r38096 r38144 94 94 proc extract_main {args} { 95 95 global UI_PREFIX euid egid worksrcpath macportsuser 96 global filespath97 96 98 97 if {![exists distfiles] && ![exists extract.only]} { … … 103 102 foreach distfile [option extract.only] { 104 103 ui_info "$UI_PREFIX [format [msgcat::mc "Extracting %s"] $distfile]" 105 if {[file exists $filespath/$distfile]} { 106 option extract.args "$filespath/$distfile" 107 } else { 108 option extract.args "[option distpath]/$distfile" 109 } 104 option extract.args "[option distpath]/$distfile" 110 105 if {[catch {command_exec extract} result]} { 111 106 return -code error "$result" … … 117 112 seteuid $euid 118 113 ui_debug "euid changed to: [geteuid]" 119 file attributes "${worksrcpath}" -owner [name_to_uid "$macportsuser"]114 chown ${worksrcpath} ${macportsuser} 120 115 ui_debug "chowned $worksrcpath to $macportsuser" 121 116 seteuid [name_to_uid "$macportsuser"] 122 117 ui_debug "euid changed to: [geteuid]" 118 } else { 119 ui_debug "no need to chown $worksrcpath. uid=[getuid]. euid=[geteuid]." 123 120 } 121 124 122 # end gsoc08-privileges 125 123 -
branches/gsoc08-privileges/base/src/port1.0/portutil.tcl
r38016 r38144 718 718 # Provides "sed in place" functionality 719 719 proc reinplace {args} { 720 global euid macportsuser 721 720 722 set extended 0 721 723 while 1 { … … 776 778 777 779 close $tmpfd 780 781 # start gsoc08-privileges 782 if { [getuid] == 0 && [geteuid] == [name_to_uid "$macportsuser"] } { 783 # if started with sudo but have dropped the privileges 784 seteuid $euid 785 ui_debug "euid changed to: [geteuid]" 786 chown $file ${macportsuser} 787 ui_debug "chowned $file to $macportsuser" 788 seteuid [name_to_uid "$macportsuser"] 789 ui_debug "euid changed to: [geteuid]" 790 } else { 791 ui_debug "no need to chown $file. uid=[getuid]. euid=[geteuid]." 792 } 793 794 # end gsoc08-privileges 778 795 779 796 set attributes [file attributes $file] … … 2248 2265 } 2249 2266 2267 ## 2268 # Recusively chown the given file or directory to the specified user. 2269 # 2270 # @param path the file/directory to be chowned 2271 # @param user the user to chown file to 2272 proc chown {path user} { 2273 file attributes $path -owner [name_to_uid "$user"] 2274 2275 if {[file isdirectory $path]} { 2276 foreach g [glob [file join $path *]] { 2277 chown $g $user 2278 } 2279 } 2280 } 2281

