PostgreSQL Source Code
git master
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
c
d
g
h
i
k
l
m
p
r
s
t
Functions
Variables
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
Data Fields
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
c
d
f
h
i
n
o
p
r
s
t
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
magic_validator.c
Go to the documentation of this file.
1
/*-------------------------------------------------------------------------
2
*
3
* magic_validator.c
4
* Test module for serverside OAuth token validation callbacks, which
5
* should fail due to using the wrong PG_OAUTH_VALIDATOR_MAGIC marker
6
* and thus the wrong ABI version
7
*
8
* Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
9
* Portions Copyright (c) 1994, Regents of the University of California
10
*
11
* src/test/modules/oauth_validator/magic_validator.c
12
*
13
*-------------------------------------------------------------------------
14
*/
15
16
#include "
postgres.h
"
17
18
#include "
fmgr.h
"
19
#include "
libpq/oauth.h
"
20
21
PG_MODULE_MAGIC
;
22
23
static
bool
validate_token
(
const
ValidatorModuleState
*
state
,
24
const
char
*
token
,
25
const
char
*role,
26
ValidatorModuleResult
*result);
27
28
/* Callback implementations (we only need the main one) */
29
static
const
OAuthValidatorCallbacks
validator_callbacks
= {
30
0xdeadbeef,
31
32
.
validate_cb
=
validate_token
,
33
};
34
35
const
OAuthValidatorCallbacks
*
36
_PG_oauth_validator_module_init
(
void
)
37
{
38
return
&
validator_callbacks
;
39
}
40
41
static
bool
42
validate_token
(
const
ValidatorModuleState
*
state
,
43
const
char
*
token
,
const
char
*role,
44
ValidatorModuleResult
*res)
45
{
46
elog
(
FATAL
,
"magic_validator: this should be unreachable"
);
47
pg_unreachable
();
48
}
pg_unreachable
#define pg_unreachable()
Definition:
c.h:332
FATAL
#define FATAL
Definition:
elog.h:41
elog
#define elog(elevel,...)
Definition:
elog.h:225
fmgr.h
_PG_oauth_validator_module_init
const OAuthValidatorCallbacks * _PG_oauth_validator_module_init(void)
Definition:
magic_validator.c:36
PG_MODULE_MAGIC
PG_MODULE_MAGIC
Definition:
magic_validator.c:21
validate_token
static bool validate_token(const ValidatorModuleState *state, const char *token, const char *role, ValidatorModuleResult *result)
Definition:
magic_validator.c:42
validator_callbacks
static const OAuthValidatorCallbacks validator_callbacks
Definition:
magic_validator.c:29
oauth.h
postgres.h
OAuthValidatorCallbacks
Definition:
oauth.h:77
OAuthValidatorCallbacks::validate_cb
ValidatorValidateCB validate_cb
Definition:
oauth.h:82
ValidatorModuleResult
Definition:
oauth.h:35
ValidatorModuleState
Definition:
oauth.h:22
state
Definition:
regguts.h:323
token
Definition:
fe-auth-oauth-curl.c:142
src
test
modules
oauth_validator
magic_validator.c
Generated on Sun Mar 16 2025 00:13:26 for PostgreSQL Source Code by
1.9.4