]> git.sur5r.net Git - openldap/commitdiff
Bug fix in Component Matching for CRL support
authorSang Seok Lim <slim@openldap.org>
Mon, 9 May 2005 01:06:06 +0000 (01:06 +0000)
committerSang Seok Lim <slim@openldap.org>
Mon, 9 May 2005 01:06:06 +0000 (01:06 +0000)
contrib/slapd-modules/comp_match/Makefile
contrib/slapd-modules/comp_match/certificate.asn1
contrib/slapd-modules/comp_match/certificate.c
contrib/slapd-modules/comp_match/certificate.h
contrib/slapd-modules/comp_match/componentlib.c
contrib/slapd-modules/comp_match/componentlib.h
contrib/slapd-modules/comp_match/crl.c
contrib/slapd-modules/comp_match/init.c

index befcdd288da9d126415bd1ade0c4d29a69ecd92e..f902e95486fab62885924eb5885c1fae3839b456 100644 (file)
@@ -31,7 +31,7 @@ INCS=$(LDAP_INC) $(SNACC_INC) $(OPENSSL_INC)
 
 SNACC_LIB=$(snaccdir)/c-lib/libcasn1.a
 SSL_LIB=/usr/local/lib/lcrypto
-#LDAP_LIB=-lldap_r -llber
+
 LIBS=$(LDAP_LIB) $(SNACC_LIB) $(SSL_LIB)
 
 all:   compmatch.la
index 0036f4bc07819a69bde34f8e80a3c102a9c44aa2..db81897932eb3172f51cb045e8acd74d53b18ca7 100644 (file)
@@ -81,6 +81,12 @@ nullOid2 OBJECT-TYPE
        STATUS mandatory
        ::= { 1 2 840 113549 1 1 1 }
 
+nullOid3 OBJECT-TYPE
+       SYNTAX  NULL
+       ACCESS read-write
+       STATUS mandatory
+       ::= { 1 2 840 113549 1 1 5 }
+
 printableStringOid OBJECT-TYPE
        SYNTAX PrintableString
        ACCESS read-write
@@ -117,6 +123,13 @@ printableStringOid6 OBJECT-TYPE
        STATUS mandatory
        ::= { 2 5 4 11 }
 
+printableStringOid7 OBJECT-TYPE
+       SYNTAX PrintableString
+       ACCESS read-write
+       STATUS mandatory
+       ::= { 0 9 2342 19200300 100 1 3 }
+
+
 iA5StringOid OBJECT-TYPE
        SYNTAX IA5String
        ACCESS read-write
@@ -141,4 +154,22 @@ octetStringOid3 OBJECT-TYPE
        STATUS mandatory
        ::= { 2 5 29 14 }
 
+octetStringOid4 OBJECT-TYPE
+       SYNTAX OCTET STRING
+       ACCESS read-write
+       STATUS mandatory
+       ::= { 2 5 29 21 }
+
+octetStringOid5 OBJECT-TYPE
+       SYNTAX OCTET STRING
+       ACCESS read-write
+       STATUS mandatory
+       ::= { 2 5 29 20 }
+
+octetStringOid7 OBJECT-TYPE
+       SYNTAX OCTET STRING
+       ACCESS read-write
+       STATUS mandatory
+       ::= { 2 5 29 28 }
+
 END
index 7c3fa8a98218e6ba127979bea3b89064890d95b9..8b58bdbba95587853bece84a6db74540b56014c1 100644 (file)
@@ -31,49 +31,62 @@ void init_module_AuthenticationFramework() {
        InitAnyAuthenticationFramework();
 }
 
