Undo inadvertent loosening of archive filename checking. Commit c8a350a439826267186c187dbfbf1f839f7521aa attempted to consolidate code for identify possibly-compressed tar archives by suffix into a new function parse_tar_compress_algorithm(). Unfortunately, the refactoring wasn't perfect, and slightly changed the behavior at both existing call sites.
In CreateBackupStreamer(), the previous code required the filename to consist of more than just a suffix, so the aforementioned commit had the effect of allowing pg_basebackup to accept a file from the server whose entire name was something like .tar.gz -- which should never happen, but let's reject it as previous releases did. In precheck_tar_backup_file(), the previous code required the suffix to be immediately adjacent to the prefix already checked, so the commit in question allowed pg_verifybackup to accept not only filenames like base.tar.gz but also filenames like baseFOOBARBAZ.tar.gz. While such filenames are perhaps unlikely, rejecting them is correct, so let's go back to that behavior. Discussion: http://postgr.es/m/ca+tgmoyjy8fkoeykgf_yf1s6uok7fd0bd3zrw0xy_ozxbmv...@mail.gmail.com Reported-by: Sarath Kumar <[email protected]> Reviewed-by: Andrew Dunstan <[email protected]> Backpatch-through: 19 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/072b962d99c6317e5cd5a5ac11b21fae2cab6f8a Modified Files -------------- src/bin/pg_basebackup/pg_basebackup.c | 4 ++-- src/bin/pg_verifybackup/pg_verifybackup.c | 8 ++++++-- src/bin/pg_waldump/pg_waldump.c | 5 +++-- src/common/compression.c | 28 +++++++++++++++++++++------- src/include/common/compression.h | 2 +- 5 files changed, 33 insertions(+), 14 deletions(-)
