From: Kurt Zeilenga Date: Mon, 29 Dec 2003 23:31:39 +0000 (+0000) Subject: Update no-op control to return LDAP_NO_OPERATION instead of LDAP_SUCCESS. X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~84 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2775c8d4a8f60a48295fc7c358faa3c7a2a5e91b;p=openldap Update no-op control to return LDAP_NO_OPERATION instead of LDAP_SUCCESS. (back-sql needs to be updated) --- diff --git a/include/ldap.h b/include/ldap.h index 3ffdf3ca86..4c6d2c911f 100644 --- a/include/ldap.h +++ b/include/ldap.h @@ -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 diff --git a/libraries/libldap/error.c b/libraries/libldap/error.c index 00cb5d68df..3b4572e3bd 100644 --- a/libraries/libldap/error.c +++ b/libraries/libldap/error.c @@ -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")}, diff --git a/servers/slapd/back-bdb/add.c b/servers/slapd/back-bdb/add.c index e08f764c4c..763523cdd4 100644 --- a/servers/slapd/back-bdb/add.c +++ b/servers/slapd/back-bdb/add.c @@ -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; } diff --git a/servers/slapd/back-bdb/delete.c b/servers/slapd/back-bdb/delete.c index eca84dcfee..f374e9e110 100644 --- a/servers/slapd/back-bdb/delete.c +++ b/servers/slapd/back-bdb/delete.c @@ -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; } diff --git a/servers/slapd/back-bdb/modify.c b/servers/slapd/back-bdb/modify.c index 9debb6c59c..5a1e857d0e 100644 --- a/servers/slapd/back-bdb/modify.c +++ b/servers/slapd/back-bdb/modify.c @@ -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; } diff --git a/servers/slapd/back-bdb/modrdn.c b/servers/slapd/back-bdb/modrdn.c index f1d58647f8..8fe60a078b 100644 --- a/servers/slapd/back-bdb/modrdn.c +++ b/servers/slapd/back-bdb/modrdn.c @@ -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; } diff --git a/servers/slapd/back-bdb/search.c b/servers/slapd/back-bdb/search.c index 382817c8d1..7223daecc0 100644 --- a/servers/slapd/back-bdb/search.c +++ b/servers/slapd/back-bdb/search.c @@ -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; diff --git a/servers/slapd/back-sql/init.c b/servers/slapd/back-sql/init.c index c4fb088a51..46e89cd14b 100644 --- a/servers/slapd/back-sql/init.c +++ b/servers/slapd/back-sql/init.c @@ -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 diff --git a/servers/slapd/result.c b/servers/slapd/result.c index 0a75e23024..23ba65a102 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -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 );