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
ldap_password_func.c
Go to the documentation of this file.
1
/*-------------------------------------------------------------------------
2
*
3
* Copyright (c) 2022-2025, PostgreSQL Global Development Group
4
*
5
* ldap_password_func.c
6
*
7
* Loadable PostgreSQL module to mutate the ldapbindpasswd. This
8
* implementation just hands back the configured password rot13'd.
9
*
10
*-------------------------------------------------------------------------
11
*/
12
13
#include "
postgres.h
"
14
15
#include <
float.h
>
16
#include <stdio.h>
17
18
#include "
fmgr.h
"
19
#include "
libpq/auth.h
"
20
21
PG_MODULE_MAGIC
;
22
23
void
_PG_init
(
void
);
24
25
/* hook function */
26
static
char
*
rot13_passphrase
(
char
*
password
);
27
28
/*
29
* Module load callback
30
*/
31
void
32
_PG_init
(
void
)
33
{
34
ldap_password_hook
=
rot13_passphrase
;
35
}
36
37
static
char
*
38
rot13_passphrase
(
char
*pw)
39
{
40
size_t
size = strlen(pw) + 1;
41
42
char
*new_pw = (
char
*)
palloc
(size);
43
44
strlcpy
(new_pw, pw, size);
45
for
(
char
*p = new_pw; *p; p++)
46
{
47
char
c
= *p;
48
49
if
((
c
>=
'a'
&&
c
<=
'm'
) || (
c
>=
'A'
&&
c
<=
'M'
))
50
*p =
c
+ 13;
51
else
if
((
c
>=
'n'
&&
c
<=
'z'
) || (
c
>=
'N'
&&
c
<=
'Z'
))
52
*p =
c
- 13;
53
}
54
55
return
new_pw;
56
}
auth.h
ldap_password_hook
PGDLLIMPORT auth_password_hook_typ ldap_password_hook
float.h
fmgr.h
rot13_passphrase
static char * rot13_passphrase(char *password)
Definition:
ldap_password_func.c:38
_PG_init
void _PG_init(void)
Definition:
ldap_password_func.c:32
PG_MODULE_MAGIC
PG_MODULE_MAGIC
Definition:
ldap_password_func.c:21
palloc
void * palloc(Size size)
Definition:
mcxt.c:1945
strlcpy
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition:
strlcpy.c:45
postgres.h
c
char * c
Definition:
preproc-cursor.c:31
password
static char * password
Definition:
streamutil.c:51
src
test
modules
ldap_password_func
ldap_password_func.c
Generated on Fri May 9 2025 12:13:30 for PostgreSQL Source Code by
1.9.4