mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-08-03 14:09:23 +00:00
ischedule: more correct error codes
This commit is contained in:
parent
1834628ae3
commit
b11ff47ef6
@ -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 );
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user