From 84830fdc157083f0bd79012d4aa2020b09e0d30b Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 22 Nov 2022 19:46:21 +0000 Subject: [PATCH] ITS#9880 slapo-accesslog: fix reqStart ordering filter Same as ITS#9358 but for ordering matching rule, not just equality --- servers/slapd/at.c | 11 +++++++++++ servers/slapd/overlays/accesslog.c | 11 ++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/servers/slapd/at.c b/servers/slapd/at.c index 63a9e9c451..99efba65d8 100644 --- a/servers/slapd/at.c +++ b/servers/slapd/at.c @@ -274,6 +274,17 @@ at_clean( AttributeType *a ) } } + if ( a->sat_ordering ) { + MatchingRule *mr; + + mr = mr_find( a->sat_ordering->smr_oid ); + assert( mr != NULL ); + if ( mr != a->sat_ordering ) { + ch_free( a->sat_ordering ); + a->sat_ordering = NULL; + } + } + assert( a->sat_syntax != NULL ); if ( a->sat_syntax != NULL ) { Syntax *syn; diff --git a/servers/slapd/overlays/accesslog.c b/servers/slapd/overlays/accesslog.c index cbdaa53b51..772b584917 100644 --- a/servers/slapd/overlays/accesslog.c +++ b/servers/slapd/overlays/accesslog.c @@ -2668,7 +2668,7 @@ int accesslog_initialize() { int i, rc; Syntax *rdnTimestampSyntax; - MatchingRule *rdnTimestampMatch; + MatchingRule *rdnTimestampMatch, *rdnTimestampOrdering; accesslog.on_bi.bi_type = "accesslog"; accesslog.on_bi.bi_db_init = accesslog_db_init; @@ -2732,21 +2732,26 @@ int accesslog_initialize() /* Inject custom normalizer for reqStart/reqEnd */ rdnTimestampMatch = ch_malloc( sizeof( MatchingRule )); + rdnTimestampOrdering = ch_malloc( sizeof( MatchingRule )); rdnTimestampSyntax = ch_malloc( sizeof( Syntax )); *rdnTimestampMatch = *ad_reqStart->ad_type->sat_equality; rdnTimestampMatch->smr_normalize = rdnTimestampNormalize; + *rdnTimestampOrdering = *ad_reqStart->ad_type->sat_ordering; + rdnTimestampOrdering->smr_normalize = rdnTimestampNormalize; *rdnTimestampSyntax = *ad_reqStart->ad_type->sat_syntax; rdnTimestampSyntax->ssyn_validate = rdnTimestampValidate; ad_reqStart->ad_type->sat_equality = rdnTimestampMatch; + ad_reqStart->ad_type->sat_ordering = rdnTimestampOrdering; ad_reqStart->ad_type->sat_syntax = rdnTimestampSyntax; rdnTimestampMatch = ch_malloc( sizeof( MatchingRule )); + rdnTimestampOrdering = ch_malloc( sizeof( MatchingRule )); rdnTimestampSyntax = ch_malloc( sizeof( Syntax )); *rdnTimestampMatch = *ad_reqStart->ad_type->sat_equality; - rdnTimestampMatch->smr_normalize = rdnTimestampNormalize; + *rdnTimestampOrdering = *ad_reqStart->ad_type->sat_ordering; *rdnTimestampSyntax = *ad_reqStart->ad_type->sat_syntax; - rdnTimestampSyntax->ssyn_validate = rdnTimestampValidate; ad_reqEnd->ad_type->sat_equality = rdnTimestampMatch; + ad_reqEnd->ad_type->sat_ordering = rdnTimestampOrdering; ad_reqEnd->ad_type->sat_syntax = rdnTimestampSyntax; for ( i=0; locs[i].ot; i++ ) { -- 2.47.2