# HG changeset patch # User Paul Boddie # Date 1441922181 -7200 # Node ID 253e9da20d9eb4b93107d4312bef2d039b57c1f8 # Parent ab2df0cbc65e1bb5f9df64d880cb52a96826672c Added genuine organiser detection. diff -r ab2df0cbc65e -r 253e9da20d9e imiptools/handlers/__init__.py --- a/imiptools/handlers/__init__.py Thu Sep 10 22:09:38 2015 +0200 +++ b/imiptools/handlers/__init__.py Thu Sep 10 23:56:21 2015 +0200 @@ -155,6 +155,14 @@ if not organiser_filter_fn(dict([organiser_item])): return None + # Test against any previously-received organiser details. + + obj = self.get_stored_object_version() + if obj: + stored_organiser = get_uri(obj.get_value("ORGANIZER")) + if stored_organiser != organiser: + return None + return organiser_item def require_attendees(self, from_organiser=True): diff -r ab2df0cbc65e -r 253e9da20d9e tests/templates/event-request-imposter.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/templates/event-request-imposter.txt Thu Sep 10 23:56:21 2015 +0200 @@ -0,0 +1,35 @@ +Content-Type: multipart/alternative; boundary="===============0047278175==" +MIME-Version: 1.0 +From: vincent.vole@example.com +To: resource-room-confroom@example.com +Subject: Invitation! + +--===============0047278175== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit + +This message contains an event. The organiser is not the real organiser! + +--===============0047278175== +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/calendar; charset="us-ascii"; method="REQUEST" + +BEGIN:VCALENDAR +PRODID:-//imip-agent/test//EN +METHOD:REQUEST +VERSION:2.0 +BEGIN:VEVENT +ORGANIZER:mailto:vincent.vole@example.com +ATTENDEE;ROLE=CHAIR:mailto:paul.boddie@example.com +ATTENDEE;RSVP=TRUE:mailto:resource-room-confroom@example.com +DTSTAMP:20141125T004600Z +DTSTART;TZID=Europe/Oslo:20141126T163000 +DTEND;TZID=Europe/Oslo:20141126T170000 +SUMMARY:Meeting at 4:30pm +UID:event1@example.com +END:VEVENT +END:VCALENDAR + +--===============0047278175==-- diff -r ab2df0cbc65e -r 253e9da20d9e tests/test_resource_invitation.sh --- a/tests/test_resource_invitation.sh Thu Sep 10 22:09:38 2015 +0200 +++ b/tests/test_resource_invitation.sh Thu Sep 10 23:56:21 2015 +0200 @@ -58,6 +58,24 @@ && echo "Success" \ || echo "Failed" + "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-imposter.txt" 2>> $ERROR \ +| "$SHOWMAIL" \ +> out2i.tmp + + ! grep -q 'METHOD:REPLY' out2i.tmp \ +&& echo "Success" \ +|| echo "Failed" + + "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request.txt" 2>> $ERROR \ +| "$SHOWMAIL" \ +> out3i.tmp + + grep -q 'METHOD:REPLY' out3i.tmp \ +&& grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out3i.tmp \ +&& ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T160000Z' out3i.tmp \ +&& echo "Success" \ +|| echo "Failed" + "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-conflict.txt" 2>> $ERROR \ | "$SHOWMAIL" \ > out4.tmp