mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
Allow ssl_passphrase_command to prompt the terminal
Previously the command could not access the terminal for a passphrase. Backpatch-through: master
This commit is contained in:
@ -22,6 +22,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "postmaster/postmaster.h"
|
||||
#include "common/string.h"
|
||||
#include "libpq/libpq.h"
|
||||
#include "storage/fd.h"
|
||||
@ -61,6 +62,19 @@ run_ssl_passphrase_command(const char *prompt, bool is_server_start, char *buf,
|
||||
appendStringInfoString(&command, prompt);
|
||||
p++;
|
||||
break;
|
||||
case 'R':
|
||||
{
|
||||
char fd_str[20];
|
||||
|
||||
if (terminal_fd == -1)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INTERNAL_ERROR),
|
||||
errmsg("ssl_passphrase_command referenced %%R, but -R not specified")));
|
||||
p++;
|
||||
snprintf(fd_str, sizeof(fd_str), "%d", terminal_fd);
|
||||
appendStringInfoString(&command, fd_str);
|
||||
break;
|
||||
}
|
||||
case '%':
|
||||
appendStringInfoChar(&command, '%');
|
||||
p++;
|
||||
|
Reference in New Issue
Block a user