-
 void InitAnyAuthenticationFramework()
 {
     AsnOid oid0 ={ 9, "\52\206\110\206\367\15\1\1\4" };
     AsnOid oid1 ={ 9, "\52\206\110\206\367\15\1\1\1" };
-    AsnOid oid2 ={ 3, "\125\4\3" };
-    AsnOid oid3 ={ 3, "\125\4\6" };
-    AsnOid oid4 ={ 3, "\125\4\7" };
-    AsnOid oid5 ={ 3, "\125\4\10" };
-    AsnOid oid6 ={ 3, "\125\4\12" };
-    AsnOid oid7 ={ 3, "\125\4\13" };
-    AsnOid oid8 ={ 9, "\52\206\110\206\367\15\1\11\1" };
-    AsnOid oid9 ={ 3, "\125\35\23" };
-    AsnOid oid10 ={ 9, "\140\206\110\1\206\370\102\1\15" };
-    AsnOid oid11 ={ 3, "\125\35\16" };
+    AsnOid oid2 ={ 9, "\52\206\110\206\367\15\1\1\5" };
+    AsnOid oid3 ={ 3, "\125\4\3" };
+    AsnOid oid4 ={ 3, "\125\4\6" };
+    AsnOid oid5 ={ 3, "\125\4\7" };
+    AsnOid oid6 ={ 3, "\125\4\10" };
+    AsnOid oid7 ={ 3, "\125\4\12" };
+    AsnOid oid8 ={ 3, "\125\4\13" };
+    AsnOid oid9 ={ 10, "\11\222\46\211\223\362\54\144\1\3" };
+    AsnOid oid10 ={ 9, "\52\206\110\206\367\15\1\11\1" };
+    AsnOid oid11 ={ 3, "\125\35\23" };
+    AsnOid oid12 ={ 9, "\140\206\110\1\206\370\102\1\15" };
+    AsnOid oid13 ={ 3, "\125\35\16" };
+    AsnOid oid14 ={ 3, "\125\35\25" };
+    AsnOid oid15 ={ 3, "\125\35\24" };
+    AsnOid oid17 ={ 3, "\125\35\34" };
 
 
     InstallAnyByComponentOid (nullOid_ANY_ID, &oid0, sizeof (ComponentNull), (EncodeFcn)BEncAsnNull, (gser_decoder_func*)GDecComponentNull, (ber_tag_decoder_func*)BDecComponentNullTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentNull,(FreeFcn)FreeComponentNull, (PrintFcn)NULL);
 
     InstallAnyByComponentOid (nullOid2_ANY_ID, &oid1, sizeof (ComponentNull), (EncodeFcn)BEncAsnNull, (gser_decoder_func*)GDecComponentNull, (ber_tag_decoder_func*)BDecComponentNullTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentNull,(FreeFcn)FreeComponentNull, (PrintFcn)NULL);
 
-    InstallAnyByComponentOid (printableStringOid_ANY_ID, &oid2, sizeof (ComponentPrintableString), (EncodeFcn)BEncPrintableString, (gser_decoder_func*)GDecComponentPrintableString, (ber_tag_decoder_func*)BDecComponentPrintableStringTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentPrintableString,(FreeFcn)FreeComponentPrintableString, (PrintFcn)NULL);
+    InstallAnyByComponentOid (nullOid3_ANY_ID, &oid2, sizeof (ComponentNull), (EncodeFcn)BEncAsnNull, (gser_decoder_func*)GDecComponentNull, (ber_tag_decoder_func*)BDecComponentNullTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentNull,(FreeFcn)FreeComponentNull, (PrintFcn)NULL);
 
-    InstallAnyByComponentOid (printableStringOid2_ANY_ID, &oid3, sizeof (ComponentPrintableString), (EncodeFcn)BEncPrintableString, (gser_decoder_func*)GDecComponentPrintableString, (ber_tag_decoder_func*)BDecComponentPrintableStringTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentPrintableString,(FreeFcn)FreeComponentPrintableString, (PrintFcn)NULL);
+    InstallAnyByComponentOid (printableStringOid_ANY_ID, &oid3, sizeof (ComponentPrintableString), (EncodeFcn)BEncPrintableString, (gser_decoder_func*)GDecComponentPrintableString, (ber_tag_decoder_func*)BDecComponentPrintableStringTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentPrintableString,(FreeFcn)FreeComponentPrintableString, (PrintFcn)NULL);
 
-    InstallAnyByComponentOid (printableStringOid3_ANY_ID, &oid4, sizeof (ComponentPrintableString), (EncodeFcn)BEncPrintableString, (gser_decoder_func*)GDecComponentPrintableString, (ber_tag_decoder_func*)BDecComponentPrintableStringTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentPrintableString,(FreeFcn)FreeComponentPrintableString, (PrintFcn)NULL);
+    InstallAnyByComponentOid (printableStringOid2_ANY_ID, &oid4, sizeof (ComponentPrintableString), (EncodeFcn)BEncPrintableString, (gser_decoder_func*)GDecComponentPrintableString, (ber_tag_decoder_func*)BDecComponentPrintableStringTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentPrintableString,(FreeFcn)FreeComponentPrintableString, (PrintFcn)NULL);
 
-    InstallAnyByComponentOid (printableStringOid4_ANY_ID, &oid5, sizeof (ComponentPrintableString), (EncodeFcn)BEncPrintableString, (gser_decoder_func*)GDecComponentPrintableString, (ber_tag_decoder_func*)BDecComponentPrintableStringTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentPrintableString,(FreeFcn)FreeComponentPrintableString, (PrintFcn)NULL);
+    InstallAnyByComponentOid (printableStringOid3_ANY_ID, &oid5, sizeof (ComponentPrintableString), (EncodeFcn)BEncPrintableString, (gser_decoder_func*)GDecComponentPrintableString, (ber_tag_decoder_func*)BDecComponentPrintableStringTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentPrintableString,(FreeFcn)FreeComponentPrintableString, (PrintFcn)NULL);
 
-    InstallAnyByComponentOid (printableStringOid5_ANY_ID, &oid6, sizeof (ComponentPrintableString), (EncodeFcn)BEncPrintableString, (gser_decoder_func*)GDecComponentPrintableString, (ber_tag_decoder_func*)BDecComponentPrintableStringTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentPrintableString,(FreeFcn)FreeComponentPrintableString, (PrintFcn)NULL);
+    InstallAnyByComponentOid (printableStringOid4_ANY_ID, &oid6, sizeof (ComponentPrintableString), (EncodeFcn)BEncPrintableString, (gser_decoder_func*)GDecComponentPrintableString, (ber_tag_decoder_func*)BDecComponentPrintableStringTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentPrintableString,(FreeFcn)FreeComponentPrintableString, (PrintFcn)NULL);
 
-    InstallAnyByComponentOid (printableStringOid6_ANY_ID, &oid7, sizeof (ComponentPrintableString), (EncodeFcn)BEncPrintableString, (gser_decoder_func*)GDecComponentPrintableString, (ber_tag_decoder_func*)BDecComponentPrintableStringTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentPrintableString,(FreeFcn)FreeComponentPrintableString, (PrintFcn)NULL);
+    InstallAnyByComponentOid (printableStringOid5_ANY_ID, &oid7, sizeof (ComponentPrintableString), (EncodeFcn)BEncPrintableString, (gser_decoder_func*)GDecComponentPrintableString, (ber_tag_decoder_func*)BDecComponentPrintableStringTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentPrintableString,(FreeFcn)FreeComponentPrintableString, (PrintFcn)NULL);
 
-    InstallAnyByComponentOid (iA5StringOid_ANY_ID, &oid8, sizeof (ComponentIA5String), (EncodeFcn)BEncIA5String, (gser_decoder_func*)GDecComponentIA5String, (ber_tag_decoder_func*)BDecComponentIA5StringTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentIA5String,(FreeFcn)FreeComponentIA5String, (PrintFcn)NULL);
+    InstallAnyByComponentOid (printableStringOid6_ANY_ID, &oid8, sizeof (ComponentPrintableString), (EncodeFcn)BEncPrintableString, (gser_decoder_func*)GDecComponentPrintableString, (ber_tag_decoder_func*)BDecComponentPrintableStringTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentPrintableString,(FreeFcn)FreeComponentPrintableString, (PrintFcn)NULL);
 
-    InstallAnyByComponentOid (octetStringOid_ANY_ID, &oid9, sizeof (ComponentOcts), (EncodeFcn)BEncAsnOcts, (gser_decoder_func*)GDecComponentOcts, (ber_tag_decoder_func*)BDecComponentOctsTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentOcts,(FreeFcn)FreeComponentOcts, (PrintFcn)NULL);
+    InstallAnyByComponentOid (printableStringOid7_ANY_ID, &oid9, sizeof (ComponentTeletexString), (EncodeFcn)BEncTeletexString, (gser_decoder_func*)GDecComponentTeletexString, (ber_tag_decoder_func*)BDecComponentTeletexStringTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentTeletexString,(FreeFcn)FreeComponentTeletexString, (PrintFcn)NULL);
 
-    InstallAnyByComponentOid (octetStringOid2_ANY_ID, &oid10, sizeof (ComponentOcts), (EncodeFcn)BEncAsnOcts, (gser_decoder_func*)GDecComponentOcts, (ber_tag_decoder_func*)BDecComponentOctsTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentOcts,(FreeFcn)FreeComponentOcts, (PrintFcn)NULL);
+    InstallAnyByComponentOid (iA5StringOid_ANY_ID, &oid10, sizeof (ComponentIA5String), (EncodeFcn)BEncIA5String, (gser_decoder_func*)GDecComponentIA5String, (ber_tag_decoder_func*)BDecComponentIA5StringTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentIA5String,(FreeFcn)FreeComponentIA5String, (PrintFcn)NULL);
 
-    InstallAnyByComponentOid (octetStringOid3_ANY_ID, &oid11, sizeof (ComponentOcts), (EncodeFcn)BEncAsnOcts, (gser_decoder_func*)GDecComponentOcts, (ber_tag_decoder_func*)BDecComponentOctsTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentOcts,(FreeFcn)FreeComponentOcts, (PrintFcn)NULL);
+    InstallAnyByComponentOid (octetStringOid_ANY_ID, &oid11, sizeof (ComponentOcts), (EncodeFcn)BEncAsnOcts, (gser_decoder_func*)GDecComponentOcts, (ber_tag_decoder_func*)BDecComponentOctsTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentOcts,(FreeFcn)FreeComponentOcts, (PrintFcn)NULL);
 
-}  /* InitAnyAuthenticationFramework */
+    InstallAnyByComponentOid (octetStringOid2_ANY_ID, &oid12, sizeof (ComponentOcts), (EncodeFcn)BEncAsnOcts, (gser_decoder_func*)GDecComponentOcts, (ber_tag_decoder_func*)BDecComponentOctsTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentOcts,(FreeFcn)FreeComponentOcts, (PrintFcn)NULL);
+
+    InstallAnyByComponentOid (octetStringOid3_ANY_ID, &oid13, sizeof (ComponentOcts), (EncodeFcn)BEncAsnOcts, (gser_decoder_func*)GDecComponentOcts, (ber_tag_decoder_func*)BDecComponentOctsTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentOcts,(FreeFcn)FreeComponentOcts, (PrintFcn)NULL);
+
+    InstallAnyByComponentOid (octetStringOid4_ANY_ID, &oid14, sizeof (ComponentOcts), (EncodeFcn)BEncAsnOcts, (gser_decoder_func*)GDecComponentOcts, (ber_tag_decoder_func*)BDecComponentOctsTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentOcts,(FreeFcn)FreeComponentOcts, (PrintFcn)NULL);
 
