Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
David Barchiesi
OpenLDAP
Commits
91ab49c3
Commit
91ab49c3
authored
9 years ago
by
Howard Chu
Browse files
Options
Downloads
Patches
Plain Diff
ITS
#8249
add option to return search entry
parent
cd514770
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/man/man5/slapd-null.5
+5
-0
5 additions, 0 deletions
doc/man/man5/slapd-null.5
servers/slapd/back-null/null.c
+74
-26
74 additions, 26 deletions
servers/slapd/back-null/null.c
with
79 additions
and
26 deletions
doc/man/man5/slapd-null.5
+
5
−
0
View file @
91ab49c3
...
...
@@ -41,6 +41,11 @@ manual page.
.B bind <on/off>
Allow binds as any DN in this backend's suffix, with any password.
The default is "off".
.TP
.B dosearch <on/off>
If enabled, a single entry will be returned on all search requests.
The entry's DN will be the same as the database suffix.
The default is "off".
.SH EXAMPLE
Here is a possible slapd.conf extract using the Null backend:
.LP
...
...
This diff is collapsed.
Click to expand it.
servers/slapd/back-null/null.c
+
74
−
26
View file @
91ab49c3
...
...
@@ -26,19 +26,24 @@
#include
"slap.h"
#include
"config.h"
struct
null_info
{
typedef
struct
null_info
{
int
ni_bind_allowed
;
int
ni_dosearch
;
ID
ni_nextid
;
};
static
ConfigDriver
null_cf_gen
;
Entry
*
ni_entry
;
}
null_info
;
static
ConfigTable
nullcfg
[]
=
{
{
"bind"
,
"true|FALSE"
,
1
,
2
,
0
,
ARG_ON_OFF
|
ARG_
MAGIC
,
null_cf_gen
,
{
"bind"
,
"true|FALSE"
,
1
,
2
,
0
,
ARG_ON_OFF
|
ARG_
OFFSET
,
(
void
*
)
offsetof
(
null_info
,
ni_bind_allowed
)
,
"( OLcfgDbAt:8.1 NAME 'olcDbBindAllowed' "
"DESC 'Allow binds to this database' "
"SYNTAX OMsBoolean SINGLE-VALUE )"
,
NULL
,
NULL
},
{
"dosearch"
,
"true|FALSE"
,
1
,
2
,
0
,
ARG_ON_OFF
|
ARG_OFFSET
,
(
void
*
)
offsetof
(
null_info
,
ni_dosearch
),
"( OLcfgDbAt:8.2 NAME 'olcDbDoSearch' "
"DESC 'Return an entry on searches' "
"SYNTAX OMsBoolean SINGLE-VALUE )"
,
NULL
,
NULL
},
{
NULL
,
NULL
,
0
,
0
,
0
,
ARG_IGNORED
,
NULL
,
NULL
,
NULL
,
NULL
}
};
...
...
@@ -48,12 +53,41 @@ static ConfigOCs nullocs[] = {
"NAME 'olcNullConfig' "
"DESC 'Null backend ocnfiguration' "
"SUP olcDatabaseConfig "
"MAY ( olcDbBindAllowed ) )"
,
"MAY ( olcDbBindAllowed
$ olcDbDoSearch
) )"
,
Cft_Database
,
nullcfg
},
{
NULL
,
0
,
NULL
}
};
static
int
null_back_db_open
(
BackendDB
*
be
,
ConfigReply
*
cr
)
{
struct
null_info
*
ni
=
(
struct
null_info
*
)
be
->
be_private
;
struct
berval
bv
[
2
];
AttributeDescription
*
ad
=
NULL
;
const
char
*
text
;
Entry
*
e
;
if
(
ni
->
ni_dosearch
)
{
e
=
entry_alloc
();
e
->
e_name
=
be
->
be_suffix
[
0
];
e
->
e_nname
=
be
->
be_nsuffix
[
0
];
dnRdn
(
&
e
->
e_nname
,
&
bv
[
0
]
);
bv
[
1
].
bv_val
=
strchr
(
bv
[
0
].
bv_val
,
'='
)
+
1
;
bv
[
1
].
bv_len
=
bv
[
0
].
bv_len
-
(
bv
[
1
].
bv_val
-
bv
[
0
].
bv_val
);
bv
[
0
].
bv_len
-=
bv
[
1
].
bv_len
+
1
;
slap_bv2ad
(
&
bv
[
0
],
&
ad
,
&
text
);
attr_merge_one
(
e
,
ad
,
&
bv
[
1
],
NULL
);
ber_str2bv
(
"extensibleObject"
,
0
,
0
,
&
bv
[
0
]);
attr_merge_one
(
e
,
slap_schema
.
si_ad_objectClass
,
&
bv
[
0
],
NULL
);
ni
->
ni_entry
=
e
;
}
return
0
;
}
/* LDAP operations */
static
int
...
...
@@ -245,6 +279,21 @@ null_back_false( Operation *op, SlapReply *rs )
return
null_back_respond
(
op
,
rs
,
LDAP_COMPARE_FALSE
);
}
static
int
null_back_search
(
Operation
*
op
,
SlapReply
*
rs
)
{
struct
null_info
*
ni
=
(
struct
null_info
*
)
op
->
o_bd
->
be_private
;
if
(
ni
->
ni_entry
)
{
rs
->
sr_entry
=
ni
->
ni_entry
;
rs
->
sr_flags
=
0
;
rs
->
sr_attrs
=
op
->
ors_attrs
;
rs
->
sr_operational_attrs
=
NULL
;
send_search_entry
(
op
,
rs
);
}
return
null_back_respond
(
op
,
rs
,
LDAP_SUCCESS
);
}
/* for overlays */
static
int
...
...
@@ -260,6 +309,15 @@ null_back_entry_get(
return
oc
||
at
?
LDAP_NO_SUCH_ATTRIBUTE
:
LDAP_BUSY
;
}
static
int
null_back_entry_release
(
Operation
*
op
,
Entry
*
e
,
int
rw
)
{
/* we reuse our entry, don't free it */
return
0
;
}
/* Slap tools */
...
...
@@ -310,23 +368,6 @@ null_tool_entry_put( BackendDB *be, Entry *e, struct berval *text )
/* Setup */
static
int
null_cf_gen
(
ConfigArgs
*
c
)
{
struct
null_info
*
ni
=
(
struct
null_info
*
)
c
->
be
->
be_private
;
if
(
c
->
op
==
SLAP_CONFIG_EMIT
)
{
c
->
value_int
=
ni
->
ni_bind_allowed
;
return
LDAP_SUCCESS
;
}
else
if
(
c
->
op
==
LDAP_MOD_DELETE
)
{
ni
->
ni_bind_allowed
=
0
;
return
LDAP_SUCCESS
;
}
ni
->
ni_bind_allowed
=
c
->
value_int
;
return
LDAP_SUCCESS
;
}
static
int
null_back_db_init
(
BackendDB
*
be
,
ConfigReply
*
cr
)
{
...
...
@@ -341,6 +382,12 @@ null_back_db_init( BackendDB *be, ConfigReply *cr )
static
int
null_back_db_destroy
(
Backend
*
be
,
ConfigReply
*
cr
)
{
struct
null_info
*
ni
=
be
->
be_private
;
if
(
ni
->
ni_entry
)
{
entry_free
(
ni
->
ni_entry
);
ni
->
ni_entry
=
NULL
;
}
free
(
be
->
be_private
);
return
0
;
}
...
...
@@ -379,13 +426,13 @@ null_back_initialize( BackendInfo *bi )
bi
->
bi_db_init
=
null_back_db_init
;
bi
->
bi_db_config
=
config_generic_wrapper
;
bi
->
bi_db_open
=
0
;
bi
->
bi_db_open
=
null_back_db_open
;
bi
->
bi_db_close
=
0
;
bi
->
bi_db_destroy
=
null_back_db_destroy
;
bi
->
bi_op_bind
=
null_back_bind
;
bi
->
bi_op_unbind
=
0
;
bi
->
bi_op_search
=
null_back_s
uccess
;
bi
->
bi_op_search
=
null_back_s
earch
;
bi
->
bi_op_compare
=
null_back_false
;
bi
->
bi_op_modify
=
null_back_success
;
bi
->
bi_op_modrdn
=
null_back_success
;
...
...
@@ -401,6 +448,7 @@ null_back_initialize( BackendInfo *bi )
bi
->
bi_connection_destroy
=
0
;
bi
->
bi_entry_get_rw
=
null_back_entry_get
;
bi
->
bi_entry_release_rw
=
null_back_entry_release
;
bi
->
bi_tool_entry_open
=
null_tool_entry_open
;
bi
->
bi_tool_entry_close
=
null_tool_entry_close
;
...
...
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