Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8d2814f

Browse filesBrowse 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
Copy full SHA for 8d2814f

File tree

Expand file treeCollapse file tree

1 file changed

+7
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-2
lines changed

‎src/bin/pg_basebackup/streamutil.c

Copy file name to clipboardExpand all lines: src/bin/pg_basebackup/streamutil.c
+7-2Lines changed: 7 additions & 2 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.