]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#10497 Use the wants_ as a shorthand where already good
authorOndřej Kuzník <ondra@mistotebe.net>
Mon, 27 Apr 2026 10:34:04 +0000 (11:34 +0100)
committerQuanah Gibson-Mount <quanah@openldap.org>
Wed, 29 Apr 2026 00:09:35 +0000 (00:09 +0000)
13 files changed:
contrib/slapd-modules/variant/variant.c
servers/slapd/back-mdb/search.c
servers/slapd/back-null/null.c
servers/slapd/back-sql/search.c
servers/slapd/back-wt/search.c
servers/slapd/backglue.c
servers/slapd/limits.c
servers/slapd/overlays/dynlist.c
servers/slapd/overlays/sssvlv.c
servers/slapd/overlays/syncprov.c
servers/slapd/overlays/translucent.c
servers/slapd/overlays/unique.c
servers/slapd/overlays/valsort.c

index 3c8867bd849eff8d7d0de851d410396e82034a48..bd59721b865d76156fe8e4255f0d53781fb3752d 100644 (file)
@@ -579,7 +579,7 @@ variant_op_search( Operation *op, SlapReply *rs )
        int variantInScope = 0, rc = SLAP_CB_CONTINUE,
                nmatch = sizeof(pmatch) / sizeof(regmatch_t);
 
-       if ( ov->passReplication && ( op->o_sync > SLAP_CONTROL_IGNORED ) ) {
+       if ( ov->passReplication && wants_sync( op ) ) {
                return SLAP_CB_CONTINUE;
        }
 
index cab352d0e7dac271a74ed3dcd94e3f78ca443991..6df40eaa6b6d1d6b80214cbbf82bf11d08290690 100644 (file)
@@ -739,7 +739,7 @@ adminlimit:
                op->o_callback = &cb;
        }
 