+    InstallAnyByComponentOid (octetStringOid5_ANY_ID, &oid15, sizeof (ComponentOcts), (EncodeFcn)BEncAsnOcts, (gser_decoder_func*)GDecComponentOcts, (ber_tag_decoder_func*)BDecComponentOctsTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentOcts,(FreeFcn)FreeComponentOcts, (PrintFcn)NULL);
+
+    InstallAnyByComponentOid (octetStringOid7_ANY_ID, &oid17, sizeof (ComponentOcts), (EncodeFcn)BEncAsnOcts, (gser_decoder_func*)GDecComponentOcts, (ber_tag_decoder_func*)BDecComponentOctsTag, (ExtractFcn)NULL,(MatchFcn)MatchingComponentOcts,(FreeFcn)FreeComponentOcts, (PrintFcn)NULL);
+
+}  /* InitAnyAuthenticationFramework */
 
 int
 MatchingComponentAlgorithmIdentifier ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
index e9cf470be7d7647a51e41d49bdfda88c7b0a407e..d1df75f1aa06829aec34b2fac722a71fcfeaec2f 100644 (file)
@@ -25,17 +25,21 @@ typedef enum AuthenticationFrameworkAnyId
 {
     nullOid_ANY_ID = 0,
     nullOid2_ANY_ID = 1,
-    printableStringOid_ANY_ID = 2,
-    printableStringOid2_ANY_ID = 3,
-    printableStringOid3_ANY_ID = 4,
-    printableStringOid4_ANY_ID = 5,
-    printableStringOid5_ANY_ID = 6,
-    printableStringOid6_ANY_ID = 7,
-    iA5StringOid_ANY_ID = 8,
-    octetStringOid_ANY_ID = 9,
-    octetStringOid2_ANY_ID = 10,
-    octetStringOid3_ANY_ID = 11} AuthenticationFrameworkAnyId;
-
+    nullOid3_ANY_ID = 2,
+    printableStringOid_ANY_ID = 3,
+    printableStringOid2_ANY_ID = 4,
+    printableStringOid3_ANY_ID = 5,
+    printableStringOid4_ANY_ID = 6,
+    printableStringOid5_ANY_ID = 7,
+    printableStringOid6_ANY_ID = 8,
+    printableStringOid7_ANY_ID = 9,
+    iA5StringOid_ANY_ID = 10,
+    octetStringOid_ANY_ID = 11,
+    octetStringOid2_ANY_ID = 12,
+    octetStringOid3_ANY_ID = 13,
+    octetStringOid4_ANY_ID = 14,
+    octetStringOid5_ANY_ID = 15,
+    octetStringOid7_ANY_ID = 17} AuthenticationFrameworkAnyId;
 
 void InitAnyAuthenticationFramework();
 
