Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
openldap
OpenLDAP
Commits
5ba8a93a
Commit
5ba8a93a
authored
May 27, 2000
by
Kurt Zeilenga
Browse files
Add asserts in attempt to find oc_find bug...
parent
8dbd3268
Changes
1
Hide whitespace changes
Inline
Side-by-side
servers/slapd/oc.c
View file @
5ba8a93a
...
...
@@ -205,6 +205,11 @@ oc_index_cmp(
struct
oindexrec
*
oir2
)
{
assert
(
oir1
->
oir_name
);
assert
(
oir1
->
oir_oc
);
assert
(
oir2
->
oir_name
);
assert
(
oir2
->
oir_oc
);
return
(
strcasecmp
(
oir1
->
oir_name
,
oir2
->
oir_name
));
}
...
...
@@ -214,18 +219,27 @@ oc_index_name_cmp(
struct
oindexrec
*
oir
)
{
assert
(
oir
->
oir_name
);
assert
(
oir
->
oir_oc
);
return
(
strcasecmp
(
name
,
oir
->
oir_name
));
}
ObjectClass
*
oc_find
(
const
char
*
ocname
)
{
struct
oindexrec
*
oir
=
NULL
;
struct
oindexrec
*
oir
;
oir
=
(
struct
oindexrec
*
)
avl_find
(
oc_index
,
ocname
,
(
AVL_CMP
)
oc_index_name_cmp
);
if
(
oir
!=
NULL
)
{
assert
(
oir
->
oir_name
);
assert
(
oir
->
oir_oc
);
if
(
(
oir
=
(
struct
oindexrec
*
)
avl_find
(
oc_index
,
ocname
,
(
AVL_CMP
)
oc_index_name_cmp
))
!=
NULL
)
{
return
(
oir
->
oir_oc
);
}
return
(
NULL
);
}
...
...
@@ -377,34 +391,51 @@ oc_insert(
ch_calloc
(
1
,
sizeof
(
struct
oindexrec
)
);
oir
->
oir_name
=
soc
->
soc_oid
;
oir
->
oir_oc
=
soc
;
assert
(
oir
->
oir_name
);
assert
(
oir
->
oir_oc
);
if
(
avl_insert
(
&
oc_index
,
(
caddr_t
)
oir
,
(
AVL_CMP
)
oc_index_cmp
,
(
AVL_DUP
)
avl_dup_error
)
)
{
(
AVL_DUP
)
avl_dup_error
)
)
{
*
err
=
soc
->
soc_oid
;
ldap_memfree
(
oir
->
oir_name
);
ldap_memfree
(
oir
);
return
SLAP_SCHERR_DUP_CLASS
;
}
/* FIX: temporal consistency check */
oc_find
(
oir
->
oir_name
);
assert
(
oc_find
(
oir
->
oir_name
)
!=
NULL
)
;
}
if
(
(
names
=
soc
->
soc_names
)
)
{
while
(
*
names
)
{
oir
=
(
struct
oindexrec
*
)
ch_calloc
(
1
,
sizeof
(
struct
oindexrec
)
);
oir
->
oir_name
=
ch_strdup
(
*
names
);
oir
->
oir_oc
=
soc
;
assert
(
oir
->
oir_name
);
assert
(
oir
->
oir_oc
);
if
(
avl_insert
(
&
oc_index
,
(
caddr_t
)
oir
,
(
AVL_CMP
)
oc_index_cmp
,
(
AVL_DUP
)
avl_dup_error
)
)
{
(
AVL_DUP
)
avl_dup_error
)
)
{
*
err
=
*
names
;
ldap_memfree
(
oir
->
oir_name
);
ldap_memfree
(
oir
);
return
SLAP_SCHERR_DUP_CLASS
;
}
/* FIX: temporal consistency check */
oc_find
(
oir
->
oir_name
);
assert
(
oc_find
(
oir
->
oir_name
)
!=
NULL
);
names
++
;
}
}
return
0
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment