[CalendarServer-changes] [10602] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Tue Jan 29 16:27:44 PST 2013
Revision: 10602
http://trac.calendarserver.org//changeset/10602
Author: cdaboo at apple.com
Date: 2013-01-29 16:27:44 -0800 (Tue, 29 Jan 2013)
Log Message:
-----------
Tweak DKIM tool to generate debug output when -v used. Also allow t= and x= values to be ignored.
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/dkimtool.py
CalendarServer/trunk/twistedcaldav/scheduling/ischedule/dkim.py
Modified: CalendarServer/trunk/calendarserver/tools/dkimtool.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/dkimtool.py 2013-01-30 00:25:07 UTC (rev 10601)
+++ CalendarServer/trunk/calendarserver/tools/dkimtool.py 2013-01-30 00:27:44 UTC (rev 10602)
@@ -17,14 +17,19 @@
from Crypto.PublicKey import RSA
from StringIO import StringIO
+
+from twext.python.log import setLogLevelForNamespace, StandardIOObserver
from twext.web2.client.http import ClientRequest
from twext.web2.http_headers import Headers
from twext.web2.stream import MemoryStream
+
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks
from twisted.python.usage import Options
+
from twistedcaldav.scheduling.ischedule.dkim import RSA256, DKIMRequest, \
PublicKeyLookup, DKIMVerifier, DKIMVerificationError
+
import sys
@@ -60,6 +65,9 @@
@inlineCallbacks
def _doRequest(options):
+ if options["verbose"]:
+ setLogLevelForNamespace("twistedcaldav.scheduling.ischedule.dkim", "debug")
+
# Parse the HTTP file
request = open(options["request"]).read()
method, uri, headers, stream = _parseRequest(request)
@@ -118,7 +126,7 @@
dkim = DKIMVerifier(request, lookup)
if options["fake-time"]:
- dkim.time = 100
+ dkim.time = 0
try:
yield dkim.verify()
@@ -284,6 +292,15 @@
options = DKIMToolOptions()
options.parseOptions(argv[1:])
+ #
+ # Send logging output to stdout
+ #
+ observer = StandardIOObserver()
+ observer.start()
+
+ if options["verbose"]:
+ setLogLevelForNamespace("twistedcaldav.scheduling.ischedule.dkim", "debug")
+
if options["key-gen"]:
_doKeyGeneration(options)
elif options["request"]:
Modified: CalendarServer/trunk/twistedcaldav/scheduling/ischedule/dkim.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/ischedule/dkim.py 2013-01-30 00:25:07 UTC (rev 10601)
+++ CalendarServer/trunk/twistedcaldav/scheduling/ischedule/dkim.py 2013-01-30 00:27:44 UTC (rev 10602)
@@ -646,15 +646,15 @@
raise DKIMVerificationError(msg)
# Check time stamp
- if "t" in self.dkim_tags:
+ if "t" in self.dkim_tags and self.time:
diff_time = self.time - int(self.dkim_tags["t"])
if diff_time < -360:
- msg = "Signature time to far in the future: %d seconds" % (diff_time,)
+ msg = "Signature time too far in the future: %d seconds" % (diff_time,)
log.debug("DKIM: " + msg)
raise DKIMVerificationError(msg)
# Check expiration
- if "x" in self.dkim_tags:
+ if "x" in self.dkim_tags and self.time:
diff_time = self.time - int(self.dkim_tags["x"])
if diff_time > 0:
msg = "Signature expired: %d seconds" % (diff_time,)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130129/2ce05d9c/attachment.html>
More information about the calendarserver-changes
mailing list