* If the parent does not exist, only allow the "root" user to
* add the entry.
*/
- pdn = dn_parent1( be, e->e_ndn );
+ pdn = dn_parent( be, e->e_ndn );
if( pdn != NULL && *pdn != '\0' ) {
Entry *matched = NULL;
goto done;
}
- pdn = dn_parent1( be, ndn );
+ pdn = dn_parent( be, ndn );
if( pdn != NULL && *pdn != '\0' ) {
/* get parent */
goto done;
}
- pdn = dn_parent1( be, ptr );
+ pdn = dn_parent( be, ptr );
if( pdn != NULL ) {
key.size -= pdn - ptr;
goto done;
}
ptr = pdn;
- pdn = dn_parent1( be, pdn );
+ pdn = dn_parent( be, pdn );
}
while( pdn != NULL ) {
break;
}
ptr = pdn;
- pdn = dn_parent1( be, pdn );
+ pdn = dn_parent( be, pdn );
}
done:
goto done;
}
- pdn = dn_parent1( be, ptr );
+ pdn = dn_parent( be, ptr );
if( pdn != NULL ) {
key.size -= pdn - ptr;
goto done;
}
ptr = pdn;
- pdn = dn_parent1( be, pdn );
+ pdn = dn_parent( be, pdn );
}
while( pdn != NULL ) {
goto done;
}
ptr = pdn;
- pdn = dn_parent1( be, pdn );
+ pdn = dn_parent( be, pdn );
}
done:
rc = db->get( db, txn, &key, &data, bdb->bi_db_opflags );
if( rc == DB_NOTFOUND ) {
- char *pdn = dn_parent1( be, dn );
+ char *pdn = dn_parent( be, dn );
if( pdn == NULL || *pdn == '\0' ) {
Debug( LDAP_DEBUG_TRACE,
goto done;
}
- p_ndn = dn_parent1( be, e->e_ndn );
+ p_ndn = dn_parent( be, e->e_ndn );
np_ndn = p_ndn;
if ( p_ndn != NULL && p_ndn[ 0 ] != '\0' ) {
/* Make sure parent entry exist and we can write its
"bdb_modrdn: wr to children of entry %s OK\n",
p_ndn, 0, 0 );
- p_dn = dn_parent1( be, e->e_dn );
+ p_dn = dn_parent( be, e->e_dn );
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: parent dn=%s\n",
/* need to skip alias which deref into scope */
if( scope & LDAP_SCOPE_ONELEVEL ) {
- char *pdn = dn_parent1( NULL, e->e_ndn );
+ char *pdn = dn_parent( NULL, e->e_ndn );
if ( pdn != NULL ) {
if( strcmp( pdn, realbase ) ) {
goto loop_continue;
/* check scope */
if ( !scopeok && scope == LDAP_SCOPE_ONELEVEL ) {
- if ( (dn = dn_parent1( be, e->e_ndn )) != NULL ) {
+ if ( (dn = dn_parent( be, e->e_ndn )) != NULL ) {
scopeok = (dn == realbase)
? 1
: (strcmp( dn, realbase ) ? 0 : 1 );
}
/* add dn2id indices */
- pdn = dn_parent1( be, e->e_ndn );
+ pdn = dn_parent( be, e->e_ndn );
rc = bdb_dn2id_add( be, tid, pdn, e );
if( rc != 0 ) {
Debug( LDAP_DEBUG_ANY,
(long) id, e->e_dn, 0 );
/* add dn2id indices */
- pdn = dn_parent1( be, e->e_ndn );
+ pdn = dn_parent( be, e->e_ndn );
rc = bdb_dn2id_add( be, tid, pdn, e );
if( rc != 0 && rc != DB_KEYEXIST ) {
Debug( LDAP_DEBUG_ANY,
ber_bvecfree( refs );
free( matched_dn );
- free( pdn );
return -1;
}
/* don't need the add lock anymore */
ldap_pvt_thread_mutex_unlock(&li->li_add_mutex);
- free(pdn);
-
if ( ! access_allowed( be, conn, op, p,
children, NULL, ACL_WRITE ) )
{
} else {
if(pdn != NULL) {
assert( *pdn == '\0' );
- free(pdn);
}
/* no parent, must be adding entry to root */
rc = 0;
return_results:;
- if ( pdn != NULL ) free(pdn);
-
if( p != NULL ) {
/* free parent and writer lock */
cache_return_entry_w( &li->li_cache, p );
free( key.dptr );
if ( rc != -1 ) {
- char *pdn = dn_parent( NULL, dn );
+ char *pdn = dn_parent( be, dn );
if( pdn != NULL ) {
ldbm_datum_init( key );
rc = idl_insert_key( be, db, key, id );
ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
free( key.dptr );
- free( pdn );
}
}
{
- char *pdn = dn_parent( NULL, dn );
+ char *pdn = dn_parent( be, dn );
if( pdn != NULL ) {
ldbm_datum_init( key );
ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
free( key.dptr );
- free( pdn );
}
}
if ( (e = dn2entry_r( be, pdn, matched )) != NULL ) {
*matched = e;
}
- free( pdn );
}
return NULL;
if( new_dn != NULL ) free( new_dn );
if( new_ndn != NULL ) free( new_ndn );
- if( p_dn != NULL ) free( p_dn );
- if( p_ndn != NULL ) free( p_ndn );
-
/* LDAP v2 supporting correct attribute handling. */
if( new_rdn_types != NULL ) charray_free( new_rdn_types );
if( new_rdn_vals != NULL ) charray_free( new_rdn_vals );
free( pdn );
goto loop_continue;
}
- free(pdn);
}
} else if ( dn_issuffix( e->e_ndn, realbase ) ) {
/* check scope */
if ( !scopeok && scope == LDAP_SCOPE_ONELEVEL ) {
if ( (dn = dn_parent( be, e->e_ndn )) != NULL ) {
- (void) dn_normalize( dn );
scopeok = (dn == realbase)
? 1
: (strcmp( dn, realbase ) ? 0 : 1 );
- free( dn );
-
} else {
scopeok = (realbase == NULL || *realbase == '\0');
}
/* check scope */
if ( !scopeok && scope == LDAP_SCOPE_ONELEVEL ) {
if ( (dn = dn_parent( be, e->e_ndn )) != NULL ) {
- (void) dn_normalize( dn );
scopeok = (dn == realbase)
? 1
: (strcmp( dn, realbase ) ? 0 : 1 );
- free( dn );
-
} else {
scopeok = (realbase == NULL || *realbase == '\0');
}
/* try with parent/ancestors */
p_ndn = dn_parent( NULL, ndn );
rc = monitor_cache_dn2entry( mi, p_ndn, &e_parent );
- free( p_ndn );
if ( rc || e_parent == NULL) {
return( -1 );
}
vals[0] = &val;
vals[1] = NULL;
- matched = ch_strdup( base );
+ matched = base;
if( scope != LDAP_SCOPE_ONELEVEL ) {
char *type;
int i;
for( i=0; be->be_nsuffix[i] != NULL; i++ ) {
if( dn_issuffix( nbase, be->be_nsuffix[i]->bv_val ) ) {
- matched = ch_strdup( be->be_suffix[i] );
+ matched = be->be_suffix[i];
break;
}
}
if ( (pw = getpwnam( user )) == NULL ) {
matched = parent;
- parent = NULL;
err = LDAP_NO_SUCH_OBJECT;
goto done;
}
err, err == LDAP_NO_SUCH_OBJECT ? matched : NULL, NULL,
NULL, NULL );
- if( matched != NULL ) free( matched );
- if( parent != NULL ) free( parent );
if( rdn != NULL ) free( rdn );
if( user != NULL ) free( user );
send_ldap_result(conn,op,LDAP_SUCCESS,"",NULL,NULL,NULL);
modrdn_return:
SQLFreeStmt(sth,SQL_DROP);
- if (p_dn)
- ch_free(p_dn);
if (newSuperior && new_pdn)
ch_free(new_pdn);
if (new_dn)
send_ldap_result(conn,op,LDAP_OTHER,"","SQL-backend error",NULL,NULL);
return 1;
}
- free(pdn);
backsql_BindParamStr(sth,1,e->e_dn,BACKSQL_MAX_DN_LEN);
SQLBindParameter(sth,2,SQL_PARAM_INPUT,SQL_C_LONG,SQL_INTEGER,0,0,&oc->id,0,0);
SQLBindParameter(sth,3,SQL_PARAM_INPUT,SQL_C_LONG,SQL_INTEGER,0,0,&parent_id.id,0,0);
}
/*
- * dn_parent1 - return the dn's parent, in-place
+ * dn_parent - return the dn's parent, in-place
*/
char *
-dn_parent1(
+dn_parent(
Backend *be,
const char *dn )
{
return "";
}
-/*
- * dn_parent - return a copy of the dn of dn's parent
- */
-
-char *
-dn_parent(
- Backend *be,
- const char *dn
-)
-{
- dn = dn_parent1( be, dn );
- if( dn != NULL )
- dn = ch_strdup( dn );
- return (char *)dn;
-}
-
char * dn_rdn(
Backend *be,
const char *dn_in )
do {
charray_add( &subtree, dn );
- dn = dn_parent1( be, dn );
+ dn = dn_parent( be, dn );
} while ( dn != NULL );
LDAP_SLAPD_F (char *) dn_normalize LDAP_P(( char *dn ));
LDAP_SLAPD_F (int) dn_match LDAP_P(( const char *val, const char *asserted ));
LDAP_SLAPD_F (char *) dn_parent LDAP_P(( Backend *be, const char *dn ));
-LDAP_SLAPD_F (char *) dn_parent1 LDAP_P(( Backend *be, const char *dn ));
LDAP_SLAPD_F (char **) dn_subtree LDAP_P(( Backend *be, const char *dn ));
LDAP_SLAPD_F (char *) dn_rdn LDAP_P(( Backend *be, const char *dn ));
LDAP_SLAPD_F (int) dn_issuffix LDAP_P(( const char *dn, const char *suffix ));