Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
openldap
OpenLDAP
Commits
ece7452b
Commit
ece7452b
authored
Apr 11, 2003
by
Howard Chu
Browse files
More memory context tweaks
parent
1874658a
Changes
66
Hide whitespace changes
Inline
Side-by-side
servers/slapd/acl.c
View file @
ece7452b
...
...
@@ -670,7 +670,7 @@ acl_mask(
string_expand
(
&
bv
,
&
b
->
a_dn_pat
,
e
->
e_ndn
,
matches
);
if
(
dnNormalize2
(
NULL
,
&
bv
,
&
pat
)
!=
LDAP_SUCCESS
)
{
if
(
dnNormalize2
(
NULL
,
&
bv
,
&
pat
,
op
->
o_tmpmemctx
)
!=
LDAP_SUCCESS
)
{
/* did not expand to a valid dn */
continue
;
}
...
...
@@ -903,7 +903,7 @@ dn_match_cleanup:;
SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH
|
SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH
,
at
->
a_nvals
,
&
bv
)
==
0
)
&
bv
,
op
->
o_tmpmemctx
)
==
0
)
{
/* found it */
match
=
1
;
...
...
@@ -975,7 +975,7 @@ dn_match_cleanup:;
bv
.
bv_val
=
buf
;
string_expand
(
&
bv
,
&
b
->
a_group_pat
,
e
->
e_ndn
,
matches
);
if
(
dnNormalize2
(
NULL
,
&
bv
,
&
ndn
)
!=
LDAP_SUCCESS
)
{
if
(
dnNormalize2
(
NULL
,
&
bv
,
&
ndn
,
op
->
o_tmpmemctx
)
!=
LDAP_SUCCESS
)
{
/* did not expand to a valid dn */
continue
;
}
...
...
@@ -1435,7 +1435,7 @@ aci_set_gather (void *cookie, struct berval *name, struct berval *attr)
* also return the syntax or some "comparison cookie".
*/
if
(
dnNormalize2
(
NULL
,
name
,
&
ndn
)
==
LDAP_SUCCESS
)
{
if
(
dnNormalize2
(
NULL
,
name
,
&
ndn
,
cp
->
op
->
o_tmpmemctx
)
==
LDAP_SUCCESS
)
{
const
char
*
text
;
AttributeDescription
*
desc
=
NULL
;
if
(
slap_bv2ad
(
attr
,
&
desc
,
&
text
)
==
LDAP_SUCCESS
)
{
...
...
@@ -1483,7 +1483,7 @@ aci_match_set (
* NOTE: dnNormalize2 honors the ber_len field
* as the length of the dn to be normalized
*/
if
(
dnNormalize2
(
NULL
,
&
subjdn
,
&
ndn
)
==
LDAP_SUCCESS
if
(
dnNormalize2
(
NULL
,
&
subjdn
,
&
ndn
,
op
->
o_tmpmemctx
)
==
LDAP_SUCCESS
&&
slap_bv2ad
(
&
setat
,
&
desc
,
&
text
)
==
LDAP_SUCCESS
)
{
backend_attribute
(
op
,
e
,
...
...
servers/slapd/aclparse.c
View file @
ece7452b
...
...
@@ -239,7 +239,7 @@ parse_acl(
{
if
(
a
->
acl_dn_style
!=
ACL_STYLE_REGEX
)
{
struct
berval
bv
;
rc
=
dnNormalize2
(
NULL
,
&
a
->
acl_dn_pat
,
&
bv
);
rc
=
dnNormalize2
(
NULL
,
&
a
->
acl_dn_pat
,
&
bv
,
NULL
);
if
(
rc
!=
LDAP_SUCCESS
)
{
fprintf
(
stderr
,
"%s: line %d: bad DN
\"
%s
\"\n
"
,
...
...
@@ -410,7 +410,7 @@ parse_acl(
}
if
(
sty
!=
ACL_STYLE_REGEX
&&
expand
==
0
)
{
rc
=
dnNormalize2
(
NULL
,
&
bv
,
&
b
->
a_dn_pat
);
rc
=
dnNormalize2
(
NULL
,
&
bv
,
&
b
->
a_dn_pat
,
NULL
);
if
(
rc
!=
LDAP_SUCCESS
)
{
fprintf
(
stderr
,
"%s: line %d: bad DN
\"
%s
\"\n
"
,
...
...
@@ -520,7 +520,7 @@ parse_acl(
b
->
a_group_pat
=
bv
;
}
else
{
ber_str2bv
(
right
,
0
,
0
,
&
bv
);
rc
=
dnNormalize2
(
NULL
,
&
bv
,
&
b
->
a_group_pat
);
rc
=
dnNormalize2
(
NULL
,
&
bv
,
&
b
->
a_group_pat
,
NULL
);
if
(
rc
!=
LDAP_SUCCESS
)
{
fprintf
(
stderr
,
"%s: line %d: bad DN
\"
%s
\"\n
"
,
...
...
servers/slapd/add.c
View file @
ece7452b
...
...
@@ -78,7 +78,7 @@ do_add( Operation *op, SlapReply *rs )
e
=
(
Entry
*
)
ch_calloc
(
1
,
sizeof
(
Entry
)
);
rs
->
sr_err
=
dnPrettyNormal
(
NULL
,
&
dn
,
&
e
->
e_name
,
&
e
->
e_nname
);
rs
->
sr_err
=
dnPrettyNormal
(
NULL
,
&
dn
,
&
e
->
e_name
,
&
e
->
e_nname
,
op
->
o_tmpmemctx
);
if
(
rs
->
sr_err
!=
LDAP_SUCCESS
)
{
#ifdef NEW_LOGGING
...
...
@@ -242,7 +242,7 @@ do_add( Operation *op, SlapReply *rs )
size_t
textlen
=
sizeof
textbuf
;
rs
->
sr_err
=
slap_mods_check
(
modlist
,
update
,
&
rs
->
sr_text
,
textbuf
,
textlen
);
textbuf
,
textlen
,
op
->
o_tmpmemctx
);
if
(
rs
->
sr_err
!=
LDAP_SUCCESS
)
{
send_ldap_result
(
op
,
rs
);
...
...
servers/slapd/attr.c
View file @
ece7452b
...
...
@@ -156,7 +156,8 @@ int
attr_merge_normalize
(
Entry
*
e
,
AttributeDescription
*
desc
,
BerVarray
vals
BerVarray
vals
,
void
*
memctx
)
{
BerVarray
nvals
=
NULL
;
int
rc
;
...
...
@@ -172,7 +173,7 @@ attr_merge_normalize(
0
,
desc
->
ad_type
->
sat_syntax
,
desc
->
ad_type
->
sat_equality
,
&
vals
[
i
],
&
nvals
[
i
]
);
&
vals
[
i
],
&
nvals
[
i
]
,
memctx
);
if
(
rc
!=
LDAP_SUCCESS
)
{
nvals
[
i
+
1
].
bv_val
=
NULL
;
...
...
@@ -225,7 +226,8 @@ int
attr_merge_normalize_one
(
Entry
*
e
,
AttributeDescription
*
desc
,
struct
berval
*
val
struct
berval
*
val
,
void
*
memctx
)
{
struct
berval
nval
;
int
rc
;
...
...
@@ -235,7 +237,7 @@ attr_merge_normalize_one(
0
,
desc
->
ad_type
->
sat_syntax
,
desc
->
ad_type
->
sat_equality
,
val
,
&
nval
);
val
,
&
nval
,
memctx
);
if
(
rc
!=
LDAP_SUCCESS
)
{
return
rc
;
...
...
servers/slapd/ava.c
View file @
ece7452b
...
...
@@ -22,8 +22,7 @@ ava_free(
int
freeit
)
{
/* op->o_tmpfree( ava->aa_value.bv_val, op->o_tmpmemctx ); */
ch_free
(
ava
->
aa_value
.
bv_val
);
op
->
o_tmpfree
(
ava
->
aa_value
.
bv_val
,
op
->
o_tmpmemctx
);
if
(
freeit
)
{
op
->
o_tmpfree
(
(
char
*
)
ava
,
op
->
o_tmpmemctx
);
}
...
...
@@ -68,7 +67,7 @@ get_ava(
rc
=
asserted_value_validate_normalize
(
aa
->
aa_desc
,
ad_mr
(
aa
->
aa_desc
,
usage
),
usage
,
&
value
,
&
aa
->
aa_value
,
text
);
usage
,
&
value
,
&
aa
->
aa_value
,
text
,
op
->
o_tmpmemctx
);
if
(
rc
!=
LDAP_SUCCESS
)
{
op
->
o_tmpfree
(
aa
,
op
->
o_tmpmemctx
);
...
...
servers/slapd/back-bdb/add.c
View file @
ece7452b
...
...
@@ -415,7 +415,7 @@ retry: /* transaction retry */
}
/* attribute indexes */
rs
->
sr_err
=
bdb_index_entry_add
(
op
->
o_bd
,
ltid
,
op
->
oq_add
.
rs_e
);
rs
->
sr_err
=
bdb_index_entry_add
(
op
,
ltid
,
op
->
oq_add
.
rs_e
);
if
(
rs
->
sr_err
!=
LDAP_SUCCESS
)
{
#ifdef NEW_LOGGING
LDAP_LOG
(
OPERATION
,
ERR
,
...
...
servers/slapd/back-bdb/compare.c
View file @
ece7452b
...
...
@@ -119,7 +119,7 @@ dn2entry_retry:
if
(
value_find_ex
(
op
->
oq_compare
.
rs_ava
->
aa_desc
,
SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH
|
SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH
,
a
->
a_nvals
,
&
op
->
oq_compare
.
rs_ava
->
aa_value
)
==
0
)
a
->
a_nvals
,
&
op
->
oq_compare
.
rs_ava
->
aa_value
,
op
->
o_tmpmemctx
)
==
0
)
{
rs
->
sr_err
=
LDAP_COMPARE_TRUE
;
break
;
...
...
servers/slapd/back-bdb/delete.c
View file @
ece7452b
...
...
@@ -388,7 +388,7 @@ retry: /* transaction retry */
}
/* delete indices for old attributes */
rs
->
sr_err
=
bdb_index_entry_del
(
op
->
o_bd
,
ltid
,
e
);
rs
->
sr_err
=
bdb_index_entry_del
(
op
,
ltid
,
e
);
if
(
rs
->
sr_err
!=
LDAP_SUCCESS
)
{
switch
(
rs
->
sr_err
)
{
case
DB_LOCK_DEADLOCK
:
...
...
servers/slapd/back-bdb/filterindex.c
View file @
ece7452b
...
...
@@ -14,28 +14,28 @@
#include
"idl.h"
static
int
presence_candidates
(
Backend
*
be
,
Operation
*
op
,
AttributeDescription
*
desc
,
ID
*
ids
);
static
int
equality_candidates
(
Backend
*
be
,
Operation
*
op
,
AttributeAssertion
*
ava
,
ID
*
ids
,
ID
*
tmp
);
static
int
approx_candidates
(
Backend
*
be
,
Operation
*
op
,
AttributeAssertion
*
ava
,
ID
*
ids
,
ID
*
tmp
);
static
int
substring_candidates
(
Backend
*
be
,
Operation
*
op
,
SubstringsAssertion
*
sub
,
ID
*
ids
,
ID
*
tmp
);
static
int
list_candidates
(
Backend
*
be
,
Operation
*
op
,
Filter
*
flist
,
int
ftype
,
ID
*
ids
,
...
...
@@ -44,7 +44,7 @@ static int list_candidates(
int
bdb_filter_candidates
(
Backend
*
be
,
Operation
*
op
,
Filter
*
f
,
ID
*
ids
,
ID
*
tmp
,
...
...
@@ -64,7 +64,7 @@ bdb_filter_candidates(
#else
Debug
(
LDAP_DEBUG_FILTER
,
"
\t
DN ONE
\n
"
,
0
,
0
,
0
);
#endif
rc
=
bdb_dn2idl
(
be
,
f
->
f_dn
,
DN_ONE_PREFIX
,
ids
);
rc
=
bdb_dn2idl
(
op
->
o_bd
,
f
->
f_dn
,
DN_ONE_PREFIX
,
ids
);
if
(
rc
==
DB_NOTFOUND
)
{
BDB_IDL_ZERO
(
ids
);
rc
=
0
;
...
...
@@ -77,7 +77,7 @@ bdb_filter_candidates(
#else
Debug
(
LDAP_DEBUG_FILTER
,
"
\t
DN SUBTREE
\n
"
,
0
,
0
,
0
);
#endif
rc
=
bdb_dn2idl
(
be
,
f
->
f_dn
,
DN_SUBTREE_PREFIX
,
ids
);
rc
=
bdb_dn2idl
(
op
->
o_bd
,
f
->
f_dn
,
DN_SUBTREE_PREFIX
,
ids
);
break
;
case
LDAP_FILTER_PRESENT
:
...
...
@@ -86,7 +86,7 @@ bdb_filter_candidates(
#else
Debug
(
LDAP_DEBUG_FILTER
,
"
\t
PRESENT
\n
"
,
0
,
0
,
0
);
#endif
rc
=
presence_candidates
(
be
,
f
->
f_desc
,
ids
);
rc
=
presence_candidates
(
op
,
f
->
f_desc
,
ids
);
break
;
case
LDAP_FILTER_EQUALITY
:
...
...
@@ -95,7 +95,7 @@ bdb_filter_candidates(
#else
Debug
(
LDAP_DEBUG_FILTER
,
"
\t
EQUALITY
\n
"
,
0
,
0
,
0
);
#endif
rc
=
equality_candidates
(
be
,
f
->
f_ava
,
ids
,
tmp
);
rc
=
equality_candidates
(
op
,
f
->
f_ava
,
ids
,
tmp
);
break
;
case
LDAP_FILTER_APPROX
:
...
...
@@ -104,7 +104,7 @@ bdb_filter_candidates(
#else
Debug
(
LDAP_DEBUG_FILTER
,
"
\t
APPROX
\n
"
,
0
,
0
,
0
);
#endif
rc
=
approx_candidates
(
be
,
f
->
f_ava
,
ids
,
tmp
);
rc
=
approx_candidates
(
op
,
f
->
f_ava
,
ids
,
tmp
);
break
;
case
LDAP_FILTER_SUBSTRINGS
:
...
...
@@ -113,7 +113,7 @@ bdb_filter_candidates(
#else
Debug
(
LDAP_DEBUG_FILTER
,
"
\t
SUBSTRINGS
\n
"
,
0
,
0
,
0
);
#endif
rc
=
substring_candidates
(
be
,
f
->
f_sub
,
ids
,
tmp
);
rc
=
substring_candidates
(
op
,
f
->
f_sub
,
ids
,
tmp
);
break
;
case
LDAP_FILTER_GE
:
...
...
@@ -123,7 +123,7 @@ bdb_filter_candidates(
#else
Debug
(
LDAP_DEBUG_FILTER
,
"
\t
GE
\n
"
,
0
,
0
,
0
);
#endif
rc
=
presence_candidates
(
be
,
f
->
f_ava
->
aa_desc
,
ids
);
rc
=
presence_candidates
(
op
,
f
->
f_ava
->
aa_desc
,
ids
);
break
;
case
LDAP_FILTER_LE
:
...
...
@@ -133,7 +133,7 @@ bdb_filter_candidates(
#else
Debug
(
LDAP_DEBUG_FILTER
,
"
\t
LE
\n
"
,
0
,
0
,
0
);
#endif
rc
=
presence_candidates
(
be
,
f
->
f_ava
->
aa_desc
,
ids
);
rc
=
presence_candidates
(
op
,
f
->
f_ava
->
aa_desc
,
ids
);
break
;
case
LDAP_FILTER_NOT
:
...
...
@@ -151,7 +151,7 @@ bdb_filter_candidates(
#else
Debug
(
LDAP_DEBUG_FILTER
,
"
\t
AND
\n
"
,
0
,
0
,
0
);
#endif
rc
=
list_candidates
(
be
,
rc
=
list_candidates
(
op
,
f
->
f_and
,
LDAP_FILTER_AND
,
ids
,
tmp
,
stack
);
break
;
...
...
@@ -161,7 +161,7 @@ bdb_filter_candidates(
#else
Debug
(
LDAP_DEBUG_FILTER
,
"
\t
OR
\n
"
,
0
,
0
,
0
);
#endif
rc
=
list_candidates
(
be
,
rc
=
list_candidates
(
op
,
f
->
f_or
,
LDAP_FILTER_OR
,
ids
,
tmp
,
stack
);
break
;
...
...
@@ -191,14 +191,14 @@ bdb_filter_candidates(
static
int
list_candidates
(
Backend
*
be
,
Operation
*
op
,
Filter
*
flist
,
int
ftype
,
ID
*
ids
,
ID
*
tmp
,
ID
*
save
)
{
struct
bdb_info
*
bdb
=
(
struct
bdb_info
*
)
be
->
be_private
;
struct
bdb_info
*
bdb
=
(
struct
bdb_info
*
)
op
->
o_bd
->
be_private
;
int
rc
=
0
;
Filter
*
f
;
...
...
@@ -216,7 +216,7 @@ list_candidates(
}
for
(
f
=
flist
;
f
!=
NULL
;
f
=
f
->
f_next
)
{
rc
=
bdb_filter_candidates
(
be
,
f
,
save
,
tmp
,
rc
=
bdb_filter_candidates
(
op
,
f
,
save
,
tmp
,
save
+
BDB_IDL_UM_SIZE
);
if
(
rc
!=
0
)
{
...
...
@@ -266,11 +266,11 @@ list_candidates(
static
int
presence_candidates
(
Backend
*
be
,
Operation
*
op
,
AttributeDescription
*
desc
,
ID
*
ids
)
{
struct
bdb_info
*
bdb
=
(
struct
bdb_info
*
)
be
->
be_private
;
struct
bdb_info
*
bdb
=
(
struct
bdb_info
*
)
op
->
o_bd
->
be_private
;
DB
*
db
;
int
rc
;
slap_mask_t
mask
;
...
...
@@ -289,7 +289,7 @@ presence_candidates(
return
0
;
}
rc
=
bdb_index_param
(
be
,
desc
,
LDAP_FILTER_PRESENT
,
rc
=
bdb_index_param
(
op
->
o_bd
,
desc
,
LDAP_FILTER_PRESENT
,
&
db
,
&
mask
,
&
prefix
);
if
(
rc
!=
LDAP_SUCCESS
)
{
...
...
@@ -334,7 +334,7 @@ presence_candidates(
return
0
;
}
rc
=
bdb_key_read
(
be
,
db
,
NULL
,
&
prefix
,
ids
);
rc
=
bdb_key_read
(
op
->
o_bd
,
db
,
NULL
,
&
prefix
,
ids
);
if
(
rc
==
DB_NOTFOUND
)
{
BDB_IDL_ZERO
(
ids
);
...
...
@@ -372,7 +372,7 @@ done:
static
int
equality_candidates
(
Backend
*
be
,
Operation
*
op
,
AttributeAssertion
*
ava
,
ID
*
ids
,
ID
*
tmp
)
...
...
@@ -393,7 +393,7 @@ equality_candidates(
ava
->
aa_desc
->
ad_cname
.
bv_val
,
0
,
0
);
#endif
rc
=
bdb_index_param
(
be
,
ava
->
aa_desc
,
LDAP_FILTER_EQUALITY
,
rc
=
bdb_index_param
(
op
->
o_bd
,
ava
->
aa_desc
,
LDAP_FILTER_EQUALITY
,
&
db
,
&
mask
,
&
prefix
);
if
(
rc
!=
LDAP_SUCCESS
)
{
...
...
@@ -440,7 +440,7 @@ equality_candidates(
mr
,
&
prefix
,
&
ava
->
aa_value
,
&
keys
);
&
keys
,
op
->
o_tmpmemctx
);
if
(
rc
!=
LDAP_SUCCESS
)
{
#ifdef NEW_LOGGING
...
...
@@ -471,7 +471,7 @@ equality_candidates(
}
for
(
i
=
0
;
keys
[
i
].
bv_val
!=
NULL
;
i
++
)
{
rc
=
bdb_key_read
(
be
,
db
,
NULL
,
&
keys
[
i
],
tmp
);
rc
=
bdb_key_read
(
op
->
o_bd
,
db
,
NULL
,
&
keys
[
i
],
tmp
);
if
(
rc
==
DB_NOTFOUND
)
{
BDB_IDL_ZERO
(
ids
);
...
...
@@ -511,7 +511,7 @@ equality_candidates(
break
;
}
ber_bvarray_free
(
keys
);
ber_bvarray_free
_x
(
keys
,
op
->
o_tmpmemctx
);
#ifdef NEW_LOGGING
LDAP_LOG
(
INDEX
,
RESULTS
,
...
...
@@ -531,7 +531,7 @@ equality_candidates(
static
int
approx_candidates
(
Backend
*
be
,
Operation
*
op
,
AttributeAssertion
*
ava
,
ID
*
ids
,
ID
*
tmp
)
...
...
@@ -552,7 +552,7 @@ approx_candidates(
ava
->
aa_desc
->
ad_cname
.
bv_val
,
0
,
0
);
#endif
rc
=
bdb_index_param
(
be
,
ava
->
aa_desc
,
LDAP_FILTER_APPROX
,
rc
=
bdb_index_param
(
op
->
o_bd
,
ava
->
aa_desc
,
LDAP_FILTER_APPROX
,
&
db
,
&
mask
,
&
prefix
);
if
(
rc
!=
LDAP_SUCCESS
)
{
...
...
@@ -604,7 +604,7 @@ approx_candidates(
mr
,
&
prefix
,
&
ava
->
aa_value
,
&
keys
);
&
keys
,
op
->
o_tmpmemctx
);
if
(
rc
!=
LDAP_SUCCESS
)
{
#ifdef NEW_LOGGING
...
...
@@ -635,7 +635,7 @@ approx_candidates(
}
for
(
i
=
0
;
keys
[
i
].
bv_val
!=
NULL
;
i
++
)
{
rc
=
bdb_key_read
(
be
,
db
,
NULL
,
&
keys
[
i
],
tmp
);
rc
=
bdb_key_read
(
op
->
o_bd
,
db
,
NULL
,
&
keys
[
i
],
tmp
);
if
(
rc
==
DB_NOTFOUND
)
{
BDB_IDL_ZERO
(
ids
);
...
...
@@ -676,7 +676,7 @@ approx_candidates(
break
;
}
ber_bvarray_free
(
keys
);
ber_bvarray_free
_x
(
keys
,
op
->
o_tmpmemctx
);
#ifdef NEW_LOGGING
LDAP_LOG
(
INDEX
,
RESULTS
,
...
...
@@ -694,7 +694,7 @@ approx_candidates(
static
int
substring_candidates
(
Backend
*
be
,
Operation
*
op
,
SubstringsAssertion
*
sub
,
ID
*
ids
,
ID
*
tmp
)
...
...
@@ -715,7 +715,7 @@ substring_candidates(
sub
->
sa_desc
->
ad_cname
.
bv_val
,
0
,
0
);
#endif
rc
=
bdb_index_param
(
be
,
sub
->
sa_desc
,
LDAP_FILTER_SUBSTRINGS
,
rc
=
bdb_index_param
(
op
->
o_bd
,
sub
->
sa_desc
,
LDAP_FILTER_SUBSTRINGS
,
&
db
,
&
mask
,
&
prefix
);
if
(
rc
!=
LDAP_SUCCESS
)
{
...
...
@@ -763,7 +763,7 @@ substring_candidates(
mr
,
&
prefix
,
sub
,
&
keys
);
&
keys
,
op
->
o_tmpmemctx
);
if
(
rc
!=
LDAP_SUCCESS
)
{
#ifdef NEW_LOGGING
...
...
@@ -794,7 +794,7 @@ substring_candidates(
}
for
(
i
=
0
;
keys
[
i
].
bv_val
!=
NULL
;
i
++
)
{
rc
=
bdb_key_read
(
be
,
db
,
NULL
,
&
keys
[
i
],
tmp
);
rc
=
bdb_key_read
(
op
->
o_bd
,
db
,
NULL
,
&
keys
[
i
],
tmp
);
if
(
rc
==
DB_NOTFOUND
)
{
BDB_IDL_ZERO
(
ids
);
...
...
@@ -835,7 +835,7 @@ substring_candidates(
break
;
}
ber_bvarray_free
(
keys
);
ber_bvarray_free
_x
(
keys
,
op
->
o_tmpmemctx
);
#ifdef NEW_LOGGING
LDAP_LOG
(
INDEX
,
RESULTS
,
...
...
servers/slapd/back-bdb/index.c
View file @
ece7452b
...
...
@@ -142,12 +142,12 @@ done:
}
static
int
indexer
(
Backend
*
be
,
Operation
*
op
,
DB_TXN
*
txn
,
struct
berval
*
atname
,
BerVarray
vals
,
ID
id
,
int
op
,
int
op
id
,
slap_mask_t
mask
)
{
int
rc
,
i
;
...
...
@@ -155,10 +155,11 @@ static int indexer(
DB
*
db
;
AttributeDescription
*
ad
=
NULL
;
struct
berval
*
keys
;
void
*
mark
;
assert
(
mask
);
rc
=
bdb_db_cache
(
be
,
txn
,
atname
->
bv_val
,
&
db
);
rc
=
bdb_db_cache
(
op
->
o_bd
,
txn
,
atname
->
bv_val
,
&
db
);
if
(
rc
!=
LDAP_SUCCESS
)
{
#ifdef NEW_LOGGING
...
...
@@ -176,8 +177,10 @@ static int indexer(
rc
=
slap_bv2ad
(
atname
,
&
ad
,
&
text
);
if
(
rc
!=
LDAP_SUCCESS
)
return
rc
;
mark
=
sl_mark
(
op
->
o_tmpmemctx
);
if
(
IS_SLAP_INDEX
(
mask
,
SLAP_INDEX_PRESENT
)
)
{
rc
=
bdb_key_change
(
be
,
db
,
txn
,
&
presence_key
,
id
,
op
);
rc
=
bdb_key_change
(
op
->
o_bd
,
db
,
txn
,
&
presence_key
,
id
,
op
id
);
if
(
rc
)
{
goto
done
;
}
...
...
@@ -189,17 +192,17 @@ static int indexer(
mask
,
ad
->
ad_type
->
sat_syntax
,
ad
->
ad_type
->
sat_equality
,
atname
,
vals
,
&
keys
);
atname
,
vals
,
&
keys
,
op
->
o_tmpmemctx
);
if
(
rc
==
LDAP_SUCCESS
&&
keys
!=
NULL
)
{
for
(
i
=
0
;
keys
[
i
].
bv_val
!=
NULL
;
i
++
)
{
rc
=
bdb_key_change
(
be
,
db
,
txn
,
&
keys
[
i
],
id
,
op
);
rc
=
bdb_key_change
(
op
->
o_bd
,
db
,
txn
,
&
keys
[
i
],
id
,
op
id
);
if
(
rc
)
{
ber_bvarray_free
(
keys
);
goto
done
;
}
}
ber_bvarray_free
(
keys
);
ber_bvarray_free
_x
(
keys
,
op
->
o_tmpmemctx
);
}
rc
=
LDAP_SUCCESS
;
}
...
...
@@ -210,17 +213,17 @@ static int indexer(
mask
,
ad
->
ad_type
->
sat_syntax
,
ad
->
ad_type
->
sat_approx
,
atname
,
vals
,
&
keys
);
atname
,
vals
,
&
keys
,
op
->
o_tmpmemctx
);
if
(
rc
==
LDAP_SUCCESS
&&
keys
!=
NULL
)
{
for
(
i
=
0
;
keys
[
i
].
bv_val
!=
NULL
;
i
++
)
{
rc
=
bdb_key_change
(
be
,
db
,
txn
,
&
keys
[
i
],
id
,
op
);
rc
=
bdb_key_change
(
op
->
o_bd
,
db
,
txn
,
&
keys
[
i
],
id
,
op
id
);
if
(
rc
)
{
ber_bvarray_free
(
keys
);
goto
done
;
}
}
ber_bvarray_free
(
keys
);
ber_bvarray_free
_x
(
keys
,
op
->
o_tmpmemctx
);
}
rc
=
LDAP_SUCCESS
;
...
...
@@ -232,55 +235,56 @@ static int indexer(
mask
,
ad
->
ad_type
->
sat_syntax
,
ad
->
ad_type
->
sat_substr
,
atname
,
vals
,
&
keys
);
atname
,
vals
,
&
keys
,
op
->
o_tmpmemctx
);
if
(
rc
==
LDAP_SUCCESS
&&
keys
!=
NULL
)
{
for
(
i
=
0
;
keys
[
i
].
bv_val
!=
NULL
;
i
++
)
{
bdb_key_change
(
be
,
db
,
txn
,
&
keys
[
i
],
id
,
op
);
bdb_key_change
(
op
->
o_bd
,
db
,
txn
,
&
keys
[
i
],
id
,
op
id
);
if
(
rc
)
{
ber_bvarray_free
(
keys
);
goto
done
;
}
}
ber_bvarray_free
(
keys
);
ber_bvarray_free
_x
(
keys
,
op
->
o_tmpmemctx
);
}
rc
=
LDAP_SUCCESS
;
}
done:
sl_release
(
mark
,
op
->
o_tmpmemctx
);
return
rc
;
}
static
int
index_at_values
(
Backend
*
be
,
Operation
*
op
,
DB_TXN
*
txn
,
AttributeType
*
type
,
struct
berval
*
tags
,
BerVarray
vals
,
ID
id
,
int
op
)
int
op
id
)
{
int
rc
;
slap_mask_t
mask
=
0
;
if
(
type
->
sat_sup
)
{
/* recurse */
rc
=
index_at_values
(
be
,
txn
,
rc
=
index_at_values
(
op
,
txn
,