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

Go to the source code of this file.

Macros

#define OAUTHDEBUG_UNSAFE_HTTP   (1<<0)
 
#define OAUTHDEBUG_UNSAFE_TRACE   (1<<1)
 
#define OAUTHDEBUG_UNSAFE_DOS_ENDPOINT   (1<<2)
 
#define OAUTHDEBUG_CALL_COUNT   (1<<16)
 
#define OAUTHDEBUG_PLUGIN_ERRORS   (1<<17)
 
#define OAUTHDEBUG_LEGACY_UNSAFE   ((uint32) ~0)
 
#define OAUTHDEBUG_UNSAFE_MASK   ((uint32) 0x0000FFFF)
 

Functions

static uint32 oauth_parse_debug_flags (void)
 

Macro Definition Documentation

◆ OAUTHDEBUG_CALL_COUNT

#define OAUTHDEBUG_CALL_COUNT   (1<<16)

Definition at line 47 of file oauth-debug.h.

◆ OAUTHDEBUG_LEGACY_UNSAFE

#define OAUTHDEBUG_LEGACY_UNSAFE   ((uint32) ~0)

Definition at line 52 of file oauth-debug.h.

◆ OAUTHDEBUG_PLUGIN_ERRORS

#define OAUTHDEBUG_PLUGIN_ERRORS   (1<<17)

Definition at line 49 of file oauth-debug.h.

◆ OAUTHDEBUG_UNSAFE_DOS_ENDPOINT

#define OAUTHDEBUG_UNSAFE_DOS_ENDPOINT   (1<<2)

Definition at line 42 of file oauth-debug.h.

◆ OAUTHDEBUG_UNSAFE_HTTP

#define OAUTHDEBUG_UNSAFE_HTTP   (1<<0)

Definition at line 38 of file oauth-debug.h.

◆ OAUTHDEBUG_UNSAFE_MASK

#define OAUTHDEBUG_UNSAFE_MASK   ((uint32) 0x0000FFFF)

Definition at line 55 of file oauth-debug.h.

◆ OAUTHDEBUG_UNSAFE_TRACE

#define OAUTHDEBUG_UNSAFE_TRACE   (1<<1)

Definition at line 40 of file oauth-debug.h.

Function Documentation

◆ oauth_parse_debug_flags()

static uint32 oauth_parse_debug_flags ( void  )
static

Definition at line 79 of file oauth-debug.h.

80{
81 uint32 flags = 0;
82 const char *env = getenv("PGOAUTHDEBUG");
83 char *options_str;
84 char *option;
85 char *saveptr = NULL;
86 bool unsafe_allowed = false;
87
88 if (!env || env[0] == '\0')
89 return flags;
90
91 if (strcmp(env, "UNSAFE") == 0)
93
94 if (strncmp(env, "UNSAFE:", 7) == 0)
95 {
96 unsafe_allowed = true;
97 env += 7;
98 }
99
101 if (!options_str)
102 return flags;
103
105 while (option != NULL)
106 {
107 uint32 flag = 0;
108
109 if (strcmp(option, "http") == 0)
111 else if (strcmp(option, "trace") == 0)
113 else if (strcmp(option, "dos-endpoint") == 0)
115 else if (strcmp(option, "call-count") == 0)
117 else if (strcmp(option, "plugin-errors") == 0)
119 else
121 libpq_gettext("WARNING: unrecognized PGOAUTHDEBUG option \"%s\" (ignored)\n"),
122 option);
123
124 if (!unsafe_allowed && ((flag & OAUTHDEBUG_UNSAFE_MASK) != 0))
125 {
126 flag = 0;
127
129 libpq_gettext("WARNING: PGOAUTHDEBUG option \"%s\" is unsafe (ignored)\n"),
130 option);
131 }
132
133 flags |= flag;
134 option = strtok_r(NULL, ",", &saveptr);
135 }
136
138
139 return flags;
140}
uint32_t uint32
Definition c.h:624
#define fprintf(file, fmt, msg)
Definition cubescan.l:21
#define OAUTHDEBUG_UNSAFE_HTTP
Definition oauth-debug.h:38
#define OAUTHDEBUG_LEGACY_UNSAFE
Definition oauth-debug.h:52
#define OAUTHDEBUG_CALL_COUNT
Definition oauth-debug.h:47
#define OAUTHDEBUG_UNSAFE_TRACE
Definition oauth-debug.h:40
#define OAUTHDEBUG_PLUGIN_ERRORS
Definition oauth-debug.h:49
#define OAUTHDEBUG_UNSAFE_MASK
Definition oauth-debug.h:55
#define OAUTHDEBUG_UNSAFE_DOS_ENDPOINT
Definition oauth-debug.h:42
#define libpq_gettext(x)
Definition oauth-utils.h:44
static int fb(int x)
#define free(a)
char * flag(int b)
Definition test-ctype.c:33
#define strtok_r
Definition win32_port.h:408

References fb(), flag(), fprintf, free, libpq_gettext, OAUTHDEBUG_CALL_COUNT, OAUTHDEBUG_LEGACY_UNSAFE, OAUTHDEBUG_PLUGIN_ERRORS, OAUTHDEBUG_UNSAFE_DOS_ENDPOINT, OAUTHDEBUG_UNSAFE_HTTP, OAUTHDEBUG_UNSAFE_MASK, OAUTHDEBUG_UNSAFE_TRACE, and strtok_r.

Referenced by issuer_from_well_known_uri(), and pg_start_oauthbearer().