mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-07 13:32:57 +00:00
Make control plane connector send encrypted password (#4607)
Control plane needs the encrypted hash that postgres itself generates
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include "port.h"
|
||||
#include <curl/curl.h>
|
||||
#include "utils/jsonb.h"
|
||||
#include "libpq/crypt.h"
|
||||
|
||||
static ProcessUtility_hook_type PreviousProcessUtilityHook = NULL;
|
||||
|
||||
@@ -161,7 +162,22 @@ ConstructDeltaMessage()
|
||||
PushKeyValue(&state, "name", entry->name);
|
||||
if (entry->password)
|
||||
{
|
||||
#if PG_MAJORVERSION_NUM == 14
|
||||
char *logdetail;
|
||||
#else
|
||||
const char *logdetail;
|
||||
#endif
|
||||
PushKeyValue(&state, "password", (char *) entry->password);
|
||||
char *encrypted_password = get_role_password(entry->name, &logdetail);
|
||||
|
||||
if (encrypted_password)
|
||||
{
|
||||
PushKeyValue(&state, "encrypted_password", encrypted_password);
|
||||
}
|
||||
else
|
||||
{
|
||||
elog(ERROR, "Failed to get encrypted password: %s", logdetail);
|
||||
}
|
||||
}
|
||||
if (entry->old_name[0] != '\0')
|
||||
{
|
||||
|
||||
@@ -33,6 +33,7 @@ def handle_role(dbs, roles, operation):
|
||||
dbs[db] = operation["name"]
|
||||
if "password" in operation:
|
||||
roles[operation["name"]] = operation["password"]
|
||||
assert "encrypted_password" in operation
|
||||
elif operation["op"] == "del":
|
||||
if "old_name" in operation:
|
||||
roles.pop(operation["old_name"])
|
||||
|
||||
Reference in New Issue
Block a user