From: Kurt Zeilenga Date: Sat, 19 Jun 1999 04:26:17 +0000 (+0000) Subject: Allow adding of dn: o=foo if suffix is "" and rootdn. X-Git-Tag: OPENLDAP_REL_ENG_2_BP~258 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f9a560114a3d8c9de8672120e06772728eb98129;p=openldap Allow adding of dn: o=foo if suffix is "" and rootdn. --- diff --git a/servers/slapd/back-ldbm/add.c b/servers/slapd/back-ldbm/add.c index dbb96e8f22..6173a78c92 100644 --- a/servers/slapd/back-ldbm/add.c +++ b/servers/slapd/back-ldbm/add.c @@ -55,9 +55,13 @@ ldbm_back_add( * add the entry. */ - if ( (pdn = dn_parent( be, e->e_ndn )) != NULL ) { + pdn = dn_parent( be, e->e_ndn ); + + if( pdn != NULL && *pdn != '\0' && !be_issuffix(be, "") ) { char *matched = NULL; + assert( *pdn != '\0' ); + /* get parent with writer lock */ if ( (p = dn2entry_w( be, pdn, &matched )) == NULL ) { ldap_pvt_thread_mutex_unlock(&li->li_add_mutex); @@ -100,11 +104,19 @@ ldbm_back_add( } } else { + if(pdn != NULL) { + assert( *pdn == '\0' ); + free(pdn); + } + /* no parent, must be adding entry to root */ if ( ! be_isroot( be, op->o_ndn ) ) { ldap_pvt_thread_mutex_unlock(&li->li_add_mutex); - Debug( LDAP_DEBUG_TRACE, "no parent & not root\n", 0, - 0, 0 ); + + Debug( LDAP_DEBUG_TRACE, "%s add denied\n", + pdn == NULL ? "suffix" : "entry at root", + 0, 0 ); + send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS, "", "" );