]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#7441 Consider both parts of an X-ORDERED value 662/head
authorOndřej Kuzník <ondra@mistotebe.net>
Mon, 4 Dec 2023 14:30:50 +0000 (14:30 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 8 Dec 2025 18:52:59 +0000 (18:52 +0000)
servers/slapd/bconfig.c
servers/slapd/value.c

index a5ff9c127ebc09a8c3bdf0e130523d2634720eaf..6bfd4118c8c05455b7868bc98d01f4ad0c49f5dd 100644 (file)
@@ -7067,6 +7067,42 @@ out:
        return rs->sr_err;
 }
 
+static int
+config_back_compare( Operation *op, SlapReply *rs )
+{
+       CfBackInfo *cfb;
+       CfEntryInfo *ce, *last;
+       slap_mask_t mask;
+
+       cfb = (CfBackInfo *)op->o_bd->be_private;
+
+       ldap_pvt_thread_rdwr_rlock( &cfb->cb_rwlock );
+       ce = config_find_base( cfb->cb_root, &op->o_req_ndn, &last, op );
+       if ( !ce ) {
+               if ( last )
+                       rs->sr_matched = last->ce_entry->e_name.bv_val;
+               rs->sr_err = LDAP_NO_SUCH_OBJECT;
+               goto out;
+       }
+       if ( !access_allowed_mask( op, ce->ce_entry, slap_schema.si_ad_entry, NULL,
+               ACL_COMPARE, NULL, &mask ))
+       {
+               if ( !ACL_GRANT( mask, ACL_DISCLOSE )) {
+                       rs->sr_err = LDAP_NO_SUCH_OBJECT;
+               } else {
+                       rs->sr_err = LDAP_INSUFFICIENT_ACCESS;
+               }
+               goto out;
+       }
+
+       rs->sr_err = slap_compare_entry( op, ce->ce_entry, op->orc_ava );
+
+out:
+       ldap_pvt_thread_rdwr_runlock( &cfb->cb_rwlock );
+       send_ldap_result( op, rs );
+       return rs->sr_err;
+}
+
 int config_entry_release(
        Operation *op,
        Entry *e,
@@ -8221,7 +8257,7 @@ config_back_initialize( BackendInfo *bi )
        bi->bi_op_bind = config_back_bind;
        bi->bi_op_unbind = 0;
        bi->bi_op_search = config_back_search;
-       bi->bi_op_compare = 0;
+       bi->bi_op_compare = config_back_compare;
        bi->bi_op_modify = config_back_modify;
        bi->bi_op_modrdn = config_back_modrdn;
        bi->bi_op_add = config_back_add;
index 00e6bed665a3d7f1f79343da5c9b81374a1f8931..5aa5061b8421c287039e43f867b0c4fb2ddb9b55 100644 (file)
@@ -669,17 +669,15 @@ ordered_value_match(
                        }
                }
 
-               if ( SLAP_MR_IS_VALUE_OF_ASSERTION_SYNTAX( flags )) {
-                       if ( !BER_BVISNULL( &ns2 ) && !BER_BVISNULL( &ns1 ) ) {
-                               /* compare index values first */
-                               (void)octetStringOrderingMatch( match, 0, NULL, NULL, &ns1, &ns2 );
-
-                               /* If not equal, or we're only comparing the index,
-                                * return result now.
-                                */
-                               if ( *match != 0 || BER_BVISEMPTY( &bv2 ) ) {
-                                       return LDAP_SUCCESS;
-                               }
+               if ( !BER_BVISNULL( &ns2 ) && !BER_BVISNULL( &ns1 ) ) {
+                       /* compare index values first */
+                       (void)octetStringOrderingMatch( match, 0, NULL, NULL, &ns1, &ns2 );
+
+                       /* If not equal, or we're only comparing the index,
+                        * return result now.
+                        */
+                       if ( *match != 0 || BER_BVISEMPTY( &bv2 ) ) {
+                               return LDAP_SUCCESS;
                        }
                }