Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8d2814f

Browse files
committed
Fix pg_recvlogical for pre-10 versions
In e170b8c, protection against modified search_path was added. However, PostgreSQL versions prior to 10 does not accept SQL commands over a replication connection, so the protection would generate a syntax error. Since we cannot run SQL commands on it, we are also not vulnerable to the issue that e170b8c fixes, so we can just skip this command for older versions. Author: Michael Paquier <michael@paquier.xyz>
1 parent 2dbee9f commit 8d2814f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/bin/pg_basebackup/streamutil.c

+7-2
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,13 @@ GetConnection(void)
209209
if (conn_opts)
210210
PQconninfoFree(conn_opts);
211211

212-
/* Set always-secure search path, so malicious users can't get control. */
213-
if (dbname != NULL)
212+
/*
213+
* Set always-secure search path, so malicious users can't get control.
214+
* The capacity to run normal SQL queries was added in PostgreSQL
215+
* 10, so the search path cannot be changed (by us or attackers) on
216+
* earlier versions.
217+
*/
218+
if (dbname != NULL && PQserverVersion(conn) >= 100000)
214219
{
215220
PGresult *res;
216221

0 commit comments

Comments
 (0)