]> git.sur5r.net Git - openldap/commitdiff
Update no-op control to return LDAP_NO_OPERATION instead of LDAP_SUCCESS.
authorKurt Zeilenga <kurt@openldap.org>
Mon, 29 Dec 2003 23:31:39 +0000 (23:31 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 29 Dec 2003 23:31:39 +0000 (23:31 +0000)
(back-sql needs to be updated)

include/ldap.h
libraries/libldap/error.c
servers/slapd/back-bdb/add.c
servers/slapd/back-bdb/delete.c
servers/slapd/back-bdb/modify.c
servers/slapd/back-bdb/modrdn.c
servers/slapd/back-bdb/search.c
servers/slapd/back-sql/init.c
servers/slapd/result.c

index 3ffdf3ca86d25523b20df7866e4dd134a8eeb6d8..4c6d2c911f8734cfe3d081a8d9672911558eb431 100644 (file)
@@ -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
 
index 00cb5d68dfc767b2c8c072b9e24a8f000e5a7b89..3b4572e3bd645b225d7b9c4148fee4a025704960 100644 (file)
@@ -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")},
index e08f764c4cca4c36835bde5f738aefac94624bf7..763523cdd4279fb0ae68aede36f88235297e82cc 100644 (file)
@@ -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;
 }
index eca84dcfeec8675e85dfa9fddf90b9dc0f8505d9..f374e9e110b2daeaab0e2ff9fdc93af190309e26 100644 (file)
@@ -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;
 }
index 9debb6c59cda4619e9c8134fff62df805dbf5bc9..5a1e857d0e92033a87d842313c38a3bf742a985f 100644 (file)
@@ -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;
 }
index f1d58647f8faa3e1a5ee9c471de67e117f2a1818..8fe60a078b61e57261b224696eb93004b7d79a30 100644 (file)
@@ -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;
 }
index 382817c8d1e5743a74358f941d23b6ab15c2fbdb..7223daecc0208fdd88450d359a9a3b1ad5ab2d72 100644 (file)
@@ -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;
index c4fb088a518e945b63058645570edefbd12ae93d..46e89cd14b0b535cb1d2eb6c7978156c3bc0de0a 100644 (file)
@@ -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
index 0a75e2302494b1271b4a4f370dddd8edfccbbbe5..23ba65a10295a446b7d68d6898bdf4ed1a8341e8 100644 (file)
@@ -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 );