[CalendarServer-changes] [3441] CalendarServer/trunk/calendarserver/tap/caldav.py
source_changes at macosforge.org
source_changes at macosforge.org
Tue Dec 2 14:13:51 PST 2008
Revision: 3441
http://trac.macosforge.org/projects/calendarserver/changeset/3441
Author: wsanchez at apple.com
Date: 2008-12-02 14:13:51 -0800 (Tue, 02 Dec 2008)
Log Message:
-----------
All __all__
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tap/caldav.py
Modified: CalendarServer/trunk/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/caldav.py 2008-12-02 22:02:41 UTC (rev 3440)
+++ CalendarServer/trunk/calendarserver/tap/caldav.py 2008-12-02 22:13:51 UTC (rev 3441)
@@ -14,6 +14,12 @@
# limitations under the License.
##
+__all__ = [
+ "CalDAVService",
+ "CalDAVOptions",
+ "CalDAVServiceMaker",
+]
+
import os
from subprocess import Popen, PIPE
@@ -279,64 +285,7 @@
% (description, dirpath,)
)
-def getSSLPassphrase(*ignored):
- if not config.SSLPrivateKey:
- return None
-
- if config.SSLCertAdmin and os.path.isfile(config.SSLCertAdmin):
- child = Popen(
- args=[
- "sudo", config.SSLCertAdmin,
- "--get-private-key-passphrase", config.SSLPrivateKey,
- ],
- stdout=PIPE, stderr=PIPE,
- )
- output, error = child.communicate()
-
- if child.returncode:
- log.error("Could not get passphrase for %s: %s"
- % (config.SSLPrivateKey, error))
- else:
- return output.strip()
-
- if config.SSLPassPhraseDialog and os.path.isfile(config.SSLPassPhraseDialog):
- sslPrivKey = open(config.SSLPrivateKey)
- try:
- keyType = None
- for line in sslPrivKey.readlines():
- if "-----BEGIN RSA PRIVATE KEY-----" in line:
- keyType = "RSA"
- break
- elif "-----BEGIN DSA PRIVATE KEY-----" in line:
- keyType = "DSA"
- break
- finally:
- sslPrivKey.close()
-
- if keyType is None:
- log.error("Could not get private key type for %s"
- % (config.SSLPrivateKey,))
- else:
- child = Popen(
- args=[
- config.SSLPassPhraseDialog,
- "%s:%s" % (config.ServerHostName, config.SSLPort),
- keyType,
- ],
- stdout=PIPE, stderr=PIPE,
- )
- output, error = child.communicate()
-
- if child.returncode:
- log.error("Could not get passphrase for %s: %s"
- % (config.SSLPrivateKey, error))
- else:
- return output.strip()
-
- return None
-
-
class CalDAVServiceMaker (object):
implements(IPlugin, IServiceMaker)
@@ -728,3 +677,61 @@
signal.signal(signal.SIGHUP, sighup_handler)
return service
+
+
+def getSSLPassphrase(*ignored):
+
+ if not config.SSLPrivateKey:
+ return None
+
+ if config.SSLCertAdmin and os.path.isfile(config.SSLCertAdmin):
+ child = Popen(
+ args=[
+ "sudo", config.SSLCertAdmin,
+ "--get-private-key-passphrase", config.SSLPrivateKey,
+ ],
+ stdout=PIPE, stderr=PIPE,
+ )
+ output, error = child.communicate()
+
+ if child.returncode:
+ log.error("Could not get passphrase for %s: %s"
+ % (config.SSLPrivateKey, error))
+ else:
+ return output.strip()
+
+ if config.SSLPassPhraseDialog and os.path.isfile(config.SSLPassPhraseDialog):
+ sslPrivKey = open(config.SSLPrivateKey)
+ try:
+ keyType = None
+ for line in sslPrivKey.readlines():
+ if "-----BEGIN RSA PRIVATE KEY-----" in line:
+ keyType = "RSA"
+ break
+ elif "-----BEGIN DSA PRIVATE KEY-----" in line:
+ keyType = "DSA"
+ break
+ finally:
+ sslPrivKey.close()
+
+ if keyType is None:
+ log.error("Could not get private key type for %s"
+ % (config.SSLPrivateKey,))
+ else:
+ child = Popen(
+ args=[
+ config.SSLPassPhraseDialog,
+ "%s:%s" % (config.ServerHostName, config.SSLPort),
+ keyType,
+ ],
+ stdout=PIPE, stderr=PIPE,
+ )
+ output, error = child.communicate()
+
+ if child.returncode:
+ log.error("Could not get passphrase for %s: %s"
+ % (config.SSLPrivateKey, error))
+ else:
+ return output.strip()
+
+ return None
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081202/5d99cd9c/attachment.html>
More information about the calendarserver-changes
mailing list