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

Commit e7d3a37

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 04c76ac commit e7d3a37

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/bin/pg_basebackup/streamutil.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,13 @@ GetConnection(void)
206206
if (conn_opts)
207207
PQconninfoFree(conn_opts);
208208

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

0 commit comments

Comments
 (0)