index 2f435fc1fc2f456f25005ef7848962993ff74830..93141b3bc88cccd5b78e44a4282dcb3476e23e51 100644 (file)
@@ -1363,6 +1363,52 @@ BDecComponentPrintableString( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len,
        return LDAP_SUCCESS;
 }
 
+/*
+ * Component BER Decoder : TeletexString
+ */
+
+int
+BDecComponentTeletexStringTag ( void* mem_op, GenBuf *b, void *v, AsnLen *bytesDecoded, int mode )
+{
+       return BDecComponentTeletexString ( mem_op, b, 0, 0, v, bytesDecoded, mode|CALL_TAG_DECODER );
+}
+
+int
+BDecComponentTeletexString( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *v, AsnLen *bytesDecoded, int mode )
+{
+        char* peek_head;
+        int i, strLen, rc;
+        void* component_values;
+        ComponentTeletexString* k, **k2;
+       AsnOid result;
+                                                                          
+        k = (ComponentTeletexString*) v;
+                                                                          
+        if ( mode & DEC_ALLOC_MODE_0 ) {
+                k2 = (ComponentTeletexString**) v;
+                *k2 = (ComponentTeletexString*) CompAlloc( mem_op, sizeof( ComponentTeletexString ) );
+               if ( !*k2 ) return LDAP_DECODING_ERROR;
+                k = *k2;
+        }
+
+       if ( mode & CALL_TAG_DECODER ) {
+               mode = mode & CALL_CONTENT_DECODER;
+               rc = BDecTeletexString ( mem_op, b, &result, bytesDecoded );
+       } else {
+               rc = BDecTeletexStringContent ( mem_op, b, tagId, len, &result, bytesDecoded );
+       }
+       if ( rc < 0 ) {
+               if ( k ) CompFree ( mem_op, k );
+               return LDAP_DECODING_ERROR;
+       }
+       k->value = result;
+
+       k->comp_desc = get_component_description (BASICTYPE_T61_STR);
+
+       return LDAP_SUCCESS;
+}
+
+
 /*
  * Matching function : Real
  */
