[CalendarServer-changes] [2775] CalendarServer/branches/users/sagen/mailgateway-implicit-2745/ twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Wed Aug 6 11:54:45 PDT 2008
Revision: 2775
http://trac.macosforge.org/projects/calendarserver/changeset/2775
Author: sagen at apple.com
Date: 2008-08-06 11:54:44 -0700 (Wed, 06 Aug 2008)
Log Message:
-----------
Moved internal scheduling resource to /inbox, ISchedule inbox to /ischedule; verifying internal scheduling is coming from the correct host address
Modified Paths:
--------------
CalendarServer/branches/users/sagen/mailgateway-implicit-2745/twistedcaldav/mail.py
CalendarServer/branches/users/sagen/mailgateway-implicit-2745/twistedcaldav/scheduling/scheduler.py
CalendarServer/branches/users/sagen/mailgateway-implicit-2745/twistedcaldav/tap.py
Modified: CalendarServer/branches/users/sagen/mailgateway-implicit-2745/twistedcaldav/mail.py
===================================================================
--- CalendarServer/branches/users/sagen/mailgateway-implicit-2745/twistedcaldav/mail.py 2008-08-06 17:02:22 UTC (rev 2774)
+++ CalendarServer/branches/users/sagen/mailgateway-implicit-2745/twistedcaldav/mail.py 2008-08-06 18:54:44 UTC (rev 2775)
@@ -29,7 +29,7 @@
from twisted.python.usage import Options, UsageError
from twisted.python.reflect import namedClass
from twisted.mail.smtp import messageid, rfc822date, sendmail
-from twistedcaldav.log import LoggingMixIn
+from twistedcaldav.log import Logger, LoggingMixIn
from twistedcaldav import ical
from twistedcaldav.resource import CalDAVResource
from twistedcaldav.scheduling.scheduler import IMIPScheduler
@@ -50,6 +50,8 @@
]
+log = Logger()
+
#
# Mail gateway service config
#
@@ -217,6 +219,13 @@
def injectMessage(organizer, attendee, calendar, reactor=None):
+ def _success(result):
+ log.info("iMIP response POSTed successfully")
+
+ def _failure(failure):
+ log.err("Failed to POST iMIP response: %s" %
+ (failure.getErrorMessage(),))
+
if reactor is None:
from twisted.internet import reactor
@@ -236,7 +245,7 @@
port = config.HTTPPort
host = config.ServerHostName
- path = "email-inbox"
+ path = "inbox"
scheme = "https:" if useSSL else "http:"
url = "%s//%s:%d/%s/" % (scheme, host, port, path)
@@ -246,6 +255,7 @@
reactor.connectSSL(host, port, factory, ssl.ClientContextFactory())
else:
reactor.connectTCP(host, port, factory)
+ factory.deferred.addCallback(_success).addErrback(_failure)
return factory.deferred
Modified: CalendarServer/branches/users/sagen/mailgateway-implicit-2745/twistedcaldav/scheduling/scheduler.py
===================================================================
--- CalendarServer/branches/users/sagen/mailgateway-implicit-2745/twistedcaldav/scheduling/scheduler.py 2008-08-06 17:02:22 UTC (rev 2774)
+++ CalendarServer/branches/users/sagen/mailgateway-implicit-2745/twistedcaldav/scheduling/scheduler.py 2008-08-06 18:54:44 UTC (rev 2775)
@@ -736,8 +736,24 @@
pass
def securityChecks(self):
- pass
+ """
+ Check that the connection is from the mail gateway
+ """
+ allowed = config.Scheduling['iMIP']['MailGatewayServer']
+ # Get the request IP and map to hostname.
+ clientip = self.request.remoteAddr.host
+ host, aliases, _ignore_ips = socket.gethostbyaddr(clientip)
+ for host in itertools.chain((host,), aliases):
+ if host == allowed:
+ break
+ else:
+ log.err("Only %s is allowed to submit internal scheduling requests, not %s" % (allowed, host))
+ # TODO: verify this is the right response:
+ raise HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "originator-allowed")))
+
+
+
@inlineCallbacks
def checkOriginator(self):
"""
Modified: CalendarServer/branches/users/sagen/mailgateway-implicit-2745/twistedcaldav/tap.py
===================================================================
--- CalendarServer/branches/users/sagen/mailgateway-implicit-2745/twistedcaldav/tap.py 2008-08-06 17:02:22 UTC (rev 2774)
+++ CalendarServer/branches/users/sagen/mailgateway-implicit-2745/twistedcaldav/tap.py 2008-08-06 18:54:44 UTC (rev 2775)
@@ -533,19 +533,19 @@
log.msg("Setting up iSchedule inbox resource: %r" % (self.iScheduleResourceClass,))
ischedule = self.iScheduleResourceClass(
- os.path.join(config.DocumentRoot, 'inbox'),
+ os.path.join(config.DocumentRoot, 'ischedule'),
root,
)
- root.putChild('inbox', ischedule)
+ root.putChild('ischedule', ischedule)
#
# IMIP delivery resource
#
imipInbox = self.imipResourceClass(
- os.path.join(config.DocumentRoot, 'email-inbox'),
+ os.path.join(config.DocumentRoot, 'inbox'),
root,
)
- root.putChild('email-inbox', imipInbox)
+ root.putChild('inbox', imipInbox)
#
# Configure ancillary data
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080806/6ceb262e/attachment-0001.html
More information about the calendarserver-changes
mailing list