-       if ( get_pagedresults( op ) > SLAP_CONTROL_IGNORED ) {
+       if ( wants_pagedresults( op ) ) {
                PagedResultsState *ps = op->o_pagedresults_state;
                /* deferred cookie parsing */
                rs->sr_err = parse_paged_cookie( op, rs );
@@ -1096,7 +1096,7 @@ notfound:
 
                if ( rs->sr_err == LDAP_COMPARE_TRUE ) {
                        /* check size limit */
-                       if ( get_pagedresults(op) > SLAP_CONTROL_IGNORED ) {
+                       if ( wants_pagedresults(op) ) {
                                if ( rs->sr_nentries >= ((PagedResultsState *)op->o_pagedresults_state)->ps_size ) {
                                        if (e != base)
                                                mdb_entry_return( op, e );
@@ -1216,7 +1216,7 @@ nochange:
        rs->sr_ref = rs->sr_v2ref;
        rs->sr_err = (rs->sr_v2ref == NULL) ? LDAP_SUCCESS : LDAP_REFERRAL;
        rs->sr_rspoid = NULL;
-       if ( get_pagedresults(op) > SLAP_CONTROL_IGNORED ) {
+       if ( wants_pagedresults(op) ) {
                send_paged_response( op, rs, NULL, 0 );
        } else {
                send_ldap_result( op, rs );
@@ -1458,7 +1458,7 @@ parse_paged_cookie( Operation *op, SlapReply *rs )
        /* this function must be invoked only if the pagedResults
         * control has been detected, parsed and partially checked
         * by the frontend */
-       assert( get_pagedresults( op ) > SLAP_CONTROL_IGNORED );
+       assert( wants_pagedresults( op ) );
 
        /* cookie decoding/checks deferred to backend... */
        if ( ps->ps_cookieval.bv_len ) {
index 0563653a398a4bd5da4dec496e121057a9d272a0..1a420d1f2f06eb0f19c611f95788b26e27ace4b0 100644 (file)
@@ -217,7 +217,7 @@ null_back_respond( Operation *op, SlapReply *rs, int rc )
                }
        }
 
-       if ( get_pagedresults( op ) > SLAP_CONTROL_IGNORED ) {
+       if ( wants_pagedresults( op ) ) {
                struct berval           cookie = BER_BVC( "" );
 
                /* should not be here... */
index f1e706813ea7d12ceb9364166d412b494c2341be..6cc98fcd863cccc6a96e7b88d2a5c3805dd88f0f 100644 (file)
@@ -1663,7 +1663,7 @@ backsql_srch_query( backsql_srch_info *bsi, struct berval *query )
 
 #ifndef BACKSQL_ARBITRARY_KEY
        /* If paged results are in effect, ignore low ldap_entries.id numbers */
-       if ( get_pagedresults(bsi->bsi_op) > SLAP_CONTROL_IGNORED ) {
+       if ( wants_pagedresults(bsi->bsi_op) ) {
                unsigned long lowid = 0;
 
                /* Pick up the previous ldap_entries.id if the previous page ended in this objectClass */
@@ -1768,7 +1768,7 @@ backsql_oc_get_candidates( void *v_oc, void *v_bsi )
 
 #ifndef BACKSQL_ARBITRARY_KEY
        /* If paged results have already completed this objectClass, skip it */
-       if ( get_pagedresults(op) > SLAP_CONTROL_IGNORED ) {
+       if ( wants_pagedresults(op) ) {
                if ( oc->bom_id < PAGECOOKIE_TO_SQL_OC( ((PagedResultsState *)op->o_pagedresults_state)->ps_cookie ) )
                {
                        return BACKSQL_AVL_CONTINUE;
@@ -2232,7 +2232,7 @@ backsql_search( Operation *op, SlapReply *rs )
 
 #ifndef BACKSQL_ARBITRARY_KEY
        /* If paged results are in effect, check the paging cookie */
-       if ( get_pagedresults( op ) > SLAP_CONTROL_IGNORED ) {
+       if ( wants_pagedresults( op ) ) {
                rs->sr_err = parse_paged_cookie( op, rs );
                if ( rs->sr_err != LDAP_SUCCESS ) {
                        send_ldap_result( op, rs );
@@ -2513,7 +2513,7 @@ backsql_search( Operation *op, SlapReply *rs )
                {
 #ifndef BACKSQL_ARBITRARY_KEY
                        /* If paged results are in effect, see if the page limit was exceeded */
-                       if ( get_pagedresults(op) > SLAP_CONTROL_IGNORED ) {
+                       if ( wants_pagedresults(op) ) {
                                if ( rs->sr_nentries >= ((PagedResultsState *)op->o_pagedresults_state)->ps_size )
                                {
                                        e = NULL;
@@ -2572,7 +2572,7 @@ end_of_search:;
 send_results:;
        if ( rs->sr_err != SLAPD_ABANDON ) {
 #ifndef BACKSQL_ARBITRARY_KEY
-               if ( get_pagedresults(op) > SLAP_CONTROL_IGNORED ) {
+               if ( wants_pagedresults(op) ) {
                        send_paged_response( op, rs, NULL );
                } else
 #endif /* ! BACKSQL_ARBITRARY_KEY */
@@ -2780,7 +2780,7 @@ parse_paged_cookie( Operation *op, SlapReply *rs )
        /* this function must be invoked only if the pagedResults
         * control has been detected, parsed and partially checked
         * by the frontend */
-       assert( get_pagedresults( op ) > SLAP_CONTROL_IGNORED );
+       assert( wants_pagedresults( op ) );
 
        /* cookie decoding/checks deferred to backend... */
        if ( ps->ps_cookieval.bv_len ) {
index 2c46755e645b675d4c7e4a5ba14a2b1b33aee2cc..886de11f2351a86ce65e8ce4f92601d0265a18c8 100644 (file)
@@ -230,7 +230,7 @@ parse_paged_cookie( Operation *op, SlapReply *rs )
        /* this function must be invoked only if the pagedResults
      * control has been detected, parsed and partially checked
      * by the frontend */
-       assert( get_pagedresults( op ) > SLAP_CONTROL_IGNORED );
+       assert( wants_pagedresults( op ) );
 
        /* cookie decoding/checks deferred to backend... */
        if ( ps->ps_cookieval.bv_len ) {
@@ -502,7 +502,7 @@ wt_search( Operation *op, SlapReply *rs )
                tentries = WT_IDL_N(candidates);
        }
 
-       if ( get_pagedresults( op ) > SLAP_CONTROL_IGNORED ) {
+       if ( wants_pagedresults( op ) ) {
                /* TODO: pageresult */
                PagedResultsState *ps = op->o_pagedresults_state;
                /* deferred cookie parsing */
@@ -663,7 +663,7 @@ loop_begin:
                rs->sr_err = test_filter( op, e, op->oq_search.rs_filter );
                if ( rs->sr_err == LDAP_COMPARE_TRUE ) {
                        /* check size limit */
-                       if ( get_pagedresults(op) > SLAP_CONTROL_IGNORED ) {
+                       if ( wants_pagedresults(op) ) {
                                if ( rs->sr_nentries >= ((PagedResultsState *)op->o_pagedresults_state)->ps_size ) {
                                        wt_entry_return( e );
                                        e = NULL;
@@ -722,7 +722,7 @@ nochange:
        rs->sr_ref = rs->sr_v2ref;
        rs->sr_err = (rs->sr_v2ref == NULL) ? LDAP_SUCCESS : LDAP_REFERRAL;
        rs->sr_rspoid = NULL;
-       if ( get_pagedresults(op) > SLAP_CONTROL_IGNORED ) {
+       if ( wants_pagedresults(op) ) {
                send_paged_response( op, rs, NULL, 0 );
        } else {
                send_ldap_result( op, rs );
index 30a7f478e26bbd98d4f16c31a87fcc49d658d537..91f37a5a107c084b10a4eb5ef70d47fe443cf549 100644 (file)
@@ -176,7 +176,7 @@ glue_op_response ( Operation *op, SlapReply *rs )
                                /* Forget old pagedResults response if we're sending
                                 * a new one now
                                 */
-                               if ( get_pagedresults( op ) > SLAP_CONTROL_IGNORED ) {
+                               if ( wants_pagedresults( op ) ) {
                                        int newpage = 0;
                                        for ( k=0; k<i; k++ ) {
                                                if ( !strcmp(rs->sr_ctrls[k]->ldctl_oid,
@@ -411,7 +411,7 @@ glue_op_search ( Operation *op, SlapReply *rs )
        stoptime = slap_get_time () + op->ors_tlimit;
 
        /* reset dummy cookie used to keep paged results going across databases */
-       if ( get_pagedresults( op ) > SLAP_CONTROL_IGNORED
+       if ( wants_pagedresults( op )
                && bvmatch( &((PagedResultsState *)op->o_pagedresults_state)->ps_cookieval, &gluecookie ) )
        {
                PagedResultsState *ps = op->o_pagedresults_state;
@@ -486,7 +486,7 @@ glue_op_search ( Operation *op, SlapReply *rs )
                        /* If we remembered which backend we were on before,
                         * skip down to it now
                         */
-                       if ( get_pagedresults( op ) > SLAP_CONTROL_IGNORED &&
+                       if ( wants_pagedresults( op ) &&
                                op->o_conn->c_pagedresults_state.ps_be &&
                                op->o_conn->c_pagedresults_state.ps_be != btmp )
                                continue;
@@ -573,7 +573,7 @@ glue_op_search ( Operation *op, SlapReply *rs )
                                goto end_of_loop;
 
                        case LDAP_SUCCESS:
-                               if ( get_pagedresults( op ) > SLAP_CONTROL_IGNORED ) {
+                               if ( wants_pagedresults( op ) ) {
                                        PagedResultsState *ps = op->o_pagedresults_state;
 
                                        /* Assume this backend can be forgotten now */
index 6ed333cafb184f99a87f33bf974bd9e8bebba35c..7e3bffa4d3e0db76554a24cc82ccc1792e83e758 100644 (file)
@@ -1090,7 +1090,7 @@ limits_check( Operation *op, SlapReply *rs )
                }
 
                /* if paged results and slimit are requested */ 
-               if ( get_pagedresults( op ) > SLAP_CONTROL_IGNORED &&
+               if ( wants_pagedresults( op ) &&
                        op->ors_slimit != SLAP_NO_LIMIT ) {
                        PagedResultsState *ps = op->o_pagedresults_state;
                        int total = op->ors_slimit - ps->ps_count;
@@ -1150,7 +1150,7 @@ limits_check( Operation *op, SlapReply *rs )
                }
 
                /* if paged results is requested */     
-               if ( get_pagedresults( op ) > SLAP_CONTROL_IGNORED ) {
+               if ( wants_pagedresults( op ) ) {
                        int     slimit = -2;
                        int     pr_total;
                        PagedResultsState *ps = op->o_pagedresults_state;
index 16672dae36a351ddcfd8832aaee134ca272406bf..3aa84c699e85fba1cedd65aff139fc37e9508449 100644 (file)
@@ -1704,7 +1704,7 @@ dynlist_search2resp( Operation *op, SlapReply *rs )
                dynlist_filterinst_t *df = NULL;
                int ndf = 0;
 
-               if ( get_pagedresults( op ) > SLAP_CONTROL_IGNORED )
+               if ( wants_pagedresults( op ) )
                        return SLAP_CB_CONTINUE;
 
                /* Check for any unexpanded dynamic group entries that weren't picked up
index 91b675b7a414b7248d6c91f8af353a657f09c334..519e195e7615b753f91d8f19c856796385b23464 100644 (file)
@@ -850,7 +850,7 @@ static int sssvlv_op_search(
                goto leave;
        }
 
-       ps = ( op->o_pagedresults > SLAP_CONTROL_IGNORED ) ?
+       ps = wants_pagedresults( op ) ?
                (PagedResultsState*)(op->o_pagedresults_state) : NULL;
        vc = op->o_ctrlflag[vlv_cid] > SLAP_CONTROL_IGNORED ?
                op->o_controls[vlv_cid] : NULL;
index 9c40a2d8a219a457cf81a5db7b5df3ab3a1edf46..80b64d0972a867d1b123431c0eb4a846ddd4486c 100644 (file)
@@ -987,7 +987,7 @@ syncprov_sendresp( Operation *op, resinfo *ri, syncops *so, int mode )
 
        switch( mode ) {
        case LDAP_SYNC_ADD:
-               if ( ri->ri_isref && so->s_op->o_managedsait <= SLAP_CONTROL_IGNORED ) {
+               if ( ri->ri_isref && !wants_manageDSAit( so->s_op ) ) {
                        rs.sr_ref = get_entry_referrals( op, rs.sr_entry );
                        rs.sr_err = send_search_reference( op, &rs );
                        ber_bvarray_free( rs.sr_ref );
@@ -1009,7 +1009,7 @@ syncprov_sendresp( Operation *op, resinfo *ri, syncops *so, int mode )
                e_uuid.e_attrs = NULL;
                e_uuid.e_name = ri->ri_dn;
                e_uuid.e_nname = ri->ri_ndn;
-               if ( ri->ri_isref && so->s_op->o_managedsait <= SLAP_CONTROL_IGNORED ) {
+               if ( ri->ri_isref && !wants_manageDSAit( so->s_op ) ) {
                        struct berval bv = BER_BVNULL;
                        rs.sr_ref = &bv;
                        rs.sr_err = send_search_reference( op, &rs );
@@ -3162,7 +3162,7 @@ syncprov_op_search( Operation *op, SlapReply *rs )
        int minsid, maxsid;
        int dirty = 0;
 
-       if ( op->o_sync > SLAP_CONTROL_IGNORED ) {
+       if ( wants_sync( op ) ) {
                cb = op->o_tmpcalloc( 1, sizeof(slap_callback), op->o_tmpmemctx );
                cb->sc_response = syncprov_search_cb;
                cb->sc_cleanup = syncprov_search_cleanup;
index 6b2220befc75dfdc4c3ac04142e1028529c1f7fc..dc8e3bc58568af10a5f56389aa7860631f0e7305 100644 (file)
@@ -1137,7 +1137,7 @@ static int translucent_search(Operation *op, SlapReply *rs) {
        struct berval fbv;
        int rc = 0;
 
-       if ( op->o_managedsait > SLAP_CONTROL_IGNORED )
+       if ( wants_manageDSAit( op ) )
                return SLAP_CB_CONTINUE;
 
        Debug(LDAP_DEBUG_TRACE, "==> translucent_search: <%s> %s\n",
index 526ea770c9c6088bf429681ac28115e4c4f5e2eb..52d1104d9c95b23e7c00fd99a0f470915b04c0f2 100644 (file)
@@ -1078,8 +1078,7 @@ unique_add(
              op->o_req_dn.bv_val );
 
        if ( be_shadow_update( op ) || (
-                       get_relax(op) > SLAP_CONTROL_IGNORED
-                       && access_allowed( op, op->ora_e,
+                       wants_relax( op ) && access_allowed( op, op->ora_e,
                                slap_schema.si_ad_entry, NULL,
                                ACL_MANAGE, NULL ) ) ) {
                return rc;
@@ -1232,7 +1231,7 @@ unique_modify(
        if ( be_shadow_update( op ) ) {
                return rc;
        }
-       if ( get_relax(op) > SLAP_CONTROL_IGNORED
+       if ( wants_relax(op)
                && overlay_entry_get_ov( op, &op->o_req_ndn, NULL, NULL, 0, &e, on ) == LDAP_SUCCESS
                && e
                && access_allowed( op, e,
@@ -1372,7 +1371,7 @@ unique_modrdn(
        if ( be_shadow_update( op ) ) {
                return rc;
        }
-       if ( get_relax(op) > SLAP_CONTROL_IGNORED
+       if ( wants_relax(op)
                && overlay_entry_get_ov( op, &op->o_req_ndn, NULL, NULL, 0, &e, on ) == LDAP_SUCCESS
                && e
                && access_allowed( op, e,
index dd5f21308d2ba0fef646ad8a943fe566045c014a..7fd427dc0f02591ed2c26116074c69c074f4db3c 100644 (file)
@@ -279,8 +279,7 @@ valsort_response( Operation *op, SlapReply *rs )
        /* If this is not a search response, or it is a syncrepl response,
         * or the valsort control wants raw results, pass thru unmodified.
         */
-       if ( rs->sr_type != REP_SEARCH ||
-               ( _SCM(op->o_sync) > SLAP_CONTROL_IGNORED ) ||
+       if ( rs->sr_type != REP_SEARCH || wants_sync( op ) ||
                ( op->o_ctrlflag[valsort_cid] & SLAP_CONTROL_DATA0))
                return SLAP_CB_CONTINUE;