[CalendarServer-changes] [15013] CalendarServer/trunk/calendarserver/tools/config.py

source_changes at macosforge.org source_changes at macosforge.org
Tue Jul 28 12:07:46 PDT 2015


Revision: 15013
          http://trac.calendarserver.org//changeset/15013
Author:   sagen at apple.com
Date:     2015-07-28 12:07:46 -0700 (Tue, 28 Jul 2015)
Log Message:
-----------
calendarserver_config must be run as root when in a Server.app context

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/config.py

Modified: CalendarServer/trunk/calendarserver/tools/config.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/config.py	2015-07-28 05:23:08 UTC (rev 15012)
+++ CalendarServer/trunk/calendarserver/tools/config.py	2015-07-28 19:07:46 UTC (rev 15013)
@@ -108,8 +108,21 @@
         sys.exit(0)
 
 
+def runAsRootCheck():
+    """
+    If we're running in Server.app context and are not running as root, exit.
+    """
 
+    if os.path.abspath(__file__).startswith("/Applications/Server.app/"):
+        if os.getuid() != 0:
+            print("Must be run as root")
+            sys.exit(1)
+
+
 def main():
+
+    runAsRootCheck()
+
     try:
         (optargs, args) = getopt(
             sys.argv[1:], "hf:rw:", [
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150728/8ad5d6e6/attachment.html>


More information about the calendarserver-changes mailing list