1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-06-23 00:07:44 +02:00

Limit manifest build recursion (i.e. links followed) to sixteen levels to detect link loops.

This commit is contained in:
David Steele
2018-08-28 16:27:10 -04:00
parent a6cecf7d5e
commit 14cde54b37
6 changed files with 81 additions and 43 deletions

View File

@ -367,6 +367,21 @@ sub run
$oManifest->build(storageDb(), $self->{strDbPath}, undef, true);
$self->testResult(sub {$self->manifestCompare($oManifestExpected, $oManifest)}, "", 'link');
# Create a link loop and expect an error
#---------------------------------------------------------------------------------------------------------------------------
testLinkCreate($self->{strDbPath} . '/pgdata', $self->{strDbPath});
$oManifest = new pgBackRest::Manifest(
$strBackupManifestFile,
{bLoad => false, strDbVersion => PG_VERSION_94, iDbCatalogVersion => $self->dbCatalogVersion(PG_VERSION_94)});
$self->testException(
sub {$oManifest->build(storageDb(), $self->{strDbPath}, undef, true)}, ERROR_FORMAT,
'recursion in manifest build exceeds depth of 16: pg_data/pgdata/pgdata/pgdata/pgdata/pgdata/pgdata/pgdata/pgdata/' .
"pgdata/pgdata/pgdata/pgdata/pgdata/pgdata/pgdata/pg_config/postgresql.conf.link\n" .
'HINT: is there a link loop in $PGDATA?');
testFileRemove($self->{strDbPath} . '/pgdata');
# Test skip files/directories
#---------------------------------------------------------------------------------------------------------------------------
# Create files to skip