]> git.sur5r.net Git - openldap/commitdiff
Enabling sharing component descriptions of primitive ASN.1 types
authorSang Seok Lim <slim@openldap.org>
Tue, 21 Dec 2004 04:44:19 +0000 (04:44 +0000)
committerSang Seok Lim <slim@openldap.org>
Tue, 21 Dec 2004 04:44:19 +0000 (04:44 +0000)
contrib/slapd-modules/comp_match/asn_to_syn_mr.c
contrib/slapd-modules/comp_match/componentlib.c
contrib/slapd-modules/comp_match/componentlib.h
contrib/slapd-modules/comp_match/init.c

index 930b39cba74695673d618d166bb27af1cb298a3a..e7e1ee7c3a730b7d68c92cd9bf26c9807f6ad337 100644 (file)
@@ -1,6 +1,7 @@
 #include <component.h>
 #include "asn.h"
 #include "componentlib.h"
+#include "certificate.h"
 
 AsnTypetoMatchingRuleTable directory_component_matching_table[] = {
        "1.2.36.79672281.1.13.7",
@@ -163,35 +164,116 @@ AsnTypetoCompType asntype_to_compType_mapping_tbl[] = {
 };
 
 AsnTypetoCompDesc asntype_to_compdesc_mapping_tbl[] = {
-{ BASICTYPE_BOOLEAN,{}},
-{ BASICTYPE_INTEGER, {}},
-{ BASICTYPE_BITSTRING, {}},
-{ BASICTYPE_OCTETSTRING, {}},
-{ BASICTYPE_NULL, {}},
-{ BASICTYPE_OID, {}},
-{ BASICTYPE_REAL, {}},
-{ BASICTYPE_ENUMERATED, {}},
-{ BASICTYPE_NUMERIC_STR, {}},
-{ BASICTYPE_PRINTABLE_STR, {}},
-{ BASICTYPE_UNIVERSAL_STR, {}},
-{ BASICTYPE_IA5_STR, {}},
-{ BASICTYPE_BMP_STR, {}},
-{ BASICTYPE_UTF8_STR, {}},
-{ BASICTYPE_UTCTIME, {}},
-{ BASICTYPE_GENERALIZEDTIME, {}},
-{ BASICTYPE_GRAPHIC_STR, {}},
-{ BASICTYPE_VISIBLE_STR, {}},
-{ BASICTYPE_GENERAL_STR,{}},
-{ BASICTYPE_OBJECTDESCRIPTOR, {}},
-{ BASICTYPE_VIDEOTEX_STR, {}},
-{ BASICTYPE_T61_STR, {}},
-{ BASICTYPE_OCTETCONTAINING, {}},
-{ BASICTYPE_BITCONTAINING, {}},
-{ BASICTYPE_RELATIVE_OID, {}},
+{ BASICTYPE_BOOLEAN, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_BOOLEAN,
+       (encoder_func*)NULL,(encoder_func*)GEncComponentBool,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentBool,(ber_decoder_func*)BDecComponentBool,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentBool}},
+{ BASICTYPE_INTEGER, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_INTEGER,
+       (encoder_func*)NULL,(encoder_func*)GEncComponentInt,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentInt,(ber_decoder_func*)BDecComponentInt,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentInt}},
+{ BASICTYPE_BITSTRING, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_BITSTRING,
+       (encoder_func*)NULL,(encoder_func*)GEncComponentBits,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentBits,(ber_decoder_func*)BDecComponentBits,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentBits}},
+{ BASICTYPE_OCTETSTRING, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_OCTETSTRING,
+       (encoder_func*)NULL,(encoder_func*)GEncComponentOcts,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentOcts,(ber_decoder_func*)BDecComponentOcts,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentOcts}},
+{ BASICTYPE_NULL, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_NULL,
+       (encoder_func*)NULL,(encoder_func*)GEncComponentNull,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentNull,(ber_decoder_func*)BDecComponentNull,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentNull}},
+{ BASICTYPE_OID, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_OID,
+       (encoder_func*)NULL,(encoder_func*)GEncComponentOid,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentOid,(ber_decoder_func*)BDecComponentOid,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentOid}},
+{ BASICTYPE_REAL, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_REAL,
+       (encoder_func*)NULL,(encoder_func*)GEncComponentReal,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentReal,(ber_decoder_func*)BDecComponentReal,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentReal}},
+{ BASICTYPE_ENUMERATED, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_ENUMERATED,
+       (encoder_func*)NULL,(encoder_func*)GEncComponentEnum,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentEnum,(ber_decoder_func*)BDecComponentEnum,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentEnum}},
+{ BASICTYPE_NUMERIC_STR, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_NUMERIC_STR,
+       (encoder_func*)NULL,(encoder_func*)GEncComponentNumericString,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentNumericString,(ber_decoder_func*)BDecComponentNumericString,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentNumericString}},
+{ BASICTYPE_PRINTABLE_STR, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_PRINTABLE_STR,
+       (encoder_func*)NULL,(encoder_func*)GEncComponentPrintableString,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentPrintableString,(ber_decoder_func*)BDecComponentPrintableString,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentPrintableString}},
+{ BASICTYPE_UNIVERSAL_STR, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_UNIVERSAL_STR,
+       (encoder_func*)NULL,(encoder_func*)GEncComponentUniversalString,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentUniversalString,(ber_decoder_func*)BDecComponentUniversalString,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentUniversalString}},
+{ BASICTYPE_IA5_STR, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_IA5_STR,
+       (encoder_func*)NULL,(encoder_func*)GEncComponentIA5String,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentIA5String,(ber_decoder_func*)BDecComponentIA5String,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentIA5String}},
+{ BASICTYPE_BMP_STR, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_BMP_STR,
+       (encoder_func*)NULL,(encoder_func*)GEncComponentBMPString,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentBMPString,(ber_decoder_func*)BDecComponentBMPString,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentBMPString}},
+{ BASICTYPE_UTF8_STR, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_UTF8_STR,
+       (encoder_func*)NULL,(encoder_func*)GEncComponentUTF8String,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentUTF8String,(ber_decoder_func*)BDecComponentUTF8String,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentUTF8String}},
+{ BASICTYPE_UTCTIME, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_UTCTIME,
+       (encoder_func*)NULL,(encoder_func*)GEncComponentUTCTime,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentUTCTime,(ber_decoder_func*)BDecComponentUTCTime,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentUTCTime}},
+{ BASICTYPE_GENERALIZEDTIME, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_GENERALIZEDTIME,
+       (encoder_func*)NULL,(encoder_func*)GEncComponentUTCTime,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentUTCTime,(ber_decoder_func*)BDecComponentUTCTime,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentUTCTime}},
+{ BASICTYPE_GRAPHIC_STR, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_GRAPHIC_STR,
+       (encoder_func*)NULL,(encoder_func*)GEncComponentPrintableString,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentPrintableString,(ber_decoder_func*)BDecComponentPrintableString,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentPrintableString}},
+{ BASICTYPE_VISIBLE_STR, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_VISIBLE_STR,
+       (encoder_func*)NULL,(encoder_func*)GEncComponentVisibleString,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentVisibleString,(ber_decoder_func*)BDecComponentVisibleString,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentVisibleString}},
+{ BASICTYPE_GENERAL_STR,{ -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_GENERAL_STR,
+       (encoder_func*)NULL,(encoder_func*)GEncComponentUTF8String,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentUTF8String,(ber_decoder_func*)BDecComponentUTF8String,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentUTF8String}},
+{ BASICTYPE_OBJECTDESCRIPTOR, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_OBJECTDESCRIPTOR,
+       (encoder_func*)NULL,(encoder_func*)GEncComponentUTF8String,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentUTF8String,(ber_decoder_func*)BDecComponentUTF8String,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentUTF8String}},
+{ BASICTYPE_VIDEOTEX_STR, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_VIDEOTEX_STR,
+       (encoder_func*)NULL,(encoder_func*)GEncComponentTeletexString,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentTeletexString,(ber_decoder_func*)BDecComponentTeletexString,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentTeletexString}},
+{ BASICTYPE_T61_STR, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_T61_STR,
+       (encoder_func*)NULL,(encoder_func*)GEncComponentUTF8String,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentUTF8String,(ber_decoder_func*)BDecComponentUTF8String,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentUTF8String}},
+{ BASICTYPE_OCTETCONTAINING, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_OCTETCONTAINING,
+       (encoder_func*)NULL,(encoder_func*)NULL,(encoder_func*)NULL,
+       (gser_decoder_func*)NULL,(ber_decoder_func*)NULL,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,NULL}},
+{ BASICTYPE_BITCONTAINING, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_BITCONTAINING,
+       (encoder_func*)NULL,(encoder_func*)NULL,(encoder_func*)NULL,
+       (gser_decoder_func*)NULL,(ber_decoder_func*)NULL,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,NULL}},
+{ BASICTYPE_RELATIVE_OID, { -1, NULL, {},{},0,ASN_BASIC,BASICTYPE_RELATIVE_OID,
+       (encoder_func*)NULL,(encoder_func*)GEncComponentRelativeOid,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentRelativeOid,(ber_decoder_func*)BDecComponentRelativeOid,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentRelativeOid}},
 { BASICTYPE_ANY, {}},
 { COMPOSITE_ASN1_TYPE, {}},
