dn2idl API changed for consistency with other dn2id* funcs

This commit is contained in:
Pierangelo Masarati 2001-07-07 14:49:42 +00:00
parent a4dc886f02
commit 04c29fb3ea
3 changed files with 21 additions and 9 deletions

View file

@ -203,16 +203,16 @@ dn2id(
return( 0 );
}
ID_BLOCK *
int
dn2idl(
Backend *be,
const char *dn,
int prefix
int prefix,
ID_BLOCK **idlp
)
{
DBCache *db;
Datum key;
ID_BLOCK *idl;
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
@ -221,6 +221,8 @@ dn2idl(
Debug( LDAP_DEBUG_TRACE, "=> dn2idl( \"%c%s\" )\n", prefix, dn, 0 );
#endif
assert( idlp != NULL );
*idlp = NULL;
if ( (db = ldbm_cache_open( be, "dn2id", LDBM_SUFFIX, LDBM_WRCREAT ))
== NULL ) {
@ -232,7 +234,7 @@ dn2idl(
LDBM_SUFFIX, 0, 0 );
#endif
return NULL;
return -1;
}
ldbm_datum_init( key );
@ -241,13 +243,13 @@ dn2idl(
key.dptr = ch_malloc( key.dsize );
sprintf( key.dptr, "%c%s", prefix, dn );
idl = idl_fetch( be, db, key );
*idlp = idl_fetch( be, db, key );
ldbm_cache_close( be, db );
free( key.dptr );
return( idl );
return( 0 );
}

View file

@ -55,7 +55,12 @@ filter_candidates(
Debug( LDAP_DEBUG_FILTER, "\tDN ONE\n", 0, 0, 0 );
#endif
result = dn2idl( be, f->f_dn, DN_ONE_PREFIX );
/* an error is treated as an empty list */
if ( dn2idl( be, f->f_dn, DN_ONE_PREFIX, &result ) != 0
&& result != NULL ) {
idl_free( result );
result = NULL;
}
break;
case SLAPD_FILTER_DN_SUBTREE:
@ -66,7 +71,12 @@ filter_candidates(
Debug( LDAP_DEBUG_FILTER, "\tDN SUBTREE\n", 0, 0, 0 );
#endif
result = dn2idl( be, f->f_dn, DN_SUBTREE_PREFIX );
/* an error is treated as an empty list */
if ( dn2idl( be, f->f_dn, DN_SUBTREE_PREFIX, &result ) != 0
&& result != NULL ) {
idl_free( result );
result = NULL;
}
break;
case LDAP_FILTER_PRESENT:

View file

@ -78,7 +78,7 @@ void *ldbm_cache_sync_daemon LDAP_P(( void *));
int dn2id_add LDAP_P(( Backend *be, const char *dn, ID id ));
int dn2id LDAP_P(( Backend *be, const char *dn, ID *idp ));
ID_BLOCK *dn2idl LDAP_P(( Backend *be, const char *dn, int prefix ));
int dn2idl LDAP_P(( Backend *be, const char *dn, int prefix, ID_BLOCK **idlp ));
int dn2id_delete LDAP_P(( Backend *be, const char *dn, ID id ));
Entry * dn2entry_rw LDAP_P(( Backend *be, const char *dn, Entry **matched, int rw ));