mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-24 23:56:29 +00:00
Fix superuser password handling
When establishing a superuser connection, the connection parameters were being copied from the existing (non-superuser) connection, which in some circumstances can lead to that user's password being included in the copied parameter list. The password parameter, if set, will now always be removed, which will cause libpq to retrieve the correct one from the .pgpass file. Addresses GitHub #400.
This commit is contained in:
@@ -2236,6 +2236,7 @@ get_superuser_connection(PGconn **conn, PGconn **superuser_conn, PGconn **privil
|
||||
log_error(_("no database connection available"));
|
||||
exit(ERR_INTERNAL);
|
||||
}
|
||||
|
||||
is_superuser = is_superuser_connection(*conn, &userinfo);
|
||||
|
||||
if (is_superuser == true)
|
||||
@@ -2277,6 +2278,8 @@ get_superuser_connection(PGconn **conn, PGconn **superuser_conn, PGconn **privil
|
||||
exit(ERR_BAD_CONFIG);
|
||||
}
|
||||
|
||||
log_debug("established superuser connection as \"%s\"", runtime_options.superuser);
|
||||
|
||||
*privileged_conn = *superuser_conn;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user