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
Jaak Ristioja
OpenLDAP
Commits
4f77f04a
Commit
4f77f04a
authored
21 years ago
by
Luke Howard
Browse files
Options
Downloads
Patches
Plain Diff
Don't use thread local malloc for search filter if SLAPI is enabled;
breaks API compat
parent
0e46e4a7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
servers/slapd/search.c
+26
-23
26 additions, 23 deletions
servers/slapd/search.c
with
26 additions
and
23 deletions
servers/slapd/search.c
+
26
−
23
View file @
4f77f04a
...
...
@@ -45,6 +45,7 @@ do_search(
int
manageDSAit
;
#ifdef LDAP_SLAPI
char
**
attrs
=
NULL
;
Operation
ch_op
;
#endif
#ifdef NEW_LOGGING
...
...
@@ -135,7 +136,20 @@ do_search(
#endif
/* filter - returns a "normalized" version */
#ifdef LDAP_SLAPI
/*
* SLAPI computed search rewriter plugins can reset the search
* filter, and because they have no way to specify the use of
* the thread-local malloc replacement, we must always use
* ch_malloc() to allocate the filter when SLAPI is enabled.
*/
ch_op
=
*
op
;
/* struct copy */
ch_op
.
o_tmpmemctx
=
NULL
;
ch_op
.
o_tmpmfuncs
=
&
ch_mfuncs
;
rs
->
sr_err
=
get_filter
(
&
ch_op
,
op
->
o_ber
,
&
op
->
ors_filter
,
&
rs
->
sr_text
);
#else
rs
->
sr_err
=
get_filter
(
op
,
op
->
o_ber
,
&
op
->
ors_filter
,
&
rs
->
sr_text
);
#endif
/* LDAP_SLAPI */
if
(
rs
->
sr_err
!=
LDAP_SUCCESS
)
{
if
(
rs
->
sr_err
==
SLAPD_DISCONNECT
)
{
rs
->
sr_err
=
LDAP_PROTOCOL_ERROR
;
...
...
@@ -396,7 +410,11 @@ return_results:;
if
(
op
->
o_req_ndn
.
bv_val
!=
NULL
)
sl_free
(
op
->
o_req_ndn
.
bv_val
,
op
->
o_tmpmemctx
);
if
(
op
->
ors_filterstr
.
bv_val
!=
NULL
)
op
->
o_tmpfree
(
op
->
ors_filterstr
.
bv_val
,
op
->
o_tmpmemctx
);
#ifdef LDAP_SLAPI
if
(
op
->
ors_filter
!=
NULL
)
filter_free
(
op
->
ors_filter
);
#else
if
(
op
->
ors_filter
!=
NULL
)
filter_free_x
(
op
,
op
->
ors_filter
);
#endif
if
(
op
->
ors_attrs
!=
NULL
)
op
->
o_tmpfree
(
op
->
ors_attrs
,
op
->
o_tmpmemctx
);
#ifdef LDAP_SLAPI
if
(
attrs
!=
NULL
)
op
->
o_tmpfree
(
attrs
,
op
->
o_tmpmemctx
);
...
...
@@ -472,36 +490,21 @@ static int doPreSearchPluginFNs( Operation *op )
static
int
doSearchRewriteFNs
(
Operation
*
op
)
{
if
(
doPluginFNs
(
op
->
o_bd
,
SLAPI_PLUGIN_COMPUTE_SEARCH_REWRITER_FN
,
op
->
o_pb
)
==
0
)
{
Filter
*
f
;
/*
* The plugin can set the SLAPI_SEARCH_FILTER.
* SLAPI_SEARCH_STRFILER is not normative.
*/
slapi_pblock_get
(
op
->
o_pb
,
SLAPI_SEARCH_FILTER
,
(
void
*
)
&
f
);
if
(
f
!=
op
->
ors_filter
)
{
/* Plugin modified filter. Is pointer comparison safe? */
/*
* This is inefficient but it is not possible to expose the
* new memory allocation API through SLAPI.
*
* Further, the plugin should be responsible for freeing
* the original filter, but there is no way to communicate
* the memory context through the SLAPI filter free API.
*/
op
->
o_tmpfree
(
op
->
ors_filterstr
.
bv_val
,
op
->
o_tmpmemctx
);
filter2bv_x
(
op
,
f
,
&
op
->
ors_filterstr
);
filter_free_x
(
op
,
op
->
ors_filter
);
op
->
ors_filter
=
str2filter_x
(
op
,
op
->
ors_filterstr
.
bv_val
);
slapi_pblock_get
(
op
->
o_pb
,
SLAPI_SEARCH_FILTER
,
(
void
*
)
&
op
->
ors_filter
);
op
->
o_tmpfree
(
op
->
ors_filterstr
.
bv_val
,
op
->
o_tmpmemctx
);
filter2bv_x
(
op
,
op
->
ors_filter
,
&
op
->
ors_filterstr
);
#ifdef NEW_LOGGING
LDAP_LOG
(
OPERATION
,
ARGS
,
"doSearchRewriteFNs: after compute_rewrite_search filter: %s
\n
"
,
op
->
ors_filterstr
.
bv_len
?
op
->
ors_filterstr
.
bv_val
:
"empty"
,
0
,
0
);
LDAP_LOG
(
OPERATION
,
ARGS
,
"doSearchRewriteFNs: after compute_rewrite_search filter: %s
\n
"
,
op
->
ors_filterstr
.
bv_len
?
op
->
ors_filterstr
.
bv_val
:
"empty"
,
0
,
0
);
#else
Debug
(
LDAP_DEBUG_ARGS
,
" after compute_rewrite_search filter: %s
\n
"
,
op
->
ors_filterstr
.
bv_len
?
op
->
ors_filterstr
.
bv_val
:
"empty"
,
0
,
0
);
Debug
(
LDAP_DEBUG_ARGS
,
" after compute_rewrite_search filter: %s
\n
"
,
op
->
ors_filterstr
.
bv_len
?
op
->
ors_filterstr
.
bv_val
:
"empty"
,
0
,
0
);
#endif
}
}
return
LDAP_SUCCESS
;
...
...
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