index 678f36973527e4b94cc2af242d8fee6ab0bf2059..31bf3759e2819aa12f8785efa3922ef7171a15a9 100644 (file)
@@ -316,7 +316,8 @@ typedef struct ComponentTeletexString {
 
 int GEncComponentTeletexString (GenBuf *b, ComponentTeletexString * tel_str);
 int GDecComponentTeletexString ( void* mem_op, GenBuf *b, void *result, AsnLen *bytesDecoded, int mode );
-#define BDecComponentTeletexString BDecComponentOcts
+int BDecComponentTeletexStringTag (void* mem_op, GenBuf *b, void *v, AsnLen *bytesDecoded, int mode );
+int BDecComponentTeletexString( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *v, AsnLen *bytesDecoded, int mode );
 #define MatchingComponentTeletexString MatchingComponentOcts
 #define ExtractingComponentTeletexString(mem_op,cr,data)
 #define FreeComponentTeletexString FreeComponentOcts
index 6c957b319525dfca03a63670d6e708650ddf335b..abd82cdb2cea9c291a6bf990c558376a0308e40a 100644 (file)
@@ -25,7 +25,7 @@ BDecComponentCertificateListTop( void* mem_op, GenBuf* b, void *v, AsnLen* bytes
 void init_module_CertificateRevokationList() {
        InstallOidDecoderMapping( "2.5.4.39", NULL,
                GDecComponentCertificateList,
-               BDecComponentCertificateList,
+               BDecComponentCertificateListTop,
                ExtractingComponentCertificateList,
                MatchingComponentCertificateList);
 }
index 9226262689c70675715d13319d8eac4bc69c9510..5f0d86d6a85e1dcb3f61d7f428032ba28a1f1b9e 100644 (file)
@@ -236,9 +236,11 @@ comp_convert_attr_to_comp LDAP_P (( Attribute* a, Syntax *syn, struct berval* bv
        ExpBufFreeBuf( buf );
        GenBufFreeBuf( b );
        if ( rc == -1 ) {
+#if 0
                ShutdownNibbleMemLocal ( a->a_comp_data->cd_mem_op );
                free ( a->a_comp_data );
                a->a_comp_data = NULL;
+#endif
                return (void*)NULL;
        }
        else {
@@ -470,10 +472,14 @@ comp_test_all_components (
                        {
                                cr->cr_curr = start_compid;
                                rc = comp_test_components ( attr_mem_op, assert_mem_op, comp_elmt, ca );
-                               
+                               if ( rc != LDAP_COMPARE_FALSE ) {
+                                       break;
+                               }
+#if 0                          
                                if ( rc == LDAP_COMPARE_TRUE ) {
                                        break;
                                }
+#endif
                        }
                }
                break;
@@ -824,6 +830,7 @@ int init_module(int argc, char *argv[]) {
        /* the initialization for example X.509 certificate */
        init_module_AuthenticationFramework();
        init_module_AuthorityKeyIdentifierDefinition();
+       init_module_CertificateRevokationList();
        init_attribute_aliasing_table ();
        init_component_description_table ();
        return 0;