Skip to content

Commit 6e240ab

Browse files
author
Till Brehm
committed
Merge branch 'feature/prevent-conflicting-aps-install-paths' into 'stable-3.1'
Prevent conflicting APS install paths See merge request ispconfig/ispconfig3!943
2 parents 3ce6d76 + 20225e7 commit 6e240ab

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

interface/lib/classes/aps_guicontroller.inc.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,11 +637,27 @@ public function validateInstallerInput($postinput, $pkg_details, $domains, $sett
637637
// The location might be empty but the DB return must not be false!
638638
if($location_for_domain) $used_path .= $location_for_domain['value'];
639639

640+
// If user is trying to install into exactly the same path, give an error
640641
if($new_path == $used_path)
641642
{
642643
$temp_errstr = $app->lng('error_used_location');
643644
break;
644645
}
646+
647+
// If the new path is _below_ an existing path, give an error because the
648+
// installation will delete the files of the existing APS installation
649+
if (mb_substr($used_path, 0, mb_strlen($new_path)) === $new_path) {
650+
$temp_errstr = $app->lng('error_used_location');
651+
break;
652+
}
653+
654+
// If the new path is _within_ an existing path, give an error. Even if
655+
// installation would proceed fine in theory, deleting the "lower" package
656+
// in the future would also inadvertedly delete the "nested" package
657+
if (mb_substr($new_path, 0, mb_strlen($used_path)) === $used_path) {
658+
$temp_errstr = $app->lng('error_used_location');
659+
break;
660+
}
645661
}
646662
}
647663
}

0 commit comments

Comments
 (0)