Commit 2775c8d4 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Update no-op control to return LDAP_NO_OPERATION instead of LDAP_SUCCESS.

(back-sql needs to be updated)
parent fcad25da
......@@ -480,6 +480,9 @@ typedef struct ldapcontrol {
/* for the LDAP Sync operation */
#define LDAP_SYNC_REFRESH_REQUIRED 0x4100
/* for the LDAP No-Op control */
#define LDAP_NO_OPERATION 0x410e
/* for the Assertion control */
#define LDAP_ASSERTION_FAILED 0x410f
......
......@@ -106,6 +106,8 @@ static struct ldaperror ldap_builtin_errlist[] = {
{LDAP_REFERRAL_LIMIT_EXCEEDED, N_("Referral Limit Exceeded")},
{LDAP_SYNC_REFRESH_REQUIRED, N_("Content Sync Refresh Required")},
{LDAP_NO_OPERATION, N_("No Operation")},
{LDAP_ASSERTION_FAILED, N_("Assertion Failed")},
{LDAP_CANCELLED, N_("Cancelled")},
......
......@@ -40,7 +40,6 @@ bdb_add(Operation *op, SlapReply *rs )
#endif
u_int32_t locker = 0;
DB_LOCK lock;
int noop = 0;
int num_retries = 0;
......@@ -460,8 +459,8 @@ retry: /* transaction retry */
if (( rs->sr_err=TXN_ABORT( ltid )) != 0 ) {
rs->sr_text = "txn_abort (no-op) failed";
} else {
noop = 1;
rs->sr_err = LDAP_SUCCESS;
rs->sr_err = LDAP_NO_OPERATION;
goto return_results;
}
} else {
......@@ -488,10 +487,11 @@ retry: /* transaction retry */
}
}
if ( rs->sr_err == LDAP_SUCCESS && !noop && !op->o_no_psearch ) {
if ( rs->sr_err == LDAP_SUCCESS && !op->o_no_psearch ) {
ldap_pvt_thread_rdwr_rlock( &bdb->bi_pslist_rwlock );
LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
bdb_psearch( op, rs, ps_list, op->oq_add.rs_e, LDAP_PSEARCH_BY_ADD );
bdb_psearch( op, rs, ps_list, op->oq_add.rs_e,
LDAP_PSEARCH_BY_ADD );
}
ldap_pvt_thread_rdwr_runlock( &bdb->bi_pslist_rwlock );
}
......@@ -506,7 +506,7 @@ retry: /* transaction retry */
ltid = NULL;
op->o_private = NULL;
if (rs->sr_err != LDAP_SUCCESS) {
if ( rs->sr_err != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ERR,
"bdb_add: %s : %s (%d)\n", rs->sr_text,
......@@ -548,5 +548,5 @@ done:
op->o_private = NULL;
}
return ( ( rs->sr_err == LDAP_SUCCESS ) ? noop : rs->sr_err );
return rs->sr_err;
}
......@@ -40,8 +40,6 @@ bdb_delete( Operation *op, SlapReply *rs )
u_int32_t locker = 0;
DB_LOCK lock, plock;
int noop = 0;
int num_retries = 0;
Operation* ps_list;
......@@ -505,8 +503,8 @@ retry: /* transaction retry */
if ( ( rs->sr_err = TXN_ABORT( ltid ) ) != 0 ) {
rs->sr_text = "txn_abort (no-op) failed";
} else {
noop = 1;
rs->sr_err = LDAP_SUCCESS;
rs->sr_err = LDAP_NO_OPERATION;
goto return_results;
}
} else {
bdb_cache_delete( &bdb->bi_cache, e, bdb->bi_dbenv,
......@@ -519,7 +517,7 @@ retry: /* transaction retry */
}
}
if ( rs->sr_err == LDAP_SUCCESS && !noop && !op->o_no_psearch ) {
if ( rs->sr_err == LDAP_SUCCESS && !op->o_no_psearch ) {
ldap_pvt_thread_rdwr_rlock( &bdb->bi_pslist_rwlock );
LDAP_LIST_FOREACH( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_DELETE );
......@@ -536,7 +534,8 @@ retry: /* transaction retry */
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ERR,
"bdb_delete: txn_%s failed: %s (%d)\n",
op->o_noop ? "abort (no-op)" : "commit", db_strerror(rs->sr_err), rs->sr_err );
op->o_noop ? "abort (no-op)" : "commit",
db_strerror(rs->sr_err), rs->sr_err );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_delete: txn_%s failed: %s (%d)\n",
......@@ -552,7 +551,8 @@ retry: /* transaction retry */
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, RESULTS,
"bdb_delete: deleted%s id=%08lx db=\"%s\"\n",
op->o_noop ? " (no-op)" : "", e->e_id, e->e_dn );
op->o_noop ? " (no-op)" : "",
e->e_id, e->e_dn );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_delete: deleted%s id=%08lx dn=\"%s\"\n",
......@@ -566,7 +566,7 @@ retry: /* transaction retry */
return_results:
send_ldap_result( op, rs );
if(rs->sr_err == LDAP_SUCCESS && bdb->bi_txn_cp ) {
if( rs->sr_err == LDAP_SUCCESS && bdb->bi_txn_cp ) {
ldap_pvt_thread_yield();
TXN_CHECKPOINT( bdb->bi_dbenv,
bdb->bi_txn_cp_kbyte, bdb->bi_txn_cp_min, 0 );
......@@ -588,5 +588,5 @@ done:
op->o_private = NULL;
}
return ( ( rs->sr_err == LDAP_SUCCESS ) ? noop : rs->sr_err );
return rs->sr_err;
}
......@@ -307,8 +307,6 @@ bdb_modify( Operation *op, SlapReply *rs )
u_int32_t locker = 0;
DB_LOCK lock;
int noop = 0;
int num_retries = 0;
LDAPControl *ctrls[SLAP_MAX_RESPONSE_CONTROLS];
......@@ -613,8 +611,8 @@ retry: /* transaction retry */
if ( ( rs->sr_err = TXN_ABORT( ltid ) ) != 0 ) {
rs->sr_text = "txn_abort (no-op) failed";
} else {
noop = 1;
rs->sr_err = LDAP_SUCCESS;
rs->sr_err = LDAP_NO_OPERATION;
goto return_results;
}
} else {
bdb_cache_modify( e, dummy.e_attrs, bdb->bi_dbenv, locker, &lock );
......@@ -626,7 +624,7 @@ retry: /* transaction retry */
}
}
if ( rs->sr_err == LDAP_SUCCESS && !op->o_noop ) {
if ( rs->sr_err == LDAP_SUCCESS ) {
/* Loop through in-scope entries for each psearch spec */
ldap_pvt_thread_rdwr_rlock( &bdb->bi_pslist_rwlock );
LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
......@@ -707,5 +705,5 @@ done:
if( e != NULL ) {
bdb_unlocked_cache_return_entry_w (&bdb->bi_cache, e);
}
return ( ( rs->sr_err == LDAP_SUCCESS ) ? noop : rs->sr_err );
return rs->sr_err;
}
......@@ -58,8 +58,6 @@ bdb_modrdn( Operation *op, SlapReply *rs )
u_int32_t locker = 0;
DB_LOCK lock, plock, nplock;
int noop = 0;
int num_retries = 0;
LDAPControl *ctrls[SLAP_MAX_RESPONSE_CONTROLS];
......@@ -975,8 +973,8 @@ retry: /* transaction retry */
if(( rs->sr_err=TXN_ABORT( ltid )) != 0 ) {
rs->sr_text = "txn_abort (no-op) failed";
} else {
noop = 1;
rs->sr_err = LDAP_SUCCESS;
goto return_results;
}
} else {
......@@ -990,7 +988,7 @@ retry: /* transaction retry */
}
}
if ( rs->sr_err == LDAP_SUCCESS && !op->o_noop ) {
if ( rs->sr_err == LDAP_SUCCESS ) {
/* Loop through in-scope entries for each psearch spec */
ldap_pvt_thread_rdwr_rlock( &bdb->bi_pslist_rwlock );
LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
......@@ -1034,11 +1032,13 @@ retry: /* transaction retry */
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, RESULTS,
"bdb_modrdn: rdn modified%s id=%08lx dn=\"%s\"\n",
op->o_noop ? " (no-op)" : "", e->e_id, e->e_dn );
op->o_noop ? " (no-op)" : "",
e->e_id, e->e_dn );
#else
Debug(LDAP_DEBUG_TRACE,
"bdb_modrdn: rdn modified%s id=%08lx dn=\"%s\"\n",
op->o_noop ? " (no-op)" : "", e->e_id, e->e_dn );
op->o_noop ? " (no-op)" : "",
e->e_id, e->e_dn );
#endif
rs->sr_text = NULL;
if( num_ctrls ) rs->sr_ctrls = ctrls;
......@@ -1106,5 +1106,5 @@ done:
op->o_private = NULL;
}
return ( ( rs->sr_err == LDAP_SUCCESS ) ? noop : rs->sr_err );
return rs->sr_err;
}
......@@ -1212,11 +1212,6 @@ id2entry_retry:
/* safe default */
int result = -1;
#if 0 /* noop is masked SLAP_CTRL_UPDATE */
if( op->o_noop ) {
result = 0;
} else
#endif
if (IS_PSEARCH) {
int premodify_found = 0;
int entry_sync_state;
......
......@@ -55,9 +55,11 @@ sql_back_initialize(
BackendInfo *bi )
{
static char *controls[] = {
#if 0 /* needs updating */
#ifdef LDAP_CONTROL_NOOP
LDAP_CONTROL_NOOP,
#endif
#endif
#ifdef LDAP_CONTROL_VALUESRETURNFILTER
LDAP_CONTROL_VALUESRETURNFILTER,
#endif
......
......@@ -1255,7 +1255,7 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
}
if ( op->o_res_ber == NULL ) {
bytes = op->o_noop ? 0 : send_ldap_ber( op->o_conn, ber );
bytes = send_ldap_ber( op->o_conn, ber );
ber_free_buf( ber );
if ( bytes < 0 ) {
......@@ -1476,7 +1476,7 @@ slap_send_search_reference( Operation *op, SlapReply *rs )
#ifdef LDAP_CONNECTIONLESS
if (!op->o_conn || op->o_conn->c_is_udp == 0) {
#endif
bytes = op->o_noop ? 0 : send_ldap_ber( op->o_conn, ber );
bytes = send_ldap_ber( op->o_conn, ber );
ber_free_buf( ber );
ldap_pvt_thread_mutex_lock( &num_sent_mutex );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment