[79649] trunk/base/src/port1.0

jmr at macports.org jmr at macports.org
Wed Jun 22 07:59:25 PDT 2011


Revision: 79649
          http://trac.macports.org/changeset/79649
Author:   jmr at macports.org
Date:     2011-06-22 07:59:23 -0700 (Wed, 22 Jun 2011)
Log Message:
-----------
fix potential (and at least one actual) privilege issues with clean and uninstall

Modified Paths:
--------------
    trunk/base/src/port1.0/portclean.tcl
    trunk/base/src/port1.0/portuninstall.tcl

Modified: trunk/base/src/port1.0/portclean.tcl
===================================================================
--- trunk/base/src/port1.0/portclean.tcl	2011-06-22 13:53:09 UTC (rev 79648)
+++ trunk/base/src/port1.0/portclean.tcl	2011-06-22 14:59:23 UTC (rev 79649)
@@ -51,9 +51,13 @@
 set_ui_prefix
 
 proc portclean::clean_start {args} {
-    global UI_PREFIX
+    global UI_PREFIX prefix
 
     ui_notice "$UI_PREFIX [format [msgcat::mc "Cleaning %s"] [option subport]]"
+
+    if {![file writable $prefix] || ([getuid] == 0 && [geteuid] != 0)} {
+        elevateToRoot "clean"
+    }
 }
 
 proc portclean::clean_main {args} {

Modified: trunk/base/src/port1.0/portuninstall.tcl
===================================================================
--- trunk/base/src/port1.0/portuninstall.tcl	2011-06-22 13:53:09 UTC (rev 79648)
+++ trunk/base/src/port1.0/portuninstall.tcl	2011-06-22 14:59:23 UTC (rev 79649)
@@ -50,7 +50,7 @@
 
 proc portuninstall::uninstall_start {args} {
     global prefix
-    if { ![file writable $prefix] } {
+    if {![file writable $prefix] || ([getuid] == 0 && [geteuid] != 0)} {
         # if install location is not writable, need root privileges
         elevateToRoot "uninstall"
     }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110622/affb470c/attachment.html>


More information about the macports-changes mailing list