PostgreSQL Source Code git master
Loading...
Searching...
No Matches
ssl_passphrase_func.c File Reference
#include "postgres.h"
#include <float.h>
#include <stdio.h>
#include "libpq/libpq.h"
#include "libpq/libpq-be.h"
#include "utils/guc.h"
Include dependency graph for ssl_passphrase_func.c:

Go to the source code of this file.

Functions

static int rot13_passphrase (char *buf, int size, int rwflag, void *userdata)
 
static void set_rot13 (SSL_CTX *context, bool isServerStart)
 
void _PG_init (void)
 

Variables

 PG_MODULE_MAGIC
 
static charssl_passphrase = NULL
 

Function Documentation

◆ _PG_init()

void _PG_init ( void  )

Definition at line 35 of file ssl_passphrase_func.c.

36{
37 /* Define custom GUC variable. */
38 DefineCustomStringVariable("ssl_passphrase.passphrase",
39 "passphrase before transformation",
40 NULL,
42 NULL,
44 0, /* no flags required */
45 NULL,
46 NULL,
47 NULL);
48
49 MarkGUCPrefixReserved("ssl_passphrase");
50
53}
openssl_tls_init_hook_typ openssl_tls_init_hook
void DefineCustomStringVariable(const char *name, const char *short_desc, const char *long_desc, char **valueAddr, const char *bootValue, GucContext context, int flags, GucStringCheckHook check_hook, GucStringAssignHook assign_hook, GucShowHook show_hook)
Definition guc.c:5091
void MarkGUCPrefixReserved(const char *className)
Definition guc.c:5148
@ PGC_SIGHUP
Definition guc.h:75
static int fb(int x)
static char * ssl_passphrase
static void set_rot13(SSL_CTX *context, bool isServerStart)

References DefineCustomStringVariable(), fb(), MarkGUCPrefixReserved(), openssl_tls_init_hook, PGC_SIGHUP, set_rot13(), and ssl_passphrase.

◆ rot13_passphrase()

static int rot13_passphrase ( char buf,
int  size,
int  rwflag,
void userdata 
)
static

Definition at line 67 of file ssl_passphrase_func.c.

68{
69
72 for (char *p = buf; *p; p++)
73 {
74 char c = *p;
75
76 if ((c >= 'a' && c <= 'm') || (c >= 'A' && c <= 'M'))
77 *p = c + 13;
78 else if ((c >= 'n' && c <= 'z') || (c >= 'N' && c <= 'Z'))
79 *p = c - 13;
80 }
81
82 return strlen(buf);
83}
#define Assert(condition)
Definition c.h:873
static char buf[DEFAULT_XLOG_SEG_SIZE]
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition strlcpy.c:45
char * c

References Assert, buf, fb(), ssl_passphrase, and strlcpy().

Referenced by set_rot13().

◆ set_rot13()

static void set_rot13 ( SSL_CTX context,
bool  isServerStart 
)
static

Definition at line 56 of file ssl_passphrase_func.c.

57{
58 /* warn if the user has set ssl_passphrase_command */
61 (errmsg("\"ssl_passphrase_command\" setting ignored by ssl_passphrase_func module")));
62
64}
char * ssl_passphrase_command
Definition be-secure.c:43
int errmsg(const char *fmt,...)
Definition elog.c:1080
#define WARNING
Definition elog.h:36
#define ereport(elevel,...)
Definition elog.h:150
static int rot13_passphrase(char *buf, int size, int rwflag, void *userdata)

References ereport, errmsg(), fb(), rot13_passphrase(), ssl_passphrase_command, and WARNING.

Referenced by _PG_init().

Variable Documentation

◆ PG_MODULE_MAGIC

PG_MODULE_MAGIC

Definition at line 21 of file ssl_passphrase_func.c.

◆ ssl_passphrase

char* ssl_passphrase = NULL
static

Definition at line 23 of file ssl_passphrase_func.c.

Referenced by _PG_init(), and rot13_passphrase().