diff --git a/inc/iSchedule-POST.php b/inc/iSchedule-POST.php index 4d33b3e4..f78c08a9 100644 --- a/inc/iSchedule-POST.php +++ b/inc/iSchedule-POST.php @@ -63,19 +63,18 @@ if ( $d->validateRequest ( ) ) { } } if ( ! in_array ( preg_replace( '/^mailto:/i', '', $_SERVER['HTTP_ORIGINATOR'] ), $addresses ) ) { // should this be case sensitive? - $request->DoResponse( 400, translate('sender must be organizer or attendee of event') ); + $request->DoResponse( 412, translate('sender must be organizer or attendee of event') ); } foreach ( $recipients as $v ) { if ( ! in_array ( preg_replace( '/^mailto:/i', '', $v ), $addresses ) ) { // should this be case sensitive? dbg_error_log('ischedule','recipient missing from event ' . $v ); - $reply->XMLResponse( 400, translate('recipient must be organizer or attendee of event') . $v ); + $reply->XMLResponse( 403, translate('recipient must be organizer or attendee of event') . $v ); continue; } $email = preg_replace( '/^mailto:/', '', $v ); dbg_error_log('ischedule','recipient ' . $v ); $schedule_target = new Principal('email',$email); if ( $schedule_target == false ){ - //$attendee->SetParameterValue ('SCHEDULE-STATUS','5.3;No scheduling support for user'); array_push ( $attendees_fail, $schedule_target ); continue; } @@ -84,6 +83,8 @@ if ( $d->validateRequest ( ) ) { } $method = $ical->GetPValue('METHOD'); $content_type = explode ( ';', $_SERVER['CONTENT_TYPE'] ); + if ( $content_type[0] != 'text/calendar' ) + $reply->XMLResponse( 406, 'content must be text/calendar' ); $content_parts = Array (); foreach ( $content_type as $v ) { list ( $a, $b ) = explode ( '=', trim ( $v ), 2 ); diff --git a/inc/iSchedule.php b/inc/iSchedule.php index 4e6dce34..202eb5ff 100644 --- a/inc/iSchedule.php +++ b/inc/iSchedule.php @@ -628,12 +628,14 @@ class iSchedule $request->DoResponse( 403, translate('DKIM signature missing') ); return false; } + if ( isset ( $_SERVER['HTTP_ORGANIZER'] ) ) + $request->DoResponse( 403, translate('Organizer Missing') ); dbg_error_log ('ischedule','beginning validation'); $err = $this->parseDKIM ( $sig ); if ( $err !== true || $this->failed ) - $request->DoResponse( 400, translate('DKIM signature invalid ' ) . "\n" . $err . "\n" . $sig ); - if ( ! $this->getTxt () || $this->failed ) + $request->DoResponse( 412, 'DKIM signature invalid ' . "\n" . $err . "\n" ); + if ( ! $this->getTxt () || $this->failed ) // this could also be a 424 failed dependency response $request->DoResponse( 400, translate('DKIM signature validation failed(DNS ERROR)') ); if ( ! $this->parseTxt () || $this->failed ) $request->DoResponse( 400, translate('DKIM signature validation failed(KEY Parse ERROR)') ); @@ -641,9 +643,8 @@ class iSchedule $request->DoResponse( 400, translate('DKIM signature validation failed(KEY Validation ERROR)') ); $err = $this->verifySignature (); if ( $err !== true || $this->failed ) - $request->DoResponse( 400, translate('DKIM signature validation failed(Signature verification ERROR)') . $this->verifySignature() ); + $request->DoResponse( 412, translate('DKIM signature validation failed(Signature verification ERROR)') . '\n' . $err ); dbg_error_log ('ischedule','signature ok'); - //$request->DoResponse( 200, translate('DKIM signature validation ok') ); return true; } }