-{ RDNSequence, {}},
-{ RelativeDistinguishedName, {}}, 
+{ RDNSequence, { -1, NULL, {},{},0,ASN_COMPOSITE,RDNSequence,
+       (encoder_func*)ConvertRDNSequence2RFC2253,(encoder_func*)NULL,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentRDNSequence,(ber_decoder_func*)BDecComponentRDNSequence,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentRDNSequence}},
+{ RelativeDistinguishedName, { -1, NULL, {},{},0,ASN_COMPOSITE,RDNSequence,
+       (encoder_func*)ConvertRDNSequence2RFC2253,(encoder_func*)NULL,(encoder_func*)NULL,
+       (gser_decoder_func*)GDecComponentRDNSequence,(ber_decoder_func*)BDecComponentRDNSequence,
+       (comp_free_func*)NULL,(extract_component_from_id_func*)NULL,MatchingComponentRDNSequence}}, 
 { TelephoneNumber, {}},
 { FacsimileTelephoneNumber__telephoneNumber, {}},
 { DirectoryString, {}},
index 46602d6446af7bdcce262e3478198f6e0a62e3fd..751f33755489114ab2b5edd6b32f24208d7dd65f 100644 (file)
@@ -102,24 +102,8 @@ GDecComponentBits ( void* mem_op, GenBuf *b, void *v, AsnLen *bytesDecoded, int
                return LDAP_DECODING_ERROR;
        }
        k->value = result.value;
+       k->comp_desc = get_component_description (BASICTYPE_BITSTRING);
 
-       k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc ) {
-               if ( k ) CompFree( mem_op,  k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentBits;
-       k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentBits;
-       k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentBits;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentBits;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-       k->comp_desc->cd_extract_i = NULL;
-       k->comp_desc->cd_type = ASN_BASIC;
-       k->comp_desc->cd_type_id = BASICTYPE_BITSTRING;
-       k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentBits;
-       /* Real Decoding code need to be followed */
        return LDAP_SUCCESS;
 }
 
@@ -163,22 +147,7 @@ BDecComponentBits ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *v,
        }
 
        k->value = result;
-
-        k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree( mem_op,  k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentBits;
-        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentBits;
-        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentBits;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentBits;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-        k->comp_desc->cd_extract_i = NULL;
-        k->comp_desc->cd_type = ASN_BASIC;
-        k->comp_desc->cd_type_id = BASICTYPE_BITSTRING;
-        k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentBits;
+       k->comp_desc = get_component_description (BASICTYPE_BITSTRING);
  
        return LDAP_SUCCESS;
 }
@@ -226,22 +195,7 @@ GDecComponentBMPString ( void* mem_op, GenBuf *b, void *v, AsnLen *bytesDecoded,
        }
 
        k->value = result.value;
-
-       k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentBMPString;
-       k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentBMPString;
-       k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentBMPString;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentBMPString;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-       k->comp_desc->cd_extract_i = NULL;
-       k->comp_desc->cd_type = ASN_BASIC;
-       k->comp_desc->cd_type_id = BASICTYPE_BMP_STR;
-       k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentBMPString;
+       k->comp_desc = get_component_description (BASICTYPE_BMP_STR);
  
        return LDAP_SUCCESS;
 
@@ -287,22 +241,7 @@ BDecComponentBMPString ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void
        }
 
        k->value = result;
-
-        k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentBMPString;
-        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentBMPString;
-        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentBMPString;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentBMPString;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-        k->comp_desc->cd_extract_i = NULL;
-        k->comp_desc->cd_type = ASN_BASIC;
-        k->comp_desc->cd_type_id = BASICTYPE_BMP_STR;
-        k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentBMPString;
+       k->comp_desc = get_component_description (BASICTYPE_BMP_STR);
  
        return LDAP_SUCCESS;
 
@@ -350,22 +289,7 @@ GDecComponentUTF8String ( void* mem_op, GenBuf *b, void *v,
        }
        
        k->value = result.value;
-
-       k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree( mem_op,  k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentUTF8String;
-       k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentUTF8String;
-       k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentUTF8String;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentUTF8String;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-       k->comp_desc->cd_extract_i = NULL;
-       k->comp_desc->cd_type = ASN_BASIC;
-       k->comp_desc->cd_type_id = BASICTYPE_UTF8_STR;
-       k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentUTF8String;
+       k->comp_desc = get_component_description (BASICTYPE_UTF8_STR);
  
        return LDAP_SUCCESS;
 }
@@ -409,22 +333,9 @@ BDecComponentUTF8String ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len,
        }
 
        k->value = result;
+       k->comp_desc = get_component_description (BASICTYPE_UTF8_STR);
 
-        k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentUTF8String;
-        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentUTF8String;
-        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentUTF8String;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentUTF8String;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-        k->comp_desc->cd_extract_i = NULL;
-        k->comp_desc->cd_type = ASN_BASIC;
-        k->comp_desc->cd_type_id = BASICTYPE_UTF8_STR;
-        k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentUTF8String;
+       return LDAP_SUCCESS;
 }
 
 /*
@@ -470,22 +381,7 @@ GDecComponentTeletexString  ( void* mem_op, GenBuf *b, void *v,
        }
 
        k->value = result.value;
-
-       k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentTeletexString;
-       k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentTeletexString;
-       k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentTeletexString;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentTeletexString;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-       k->comp_desc->cd_extract_i = NULL;
-       k->comp_desc->cd_type = ASN_BASIC;
-       k->comp_desc->cd_type_id = BASICTYPE_VIDEOTEX_STR;
-       k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentTeletexString;
+       k->comp_desc = get_component_description (BASICTYPE_VIDEOTEX_STR);
  
        return LDAP_SUCCESS;
 }
@@ -553,22 +449,7 @@ GDecComponentBool ( void* mem_op, GenBuf *b, void *v, AsnLen *bytesDecoded, int
        }
 
        k->value = result.value;
-
-       k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentBool;
-       k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentBool;
-       k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentBool;
-       k->comp_desc->cd_free = (comp_free_func*)NULL;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-       k->comp_desc->cd_extract_i = NULL;
-       k->comp_desc->cd_type = ASN_BASIC;
-       k->comp_desc->cd_type_id = BASICTYPE_BOOLEAN;
-       k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentBool;
+       k->comp_desc = get_component_description (BASICTYPE_BOOLEAN);
  
         return LDAP_SUCCESS;
 }
@@ -611,23 +492,8 @@ BDecComponentBool ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *v,
        }
 
        k->value = result;
+       k->comp_desc = get_component_description (BASICTYPE_BOOLEAN);
 
-        k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentBool;
-        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentBool;
-        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentBool;
-       k->comp_desc->cd_free = (comp_free_func*)NULL;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-        k->comp_desc->cd_extract_i = NULL;
-        k->comp_desc->cd_type = ASN_BASIC;
-        k->comp_desc->cd_type_id = BASICTYPE_BOOLEAN;
-        k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentBool;
         return LDAP_SUCCESS;
 }
 
@@ -706,8 +572,6 @@ GDecComponentEnum ( void* mem_op, GenBuf *b, void *v, AsnLen *bytesDecoded, int
        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentEnum;
        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentEnum;
        k->comp_desc->cd_free = (comp_free_func*)NULL;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
        k->comp_desc->cd_extract_i = NULL;
        k->comp_desc->cd_type = ASN_BASIC;
        k->comp_desc->cd_type_id = BASICTYPE_ENUMERATED;
@@ -765,8 +629,6 @@ BDecComponentEnum ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *v,
         k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentEnum;
         k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentEnum;
        k->comp_desc->cd_free = (comp_free_func*)NULL;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
         k->comp_desc->cd_extract_i = NULL;
         k->comp_desc->cd_type = ASN_BASIC;
         k->comp_desc->cd_type_id = BASICTYPE_ENUMERATED;
@@ -836,8 +698,6 @@ BDecComponentIA5String ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void
         k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentIA5String;
         k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentIA5String;
        k->comp_desc->cd_free = (comp_free_func*)FreeComponentIA5String;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
         k->comp_desc->cd_extract_i = NULL;
         k->comp_desc->cd_type = ASN_BASIC;
         k->comp_desc->cd_type_id = BASICTYPE_IA5_STR;
@@ -910,22 +770,7 @@ GDecComponentInt( void* mem_op, GenBuf * b, void *v, AsnLen *bytesDecoded, int m
                return LDAP_DECODING_ERROR;
        }
        k->value = result.value;
-
-       k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentInt;
-       k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentInt;
-       k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentInt;
-       k->comp_desc->cd_free = (comp_free_func*)NULL;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-       k->comp_desc->cd_extract_i = NULL;
-       k->comp_desc->cd_type = ASN_BASIC;
-       k->comp_desc->cd_type_id = BASICTYPE_INTEGER;
-       k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentInt;
+       k->comp_desc = get_component_description (BASICTYPE_INTEGER );
 
         return LDAP_SUCCESS;
 }
@@ -965,21 +810,7 @@ BDecComponentInt ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *v,
        }
        k->value = result;
 
-        k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentInt;
-        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentInt;
-        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentInt;
-       k->comp_desc->cd_free = (comp_free_func*)NULL;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-        k->comp_desc->cd_extract_i = NULL;
-        k->comp_desc->cd_type = ASN_BASIC;
-        k->comp_desc->cd_type_id = BASICTYPE_INTEGER;
-        k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentInt;
+       k->comp_desc = get_component_description (BASICTYPE_INTEGER );
         
         return LDAP_SUCCESS;
 }
@@ -1055,8 +886,6 @@ GDecComponentNull ( void* mem_op, GenBuf *b, void *v, AsnLen *bytesDecoded, int
        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentNull;
        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentNull;
        k->comp_desc->cd_free = (comp_free_func*)FreeComponentNull;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
        k->comp_desc->cd_extract_i = NULL;
        k->comp_desc->cd_type = ASN_BASIC;
        k->comp_desc->cd_type_id = BASICTYPE_NULL;
@@ -1115,8 +944,6 @@ BDecComponentNull ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *v,
        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentNull;
        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentNull;
        k->comp_desc->cd_free = (comp_free_func*)FreeComponentNull;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
        k->comp_desc->cd_extract_i = NULL;
        k->comp_desc->cd_type = ASN_BASIC;
        k->comp_desc->cd_type_id = BASICTYPE_NULL;
@@ -1171,8 +998,6 @@ BDecComponentNumericString ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len,
         k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentNumericString;
         k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentNumericString;
        k->comp_desc->cd_free = (comp_free_func*)FreeComponentNumericString;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
         k->comp_desc->cd_extract_i = NULL;
         k->comp_desc->cd_type = ASN_BASIC;
         k->comp_desc->cd_type_id = BASICTYPE_NUMERIC_STR;
@@ -1266,8 +1091,6 @@ GDecComponentOcts ( void* mem_op, GenBuf *b, void *v, AsnLen *bytesDecoded, int
        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentOcts;
        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentOcts;
        k->comp_desc->cd_free = (comp_free_func*)FreeComponentOcts;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
        k->comp_desc->cd_extract_i = NULL;
        k->comp_desc->cd_type = ASN_BASIC;
        k->comp_desc->cd_type_id = BASICTYPE_OCTETSTRING;
@@ -1324,8 +1147,6 @@ BDecComponentOcts ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *v,
         k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentOcts;
         k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentOcts;
        k->comp_desc->cd_free = (comp_free_func*)FreeComponentOcts;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
         k->comp_desc->cd_extract_i = NULL;
         k->comp_desc->cd_type = ASN_BASIC;
         k->comp_desc->cd_type_id = BASICTYPE_OCTETSTRING;
@@ -1448,22 +1269,7 @@ GDecComponentOid ( void* mem_op, GenBuf *b, void *v, AsnLen *bytesDecoded, int m
                }
        }
        k->value = result.value;
-
-       k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentOid;
-       k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentOid;
-       k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentOid;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentOid;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-       k->comp_desc->cd_extract_i = NULL;
-       k->comp_desc->cd_type = ASN_BASIC;
-       k->comp_desc->cd_type_id = BASICTYPE_OID;
-       k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentOid;
+       k->comp_desc = get_component_description (BASICTYPE_OID);
 
        return LDAP_SUCCESS;
 }
@@ -1507,21 +1313,8 @@ BDecComponentOid ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *v,
        }
        k->value = result;
 
-        k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentOid;
-        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentOid;
-        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentOid;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentOid;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-        k->comp_desc->cd_extract_i = NULL;
-        k->comp_desc->cd_type = ASN_BASIC;
-        k->comp_desc->cd_type_id = BASICTYPE_OID;
-        k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentOid;
+       k->comp_desc = get_component_description (BASICTYPE_OID);
+
        return LDAP_SUCCESS;
 }
 
@@ -1565,21 +1358,8 @@ BDecComponentPrintableString( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len,
        }
        k->value = result;
 
-       k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentPrintableString;
-       k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentPrintableString;
-       k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentPrintableString;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentPrintableString;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-       k->comp_desc->cd_extract_i = NULL;
-       k->comp_desc->cd_type = ASN_BASIC;
-       k->comp_desc->cd_type_id = BASICTYPE_PRINTABLE_STR;
-       k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentPrintableString;
+       k->comp_desc = get_component_description (BASICTYPE_PRINTABLE_STR);
+
        return LDAP_SUCCESS;
 }
 
@@ -1645,22 +1425,7 @@ GDecComponentReal ( void* mem_op, GenBuf *b, void *v, AsnLen *bytesDecoded, int
                return LDAP_DECODING_ERROR;
        }
        k->value = result.value;
-
-       k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentReal;
-       k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentReal;
-       k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentReal;
-       k->comp_desc->cd_free = (comp_free_func*)NULL;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-       k->comp_desc->cd_extract_i = NULL;
-       k->comp_desc->cd_type = ASN_BASIC;
-       k->comp_desc->cd_type_id = BASICTYPE_REAL;
-       k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentReal;
+       k->comp_desc = get_component_description (BASICTYPE_REAL);
 
         return LDAP_SUCCESS;
 }
@@ -1702,22 +1467,7 @@ BDecComponentReal ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *v,
                return LDAP_DECODING_ERROR;
        }
        k->value = result;
-
-        k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentReal;
-        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentReal;
-        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentReal;
-       k->comp_desc->cd_free = (comp_free_func*)NULL;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-        k->comp_desc->cd_extract_i = NULL;
-        k->comp_desc->cd_type = ASN_BASIC;
-        k->comp_desc->cd_type_id = BASICTYPE_REAL;
-        k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentReal;
+       k->comp_desc = get_component_description (BASICTYPE_REAL);
 
         return LDAP_SUCCESS;
 }
@@ -1789,23 +1539,8 @@ GDecComponentRelativeOid ( void* mem_op, GenBuf *b,void *v, AsnLen *bytesDecoded
                return LDAP_DECODING_ERROR;
        }
        k->value = result.value;
+       k->comp_desc = get_component_description (BASICTYPE_OID);
 
-       k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentRelativeOid;
-       k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentRelativeOid;
-       k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentRelativeOid;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentRelativeOid;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-       k->comp_desc->cd_extract_i = NULL;
-       k->comp_desc->cd_type = ASN_BASIC;
-       k->comp_desc->cd_type_id = BASICTYPE_OID;
-       k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentRelativeOid;
-       
        return LDAP_SUCCESS;
 }
 
@@ -1846,22 +1581,8 @@ BDecComponentRelativeOid ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, vo
                return LDAP_DECODING_ERROR;
        }
        k->value = result;
+       k->comp_desc = get_component_description (BASICTYPE_OID);
 
-        k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentRelativeOid;
-        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentRelativeOid;
-        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentRelativeOid;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentRelativeOid;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-        k->comp_desc->cd_extract_i = NULL;
-        k->comp_desc->cd_type = ASN_BASIC;
-        k->comp_desc->cd_type_id = BASICTYPE_RELATIVE_OID;
-        k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentRelativeOid;
        return LDAP_SUCCESS;
 }
 
@@ -1932,22 +1653,8 @@ BDecComponentUniversalString ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len
                return LDAP_DECODING_ERROR;
        }
        k->value = result;
+       k->comp_desc = get_component_description (BASICTYPE_UNIVERSAL_STR);
 
-        k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentUniversalString;
-        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentUniversalString;
-        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentUniversalString;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentUniversalString;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-        k->comp_desc->cd_extract_i = NULL;
-        k->comp_desc->cd_type = ASN_BASIC;
-        k->comp_desc->cd_type_id = BASICTYPE_UNIVERSAL_STR;
-        k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentUniversalString;
        return LDAP_SUCCESS;
 }
 
@@ -1984,22 +1691,8 @@ BDecComponentVisibleString ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len,
                rc = BDecVisibleStringContent ( mem_op, b, tagId, len, &result, bytesDecoded );
        }
        k->value = result;
+       k->comp_desc = get_component_description (BASICTYPE_VISIBLE_STR);
 
-        k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentVisibleString;
-        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentVisibleString;
-        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentVisibleString;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentVisibleString;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-        k->comp_desc->cd_extract_i = NULL;
-        k->comp_desc->cd_type = ASN_BASIC;
-        k->comp_desc->cd_type_id = BASICTYPE_VISIBLE_STR;
-        k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentVisibleString;
        return LDAP_SUCCESS;
 }
 
@@ -2109,8 +1802,6 @@ BEncComponentAny ( void* mem_op, GenBuf *b, ComponentAny *result, AsnLen *bytesD
                k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentAny;
                k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentAny;
                k->comp_desc->cd_free = (comp_free_func*)FreeComponentAny;
-               k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-               k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
                k->comp_desc->cd_extract_i = NULL;
                k->comp_desc->cd_type = ASN_BASIC;
                k->comp_desc->cd_type_id = BASICTYPE_ANY;
@@ -2140,15 +1831,7 @@ BDecComponentAny ( void* mem_op, GenBuf *b, ComponentAny *result, AsnLen *bytesD
         }
        
        if ((result->cai != NULL) && (result->cai->BER_Decode != NULL)) {
-#if 0
-               result->value = (void*) CompAlloc ( mem_op, result->cai->size );
-               if ( !result->value ) return 0;
-#endif
                result->cai->BER_Decode ( mem_op, b, (ComponentSyntaxInfo*)&result->value, (int*)bytesDecoded, DEC_ALLOC_MODE_0 );
-#if 0
-               rc = BDecComponentTop( result->cai->BER_Decode, mem_op, 0, 0, &result->value, bytesDecoded, DEC_ALLOC_MODE_0 );
-               if ( rc != LDAP_SUCCESS ) return rc;
-#endif
 
                k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
                if ( !k->comp_desc )  {
@@ -2159,8 +1842,6 @@ BDecComponentAny ( void* mem_op, GenBuf *b, ComponentAny *result, AsnLen *bytesD
                k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentAny;
                k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentAny;
                k->comp_desc->cd_free = (comp_free_func*)FreeComponentAny;
-               k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-               k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
                k->comp_desc->cd_extract_i = NULL;
                k->comp_desc->cd_type = ASN_BASIC;
                k->comp_desc->cd_type_id = BASICTYPE_ANY;
index 90745ebe49132d652ceaa45b15c556a3b8ded3e7..bd3a57caf8e4ada8bd818b87c22393d1c1b06380 100644 (file)
@@ -435,7 +435,7 @@ OidDecoderMapping* RetrieveOidDecoderMappingbyDesc( char* desc, int desc_len );
  * UTCTime
  */
 typedef ComponentVisibleString ComponentUTCTime;
-int GEncComponentUTCTime( GenBuf* b, ComponentUTCTime* utc_time);
+#define GEncComponentUTCTime GEncComponentUTF8String 
 #define GDecComponentUTCTime GDecComponentVisibleString
 #define BDecComponentUTCTime BDecComponentOcts
 #define MatchingComponentUTCTime MatchingComponentOcts
@@ -587,4 +587,6 @@ int ConvertRDN2RFC2253 ( irRelativeDistinguishedName* in, struct berval *out );
 int ConvertRDNSequence2RFC2253( irRDNSequence *in, struct berval* out );
        
 void* comp_nibble_memory_allocator ( int init_mem, int inc_mem );
+
+ComponentDesc* get_ComponentDesc( int id );
 #endif
index 577ce4a8de600c724bd88ba5773d93301172458c..677dee6cfbb6b33d134d9f511e1ec73fb0dfe555 100644 (file)
@@ -171,6 +171,7 @@ init_component_description_table () {
                        syn = NULL;
                asntype_to_compType_mapping_tbl[id].ac_comp_type.ct_syntax = syn;
 
+               /* Initialize Component Descriptions of primitive ASN.1 types */
                asntype_to_compdesc_mapping_tbl[id].atcd_cd.cd_comp_type = (AttributeType*)&asntype_to_compType_mapping_tbl[id].ac_comp_type;
        }
 }
@@ -803,12 +804,12 @@ int init_module(int argc, char *argv[]) {
        /*
         * Initialize function pointers in slapd
         */
-       attr_converter = comp_convert_attr_to_comp;
-       assert_converter = comp_convert_assert_to_comp;
-       component_destructor = comp_free_component;
-       test_components = comp_test_components;
+       attr_converter = (convert_attr_to_comp_func*)comp_convert_attr_to_comp;
+       assert_converter = (convert_assert_to_comp_func*)comp_convert_assert_to_comp;
+       component_destructor = (free_component_func*)comp_free_component;
+       test_components = (test_component_func*)comp_test_components;
        nibble_mem_allocator = (free_nibble_func*)comp_nibble_memory_allocator;
-       nibble_mem_free = comp_nibble_memory_free;
+       nibble_mem_free = (free_nibble_func*)comp_nibble_memory_free;
        is_aliased_attribute = (test_membership_func*)comp_is_aliased_attribute;
        get_component_description = (get_component_info_func*)comp_get_component_description;
        component_encoder = (component_encoder_func*)comp_component_encoder;