Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
openldap
OpenLDAP
Commits
b07fc2e6
Commit
b07fc2e6
authored
Dec 21, 2004
by
Sang Seok Lim
Browse files
Enabling sharing component descriptions of primitive ASN.1 types
parent
ae8bafea
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
contrib/slapd-modules/comp_match/asn_to_syn_mr.c
View file @
b07fc2e6
#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
,
{}},
...
...
contrib/slapd-modules/comp_match/componentlib.c
View file @
b07fc2e6
This diff is collapsed.
Click to expand it.
contrib/slapd-modules/comp_match/componentlib.h
View file @
b07fc2e6
...
...
@@ -435,7 +435,7 @@ OidDecoderMapping* RetrieveOidDecoderMappingbyDesc( char* desc, int desc_len );
* UTCTime
*/
typedef
ComponentVisibleString
ComponentUTCTime
;
in
t
GEncComponentUTCTime
(
G
enBuf
*
b
,
ComponentUT
CTime
*
utc_time
);
#def
in
e
GEncComponentUTCTime G
Enc
ComponentUT
F8String
#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
contrib/slapd-modules/comp_match/init.c
View file @
b07fc2e6
...
...
@@ -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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment