From c3c3c9c16bc364be5c72346e3afd61c6dcb2e177 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Fri, 5 Oct 2007 09:26:48 +0000 Subject: [PATCH] support de-normalization --- servers/slapd/schema_init.c | 13 +++++++++++++ servers/slapd/slap.h | 5 ++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c index 34dbc86cee..41250c0190 100644 --- a/servers/slapd/schema_init.c +++ b/servers/slapd/schema_init.c @@ -2348,6 +2348,19 @@ UUIDNormalize( unsigned char octet = '\0'; int i; int j; + + if ( SLAP_MR_IS_DENORMALIZE( usage ) ) { + /* NOTE: must be a normalized UUID */ + assert( val->bv_len == 16 ); + + normalized->bv_val = slap_sl_malloc( LDAP_LUTIL_UUIDSTR_BUFSIZE, ctx ); + normalized->bv_len = lutil_uuidstr_from_normalized( val->bv_val, + val->bv_len, normalized->bv_val, LDAP_LUTIL_UUIDSTR_BUFSIZE ); + assert( normalized->bv_len == STRLENOF( "BADBADBA-DBAD-0123-4567-BADBADBADBAD" ) ); + + return LDAP_SUCCESS; + } + normalized->bv_len = 16; normalized->bv_val = slap_sl_malloc( normalized->bv_len + 1, ctx ); diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index bf181aeb9e..eae710d0ce 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -556,7 +556,8 @@ struct MatchingRule { */ #define SLAP_MR_VALUE_OF_ASSERTION_SYNTAX 0x0001U #define SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX 0x0002U -#define SLAP_MR_VALUE_OF_SYNTAX 0x0003U +#define SLAP_MR_VALUE_OF_SYNTAX (SLAP_MR_VALUE_OF_ASSERTION_SYNTAX|SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX) +#define SLAP_MR_DENORMALIZE (SLAP_MR_MUTATION_NORMALIZER) #define SLAP_MR_IS_VALUE_OF_ATTRIBUTE_SYNTAX( usage ) \ ((usage) & SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX ) @@ -568,6 +569,8 @@ struct MatchingRule { #else #define SLAP_MR_IS_VALUE_OF_SYNTAX( usage ) (1) #endif +#define SLAP_MR_IS_DENORMALIZE( usage ) \ + ((usage) & SLAP_MR_DENORMALIZE ) /* either or both the asserted value or attribute value * may be provided in normalized form -- 2.39.5