Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christopher Ng
OpenLDAP
Commits
7ed90904
Commit
7ed90904
authored
18 years ago
by
Pierangelo Masarati
Browse files
Options
Downloads
Patches
Plain Diff
document the LDAP builtin map in librewrite (ITS#4602)
parent
0ccdccd0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/man/man5/slapo-rwm.5
+45
-0
45 additions, 0 deletions
doc/man/man5/slapo-rwm.5
libraries/librewrite/ldapmap.c
+21
-7
21 additions, 7 deletions
libraries/librewrite/ldapmap.c
with
66 additions
and
7 deletions
doc/man/man5/slapo-rwm.5
+
45
−
0
View file @
7ed90904
...
...
@@ -393,6 +393,51 @@ The count applies to the rewriting operation as a whole, not
to any single rule; an optional per-rule limit can be set.
This limit is overridden by setting specific per-rule limits
with the `M{n}' flag.
.SH "MAPS"
Currently, few maps are builtin and there are no provisions for developers
to register new map types at runtime.
Supported maps are:
.TP
.B LDAP <URI> [bindwhen=<when>] [version=<version>] [binddn=<DN>] [credentials=<cred>]
The
.B LDAP
map expands a value by performing a simple LDAP search.
Its configuration is based on a mandatory URI, whose
.B attrs
portion must contain exactly one attribute
(use
.B entryDN
to fetch the DN of an entry).
If a multi-valued attribute is used, only the first value is considered.
The parameter
.B bindwhen
determines when the connection is established.
It can take the values
.BR now ,
.BR later ,
and
.BR everytime ,
respectively indicating that the connection should be created at startup,
when required, or any time it is used.
In the former two cases, the connection is cached, while in the latter
a fresh new one is used all times. This is the default.
The parameters
.B binddn
and
.B credentials
represent the DN and the password that is used to perform an authenticated
simple bind before performing the search operation; if not given,
an anonymous connection is used.
The parameter
.B version
can be 2 or 3 to indicate the protocol version that must be used.
The default is 3.
.SH "REWRITE CONFIGURATION EXAMPLES"
.nf
# set to `off' to disable rewriting
...
...
This diff is collapsed.
Click to expand it.
libraries/librewrite/ldapmap.c
+
21
−
7
View file @
7ed90904
...
...
@@ -23,6 +23,13 @@
#include
"rewrite-int.h"
#include
"rewrite-map.h"
typedef
enum
{
MAP_LDAP_UNKNOWN
,
MAP_LDAP_EVERYTIME
,
MAP_LDAP_NOW
,
MAP_LDAP_LATER
}
bindwhen_t
;
/*
* LDAP map data structure
*/
...
...
@@ -33,10 +40,7 @@ struct ldap_map_data {
char
*
lm_binddn
;
struct
berval
lm_cred
;
#define MAP_LDAP_EVERYTIME 0x00
#define MAP_LDAP_NOW 0x01
#define MAP_LDAP_LATER 0x02
int
lm_when
;
bindwhen_t
lm_when
;
LDAP
*
lm_ld
;
...
...
@@ -91,7 +95,7 @@ map_ldap_parse(
)
{
struct
ldap_map_data
*
data
;
char
*
p
;
char
*
p
,
*
uri
;
assert
(
info
!=
NULL
);
assert
(
fname
!=
NULL
);
...
...
@@ -110,13 +114,18 @@ map_ldap_parse(
return
NULL
;
}
data
->
lm_url
=
strdup
(
argv
[
0
]
);
uri
=
argv
[
0
];
if
(
strncasecmp
(
uri
,
"uri="
,
STRLENOF
(
"uri="
)
)
==
0
)
{
uri
+=
STRLENOF
(
"uri="
);
}
data
->
lm_url
=
strdup
(
uri
);
if
(
data
->
lm_url
==
NULL
)
{
map_ldap_free
(
data
);
return
NULL
;
}
if
(
ldap_url_parse
(
argv
[
0
]
,
&
data
->
lm_lud
)
!=
REWRITE_SUCCESS
)
{
if
(
ldap_url_parse
(
uri
,
&
data
->
lm_lud
)
!=
REWRITE_SUCCESS
)
{
Debug
(
LDAP_DEBUG_ANY
,
"[%s:%d] illegal URI '%s'
\n
"
,
fname
,
lineno
,
argv
[
0
]
);
...
...
@@ -124,6 +133,7 @@ map_ldap_parse(
return
NULL
;
}
/* trim everything after [host][:port] */
p
=
strchr
(
data
->
lm_url
,
'/'
);
assert
(
p
[
1
]
==
'/'
);
if
(
(
p
=
strchr
(
p
+
2
,
'/'
)
)
!=
NULL
)
{
...
...
@@ -268,6 +278,10 @@ map_ldap_parse(
}
}
if
(
data
->
lm_when
==
MAP_LDAP_UNKNOWN
)
{
data
->
lm_when
=
MAP_LDAP_EVERYTIME
;
}
return
(
void
*
)
data
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment