* If the parent does not exist, only allow the "root" user to
* add the entry.
*/
- pdn.bv_val = dn_parent( be, e->e_nname.bv_val );
- if (pdn.bv_val == NULL)
- pdn.bv_len = 0;
+ pdn.bv_val = dn_parent( be, e->e_ndn );
+ if (pdn.bv_val && *pdn.bv_val)
+ pdn.bv_len = e->e_nname.bv_len - (pdn.bv_val - e->e_ndn);
else
- pdn.bv_len = e->e_nname.bv_len - (pdn.bv_val - e->e_nname.bv_val);
+ pdn.bv_len = 0;
if( pdn.bv_len != 0 ) {
Entry *matched = NULL;
}
p_ndn.bv_val = dn_parent( be, e->e_ndn );
- if (p_ndn.bv_val)
+ if (p_ndn.bv_val && *p_ndn.bv_val)
p_ndn.bv_len = e->e_nname.bv_len - (p_ndn.bv_val - e->e_ndn);
else
p_ndn.bv_len = 0;
p_ndn.bv_val, 0, 0 );
p_dn.bv_val = dn_parent( be, e->e_dn );
- if (p_dn.bv_val)
+ if (p_dn.bv_val && *p_dn.bv_val)
p_dn.bv_len = e->e_name.bv_len - (p_dn.bv_val - e->e_dn);
else
p_dn.bv_len = 0;
/* add dn2id indices */
pdn.bv_val = dn_parent( be, e->e_ndn );
- if (pdn.bv_val)
+ if (pdn.bv_val && *pdn.bv_val)
pdn.bv_len = e->e_nname.bv_len - (pdn.bv_val - e->e_ndn);
else
pdn.bv_len = 0;
/* add dn2id indices */
pdn.bv_val = dn_parent( be, e->e_ndn );
- if (pdn.bv_val)
+ if (pdn.bv_val && *pdn.bv_val)
pdn.bv_len = e->e_nname.bv_len - (pdn.bv_val - e->e_ndn);
else
pdn.bv_len = 0;
slap_syntax_transform_func *transf = NULL;
MatchingRule *mr;
struct berval bv = { 0, NULL };
+ int do_sort = 0;
assert( ava );
}
ava->la_private = ( void * )ad;
+ do_sort = 1;
}
/*
ava->la_value = bv;
}
- AVA_Sort( rdn, iAVA );
+ if( do_sort ) AVA_Sort( rdn, iAVA );
}
}
return rc;
}
+ /* Parent is root */
+ if (*p == '\0') {
+ *pdn = "";
+ return LDAP_SUCCESS;
+ }
+
assert( DN_SEPARATOR( p[ 0 ] ) );
p++;