From 43cb17f5be2e30f94c7a8165e03c44c31403c43a Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@otacoo.com>
Date: Tue, 23 Feb 2016 14:53:37 +0900
Subject: [PATCH 4/9] Remove password verifiers for unsupported protocols in
 pg_upgrade

This uses pg_auth_verifiers_sanitize to perform the cleanup in
pg_auth_verifiers that has been introduced previously.
---
 src/bin/pg_upgrade/pg_upgrade.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c
index 984c395..4459990 100644
--- a/src/bin/pg_upgrade/pg_upgrade.c
+++ b/src/bin/pg_upgrade/pg_upgrade.c
@@ -262,6 +262,18 @@ prepare_new_cluster(void)
 	check_ok();
 
 	get_pg_database_relfilenode(&new_cluster);
+
+	/*
+	 * In order to ensure that the freshly-deployed cluster has no outdated
+	 * password verifier entries, sanitize pg_auth_verifiers using the
+	 * in-core function aimed at this purpose.
+	 */
+	prep_status("Removing password verifiers for unsupported protocols");
+	exec_prog(UTILITY_LOG_FILE, NULL, true,
+			  "\"%s/psql\" " EXEC_PSQL_ARGS
+			  " %s -c \"SELECT pg_auth_verifiers_sanitize()\"",
+			  new_cluster.bindir, cluster_conn_opts(&new_cluster));
+	check_ok();
 }
 
 
-- 
2.7.1

