summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier2019-03-13 00:51:25 +0000
committerMichael Paquier2019-03-13 00:51:25 +0000
commit501f58359b59af1ffb58f9fbd6f97c4b226c69da (patch)
treef58db938fdff453501415ce8d8b9d7e50166f7e4
parentfd1eaf9202dc3bbd657aa1f46b787329173b261c (diff)
Fix cross-version compatibility checks of pg_verify_checksums
pg_verify_checksums performs a read of the control file, and the data it fetches should be from a data folder compatible with the major version of Postgres the binary has been compiled with, but we never actually checked that compatibility. Reported-by: Sergei Kornilov Author: Michael Paquier Reviewed-by: Sergei Kornilov Discussion: https://postgr.es/m/155231347133.16480.11453587097036807558.pgcf@coridan.postgresql.org Backpatch-through: 11
-rw-r--r--src/bin/pg_verify_checksums/pg_verify_checksums.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/bin/pg_verify_checksums/pg_verify_checksums.c b/src/bin/pg_verify_checksums/pg_verify_checksums.c
index 3ad69451ab6..6c2d0cd2ab5 100644
--- a/src/bin/pg_verify_checksums/pg_verify_checksums.c
+++ b/src/bin/pg_verify_checksums/pg_verify_checksums.c
@@ -316,6 +316,13 @@ main(int argc, char *argv[])
exit(1);
}
+ if (ControlFile->pg_control_version != PG_CONTROL_VERSION)
+ {
+ fprintf(stderr, _("%s: cluster is not compatible with this version of pg_verify_checksums\n"),
+ progname);
+ exit(1);
+ }
+
if (ControlFile->state != DB_SHUTDOWNED &&
ControlFile->state != DB_SHUTDOWNED_IN_RECOVERY)
{