]> git.sur5r.net Git - openldap/commitdiff
support de-normalization
authorPierangelo Masarati <ando@openldap.org>
Fri, 5 Oct 2007 09:26:48 +0000 (09:26 +0000)
committerPierangelo Masarati <ando@openldap.org>
Fri, 5 Oct 2007 09:26:48 +0000 (09:26 +0000)
servers/slapd/schema_init.c
servers/slapd/slap.h

index 34dbc86cee05e6eeb9aa6812436a32c021662fd0..41250c019014263ac9a55971d17ae32d78285b57 100644 (file)
@@ -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 );
 
index bf181aeb9e14b07e3e461ff20683e085ff9e2e02..eae710d0ce47fe862f5e7591eb49fc83cfccfe93 100644 (file)
@@ -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