PostgreSQL Source Code git master
Loading...
Searching...
No Matches
oauth-utils.h File Reference
#include "libpq-fe.h"
#include "pqexpbuffer.h"
Include dependency graph for oauth-utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define libpq_gettext(x)   (x)
 
#define pglock_thread()   pg_g_threadlock(true)
 
#define pgunlock_thread()   pg_g_threadlock(false)
 

Typedefs

typedef char *(* libpq_gettext_func) (const char *msgid)
 

Enumerations

enum  PGTernaryBool { PG_BOOL_UNKNOWN = 0 , PG_BOOL_YES , PG_BOOL_NO }
 

Functions

PGDLLEXPORT void libpq_oauth_init (libpq_gettext_func gettext_impl)
 
bool oauth_unsafe_debugging_enabled (void)
 
int pq_block_sigpipe (sigset_t *osigset, bool *sigpipe_pending)
 
void pq_reset_sigpipe (sigset_t *osigset, bool sigpipe_pending, bool got_epipe)
 

Variables

pgthreadlock_t pg_g_threadlock
 

Macro Definition Documentation

◆ libpq_gettext

#define libpq_gettext (   x)    (x)

Definition at line 45 of file oauth-utils.h.

◆ pglock_thread

#define pglock_thread ( )    pg_g_threadlock(true)

Definition at line 50 of file oauth-utils.h.

◆ pgunlock_thread

#define pgunlock_thread ( )    pg_g_threadlock(false)

Definition at line 51 of file oauth-utils.h.

Typedef Documentation

◆ libpq_gettext_func

typedef char *(* libpq_gettext_func) (const char *msgid)

Definition at line 21 of file oauth-utils.h.

Enumeration Type Documentation

◆ PGTernaryBool

Enumerator
PG_BOOL_UNKNOWN 
PG_BOOL_YES 
PG_BOOL_NO 

Definition at line 31 of file oauth-utils.h.

32{
33 PG_BOOL_UNKNOWN = 0, /* Currently unknown */
34 PG_BOOL_YES, /* Yes (true) */
35 PG_BOOL_NO /* No (false) */
PGTernaryBool
Definition oauth-utils.h:32
@ PG_BOOL_YES
Definition oauth-utils.h:34
@ PG_BOOL_NO
Definition oauth-utils.h:35
@ PG_BOOL_UNKNOWN
Definition oauth-utils.h:33

Function Documentation

◆ libpq_oauth_init()

PGDLLEXPORT void libpq_oauth_init ( libpq_gettext_func  gettext_impl)
extern

Definition at line 46 of file oauth-utils.c.

47{
50}
pgthreadlock_t PQgetThreadLock(void)
static libpq_gettext_func libpq_gettext_impl
Definition oauth-utils.c:36
pgthreadlock_t pg_g_threadlock
Definition oauth-utils.c:35
static int fb(int x)

References fb(), libpq_gettext_impl, pg_g_threadlock, and PQgetThreadLock().

◆ oauth_unsafe_debugging_enabled()

bool oauth_unsafe_debugging_enabled ( void  )
extern

Definition at line 82 of file oauth-utils.c.

83{
84 const char *env = getenv("PGOAUTHDEBUG");
85
86 return (env && strcmp(env, "UNSAFE") == 0);
87}

◆ pq_block_sigpipe()

int pq_block_sigpipe ( sigset_t osigset,
bool sigpipe_pending 
)
extern

Definition at line 105 of file oauth-utils.c.

106{
109
112
113 /* Block SIGPIPE and save previous mask for later reset */
115 if (SOCK_ERRNO)
116 return -1;
117
118 /* We can have a pending SIGPIPE only if it was blocked before */
120 {
121 /* Is there a pending SIGPIPE? */
122 if (sigpending(&sigset) != 0)
123 return -1;
124
126 *sigpipe_pending = true;
127 else
128 *sigpipe_pending = false;
129 }
130 else
131 *sigpipe_pending = false;
132
133 return 0;
134}
#define SOCK_ERRNO
Definition oauth-utils.c:97
#define SOCK_ERRNO_SET(e)
Definition oauth-utils.c:98
#define SIGPIPE
Definition win32_port.h:163

◆ pq_reset_sigpipe()

void pq_reset_sigpipe ( sigset_t osigset,
bool  sigpipe_pending,
bool  got_epipe 
)
extern

Definition at line 141 of file oauth-utils.c.

142{
144 int signo;
146
147 /* Clear SIGPIPE only if none was pending */
148 if (got_epipe && !sigpipe_pending)
149 {
150 if (sigpending(&sigset) == 0 &&
152 {
154
157
159 }
160 }
161
162 /* Restore saved block mask */
164
166}

Variable Documentation

◆ pg_g_threadlock

pgthreadlock_t pg_g_threadlock
extern

Definition at line 35 of file oauth-utils.c.