When creating an external bind attempts to create an external bind to the local host should be excluded

This commit is contained in:
Rob Ostensen 2011-12-02 11:16:28 -06:00
parent 35e1ae64b0
commit 5bea2e16d1

View File

@ -47,7 +47,8 @@ if ( $destination->Exists() ) {
$request->PreconditionFailed(403,'DAV::can-overwrite',translate('A resource already exists at the destination.'));
}
if ( preg_match ( '{^https?://[A-Za-z][^/]*/.+$}', $href ) ) {
if ( preg_match ( '{^https?://[A-Za-z][^/]*/.+$}', $href ) && ! stripos( $href, 'localhost' ) < 9
&& ! stripos( $href, '127.0.0.1' ) < 9 && ! stripos( $href, $_SERVER['SERVER_NAME'] ) < 9 && ! stripos( $href, $_SERVER['SERVER_ADDR'] ) < 9 ) {
require_once('external-fetch.php');
$qry = new AwlQuery( );
$qry->QDo('SELECT collection_id FROM collection WHERE dav_name = :dav_name ', array( ':dav_name' => '/.external/'. md5($href) ));