move compare and delete to struct berval DNs

This commit is contained in:
Kurt Zeilenga 2001-12-26 19:05:26 +00:00
parent 9f8c9bf3a8
commit 24a4d888dc
9 changed files with 70 additions and 66 deletions

View File

@ -18,8 +18,8 @@ bdb_compare(
BackendDB *be, BackendDB *be,
Connection *conn, Connection *conn,
Operation *op, Operation *op,
const char *dn, struct berval *dn,
const char *ndn, struct berval *ndn,
AttributeAssertion *ava AttributeAssertion *ava
) )
{ {
@ -32,7 +32,7 @@ bdb_compare(
int manageDSAit = get_manageDSAit( op ); int manageDSAit = get_manageDSAit( op );
/* get entry */ /* get entry */
rc = bdb_dn2entry( be, NULL, ndn, &e, &matched, 0 ); rc = bdb_dn2entry( be, NULL, ndn->bv_val, &e, &matched, 0 );
switch( rc ) { switch( rc ) {
case DB_NOTFOUND: case DB_NOTFOUND:
@ -52,14 +52,14 @@ bdb_compare(
matched_dn = ch_strdup( matched->e_dn ); matched_dn = ch_strdup( matched->e_dn );
refs = is_entry_referral( matched ) refs = is_entry_referral( matched )
? get_entry_referrals( be, conn, op, matched, ? get_entry_referrals( be, conn, op, matched,
dn, LDAP_SCOPE_DEFAULT ) dn->bv_val, LDAP_SCOPE_DEFAULT )
: NULL; : NULL;
bdb_entry_return( be, matched ); bdb_entry_return( be, matched );
matched = NULL; matched = NULL;
} else { } else {
refs = referral_rewrite( default_referral, refs = referral_rewrite( default_referral,
NULL, dn, LDAP_SCOPE_DEFAULT ); NULL, dn->bv_val, LDAP_SCOPE_DEFAULT );
} }
send_ldap_result( conn, op, rc = LDAP_REFERRAL, send_ldap_result( conn, op, rc = LDAP_REFERRAL,
@ -74,7 +74,7 @@ bdb_compare(
if (!manageDSAit && is_entry_referral( e ) ) { if (!manageDSAit && is_entry_referral( e ) ) {
/* entry is a referral, don't allow add */ /* entry is a referral, don't allow add */
struct berval **refs = get_entry_referrals( be, struct berval **refs = get_entry_referrals( be,
conn, op, e, dn, LDAP_SCOPE_DEFAULT ); conn, op, e, dn->bv_val, LDAP_SCOPE_DEFAULT );
Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0, Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0,
0, 0 ); 0, 0 );

View File

@ -18,8 +18,8 @@ bdb_delete(
BackendDB *be, BackendDB *be,
Connection *conn, Connection *conn,
Operation *op, Operation *op,
const char *dn, struct berval *dn,
const char *ndn struct berval *ndn
) )
{ {
struct bdb_info *bdb = (struct bdb_info *) be->be_private; struct bdb_info *bdb = (struct bdb_info *) be->be_private;
@ -33,11 +33,13 @@ bdb_delete(
DB_TXN *ltid = NULL; DB_TXN *ltid = NULL;
struct bdb_op_info opinfo; struct bdb_op_info opinfo;
Debug( LDAP_DEBUG_ARGS, "==> bdb_delete: %s\n", dn, 0, 0 ); Debug( LDAP_DEBUG_ARGS, "==> bdb_delete: %s\n",
dn->bv_val, 0, 0 );
if( 0 ) { if( 0 ) {
retry: /* transaction retry */ retry: /* transaction retry */
Debug( LDAP_DEBUG_TRACE, "==> bdb_delete: retrying...\n", 0, 0, 0 ); Debug( LDAP_DEBUG_TRACE, "==> bdb_delete: retrying...\n",
0, 0, 0 );
rc = txn_abort( ltid ); rc = txn_abort( ltid );
ltid = NULL; ltid = NULL;
op->o_private = NULL; op->o_private = NULL;
@ -69,7 +71,7 @@ retry: /* transaction retry */
op->o_private = &opinfo; op->o_private = &opinfo;
/* get entry for read/modify/write */ /* get entry for read/modify/write */
rc = bdb_dn2entry( be, ltid, ndn, &e, &matched, DB_RMW ); rc = bdb_dn2entry( be, ltid, ndn->bv_val, &e, &matched, DB_RMW );
switch( rc ) { switch( rc ) {
case 0: case 0:
@ -96,14 +98,14 @@ retry: /* transaction retry */
matched_dn = ch_strdup( matched->e_dn ); matched_dn = ch_strdup( matched->e_dn );
refs = is_entry_referral( matched ) refs = is_entry_referral( matched )
? get_entry_referrals( be, conn, op, matched, ? get_entry_referrals( be, conn, op, matched,
dn, LDAP_SCOPE_DEFAULT ) dn->bv_val, LDAP_SCOPE_DEFAULT )
: NULL; : NULL;
bdb_entry_return( be, matched ); bdb_entry_return( be, matched );
matched = NULL; matched = NULL;
} else { } else {
refs = referral_rewrite( default_referral, refs = referral_rewrite( default_referral,
NULL, dn, LDAP_SCOPE_DEFAULT ); NULL, dn->bv_val, LDAP_SCOPE_DEFAULT );
} }
send_ldap_result( conn, op, LDAP_REFERRAL, send_ldap_result( conn, op, LDAP_REFERRAL,
@ -116,7 +118,7 @@ retry: /* transaction retry */
goto done; goto done;
} }
pdn = dn_parent( be, ndn ); pdn = dn_parent( be, ndn->bv_val );
if( pdn != NULL && *pdn != '\0' ) { if( pdn != NULL && *pdn != '\0' ) {
/* get parent */ /* get parent */
@ -192,7 +194,7 @@ retry: /* transaction retry */
/* parent is a referral, don't allow add */ /* parent is a referral, don't allow add */
/* parent is an alias, don't allow add */ /* parent is an alias, don't allow add */
struct berval **refs = get_entry_referrals( be, struct berval **refs = get_entry_referrals( be,
conn, op, e, dn, LDAP_SCOPE_DEFAULT ); conn, op, e, dn->bv_val, LDAP_SCOPE_DEFAULT );
Debug( LDAP_DEBUG_TRACE, Debug( LDAP_DEBUG_TRACE,
"bdb_delete: entry is referral\n", "bdb_delete: entry is referral\n",

View File

@ -21,8 +21,8 @@ ldbm_back_compare(
Backend *be, Backend *be,
Connection *conn, Connection *conn,
Operation *op, Operation *op,
const char *dn, struct berval *dn,
const char *ndn, struct berval *ndn,
AttributeAssertion *ava AttributeAssertion *ava
) )
{ {
@ -34,7 +34,7 @@ ldbm_back_compare(
int manageDSAit = get_manageDSAit( op ); int manageDSAit = get_manageDSAit( op );
/* get entry with reader lock */ /* get entry with reader lock */
if ( (e = dn2entry_r( be, ndn, &matched )) == NULL ) { if ( (e = dn2entry_r( be, ndn->bv_val, &matched )) == NULL ) {
char *matched_dn = NULL; char *matched_dn = NULL;
struct berval **refs = NULL; struct berval **refs = NULL;
@ -42,12 +42,12 @@ ldbm_back_compare(
matched_dn = ch_strdup( matched->e_dn ); matched_dn = ch_strdup( matched->e_dn );
refs = is_entry_referral( matched ) refs = is_entry_referral( matched )
? get_entry_referrals( be, conn, op, matched, ? get_entry_referrals( be, conn, op, matched,
dn, LDAP_SCOPE_DEFAULT ) dn->bv_val, LDAP_SCOPE_DEFAULT )
: NULL; : NULL;
cache_return_entry_r( &li->li_cache, matched ); cache_return_entry_r( &li->li_cache, matched );
} else { } else {
refs = referral_rewrite( default_referral, refs = referral_rewrite( default_referral,
NULL, dn, LDAP_SCOPE_DEFAULT ); NULL, dn->bv_val, LDAP_SCOPE_DEFAULT );
} }
send_ldap_result( conn, op, LDAP_REFERRAL, send_ldap_result( conn, op, LDAP_REFERRAL,
@ -62,7 +62,7 @@ ldbm_back_compare(
if (!manageDSAit && is_entry_referral( e ) ) { if (!manageDSAit && is_entry_referral( e ) ) {
/* entry is a referral, don't allow add */ /* entry is a referral, don't allow add */
struct berval **refs = get_entry_referrals( be, struct berval **refs = get_entry_referrals( be,
conn, op, e, dn, LDAP_SCOPE_DEFAULT ); conn, op, e, dn->bv_val, LDAP_SCOPE_DEFAULT );
#ifdef NEW_LOGGING #ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_INFO, LDAP_LOG(( "backend", LDAP_LEVEL_INFO,

View File

@ -21,8 +21,8 @@ ldbm_back_delete(
Backend *be, Backend *be,
Connection *conn, Connection *conn,
Operation *op, Operation *op,
const char *dn, struct berval *dn,
const char *ndn struct berval *ndn
) )
{ {
struct ldbminfo *li = (struct ldbminfo *) be->be_private; struct ldbminfo *li = (struct ldbminfo *) be->be_private;
@ -36,35 +36,35 @@ ldbm_back_delete(
#ifdef NEW_LOGGING #ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY, LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
"ldbm_back_delete: %s\n", dn )); "ldbm_back_delete: %s\n", dn->bv_val ));
#else #else
Debug(LDAP_DEBUG_ARGS, "==> ldbm_back_delete: %s\n", dn, 0, 0); Debug(LDAP_DEBUG_ARGS, "==> ldbm_back_delete: %s\n", dn->bv_val, 0, 0);
#endif #endif
/* get entry with writer lock */ /* get entry with writer lock */
if ( (e = dn2entry_w( be, ndn, &matched )) == NULL ) { if ( (e = dn2entry_w( be, ndn->bv_val, &matched )) == NULL ) {
char *matched_dn = NULL; char *matched_dn = NULL;
struct berval **refs; struct berval **refs;
#ifdef NEW_LOGGING #ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_INFO, LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
"ldbm_back_delete: no such object %s\n", dn )); "ldbm_back_delete: no such object %s\n", dn->bv_val ));
#else #else
Debug(LDAP_DEBUG_ARGS, "<=- ldbm_back_delete: no such object %s\n", Debug(LDAP_DEBUG_ARGS, "<=- ldbm_back_delete: no such object %s\n",
dn, 0, 0); dn->bv_val, 0, 0);
#endif #endif
if ( matched != NULL ) { if ( matched != NULL ) {
matched_dn = ch_strdup( matched->e_dn ); matched_dn = ch_strdup( matched->e_dn );
refs = is_entry_referral( matched ) refs = is_entry_referral( matched )
? get_entry_referrals( be, conn, op, matched, ? get_entry_referrals( be, conn, op, matched,
dn, LDAP_SCOPE_DEFAULT ) dn->bv_val, LDAP_SCOPE_DEFAULT )
: NULL; : NULL;
cache_return_entry_r( &li->li_cache, matched ); cache_return_entry_r( &li->li_cache, matched );
} else { } else {
refs = referral_rewrite( default_referral, refs = referral_rewrite( default_referral,
NULL, dn, LDAP_SCOPE_DEFAULT ); NULL, dn->bv_val, LDAP_SCOPE_DEFAULT );
} }
send_ldap_result( conn, op, LDAP_REFERRAL, send_ldap_result( conn, op, LDAP_REFERRAL,
@ -80,7 +80,7 @@ ldbm_back_delete(
/* parent is a referral, don't allow add */ /* parent is a referral, don't allow add */
/* parent is an alias, don't allow add */ /* parent is an alias, don't allow add */
struct berval **refs = get_entry_referrals( be, struct berval **refs = get_entry_referrals( be,
conn, op, e, dn, LDAP_SCOPE_DEFAULT ); conn, op, e, dn->bv_val, LDAP_SCOPE_DEFAULT );
#ifdef NEW_LOGGING #ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_INFO, LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
@ -139,7 +139,8 @@ ldbm_back_delete(
{ {
#ifdef NEW_LOGGING #ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_ERR, LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
"ldbm_back_delete: no access to parent of (%s)\n", dn )); "ldbm_back_delete: no access to parent of (%s)\n",
dn->bv_val ));
#else #else
Debug( LDAP_DEBUG_TRACE, Debug( LDAP_DEBUG_TRACE,
"<=- ldbm_back_delete: no access to parent\n", 0, "<=- ldbm_back_delete: no access to parent\n", 0,
@ -205,11 +206,12 @@ ldbm_back_delete(
if ( dn2id_delete( be, e->e_ndn, e->e_id ) != 0 ) { if ( dn2id_delete( be, e->e_ndn, e->e_id ) != 0 ) {
#ifdef NEW_LOGGING #ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_ERR, LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
"ldbm_back_delete: (%s) operations error\n", dn )); "ldbm_back_delete: (%s) operations error\n",
dn->bv_val ));
#else #else
Debug(LDAP_DEBUG_ARGS, Debug(LDAP_DEBUG_ARGS,
"<=- ldbm_back_delete: operations error %s\n", "<=- ldbm_back_delete: operations error %s\n",
dn, 0, 0); dn->bv_val, 0, 0);
#endif #endif
send_ldap_result( conn, op, LDAP_OTHER, send_ldap_result( conn, op, LDAP_OTHER,
@ -222,11 +224,11 @@ ldbm_back_delete(
#ifdef NEW_LOGGING #ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_ERR, LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
"ldbm_back_delete: (%s) operations error\n", "ldbm_back_delete: (%s) operations error\n",
dn )); dn->bv_val ));
#else #else
Debug(LDAP_DEBUG_ARGS, Debug(LDAP_DEBUG_ARGS,
"<=- ldbm_back_delete: operations error %s\n", "<=- ldbm_back_delete: operations error %s\n",
dn, 0, 0); dn->bv_val, 0, 0);
#endif #endif
send_ldap_result( conn, op, LDAP_OTHER, send_ldap_result( conn, op, LDAP_OTHER,

View File

@ -46,8 +46,8 @@ monitor_back_compare(
Backend *be, Backend *be,
Connection *conn, Connection *conn,
Operation *op, Operation *op,
const char *dn, struct berval *dn,
const char *ndn, struct berval *ndn,
AttributeAssertion *ava AttributeAssertion *ava
) )
{ {
@ -56,7 +56,7 @@ monitor_back_compare(
Attribute *a; Attribute *a;
/* get entry with reader lock */ /* get entry with reader lock */
monitor_cache_dn2entry( mi, ndn, &e, &matched ); monitor_cache_dn2entry( mi, ndn->bv_val, &e, &matched );
if ( e == NULL ) { if ( e == NULL ) {
send_ldap_result( conn, op, LDAP_NO_SUCH_OBJECT, send_ldap_result( conn, op, LDAP_NO_SUCH_OBJECT,
matched ? matched->e_dn : NULL, matched ? matched->e_dn : NULL,
@ -85,7 +85,6 @@ monitor_back_compare(
rc = LDAP_COMPARE_FALSE; rc = LDAP_COMPARE_FALSE;
if ( value_find( ava->aa_desc, a->a_vals, ava->aa_value ) == 0 ) { if ( value_find( ava->aa_desc, a->a_vals, ava->aa_value ) == 0 ) {
rc = LDAP_COMPARE_TRUE; rc = LDAP_COMPARE_TRUE;
break; break;
} }

View File

@ -397,15 +397,15 @@ glue_back_compare (
BackendDB *b0, BackendDB *b0,
Connection *conn, Connection *conn,
Operation *op, Operation *op,
const char *dn, struct berval *dn,
const char *ndn, struct berval *ndn,
AttributeAssertion *ava AttributeAssertion *ava
) )
{ {
BackendDB *be; BackendDB *be;
int rc; int rc;
be = glue_back_select (b0, ndn); be = glue_back_select (b0, ndn->bv_val);
if (be && be->be_compare) { if (be && be->be_compare) {
rc = be->be_compare (be, conn, op, dn, ndn, ava); rc = be->be_compare (be, conn, op, dn, ndn, ava);
@ -497,14 +497,14 @@ glue_back_delete (
BackendDB *b0, BackendDB *b0,
Connection *conn, Connection *conn,
Operation *op, Operation *op,
const char *dn, struct berval *dn,
const char *ndn struct berval *ndn
) )
{ {
BackendDB *be; BackendDB *be;
int rc; int rc;
be = glue_back_select (b0, ndn); be = glue_back_select (b0, ndn->bv_val);
if (be && be->be_delete) { if (be && be->be_delete) {
rc = be->be_delete (be, conn, op, dn, ndn); rc = be->be_delete (be, conn, op, dn, ndn);

View File

@ -284,7 +284,7 @@ do_compare(
suffix_alias( be, ndn ); suffix_alias( be, ndn );
if ( be->be_compare ) { if ( be->be_compare ) {
(*be->be_compare)( be, conn, op, pdn->bv_val, ndn->bv_val, &ava ); (*be->be_compare)( be, conn, op, pdn, ndn, &ava );
} else { } else {
send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM, send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
NULL, "operation not supported within namingContext", NULL, "operation not supported within namingContext",

View File

@ -184,7 +184,7 @@ do_delete(
if ( !be->be_update_ndn.bv_len || repl_user ) if ( !be->be_update_ndn.bv_len || repl_user )
#endif #endif
{ {
if ( (*be->be_delete)( be, conn, op, pdn->bv_val, ndn->bv_val ) == 0 ) { if ( (*be->be_delete)( be, conn, op, pdn, ndn ) == 0 ) {
#ifdef SLAPD_MULTIMASTER #ifdef SLAPD_MULTIMASTER
if ( !be->be_update_ndn.bv_len || !repl_user ) if ( !be->be_update_ndn.bv_len || !repl_user )
#endif #endif

View File

@ -1048,7 +1048,7 @@ typedef int (BI_op_search) LDAP_P((BackendDB *bd,
struct berval **attrs, int attrsonly)); struct berval **attrs, int attrsonly));
typedef int (BI_op_compare)LDAP_P((BackendDB *bd, typedef int (BI_op_compare)LDAP_P((BackendDB *bd,
struct slap_conn *c, struct slap_op *o, struct slap_conn *c, struct slap_op *o,
const char *dn, const char *ndn, struct berval *dn, struct berval *ndn,
AttributeAssertion *ava)); AttributeAssertion *ava));
typedef int (BI_op_modify) LDAP_P((BackendDB *bd, typedef int (BI_op_modify) LDAP_P((BackendDB *bd,
struct slap_conn *c, struct slap_op *o, struct slap_conn *c, struct slap_op *o,
@ -1063,7 +1063,7 @@ typedef int (BI_op_add) LDAP_P((BackendDB *bd,
Entry *e)); Entry *e));
typedef int (BI_op_delete) LDAP_P((BackendDB *bd, typedef int (BI_op_delete) LDAP_P((BackendDB *bd,
struct slap_conn *c, struct slap_op *o, struct slap_conn *c, struct slap_op *o,
const char *dn, const char *ndn)); struct berval *dn, struct berval *ndn));
typedef int (BI_op_abandon) LDAP_P((BackendDB *bd, typedef int (BI_op_abandon) LDAP_P((BackendDB *bd,
struct slap_conn *c, struct slap_op *o, struct slap_conn *c, struct slap_op *o,
ber_int_t msgid)); ber_int_t msgid));
@ -1094,6 +1094,7 @@ typedef int (BI_acl_group) LDAP_P((Backend *bd,
Entry *e, const char *bdn, const char *edn, Entry *e, const char *bdn, const char *edn,
ObjectClass *group_oc, ObjectClass *group_oc,
AttributeDescription *group_at )); AttributeDescription *group_at ));
typedef int (BI_acl_attribute) LDAP_P((Backend *bd, typedef int (BI_acl_attribute) LDAP_P((Backend *bd,
struct slap_conn *c, struct slap_op *o, struct slap_conn *c, struct slap_op *o,
Entry *e, const char *edn, Entry *e, const char *edn,