Commit 68daf5be authored by Howard Chu's avatar Howard Chu
Browse files

Misc cleanup

parent 975a5e9a
......@@ -606,7 +606,7 @@ int bdb_fix_dn(
o = bdb_find_id_node(id, bdb->bi_tree);
rlen = be->be_suffix[0]->bv_len + 1;
nrlen = be->be_nsuffix[0]->bv_len + 1;
for (n = o; n; n=n->i_parent) {
for (n = o; n && n->i_parent; n=n->i_parent) {
rlen += n->i_rdn->rdn.bv_len + 1;
nrlen += n->i_rdn->nrdn.bv_len + 1;
}
......@@ -616,7 +616,7 @@ int bdb_fix_dn(
e->e_nname.bv_val = e->e_name.bv_val + rlen;
ptr = e->e_name.bv_val;
nptr = e->e_nname.bv_val;
for (n = o; n; n=n->i_parent) {
for (n = o; n && n->i_parent; n=n->i_parent) {
ptr = slap_strcopy(ptr, n->i_rdn->rdn.bv_val);
*ptr++ = ',';
nptr = slap_strcopy(nptr, n->i_rdn->nrdn.bv_val);
......@@ -624,8 +624,6 @@ int bdb_fix_dn(
}
ldap_pvt_thread_rdwr_runlock(&bdb->bi_tree_rdwr);
ptr--;
nptr--;
strcpy(ptr, be->be_suffix[0]->bv_val);
strcpy(nptr, be->be_nsuffix[0]->bv_val);
......@@ -665,7 +663,7 @@ bdb_dn2id_add(
d->rdn.bv_val -= (long)d;
d->nrdn.bv_val -= (long)d;
if (pdn) {
if (pdn->bv_len) {
bdb_dn2id(be, txn, pdn, &d->parent);
} else {
d->parent = 0;
......
......@@ -118,10 +118,10 @@ bdb_search(
}
send_ldap_result( conn, op, rc=LDAP_REFERRAL ,
matched_dn->bv_val, text, refs, NULL );
matched_dn ? matched_dn->bv_val : NULL, text, refs, NULL );
ber_bvecfree( refs );
ber_bvfree( matched_dn );
if ( refs ) ber_bvecfree( refs );
if ( matched_dn ) ber_bvfree( matched_dn );
return rc;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment