Author: justi9
Date: 2010-01-28 16:25:27 -0500 (Thu, 28 Jan 2010)
New Revision: 3830
Modified:
mgmt/trunk/cumin/python/cumin/tools.py
mgmt/trunk/mint/python/mint/tools.py
Log:
Don't use __file__ as the source for privilege hecks; it won't have the owner we
want
Modified: mgmt/trunk/cumin/python/cumin/tools.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/tools.py 2010-01-28 19:04:36 UTC (rev 3829)
+++ mgmt/trunk/cumin/python/cumin/tools.py 2010-01-28 21:25:27 UTC (rev 3830)
@@ -40,7 +40,7 @@
opt.description = "Enable debugging; print logging to console"
def check(self):
- if os.getuid() not in (os.stat(__file__).st_uid, 0):
+ if os.getuid() not in (os.stat(sys.argv[0]).st_uid, 0):
print "Error: You have insufficient privileges"
sys.exit(1)
@@ -50,7 +50,7 @@
# Drop privileges
if os.getuid() == 0:
- os.setuid(os.stat(__file__).st_uid)
+ os.setuid(os.stat(sys.argv[0]).st_uid)
try:
import psyco
Modified: mgmt/trunk/mint/python/mint/tools.py
===================================================================
--- mgmt/trunk/mint/python/mint/tools.py 2010-01-28 19:04:36 UTC (rev 3829)
+++ mgmt/trunk/mint/python/mint/tools.py 2010-01-28 21:25:27 UTC (rev 3830)
@@ -36,7 +36,7 @@
opt.description = "Enable debugging; print logging to console"
def check(self):
- if os.getuid() not in (os.stat(__file__).st_uid, 0):
+ if os.getuid() not in (os.stat(sys.argv[0]).st_uid, 0):
print "Error: You have insufficient privileges"
sys.exit(1)
@@ -46,7 +46,7 @@
# Drop privileges
if os.getuid() == 0:
- os.setuid(os.stat(__file__).st_uid)
+ os.setuid(os.stat(sys.argv[0]).st_uid)
try:
import psyco