mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Fix pg_recvlogical for pre-10 versions
Ine170b8c8, 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 thate170b8c8fixes, so we can just skip this command for older versions. Author: Michael Paquier <michael@paquier.xyz>
This commit is contained in:
		@@ -209,8 +209,13 @@ GetConnection(void)
 | 
			
		||||
	if (conn_opts)
 | 
			
		||||
		PQconninfoFree(conn_opts);
 | 
			
		||||
 | 
			
		||||
	/* Set always-secure search path, so malicious users can't get control. */
 | 
			
		||||
	if (dbname != NULL)
 | 
			
		||||
	/*
 | 
			
		||||
	 * Set always-secure search path, so malicious users can't get control.
 | 
			
		||||
	 * The capacity to run normal SQL queries was added in PostgreSQL
 | 
			
		||||
	 * 10, so the search path cannot be changed (by us or attackers) on
 | 
			
		||||
	 * earlier versions.
 | 
			
		||||
	 */
 | 
			
		||||
	if (dbname != NULL && PQserverVersion(conn) >= 100000)
 | 
			
		||||
	{
 | 
			
		||||
		PGresult   *res;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user