[tor-commits] [arm/release] fix: torrc validation arg doesn't need root check

atagar at torproject.org atagar at torproject.org
Sun Sep 25 21:38:23 UTC 2011


commit c8de18c201814f4acfee6d64904c4c7335077846
Author: Damian Johnson <atagar at torproject.org>
Date:   Wed Jul 27 13:39:38 2011 -0700

    fix: torrc validation arg doesn't need root check
---
 src/resources/torrcOverride/override.py |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/resources/torrcOverride/override.py b/src/resources/torrcOverride/override.py
index dffa3a5..b99ae95 100755
--- a/src/resources/torrcOverride/override.py
+++ b/src/resources/torrcOverride/override.py
@@ -315,6 +315,17 @@ if __name__ == "__main__":
     print "This is a script specifically for configuring Linux"
     sys.exit(1)
   
+  if len(sys.argv) == 3 and sys.argv[1] == "--validate":
+    torrcFile = open(sys.argv[2])
+    torrcContents = torrcFile.readlines()
+    torrcFile.close()
+    
+    isValid = isWizardGenerated(torrcContents)
+    if isValid: print "torrc validated"
+    else: print "torrc invalid"
+    
+    sys.exit(0)
+  
   # check that we're running effectively as root
   if os.geteuid() != 0:
     print "This script needs to be run as root"
@@ -326,14 +337,6 @@ if __name__ == "__main__":
     init()
   elif len(sys.argv) == 2 and sys.argv[1] == "--remove":
     remove()
-  elif len(sys.argv) == 3 and sys.argv[1] == "--validate":
-    torrcFile = open(sys.argv[2])
-    torrcContents = torrcFile.readlines()
-    torrcFile.close()
-    
-    isValid = isWizardGenerated(torrcContents)
-    if isValid: print "torrc validated"
-    else: print "torrc invalid"
   else:
     print HELP_MSG
     sys.exit(1)





More information about the tor-commits mailing list