2 * authorityKeyIdentifier.c
3 * "AuthorityKeyIdentifierDefinition" ASN.1 module encode/decode/extracting/matching/free C src.
4 * This file was generated by modified eSMACC compiler Wed Dec 8 22:22:49 2004
5 * The generated files are supposed to be compiled as a module for OpenLDAP Software
8 #include "authorityKeyIdentifier.h"
10 BDecComponentAuthorityKeyIdentifierTop( void* mem_op, GenBuf* b, void *v, AsnLen* bytesDecoded,int mode) {
14 tag = BDecTag ( b, bytesDecoded );
15 elmtLen = BDecLen ( b, bytesDecoded );
16 if ( elmtLen <= 0 ) return (-1);
17 if ( tag != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE) ) {
21 return BDecComponentAuthorityKeyIdentifier( mem_op, b, tag, elmtLen, ( ComponentAuthorityKeyIdentifier**)v, (AsnLen*)bytesDecoded, mode );
25 void init_module_AuthorityKeyIdentifierDefinition() {
26 InstallOidDecoderMapping( "2.5.29.35", NULL,
27 GDecComponentAuthorityKeyIdentifier,
28 BDecComponentAuthorityKeyIdentifierTop,
29 ExtractingComponentAuthorityKeyIdentifier,
30 MatchingComponentAuthorityKeyIdentifier );
34 MatchingComponentOtherName ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
39 mr = retrieve_matching_rule( oid, csi_attr->csi_comp_desc->cd_type_id);
40 if ( mr ) return component_value_match( mr, csi_attr, csi_assert );
44 rc = MatchingComponentOid ( oid, (ComponentSyntaxInfo*)&((ComponentOtherName*)csi_attr)->type_id, (ComponentSyntaxInfo*)&((ComponentOtherName*)csi_assert)->type_id );
45 if ( rc != LDAP_COMPARE_TRUE )
47 rc = SetAnyTypeByComponentOid ((ComponentSyntaxInfo*)&((ComponentOtherName*)csi_attr)->value, (&((ComponentOtherName*)csi_attr)->type_id));
48 rc = MatchingComponentAnyDefinedBy ( oid, (ComponentAny*)&((ComponentOtherName*)csi_attr)->value, (ComponentAny*)&((ComponentOtherName*)csi_assert)->value);
49 if ( rc != LDAP_COMPARE_TRUE )
51 return LDAP_COMPARE_TRUE;
52 } /* BMatchingComponentOtherName */
55 ExtractingComponentOtherName ( void* mem_op, ComponentReference* cr, ComponentOtherName *comp )
58 if ( ( comp->type_id.identifier.bv_val && strncmp(comp->type_id.identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->type_id.id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {
59 if ( cr->cr_curr->ci_next == NULL )
60 return &comp->type_id;
64 if ( ( comp->value.identifier.bv_val && strncmp(comp->value.identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->value.id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {
65 if ( cr->cr_curr->ci_next == NULL )
71 } /* ExtractingComponentOtherName */
74 BDecComponentOtherName PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),
79 ComponentOtherName **v _AND_
80 AsnLen *bytesDecoded _AND_
84 AsnLen totalElmtsLen1 = 0;
87 int mandatoryElmtCount1 = 0;
88 AsnLen totalElmtsLen2 = 0;
93 ComponentOtherName *k, *t, c_temp;
96 if ( !(mode & DEC_ALLOC_MODE_1) ) {
97 memset(&c_temp,0,sizeof(c_temp));
101 mode = DEC_ALLOC_MODE_2;
102 tagId1 = BDecTag (b, &totalElmtsLen1 );
104 if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, OID_TAG_CODE))))
106 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
107 rc = BDecComponentOid (mem_op, b, tagId1, elmtLen1, (&k->type_id), &totalElmtsLen1, mode);
108 if ( rc != LDAP_SUCCESS ) return rc;
109 (&k->type_id)->identifier.bv_val = (&k->type_id)->id_buf;
110 (&k->type_id)->identifier.bv_len = strlen("type_id");
111 strcpy( (&k->type_id)->identifier.bv_val, "type_id");
112 tagId1 = BDecTag (b, &totalElmtsLen1);
119 if (((tagId1 == MAKE_TAG_ID (CNTX, CONS, 0))))
121 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
122 rc = SetAnyTypeByComponentOid ((&k->value), (&k->type_id));
123 rc = BDecComponentAnyDefinedBy (mem_op,b, (&k->value), &totalElmtsLen1, mode );
124 if ( rc != LDAP_SUCCESS ) return rc;
125 (&k->value)->identifier.bv_val = (&k->value)->id_buf;
126 (&k->value)->identifier.bv_len = strlen("value");
127 strcpy( (&k->value)->identifier.bv_val, "value");
128 if (elmtLen1 == INDEFINITE_LEN)
129 BDecEoc (b, &totalElmtsLen1 );
131 if (elmtLen0 == INDEFINITE_LEN)
132 BDecEoc (b, &totalElmtsLen1 );
133 else if (totalElmtsLen1 != elmtLen0)
145 if( !(old_mode & DEC_ALLOC_MODE_1) ) {
146 *v = t = (ComponentOtherName*) CompAlloc( mem_op, sizeof(ComponentOtherName) );
150 t->syntax = (Syntax*)NULL;
151 t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
152 if ( !t->comp_desc ) {
156 t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentOtherName ;
157 t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentOtherName ;
158 t->comp_desc->cd_free = (comp_free_func*)NULL;
159 t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentOtherName;
160 t->comp_desc->cd_type = ASN_COMPOSITE;
161 t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
162 t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentOtherName;
163 (*bytesDecoded) += totalElmtsLen1;
168 GDecComponentOtherName PARAMS (( mem_op,b, v, bytesDecoded, mode),
171 ComponentOtherName **v _AND_
172 AsnLen *bytesDecoded _AND_
175 char* peek_head,*peek_head2;
176 int i, strLen,strLen2, rc, old_mode = mode;
177 ComponentOtherName *k,*t, c_temp;
180 if ( !(mode & DEC_ALLOC_MODE_1) ) {
181 memset(&c_temp,0,sizeof(c_temp));
185 mode = DEC_ALLOC_MODE_2;
187 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
188 Asn1Error("Error during Reading { in encoded data");
189 return LDAP_PROTOCOL_ERROR;
191 if(*peek_head != '{'){
192 Asn1Error("Missing { in encoded data");
193 return LDAP_PROTOCOL_ERROR;
196 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
197 Asn1Error("Error during Reading identifier");
198 return LDAP_PROTOCOL_ERROR;
200 if ( strncmp( peek_head, "type_id", strlen("type_id") ) == 0 ) {
201 rc = GDecComponentOid (mem_op, b, (&k->type_id), bytesDecoded, mode);
202 if ( rc != LDAP_SUCCESS ) return rc;
203 (&k->type_id)->identifier.bv_val = peek_head;
204 (&k->type_id)->identifier.bv_len = strLen;
205 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
206 Asn1Error("Error during Reading , ");
207 return LDAP_PROTOCOL_ERROR;
209 if(*peek_head != ','){
210 Asn1Error("Missing , in encoding");
211 return LDAP_PROTOCOL_ERROR;
213 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
214 Asn1Error("Error during Reading identifier");
215 return LDAP_PROTOCOL_ERROR;
218 if ( strncmp( peek_head, "value", strlen("value") ) == 0 ) {
219 rc = SetAnyTypeByComponentOid ((&k->value), (&k->type_id));
220 rc = GDecComponentAnyDefinedBy (mem_op, b, (&k->value), bytesDecoded, mode );
221 if ( rc != LDAP_SUCCESS ) return rc;
222 (&k->value)->identifier.bv_val = peek_head;
223 (&k->value)->identifier.bv_len = strLen;
225 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ) {
226 Asn1Error("Error during Reading } in encoding");
227 return LDAP_PROTOCOL_ERROR;
229 if(*peek_head != '}'){
230 Asn1Error("Missing } in encoding");
231 return LDAP_PROTOCOL_ERROR;
233 if( !(old_mode & DEC_ALLOC_MODE_1) ) {
234 *v = t = (ComponentOtherName*) CompAlloc( mem_op, sizeof(ComponentOtherName) );
238 t->syntax = (Syntax*)NULL;
239 t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
240 if ( !t->comp_desc ) {
244 t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentOtherName ;
245 t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentOtherName ;
246 t->comp_desc->cd_free = (comp_free_func*)NULL;
247 t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentOtherName;
248 t->comp_desc->cd_type = ASN_COMPOSITE;
249 t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
250 t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentOtherName;
256 MatchingComponentORAddress ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
261 mr = retrieve_matching_rule( oid, csi_attr->csi_comp_desc->cd_type_id);
262 if ( mr ) return component_value_match( mr, csi_attr, csi_assert );
266 rc = MatchingComponentOid ( oid, (ComponentSyntaxInfo*)&((ComponentORAddress*)csi_attr)->type_id, (ComponentSyntaxInfo*)&((ComponentORAddress*)csi_assert)->type_id );
267 if ( rc != LDAP_COMPARE_TRUE )
269 rc = SetAnyTypeByComponentOid ((ComponentSyntaxInfo*)&((ComponentORAddress*)csi_attr)->value, (&((ComponentORAddress*)csi_attr)->type_id));
270 rc = MatchingComponentAnyDefinedBy ( oid, (ComponentAny*)&((ComponentORAddress*)csi_attr)->value, (ComponentAny*)&((ComponentORAddress*)csi_assert)->value);
271 if ( rc != LDAP_COMPARE_TRUE )
273 rc = MatchingComponentOcts ( oid, (ComponentSyntaxInfo*)&((ComponentORAddress*)csi_attr)->extension, (ComponentSyntaxInfo*)&((ComponentORAddress*)csi_assert)->extension );
274 if ( rc != LDAP_COMPARE_TRUE )
276 return LDAP_COMPARE_TRUE;
277 } /* BMatchingComponentORAddress */
280 ExtractingComponentORAddress ( void* mem_op, ComponentReference* cr, ComponentORAddress *comp )
283 if ( ( comp->type_id.identifier.bv_val && strncmp(comp->type_id.identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->type_id.id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {
284 if ( cr->cr_curr->ci_next == NULL )
285 return &comp->type_id;
289 if ( ( comp->value.identifier.bv_val && strncmp(comp->value.identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->value.id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {
290 if ( cr->cr_curr->ci_next == NULL )
295 if ( ( comp->extension.identifier.bv_val && strncmp(comp->extension.identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->extension.id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {
296 if ( cr->cr_curr->ci_next == NULL )
297 return &comp->extension;
302 } /* ExtractingComponentORAddress */
305 BDecComponentORAddress PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),
309 AsnLen elmtLen0 _AND_
310 ComponentORAddress **v _AND_
311 AsnLen *bytesDecoded _AND_
315 AsnLen totalElmtsLen1 = 0;
318 int mandatoryElmtCount1 = 0;
321 ComponentORAddress *k, *t, c_temp;
324 if ( !(mode & DEC_ALLOC_MODE_1) ) {
325 memset(&c_temp,0,sizeof(c_temp));
329 mode = DEC_ALLOC_MODE_2;
330 tagId1 = BDecTag (b, &totalElmtsLen1 );
332 if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, OID_TAG_CODE))))
334 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
335 rc = BDecComponentOid (mem_op, b, tagId1, elmtLen1, (&k->type_id), &totalElmtsLen1, mode);
336 if ( rc != LDAP_SUCCESS ) return rc;
337 (&k->type_id)->identifier.bv_val = (&k->type_id)->id_buf;
338 (&k->type_id)->identifier.bv_len = strlen("type_id");
339 strcpy( (&k->type_id)->identifier.bv_val, "type_id");
347 rc = SetAnyTypeByComponentOid ((&k->value), (&k->type_id));
348 rc = BDecComponentAnyDefinedBy (mem_op,b, (&k->value), &totalElmtsLen1, mode );
349 if ( rc != LDAP_SUCCESS ) return rc;
350 (&k->value)->identifier.bv_val = (&k->value)->id_buf;
351 (&k->value)->identifier.bv_len = strlen("value");
352 strcpy( (&k->value)->identifier.bv_val, "value");
353 if ((elmtLen0 != INDEFINITE_LEN) && (totalElmtsLen1 == elmtLen0))
357 tagId1 = BDecTag (b, &totalElmtsLen1 );
359 if ((elmtLen0 == INDEFINITE_LEN) && (tagId1 == EOC_TAG_ID))
361 BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1 )
368 if ((!seqDone) && ((tagId1 == MAKE_TAG_ID (UNIV, PRIM, OCTETSTRING_TAG_CODE)) ||
369 (tagId1 == MAKE_TAG_ID (UNIV, CONS, OCTETSTRING_TAG_CODE))))
371 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
372 rc = BDecComponentOcts (mem_op, b, tagId1, elmtLen1, (&k->extension), &totalElmtsLen1, mode);
373 if ( rc != LDAP_SUCCESS ) return rc;
374 (&k->extension)->identifier.bv_val = (&k->extension)->id_buf;
375 (&k->extension)->identifier.bv_len = strlen("extension");
376 strcpy( (&k->extension)->identifier.bv_val, "extension");
378 if (elmtLen0 == INDEFINITE_LEN)
379 BDecEoc (b, &totalElmtsLen1 );
380 else if (totalElmtsLen1 != elmtLen0)
389 if( !(old_mode & DEC_ALLOC_MODE_1) ) {
390 *v = t = (ComponentORAddress*) CompAlloc( mem_op, sizeof(ComponentORAddress) );
394 t->syntax = (Syntax*)NULL;
395 t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
396 if ( !t->comp_desc ) {
400 t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentORAddress ;
401 t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentORAddress ;
402 t->comp_desc->cd_free = (comp_free_func*)NULL;
403 t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentORAddress;
404 t->comp_desc->cd_type = ASN_COMPOSITE;
405 t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
406 t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentORAddress;
407 (*bytesDecoded) += totalElmtsLen1;
412 GDecComponentORAddress PARAMS (( mem_op,b, v, bytesDecoded, mode),
415 ComponentORAddress **v _AND_
416 AsnLen *bytesDecoded _AND_
419 char* peek_head,*peek_head2;
420 int i, strLen,strLen2, rc, old_mode = mode;
421 ComponentORAddress *k,*t, c_temp;
424 if ( !(mode & DEC_ALLOC_MODE_1) ) {
425 memset(&c_temp,0,sizeof(c_temp));
429 mode = DEC_ALLOC_MODE_2;
431 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
432 Asn1Error("Error during Reading { in encoded data");
433 return LDAP_PROTOCOL_ERROR;
435 if(*peek_head != '{'){
436 Asn1Error("Missing { in encoded data");
437 return LDAP_PROTOCOL_ERROR;
440 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
441 Asn1Error("Error during Reading identifier");
442 return LDAP_PROTOCOL_ERROR;
444 if ( strncmp( peek_head, "type_id", strlen("type_id") ) == 0 ) {
445 rc = GDecComponentOid (mem_op, b, (&k->type_id), bytesDecoded, mode);
446 if ( rc != LDAP_SUCCESS ) return rc;
447 (&k->type_id)->identifier.bv_val = peek_head;
448 (&k->type_id)->identifier.bv_len = strLen;
449 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
450 Asn1Error("Error during Reading , ");
451 return LDAP_PROTOCOL_ERROR;
453 if(*peek_head != ','){
454 Asn1Error("Missing , in encoding");
455 return LDAP_PROTOCOL_ERROR;
457 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
458 Asn1Error("Error during Reading identifier");
459 return LDAP_PROTOCOL_ERROR;
462 if ( strncmp( peek_head, "value", strlen("value") ) == 0 ) {
463 rc = SetAnyTypeByComponentOid ((&k->value), (&k->type_id));
464 rc = GDecComponentAnyDefinedBy (mem_op, b, (&k->value), bytesDecoded, mode );
465 if ( rc != LDAP_SUCCESS ) return rc;
466 (&k->value)->identifier.bv_val = peek_head;
467 (&k->value)->identifier.bv_len = strLen;
468 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
469 Asn1Error("Error during Reading , ");
470 return LDAP_PROTOCOL_ERROR;
472 if(*peek_head != ','){
473 Asn1Error("Missing , in encoding");
474 return LDAP_PROTOCOL_ERROR;
476 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
477 Asn1Error("Error during Reading identifier");
478 return LDAP_PROTOCOL_ERROR;
481 if ( strncmp( peek_head, "extension", strlen("extension") ) == 0 ) {
482 rc = GDecComponentOcts (mem_op, b, (&k->extension), bytesDecoded, mode);
483 if ( rc != LDAP_SUCCESS ) return rc;
484 (&k->extension)->identifier.bv_val = peek_head;
485 (&k->extension)->identifier.bv_len = strLen;
487 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ) {
488 Asn1Error("Error during Reading } in encoding");
489 return LDAP_PROTOCOL_ERROR;
491 if(*peek_head != '}'){
492 Asn1Error("Missing } in encoding");
493 return LDAP_PROTOCOL_ERROR;
495 if( !(old_mode & DEC_ALLOC_MODE_1) ) {
496 *v = t = (ComponentORAddress*) CompAlloc( mem_op, sizeof(ComponentORAddress) );
500 t->syntax = (Syntax*)NULL;
501 t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
502 if ( !t->comp_desc ) {
506 t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentORAddress ;
507 t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentORAddress ;
508 t->comp_desc->cd_free = (comp_free_func*)NULL;
509 t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentORAddress;
510 t->comp_desc->cd_type = ASN_COMPOSITE;
511 t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
512 t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentORAddress;
518 MatchingComponentDirectoryString ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
521 ComponentDirectoryString *v1, *v2;
524 v1 = (ComponentDirectoryString*)csi_attr;
525 v2 = (ComponentDirectoryString*)csi_assert;
527 mr = retrieve_matching_rule( oid, csi_attr->csi_comp_desc->cd_type_id);
528 if ( mr ) return component_value_match( mr, csi_attr, csi_assert );
531 if( (v1->choiceId != v2->choiceId ) )
532 return LDAP_COMPARE_FALSE;
533 switch( v1->choiceId )
535 case DIRECTORYSTRING_TELETEXSTRING :
536 rc = MatchingComponentTeletexString ( oid, (ComponentSyntaxInfo*)(v1->a.teletexString), (ComponentSyntaxInfo*)(v2->a.teletexString) );
538 case DIRECTORYSTRING_PRINTABLESTRING :
539 rc = MatchingComponentPrintableString ( oid, (ComponentSyntaxInfo*)(v1->a.printableString), (ComponentSyntaxInfo*)(v2->a.printableString) );
541 case DIRECTORYSTRING_UNIVERSALSTRING :
542 rc = MatchingComponentUniversalString ( oid, (ComponentSyntaxInfo*)(v1->a.universalString), (ComponentSyntaxInfo*)(v2->a.universalString) );
544 case DIRECTORYSTRING_UTF8STRING :
545 rc = MatchingComponentUTF8String ( oid, (ComponentSyntaxInfo*)(v1->a.utf8String), (ComponentSyntaxInfo*)(v2->a.utf8String) );
547 case DIRECTORYSTRING_BMPSTRING :
548 rc = MatchingComponentBMPString ( oid, (ComponentSyntaxInfo*)(v1->a.bmpString), (ComponentSyntaxInfo*)(v2->a.bmpString) );
551 return LDAP_PROTOCOL_ERROR;
554 } /* BMatchingComponentDirectoryStringContent */
557 ExtractingComponentDirectoryString ( void* mem_op, ComponentReference* cr, ComponentDirectoryString *comp )
561 if( (comp->choiceId) == DIRECTORYSTRING_TELETEXSTRING &&
562 (( comp->a.teletexString->identifier.bv_val && strncmp(comp->a.teletexString->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0) ||
563 ( strncmp(comp->a.teletexString->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0))) {
564 if ( cr->cr_curr->ci_next == NULL )
565 return (comp->a.teletexString);
567 cr->cr_curr = cr->cr_curr->ci_next;
568 return ExtractingComponentTeletexString ( mem_op, cr, (comp->a.teletexString) );
571 if( (comp->choiceId) == DIRECTORYSTRING_PRINTABLESTRING &&
572 (( comp->a.printableString->identifier.bv_val && strncmp(comp->a.printableString->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0) ||
573 ( strncmp(comp->a.printableString->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0))) {
574 if ( cr->cr_curr->ci_next == NULL )
575 return (comp->a.printableString);
577 cr->cr_curr = cr->cr_curr->ci_next;
578 return ExtractingComponentPrintableString ( mem_op, cr, (comp->a.printableString) );
581 if( (comp->choiceId) == DIRECTORYSTRING_UNIVERSALSTRING &&
582 (( comp->a.universalString->identifier.bv_val && strncmp(comp->a.universalString->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0) ||
583 ( strncmp(comp->a.universalString->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0))) {
584 if ( cr->cr_curr->ci_next == NULL )
585 return (comp->a.universalString);
587 cr->cr_curr = cr->cr_curr->ci_next;
588 return ExtractingComponentUniversalString ( mem_op, cr, (comp->a.universalString) );
591 if( (comp->choiceId) == DIRECTORYSTRING_UTF8STRING &&
592 (( comp->a.utf8String->identifier.bv_val && strncmp(comp->a.utf8String->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0) ||
593 ( strncmp(comp->a.utf8String->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0))) {
594 if ( cr->cr_curr->ci_next == NULL )
595 return (comp->a.utf8String);
597 cr->cr_curr = cr->cr_curr->ci_next;
598 return ExtractingComponentUTF8String ( mem_op, cr, (comp->a.utf8String) );
601 if( (comp->choiceId) == DIRECTORYSTRING_BMPSTRING &&
602 (( comp->a.bmpString->identifier.bv_val && strncmp(comp->a.bmpString->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0) ||
603 ( strncmp(comp->a.bmpString->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0))) {
604 if ( cr->cr_curr->ci_next == NULL )
605 return (comp->a.bmpString);
607 cr->cr_curr = cr->cr_curr->ci_next;
608 return ExtractingComponentBMPString ( mem_op, cr, (comp->a.bmpString) );
612 } /* ExtractingComponentDirectoryString */
615 BDecComponentDirectoryString PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),
619 AsnLen elmtLen0 _AND_
620 ComponentDirectoryString **v _AND_
621 AsnLen *bytesDecoded _AND_
625 AsnLen totalElmtsLen1 = 0;
628 int mandatoryElmtCount1 = 0;
631 ComponentDirectoryString *k, *t, c_temp;
634 if ( !(mode & DEC_ALLOC_MODE_1) ) {
635 memset(&c_temp,0,sizeof(c_temp));
639 mode = DEC_ALLOC_MODE_2;
642 case MAKE_TAG_ID (UNIV, PRIM, TELETEXSTRING_TAG_CODE):
643 case MAKE_TAG_ID (UNIV, CONS, TELETEXSTRING_TAG_CODE):
644 (k->choiceId) = DIRECTORYSTRING_TELETEXSTRING;
645 rc = BDecComponentTeletexString (mem_op, b, tagId0, elmtLen0, (&k->a.teletexString), &totalElmtsLen1, DEC_ALLOC_MODE_0 );
646 if ( rc != LDAP_SUCCESS ) return rc;
647 (k->a.teletexString)->identifier.bv_val = (k->a.teletexString)->id_buf;
648 (k->a.teletexString)->identifier.bv_len = strlen("teletexString");
649 strcpy( (k->a.teletexString)->identifier.bv_val, "teletexString");
652 case MAKE_TAG_ID (UNIV, PRIM, PRINTABLESTRING_TAG_CODE):
653 case MAKE_TAG_ID (UNIV, CONS, PRINTABLESTRING_TAG_CODE):
654 (k->choiceId) = DIRECTORYSTRING_PRINTABLESTRING;
655 rc = BDecComponentPrintableString (mem_op, b, tagId0, elmtLen0, (&k->a.printableString), &totalElmtsLen1, DEC_ALLOC_MODE_0 );
656 if ( rc != LDAP_SUCCESS ) return rc;
657 (k->a.printableString)->identifier.bv_val = (k->a.printableString)->id_buf;
658 (k->a.printableString)->identifier.bv_len = strlen("printableString");
659 strcpy( (k->a.printableString)->identifier.bv_val, "printableString");
662 case MAKE_TAG_ID (UNIV, PRIM, UNIVERSALSTRING_TAG_CODE):
663 case MAKE_TAG_ID (UNIV, CONS, UNIVERSALSTRING_TAG_CODE):
664 (k->choiceId) = DIRECTORYSTRING_UNIVERSALSTRING;
665 rc = BDecComponentUniversalString (mem_op, b, tagId0, elmtLen0, (&k->a.universalString), &totalElmtsLen1, DEC_ALLOC_MODE_0 );
666 if ( rc != LDAP_SUCCESS ) return rc;
667 (k->a.universalString)->identifier.bv_val = (k->a.universalString)->id_buf;
668 (k->a.universalString)->identifier.bv_len = strlen("universalString");
669 strcpy( (k->a.universalString)->identifier.bv_val, "universalString");
672 case MAKE_TAG_ID (UNIV, PRIM, UTF8STRING_TAG_CODE):
673 case MAKE_TAG_ID (UNIV, CONS, UTF8STRING_TAG_CODE):
674 (k->choiceId) = DIRECTORYSTRING_UTF8STRING;
675 rc = BDecComponentUTF8String (mem_op, b, tagId0, elmtLen0, (&k->a.utf8String), &totalElmtsLen1, DEC_ALLOC_MODE_0 );
676 if ( rc != LDAP_SUCCESS ) return rc;
677 (k->a.utf8String)->identifier.bv_val = (k->a.utf8String)->id_buf;
678 (k->a.utf8String)->identifier.bv_len = strlen("utf8String");
679 strcpy( (k->a.utf8String)->identifier.bv_val, "utf8String");
682 case MAKE_TAG_ID (UNIV, PRIM, BMPSTRING_TAG_CODE):
683 case MAKE_TAG_ID (UNIV, CONS, BMPSTRING_TAG_CODE):
684 (k->choiceId) = DIRECTORYSTRING_BMPSTRING;
685 rc = BDecComponentBMPString (mem_op, b, tagId0, elmtLen0, (&k->a.bmpString), &totalElmtsLen1, DEC_ALLOC_MODE_0 );
686 if ( rc != LDAP_SUCCESS ) return rc;
687 (k->a.bmpString)->identifier.bv_val = (k->a.bmpString)->id_buf;
688 (k->a.bmpString)->identifier.bv_len = strlen("bmpString");
689 strcpy( (k->a.bmpString)->identifier.bv_val, "bmpString");
693 Asn1Error ("ERROR - unexpected tag in CHOICE\n");
697 if( !(old_mode & DEC_ALLOC_MODE_1) ) {
698 *v = t = (ComponentDirectoryString*) CompAlloc( mem_op, sizeof(ComponentDirectoryString) );
702 t->syntax = (Syntax*)NULL;
703 t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
704 if ( !t->comp_desc ) {
708 t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentDirectoryString ;
709 t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentDirectoryString ;
710 t->comp_desc->cd_free = (comp_free_func*)NULL;
711 t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentDirectoryString;
712 t->comp_desc->cd_type = ASN_COMPOSITE;
713 t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
714 t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentDirectoryString;
715 (*bytesDecoded) += totalElmtsLen1;
717 } /* BDecDirectoryStringContent */
720 GDecComponentDirectoryString PARAMS (( mem_op,b, v, bytesDecoded, mode),
723 ComponentDirectoryString **v _AND_
724 AsnLen *bytesDecoded _AND_
727 char* peek_head,*peek_head2;
728 int i, strLen,strLen2, rc, old_mode = mode;
729 ComponentDirectoryString *k,*t, c_temp;
732 if ( !(mode & DEC_ALLOC_MODE_1) ) {
733 memset(&c_temp,0,sizeof(c_temp));
737 mode = DEC_ALLOC_MODE_2;
738 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
739 Asn1Error("Error during Reading identifier");
740 return LDAP_PROTOCOL_ERROR;
742 if( !(strLen2 = LocateNextGSERToken(mem_op,b,&peek_head2,GSER_NO_COPY)) ){
743 Asn1Error("Error during Reading identifier");
744 return LDAP_PROTOCOL_ERROR;
746 if(*peek_head2 != ':'){
747 Asn1Error("Missing : in encoded data");
748 return LDAP_PROTOCOL_ERROR;
750 if( strncmp("teletexString",peek_head, strlen("teletexString")) == 0){
751 (k->choiceId) = DIRECTORYSTRING_TELETEXSTRING;
752 rc = GDecComponentTeletexString (mem_op, b, (&k->a.teletexString), bytesDecoded, DEC_ALLOC_MODE_0 );
753 if ( rc != LDAP_SUCCESS ) return rc;
754 (k->a.teletexString)->identifier.bv_val = peek_head;
755 (k->a.teletexString)->identifier.bv_len = strLen;
757 else if( strncmp("printableString",peek_head,strlen("printableString")) == 0){
758 (k->choiceId) = DIRECTORYSTRING_PRINTABLESTRING;
759 rc = GDecComponentPrintableString (mem_op, b, (&k->a.printableString), bytesDecoded, DEC_ALLOC_MODE_0 );
760 if ( rc != LDAP_SUCCESS ) return rc;
761 (k->a.printableString)->identifier.bv_val = peek_head;
762 (k->a.printableString)->identifier.bv_len = strLen;
764 else if( strncmp("universalString",peek_head,strlen("universalString")) == 0){
765 (k->choiceId) = DIRECTORYSTRING_UNIVERSALSTRING;
766 rc = GDecComponentUniversalString (mem_op, b, (&k->a.universalString), bytesDecoded, DEC_ALLOC_MODE_0 );
767 if ( rc != LDAP_SUCCESS ) return rc;
768 (k->a.universalString)->identifier.bv_val = peek_head;
769 (k->a.universalString)->identifier.bv_len = strLen;
771 else if( strncmp("utf8String",peek_head,strlen("utf8String")) == 0){
772 (k->choiceId) = DIRECTORYSTRING_UTF8STRING;
773 rc = GDecComponentUTF8String (mem_op, b, (&k->a.utf8String), bytesDecoded, DEC_ALLOC_MODE_0 );
774 if ( rc != LDAP_SUCCESS ) return rc;
775 (k->a.utf8String)->identifier.bv_val = peek_head;
776 (k->a.utf8String)->identifier.bv_len = strLen;
778 else if( strncmp("bmpString",peek_head,strlen("bmpString")) == 0){
779 (k->choiceId) = DIRECTORYSTRING_BMPSTRING;
780 rc = GDecComponentBMPString (mem_op, b, (&k->a.bmpString), bytesDecoded, DEC_ALLOC_MODE_0 );
781 if ( rc != LDAP_SUCCESS ) return rc;
782 (k->a.bmpString)->identifier.bv_val = peek_head;
783 (k->a.bmpString)->identifier.bv_len = strLen;
786 Asn1Error("Undefined Identifier");
787 return LDAP_PROTOCOL_ERROR;
789 if( !(old_mode & DEC_ALLOC_MODE_1) ) {
790 *v = t = (ComponentDirectoryString*) CompAlloc( mem_op, sizeof(ComponentDirectoryString) );
794 t->syntax = (Syntax*)NULL;
795 t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
796 if ( !t->comp_desc ) {
800 t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentDirectoryString ;
801 t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentDirectoryString ;
802 t->comp_desc->cd_free = (comp_free_func*)NULL;
803 t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentDirectoryString;
804 t->comp_desc->cd_type = ASN_COMPOSITE;
805 t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
806 t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentDirectoryString;
808 } /* GDecDirectoryStringContent */
812 MatchingComponentEDIPartyName ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
817 mr = retrieve_matching_rule( oid, csi_attr->csi_comp_desc->cd_type_id);
818 if ( mr ) return component_value_match( mr, csi_attr, csi_assert );
822 if(COMPONENTNOT_NULL( ((ComponentEDIPartyName*)csi_attr)->nameAssigner ) ) {
823 rc = MatchingComponentDirectoryString ( oid, (ComponentSyntaxInfo*)((ComponentEDIPartyName*)csi_attr)->nameAssigner, (ComponentSyntaxInfo*)((ComponentEDIPartyName*)csi_assert)->nameAssigner );
824 if ( rc != LDAP_COMPARE_TRUE )
827 rc = MatchingComponentDirectoryString ( oid, (ComponentSyntaxInfo*)((ComponentEDIPartyName*)csi_attr)->partyName, (ComponentSyntaxInfo*)((ComponentEDIPartyName*)csi_assert)->partyName );
828 if ( rc != LDAP_COMPARE_TRUE )
830 return LDAP_COMPARE_TRUE;
831 } /* BMatchingComponentEDIPartyName */
834 ExtractingComponentEDIPartyName ( void* mem_op, ComponentReference* cr, ComponentEDIPartyName *comp )
837 if ( ( comp->nameAssigner->identifier.bv_val && strncmp(comp->nameAssigner->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->nameAssigner->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {
838 if ( cr->cr_curr->ci_next == NULL )
839 return comp->nameAssigner;
841 cr->cr_curr = cr->cr_curr->ci_next;
842 return ExtractingComponentDirectoryString ( mem_op, cr, comp->nameAssigner );
845 if ( ( comp->partyName->identifier.bv_val && strncmp(comp->partyName->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->partyName->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {
846 if ( cr->cr_curr->ci_next == NULL )
847 return comp->partyName;
849 cr->cr_curr = cr->cr_curr->ci_next;
850 return ExtractingComponentDirectoryString ( mem_op, cr, comp->partyName );
854 } /* ExtractingComponentEDIPartyName */
857 BDecComponentEDIPartyName PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),
861 AsnLen elmtLen0 _AND_
862 ComponentEDIPartyName **v _AND_
863 AsnLen *bytesDecoded _AND_
867 AsnLen totalElmtsLen1 = 0;
870 int mandatoryElmtCount1 = 0;
871 AsnLen totalElmtsLen2 = 0;
874 AsnLen totalElmtsLen3 = 0;
879 ComponentEDIPartyName *k, *t, c_temp;
882 if ( !(mode & DEC_ALLOC_MODE_1) ) {
883 memset(&c_temp,0,sizeof(c_temp));
887 mode = DEC_ALLOC_MODE_2;
888 tagId1 = BDecTag (b, &totalElmtsLen1 );
890 if (((tagId1 == MAKE_TAG_ID (CNTX, CONS, 0))))
892 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
893 rc = tagId2 = BDecTag (b, &totalElmtsLen1 );
894 elmtLen2 = BDecLen (b, &totalElmtsLen1 );
895 BDecComponentDirectoryString (mem_op, b, tagId2, elmtLen2, (&k->nameAssigner), &totalElmtsLen1, mode);
896 if (elmtLen1 == INDEFINITE_LEN)
897 BDecEoc(b, &totalElmtsLen1 );
898 if ( rc != LDAP_SUCCESS ) return rc;
899 (k->nameAssigner)->identifier.bv_val = (k->nameAssigner)->id_buf;
900 (k->nameAssigner)->identifier.bv_len = strlen("nameAssigner");
901 strcpy( (k->nameAssigner)->identifier.bv_val, "nameAssigner");
902 if (elmtLen1 == INDEFINITE_LEN)
903 BDecEoc (b, &totalElmtsLen1 );
904 tagId1 = BDecTag (b, &totalElmtsLen1);
908 if (((tagId1 == MAKE_TAG_ID (CNTX, CONS, 1))))
910 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
911 rc = tagId2 = BDecTag (b, &totalElmtsLen1 );
912 elmtLen2 = BDecLen (b, &totalElmtsLen1 );
913 BDecComponentDirectoryString (mem_op, b, tagId2, elmtLen2, (&k->partyName), &totalElmtsLen1, mode);
914 if (elmtLen1 == INDEFINITE_LEN)
915 BDecEoc(b, &totalElmtsLen1 );
916 if ( rc != LDAP_SUCCESS ) return rc;
917 (k->partyName)->identifier.bv_val = (k->partyName)->id_buf;
918 (k->partyName)->identifier.bv_len = strlen("partyName");
919 strcpy( (k->partyName)->identifier.bv_val, "partyName");
920 if (elmtLen1 == INDEFINITE_LEN)
921 BDecEoc (b, &totalElmtsLen1 );
923 if (elmtLen0 == INDEFINITE_LEN)
924 BDecEoc (b, &totalElmtsLen1 );
925 else if (totalElmtsLen1 != elmtLen0)
937 if( !(old_mode & DEC_ALLOC_MODE_1) ) {
938 *v = t = (ComponentEDIPartyName*) CompAlloc( mem_op, sizeof(ComponentEDIPartyName) );
942 t->syntax = (Syntax*)NULL;
943 t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
944 if ( !t->comp_desc ) {
948 t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentEDIPartyName ;
949 t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentEDIPartyName ;
950 t->comp_desc->cd_free = (comp_free_func*)NULL;
951 t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentEDIPartyName;
952 t->comp_desc->cd_type = ASN_COMPOSITE;
953 t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
954 t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentEDIPartyName;
955 (*bytesDecoded) += totalElmtsLen1;
957 } /* BDecEDIPartyName*/
960 GDecComponentEDIPartyName PARAMS (( mem_op,b, v, bytesDecoded, mode),
963 ComponentEDIPartyName **v _AND_
964 AsnLen *bytesDecoded _AND_
967 char* peek_head,*peek_head2;
968 int i, strLen,strLen2, rc, old_mode = mode;
969 ComponentEDIPartyName *k,*t, c_temp;
972 if ( !(mode & DEC_ALLOC_MODE_1) ) {
973 memset(&c_temp,0,sizeof(c_temp));
977 mode = DEC_ALLOC_MODE_2;
979 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
980 Asn1Error("Error during Reading { in encoded data");
981 return LDAP_PROTOCOL_ERROR;
983 if(*peek_head != '{'){
984 Asn1Error("Missing { in encoded data");
985 return LDAP_PROTOCOL_ERROR;
988 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
989 Asn1Error("Error during Reading identifier");
990 return LDAP_PROTOCOL_ERROR;
992 if ( strncmp( peek_head, "nameAssigner", strlen("nameAssigner") ) == 0 ) {
993 rc = GDecComponentDirectoryString (mem_op, b, (&k->nameAssigner), bytesDecoded, mode);
994 if ( rc != LDAP_SUCCESS ) return rc;
995 ( k->nameAssigner)->identifier.bv_val = peek_head;
996 ( k->nameAssigner)->identifier.bv_len = strLen;
997 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
998 Asn1Error("Error during Reading , ");
999 return LDAP_PROTOCOL_ERROR;
1001 if(*peek_head != ','){
1002 Asn1Error("Missing , in encoding");
1003 return LDAP_PROTOCOL_ERROR;
1005 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
1006 Asn1Error("Error during Reading identifier");
1007 return LDAP_PROTOCOL_ERROR;
1010 if ( strncmp( peek_head, "partyName", strlen("partyName") ) == 0 ) {
1011 rc = GDecComponentDirectoryString (mem_op, b, (&k->partyName), bytesDecoded, mode);
1012 if ( rc != LDAP_SUCCESS ) return rc;
1013 ( k->partyName)->identifier.bv_val = peek_head;
1014 ( k->partyName)->identifier.bv_len = strLen;
1016 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ) {
1017 Asn1Error("Error during Reading } in encoding");
1018 return LDAP_PROTOCOL_ERROR;
1020 if(*peek_head != '}'){
1021 Asn1Error("Missing } in encoding");
1022 return LDAP_PROTOCOL_ERROR;
1024 if( !(old_mode & DEC_ALLOC_MODE_1) ) {
1025 *v = t = (ComponentEDIPartyName*) CompAlloc( mem_op, sizeof(ComponentEDIPartyName) );
1026 if ( !t ) return -1;
1029 t->syntax = (Syntax*)NULL;
1030 t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
1031 if ( !t->comp_desc ) {
1035 t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentEDIPartyName ;
1036 t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentEDIPartyName ;
1037 t->comp_desc->cd_free = (comp_free_func*)NULL;
1038 t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentEDIPartyName;
1039 t->comp_desc->cd_type = ASN_COMPOSITE;
1040 t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
1041 t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentEDIPartyName;
1042 return LDAP_SUCCESS;
1043 } /* GDecEDIPartyName*/
1048 MatchingComponentGeneralName ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
1051 ComponentGeneralName *v1, *v2;
1054 v1 = (ComponentGeneralName*)csi_attr;
1055 v2 = (ComponentGeneralName*)csi_assert;
1057 mr = retrieve_matching_rule( oid, csi_attr->csi_comp_desc->cd_type_id);
1058 if ( mr ) return component_value_match( mr, csi_attr, csi_assert );
1061 if( (v1->choiceId != v2->choiceId ) )
1062 return LDAP_COMPARE_FALSE;
1063 switch( v1->choiceId )
1065 case GENERALNAME_OTHERNAME :
1066 rc = MatchingComponentOtherName ( oid, (ComponentSyntaxInfo*)(v1->a.otherName), (ComponentSyntaxInfo*)(v2->a.otherName) );
1068 case GENERALNAME_RFC822NAME :
1069 rc = MatchingComponentIA5String ( oid, (ComponentSyntaxInfo*)(v1->a.rfc822Name), (ComponentSyntaxInfo*)(v2->a.rfc822Name) );
1071 case GENERALNAME_DNSNAME :
1072 rc = MatchingComponentIA5String ( oid, (ComponentSyntaxInfo*)(v1->a.dNSName), (ComponentSyntaxInfo*)(v2->a.dNSName) );
1074 case GENERALNAME_X400ADDRESS :
1075 rc = MatchingComponentORAddress ( oid, (ComponentSyntaxInfo*)(v1->a.x400Address), (ComponentSyntaxInfo*)(v2->a.x400Address) );
1077 case GENERALNAME_DIRECTORYNAME :
1078 rc = MatchingComponentName ( oid, (ComponentSyntaxInfo*)(v1->a.directoryName), (ComponentSyntaxInfo*)(v2->a.directoryName) );
1080 case GENERALNAME_EDIPARTYNAME :
1081 rc = MatchingComponentEDIPartyName ( oid, (ComponentSyntaxInfo*)(v1->a.ediPartyName), (ComponentSyntaxInfo*)(v2->a.ediPartyName) );
1083 case GENERALNAME_UNIFORMRESOURCEIDENTIFIER :
1084 rc = MatchingComponentIA5String ( oid, (ComponentSyntaxInfo*)(v1->a.uniformResourceIdentifier), (ComponentSyntaxInfo*)(v2->a.uniformResourceIdentifier) );
1086 case GENERALNAME_IPADDRESS :
1087 rc = MatchingComponentOcts ( oid, (ComponentSyntaxInfo*)(v1->a.iPAddress), (ComponentSyntaxInfo*)(v2->a.iPAddress) );
1089 case GENERALNAME_REGISTEREDID :
1090 rc = MatchingComponentOid ( oid, (ComponentSyntaxInfo*)(v1->a.registeredID), (ComponentSyntaxInfo*)(v2->a.registeredID) );
1093 return LDAP_PROTOCOL_ERROR;
1096 } /* BMatchingComponentGeneralNameContent */
1099 ExtractingComponentGeneralName ( void* mem_op, ComponentReference* cr, ComponentGeneralName *comp )
1103 if( (comp->choiceId) == GENERALNAME_OTHERNAME &&
1104 (( comp->a.otherName->identifier.bv_val && strncmp(comp->a.otherName->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0) ||
1105 ( strncmp(comp->a.otherName->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0))) {
1106 if ( cr->cr_curr->ci_next == NULL )
1107 return (comp->a.otherName);
1109 cr->cr_curr = cr->cr_curr->ci_next;
1110 return ExtractingComponentOtherName ( mem_op, cr, (comp->a.otherName) );
1113 if( (comp->choiceId) == GENERALNAME_RFC822NAME &&
1114 (( comp->a.rfc822Name->identifier.bv_val && strncmp(comp->a.rfc822Name->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0) ||
1115 ( strncmp(comp->a.rfc822Name->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0))) {
1116 if ( cr->cr_curr->ci_next == NULL )
1117 return (comp->a.rfc822Name);
1119 cr->cr_curr = cr->cr_curr->ci_next;
1120 return ExtractingComponentIA5String ( mem_op, cr, (comp->a.rfc822Name) );
1123 if( (comp->choiceId) == GENERALNAME_DNSNAME &&
1124 (( comp->a.dNSName->identifier.bv_val && strncmp(comp->a.dNSName->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0) ||
1125 ( strncmp(comp->a.dNSName->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0))) {
1126 if ( cr->cr_curr->ci_next == NULL )
1127 return (comp->a.dNSName);
1129 cr->cr_curr = cr->cr_curr->ci_next;
1130 return ExtractingComponentIA5String ( mem_op, cr, (comp->a.dNSName) );
1133 if( (comp->choiceId) == GENERALNAME_X400ADDRESS &&
1134 (( comp->a.x400Address->identifier.bv_val && strncmp(comp->a.x400Address->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0) ||
1135 ( strncmp(comp->a.x400Address->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0))) {
1136 if ( cr->cr_curr->ci_next == NULL )
1137 return (comp->a.x400Address);
1139 cr->cr_curr = cr->cr_curr->ci_next;
1140 return ExtractingComponentORAddress ( mem_op, cr, (comp->a.x400Address) );
1143 if( (comp->choiceId) == GENERALNAME_DIRECTORYNAME &&
1144 (( comp->a.directoryName->identifier.bv_val && strncmp(comp->a.directoryName->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0) ||
1145 ( strncmp(comp->a.directoryName->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0))) {
1146 if ( cr->cr_curr->ci_next == NULL )
1147 return (comp->a.directoryName);
1149 cr->cr_curr = cr->cr_curr->ci_next;
1150 return ExtractingComponentName ( mem_op, cr, (comp->a.directoryName) );
1153 if( (comp->choiceId) == GENERALNAME_EDIPARTYNAME &&
1154 (( comp->a.ediPartyName->identifier.bv_val && strncmp(comp->a.ediPartyName->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0) ||
1155 ( strncmp(comp->a.ediPartyName->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0))) {
1156 if ( cr->cr_curr->ci_next == NULL )
1157 return (comp->a.ediPartyName);
1159 cr->cr_curr = cr->cr_curr->ci_next;
1160 return ExtractingComponentEDIPartyName ( mem_op, cr, (comp->a.ediPartyName) );
1163 if( (comp->choiceId) == GENERALNAME_UNIFORMRESOURCEIDENTIFIER &&
1164 (( comp->a.uniformResourceIdentifier->identifier.bv_val && strncmp(comp->a.uniformResourceIdentifier->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0) ||
1165 ( strncmp(comp->a.uniformResourceIdentifier->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0))) {
1166 if ( cr->cr_curr->ci_next == NULL )
1167 return (comp->a.uniformResourceIdentifier);
1169 cr->cr_curr = cr->cr_curr->ci_next;
1170 return ExtractingComponentIA5String ( mem_op, cr, (comp->a.uniformResourceIdentifier) );
1173 if( (comp->choiceId) == GENERALNAME_IPADDRESS &&
1174 (( comp->a.iPAddress->identifier.bv_val && strncmp(comp->a.iPAddress->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0) ||
1175 ( strncmp(comp->a.iPAddress->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0))) {
1176 if ( cr->cr_curr->ci_next == NULL )
1177 return (comp->a.iPAddress);
1179 cr->cr_curr = cr->cr_curr->ci_next;
1180 return ExtractingComponentOcts ( mem_op, cr, (comp->a.iPAddress) );
1183 if( (comp->choiceId) == GENERALNAME_REGISTEREDID &&
1184 (( comp->a.registeredID->identifier.bv_val && strncmp(comp->a.registeredID->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0) ||
1185 ( strncmp(comp->a.registeredID->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0))) {
1186 if ( cr->cr_curr->ci_next == NULL )
1187 return (comp->a.registeredID);
1189 cr->cr_curr = cr->cr_curr->ci_next;
1190 return ExtractingComponentOid ( mem_op, cr, (comp->a.registeredID) );
1194 } /* ExtractingComponentGeneralName */
1197 BDecComponentGeneralName PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),
1201 AsnLen elmtLen0 _AND_
1202 ComponentGeneralName **v _AND_
1203 AsnLen *bytesDecoded _AND_
1206 int seqDone = FALSE;
1207 AsnLen totalElmtsLen1 = 0;
1210 int mandatoryElmtCount1 = 0;
1211 AsnLen totalElmtsLen2 = 0;
1214 AsnLen totalElmtsLen3 = 0;
1217 int old_mode = mode;
1219 ComponentGeneralName *k, *t, c_temp;
1222 if ( !(mode & DEC_ALLOC_MODE_1) ) {
1223 memset(&c_temp,0,sizeof(c_temp));
1227 mode = DEC_ALLOC_MODE_2;
1230 case MAKE_TAG_ID (CNTX, CONS, 0):
1231 if (BDecTag (b, &totalElmtsLen1 ) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
1233 Asn1Error ("Unexpected Tag\n");
1237 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
1238 (k->choiceId) = GENERALNAME_OTHERNAME;
1239 rc = BDecComponentOtherName (mem_op, b, tagId1, elmtLen1, (&k->a.otherName), &totalElmtsLen1, mode);
1240 if ( rc != LDAP_SUCCESS ) return rc;
1241 (k->a.otherName)->identifier.bv_val = (k->a.otherName)->id_buf;
1242 (k->a.otherName)->identifier.bv_len = strlen("otherName");
1243 strcpy( (k->a.otherName)->identifier.bv_val, "otherName");
1244 if (elmtLen0 == INDEFINITE_LEN)
1245 BDecEoc (b, &totalElmtsLen1 );
1248 case MAKE_TAG_ID (CNTX, CONS, 1):
1249 tagId1 = BDecTag (b, &totalElmtsLen1 );
1250 if ((tagId1 != MAKE_TAG_ID (UNIV, PRIM, IA5STRING_TAG_CODE)) &&
1251 (tagId1 != MAKE_TAG_ID (UNIV, CONS, IA5STRING_TAG_CODE)))
1253 Asn1Error ("Unexpected Tag\n");
1257 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
1258 (k->choiceId) = GENERALNAME_RFC822NAME;
1259 rc = BDecComponentIA5String (mem_op, b, tagId1, elmtLen1, (&k->a.rfc822Name), &totalElmtsLen1, DEC_ALLOC_MODE_0 );
1260 if ( rc != LDAP_SUCCESS ) return rc;
1261 (k->a.rfc822Name)->identifier.bv_val = (k->a.rfc822Name)->id_buf;
1262 (k->a.rfc822Name)->identifier.bv_len = strlen("rfc822Name");
1263 strcpy( (k->a.rfc822Name)->identifier.bv_val, "rfc822Name");
1264 if (elmtLen0 == INDEFINITE_LEN)
1265 BDecEoc (b, &totalElmtsLen1 );
1268 case MAKE_TAG_ID (CNTX, CONS, 2):
1269 tagId1 = BDecTag (b, &totalElmtsLen1 );
1270 if ((tagId1 != MAKE_TAG_ID (UNIV, PRIM, IA5STRING_TAG_CODE)) &&
1271 (tagId1 != MAKE_TAG_ID (UNIV, CONS, IA5STRING_TAG_CODE)))
1273 Asn1Error ("Unexpected Tag\n");
1277 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
1278 (k->choiceId) = GENERALNAME_DNSNAME;
1279 rc = BDecComponentIA5String (mem_op, b, tagId1, elmtLen1, (&k->a.dNSName), &totalElmtsLen1, DEC_ALLOC_MODE_0 );
1280 if ( rc != LDAP_SUCCESS ) return rc;
1281 (k->a.dNSName)->identifier.bv_val = (k->a.dNSName)->id_buf;
1282 (k->a.dNSName)->identifier.bv_len = strlen("dNSName");
1283 strcpy( (k->a.dNSName)->identifier.bv_val, "dNSName");
1284 if (elmtLen0 == INDEFINITE_LEN)
1285 BDecEoc (b, &totalElmtsLen1 );
1288 case MAKE_TAG_ID (CNTX, CONS, 3):
1289 if (BDecTag (b, &totalElmtsLen1 ) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
1291 Asn1Error ("Unexpected Tag\n");
1295 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
1296 (k->choiceId) = GENERALNAME_X400ADDRESS;
1297 rc = BDecComponentORAddress (mem_op, b, tagId1, elmtLen1, (&k->a.x400Address), &totalElmtsLen1, mode);
1298 if ( rc != LDAP_SUCCESS ) return rc;
1299 (k->a.x400Address)->identifier.bv_val = (k->a.x400Address)->id_buf;
1300 (k->a.x400Address)->identifier.bv_len = strlen("x400Address");
1301 strcpy( (k->a.x400Address)->identifier.bv_val, "x400Address");
1302 if (elmtLen0 == INDEFINITE_LEN)
1303 BDecEoc (b, &totalElmtsLen1 );
1306 case MAKE_TAG_ID (CNTX, CONS, 4):
1307 (k->choiceId) = GENERALNAME_DIRECTORYNAME;
1308 tagId1 = BDecTag (b, &totalElmtsLen1 );
1309 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
1310 rc = BDecComponentName (mem_op, b, tagId1, elmtLen1, (&k->a.directoryName), &totalElmtsLen1, mode);
1311 if (elmtLen0 == INDEFINITE_LEN)
1312 BDecEoc(b, &totalElmtsLen1 );
1313 if ( rc != LDAP_SUCCESS ) return rc;
1314 (k->a.directoryName)->identifier.bv_val = (k->a.directoryName)->id_buf;
1315 (k->a.directoryName)->identifier.bv_len = strlen("directoryName");
1316 strcpy( (k->a.directoryName)->identifier.bv_val, "directoryName");
1317 if (elmtLen0 == INDEFINITE_LEN)
1318 BDecEoc (b, &totalElmtsLen1 );
1321 case MAKE_TAG_ID (CNTX, CONS, 5):
1322 if (BDecTag (b, &totalElmtsLen1 ) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
1324 Asn1Error ("Unexpected Tag\n");
1328 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
1329 (k->choiceId) = GENERALNAME_EDIPARTYNAME;
1330 rc = BDecComponentEDIPartyName (mem_op, b, tagId1, elmtLen1, (&k->a.ediPartyName), &totalElmtsLen1, mode);
1331 if ( rc != LDAP_SUCCESS ) return rc;
1332 (k->a.ediPartyName)->identifier.bv_val = (k->a.ediPartyName)->id_buf;
1333 (k->a.ediPartyName)->identifier.bv_len = strlen("ediPartyName");
1334 strcpy( (k->a.ediPartyName)->identifier.bv_val, "ediPartyName");
1335 if (elmtLen0 == INDEFINITE_LEN)
1336 BDecEoc (b, &totalElmtsLen1 );
1339 case MAKE_TAG_ID (CNTX, CONS, 6):
1340 tagId1 = BDecTag (b, &totalElmtsLen1 );
1341 if ((tagId1 != MAKE_TAG_ID (UNIV, PRIM, IA5STRING_TAG_CODE)) &&
1342 (tagId1 != MAKE_TAG_ID (UNIV, CONS, IA5STRING_TAG_CODE)))
1344 Asn1Error ("Unexpected Tag\n");
1348 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
1349 (k->choiceId) = GENERALNAME_UNIFORMRESOURCEIDENTIFIER;
1350 rc = BDecComponentIA5String (mem_op, b, tagId1, elmtLen1, (&k->a.uniformResourceIdentifier), &totalElmtsLen1, DEC_ALLOC_MODE_0 );
1351 if ( rc != LDAP_SUCCESS ) return rc;
1352 (k->a.uniformResourceIdentifier)->identifier.bv_val = (k->a.uniformResourceIdentifier)->id_buf;
1353 (k->a.uniformResourceIdentifier)->identifier.bv_len = strlen("uniformResourceIdentifier");
1354 strcpy( (k->a.uniformResourceIdentifier)->identifier.bv_val, "uniformResourceIdentifier");
1355 if (elmtLen0 == INDEFINITE_LEN)
1356 BDecEoc (b, &totalElmtsLen1 );
1359 case MAKE_TAG_ID (CNTX, CONS, 7):
1360 tagId1 = BDecTag (b, &totalElmtsLen1 );
1361 if ((tagId1 != MAKE_TAG_ID (UNIV, PRIM, OCTETSTRING_TAG_CODE)) &&
1362 (tagId1 != MAKE_TAG_ID (UNIV, CONS, OCTETSTRING_TAG_CODE)))
1364 Asn1Error ("Unexpected Tag\n");
1368 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
1369 (k->choiceId) = GENERALNAME_IPADDRESS;
1370 rc = BDecComponentOcts (mem_op, b, tagId1, elmtLen1, (&k->a.iPAddress), &totalElmtsLen1, DEC_ALLOC_MODE_0 );
1371 if ( rc != LDAP_SUCCESS ) return rc;
1372 (k->a.iPAddress)->identifier.bv_val = (k->a.iPAddress)->id_buf;
1373 (k->a.iPAddress)->identifier.bv_len = strlen("iPAddress");
1374 strcpy( (k->a.iPAddress)->identifier.bv_val, "iPAddress");
1375 if (elmtLen0 == INDEFINITE_LEN)
1376 BDecEoc (b, &totalElmtsLen1 );
1379 case MAKE_TAG_ID (CNTX, CONS, 8):
1380 if (BDecTag (b, &totalElmtsLen1 ) != MAKE_TAG_ID (UNIV, PRIM, OID_TAG_CODE))
1382 Asn1Error ("Unexpected Tag\n");
1386 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
1387 (k->choiceId) = GENERALNAME_REGISTEREDID;
1388 rc = BDecComponentOid (mem_op, b, tagId1, elmtLen1, (&k->a.registeredID), &totalElmtsLen1, DEC_ALLOC_MODE_0 );
1389 if ( rc != LDAP_SUCCESS ) return rc;
1390 (k->a.registeredID)->identifier.bv_val = (k->a.registeredID)->id_buf;
1391 (k->a.registeredID)->identifier.bv_len = strlen("registeredID");
1392 strcpy( (k->a.registeredID)->identifier.bv_val, "registeredID");
1393 if (elmtLen0 == INDEFINITE_LEN)
1394 BDecEoc (b, &totalElmtsLen1 );
1398 Asn1Error ("ERROR - unexpected tag in CHOICE\n");
1402 if( !(old_mode & DEC_ALLOC_MODE_1) ) {
1403 *v = t = (ComponentGeneralName*) CompAlloc( mem_op, sizeof(ComponentGeneralName) );
1404 if ( !t ) return -1;
1407 t->syntax = (Syntax*)NULL;
1408 t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
1409 if ( !t->comp_desc ) {
1413 t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentGeneralName ;
1414 t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentGeneralName ;
1415 t->comp_desc->cd_free = (comp_free_func*)NULL;
1416 t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentGeneralName;
1417 t->comp_desc->cd_type = ASN_COMPOSITE;
1418 t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
1419 t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentGeneralName;
1420 (*bytesDecoded) += totalElmtsLen1;
1421 return LDAP_SUCCESS;
1422 } /* BDecGeneralNameContent */
1425 GDecComponentGeneralName PARAMS (( mem_op,b, v, bytesDecoded, mode),
1428 ComponentGeneralName **v _AND_
1429 AsnLen *bytesDecoded _AND_
1432 char* peek_head,*peek_head2;
1433 int i, strLen,strLen2, rc, old_mode = mode;
1434 ComponentGeneralName *k,*t, c_temp;
1437 if ( !(mode & DEC_ALLOC_MODE_1) ) {
1438 memset(&c_temp,0,sizeof(c_temp));
1442 mode = DEC_ALLOC_MODE_2;
1443 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
1444 Asn1Error("Error during Reading identifier");
1445 return LDAP_PROTOCOL_ERROR;
1447 if( !(strLen2 = LocateNextGSERToken(mem_op,b,&peek_head2,GSER_NO_COPY)) ){
1448 Asn1Error("Error during Reading identifier");
1449 return LDAP_PROTOCOL_ERROR;
1451 if(*peek_head2 != ':'){
1452 Asn1Error("Missing : in encoded data");
1453 return LDAP_PROTOCOL_ERROR;
1455 if( strncmp("otherName",peek_head, strlen("otherName")) == 0){
1456 (k->choiceId) = GENERALNAME_OTHERNAME;
1457 rc = GDecComponentOtherName (mem_op, b, (&k->a.otherName), bytesDecoded, mode);
1458 if ( rc != LDAP_SUCCESS ) return rc;
1459 (k->a.otherName)->identifier.bv_val = peek_head;
1460 (k->a.otherName)->identifier.bv_len = strLen;
1462 else if( strncmp("rfc822Name",peek_head,strlen("rfc822Name")) == 0){
1463 (k->choiceId) = GENERALNAME_RFC822NAME;
1464 rc = GDecComponentIA5String (mem_op, b, (&k->a.rfc822Name), bytesDecoded, DEC_ALLOC_MODE_0 );
1465 if ( rc != LDAP_SUCCESS ) return rc;
1466 (k->a.rfc822Name)->identifier.bv_val = peek_head;
1467 (k->a.rfc822Name)->identifier.bv_len = strLen;
1469 else if( strncmp("dNSName",peek_head,strlen("dNSName")) == 0){
1470 (k->choiceId) = GENERALNAME_DNSNAME;
1471 rc = GDecComponentIA5String (mem_op, b, (&k->a.dNSName), bytesDecoded, DEC_ALLOC_MODE_0 );
1472 if ( rc != LDAP_SUCCESS ) return rc;
1473 (k->a.dNSName)->identifier.bv_val = peek_head;
1474 (k->a.dNSName)->identifier.bv_len = strLen;
1476 else if( strncmp("x400Address",peek_head,strlen("x400Address")) == 0){
1477 (k->choiceId) = GENERALNAME_X400ADDRESS;
1478 rc = GDecComponentORAddress (mem_op, b, (&k->a.x400Address), bytesDecoded, mode);
1479 if ( rc != LDAP_SUCCESS ) return rc;
1480 (k->a.x400Address)->identifier.bv_val = peek_head;
1481 (k->a.x400Address)->identifier.bv_len = strLen;
1483 else if( strncmp("directoryName",peek_head,strlen("directoryName")) == 0){
1484 (k->choiceId) = GENERALNAME_DIRECTORYNAME;
1485 rc = GDecComponentName (mem_op, b, (&k->a.directoryName), bytesDecoded, mode);
1486 if ( rc != LDAP_SUCCESS ) return rc;
1487 (k->a.directoryName)->identifier.bv_val = peek_head;
1488 (k->a.directoryName)->identifier.bv_len = strLen;
1490 else if( strncmp("ediPartyName",peek_head,strlen("ediPartyName")) == 0){
1491 (k->choiceId) = GENERALNAME_EDIPARTYNAME;
1492 rc = GDecComponentEDIPartyName (mem_op, b, (&k->a.ediPartyName), bytesDecoded, mode);
1493 if ( rc != LDAP_SUCCESS ) return rc;
1494 (k->a.ediPartyName)->identifier.bv_val = peek_head;
1495 (k->a.ediPartyName)->identifier.bv_len = strLen;
1497 else if( strncmp("uniformResourceIdentifier",peek_head,strlen("uniformResourceIdentifier")) == 0){
1498 (k->choiceId) = GENERALNAME_UNIFORMRESOURCEIDENTIFIER;
1499 rc = GDecComponentIA5String (mem_op, b, (&k->a.uniformResourceIdentifier), bytesDecoded, DEC_ALLOC_MODE_0 );
1500 if ( rc != LDAP_SUCCESS ) return rc;
1501 (k->a.uniformResourceIdentifier)->identifier.bv_val = peek_head;
1502 (k->a.uniformResourceIdentifier)->identifier.bv_len = strLen;
1504 else if( strncmp("iPAddress",peek_head,strlen("iPAddress")) == 0){
1505 (k->choiceId) = GENERALNAME_IPADDRESS;
1506 rc = GDecComponentOcts (mem_op, b, (&k->a.iPAddress), bytesDecoded, DEC_ALLOC_MODE_0 );
1507 if ( rc != LDAP_SUCCESS ) return rc;
1508 (k->a.iPAddress)->identifier.bv_val = peek_head;
1509 (k->a.iPAddress)->identifier.bv_len = strLen;
1511 else if( strncmp("registeredID",peek_head,strlen("registeredID")) == 0){
1512 (k->choiceId) = GENERALNAME_REGISTEREDID;
1513 rc = GDecComponentOid (mem_op, b, (&k->a.registeredID), bytesDecoded, DEC_ALLOC_MODE_0 );
1514 if ( rc != LDAP_SUCCESS ) return rc;
1515 (k->a.registeredID)->identifier.bv_val = peek_head;
1516 (k->a.registeredID)->identifier.bv_len = strLen;
1519 Asn1Error("Undefined Identifier");
1520 return LDAP_PROTOCOL_ERROR;
1522 if( !(old_mode & DEC_ALLOC_MODE_1) ) {
1523 *v = t = (ComponentGeneralName*) CompAlloc( mem_op, sizeof(ComponentGeneralName) );
1524 if ( !t ) return -1;
1527 t->syntax = (Syntax*)NULL;
1528 t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
1529 if ( !t->comp_desc ) {
1533 t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentGeneralName ;
1534 t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentGeneralName ;
1535 t->comp_desc->cd_free = (comp_free_func*)NULL;
1536 t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentGeneralName;
1537 t->comp_desc->cd_type = ASN_COMPOSITE;
1538 t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
1539 t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentGeneralName;
1540 return LDAP_SUCCESS;
1541 } /* GDecGeneralNameContent */
1545 MatchingComponentGeneralNames ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
1548 void* component1, *component2;
1549 AsnList *v1, *v2, t_list;
1553 mr = retrieve_matching_rule( oid, csi_attr->csi_comp_desc->cd_type_id);
1554 if ( mr ) return component_value_match( mr, csi_attr, csi_assert );
1557 v1 = &((ComponentGeneralNames*)csi_attr)->comp_list;
1558 v2 = &((ComponentGeneralNames*)csi_assert)->comp_list;
1559 FOR_EACH_LIST_PAIR_ELMT(component1, component2, v1, v2)
1561 if( MatchingComponentGeneralName(oid, (ComponentSyntaxInfo*)component1, (ComponentSyntaxInfo*)component2) == LDAP_COMPARE_FALSE) {
1562 return LDAP_COMPARE_FALSE;
1568 if( (!component1 && component2) || (component1 && !component2))
1569 return LDAP_COMPARE_FALSE;
1571 return LDAP_COMPARE_TRUE;
1572 } /* BMatchingComponentGeneralNamesContent */
1575 ExtractingComponentGeneralNames ( void* mem_op, ComponentReference* cr, ComponentGeneralNames *comp )
1579 AsnList *v = &comp->comp_list;
1581 ComponentGeneralName *component;
1584 switch ( cr->cr_curr->ci_type ) {
1585 case LDAP_COMPREF_FROM_BEGINNING :
1586 count = cr->cr_curr->ci_val.ci_from_beginning;
1587 FOR_EACH_LIST_ELMT( component , v ) {
1588 if( --count == 0 ) {
1589 if( cr->cr_curr->ci_next == NULL )
1592 cr->cr_curr = cr->cr_curr->ci_next;
1593 return ExtractingComponentGeneralName ( mem_op, cr, component );
1598 case LDAP_COMPREF_FROM_END :
1599 total = AsnListCount ( v );
1600 count = cr->cr_curr->ci_val.ci_from_end;
1601 count = total + count +1;
1602 FOR_EACH_LIST_ELMT ( component, v ) {
1603 if( --count == 0 ) {
1604 if( cr->cr_curr->ci_next == NULL )
1607 cr->cr_curr = cr->cr_curr->ci_next;
1608 return ExtractingComponentGeneralName ( mem_op, cr, component );
1613 case LDAP_COMPREF_ALL :
1615 case LDAP_COMPREF_COUNT :
1616 k = (ComponentInt*)CompAlloc( mem_op, sizeof(ComponentInt));
1617 k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
1618 k->comp_desc->cd_tag = (-1);
1619 k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentInt;
1620 k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentInt;
1621 k->comp_desc->cd_extract_i = (extract_component_from_id_func*)NULL;
1622 k->comp_desc->cd_type = ASN_BASIC;
1623 k->comp_desc->cd_type_id = BASICTYPE_INTEGER;
1624 k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentInt;
1625 k->value = AsnListCount(v);
1630 } /* ExtractingComponentGeneralNames */
1633 BDecComponentGeneralNames PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),
1637 AsnLen elmtLen0 _AND_
1638 ComponentGeneralNames **v _AND_
1639 AsnLen *bytesDecoded _AND_
1642 int seqDone = FALSE;
1643 AsnLen totalElmtsLen1 = 0;
1646 int mandatoryElmtCount1 = 0;
1647 int old_mode = mode;
1649 ComponentGeneralNames *k, *t, c_temp;
1652 if ( !(mode & DEC_ALLOC_MODE_1) ) {
1653 memset(&c_temp,0,sizeof(c_temp));
1657 mode = DEC_ALLOC_MODE_2;
1658 AsnListInit(&k->comp_list,sizeof(ComponentGeneralName));
1659 for (totalElmtsLen1 = 0; (totalElmtsLen1 < elmtLen0) || (elmtLen0 == INDEFINITE_LEN);)
1661 ComponentGeneralName **tmpVar;
1662 tagId1 = BDecTag (b, &totalElmtsLen1 );
1664 if ((tagId1 == EOC_TAG_ID) && (elmtLen0 == INDEFINITE_LEN))
1666 BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1 )
1667 break; /* got EOC so can exit this SET OF/SEQ OF's for loop*/
1669 elmtLen1 = BDecLen (b, &totalElmtsLen1);
1670 tmpVar = (ComponentGeneralName**) CompAsnListAppend (mem_op,&k->comp_list);
1671 rc = BDecComponentGeneralName (mem_op, b, tagId1, elmtLen1, tmpVar, &totalElmtsLen1, mode);
1672 if ( rc != LDAP_SUCCESS ) return rc;
1675 if( !(old_mode & DEC_ALLOC_MODE_1) ) {
1676 *v = t = (ComponentGeneralNames*) CompAlloc( mem_op, sizeof(ComponentGeneralNames) );
1677 if ( !t ) return -1;
1680 t->syntax = (Syntax*)NULL;
1681 t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
1682 if ( !t->comp_desc ) {
1686 t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentGeneralNames ;
1687 t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentGeneralNames ;
1688 t->comp_desc->cd_free = (comp_free_func*)NULL;
1689 t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentGeneralNames;
1690 t->comp_desc->cd_type = ASN_COMPOSITE;
1691 t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
1692 t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentGeneralNames;
1693 (*bytesDecoded) += totalElmtsLen1;
1694 return LDAP_SUCCESS;
1695 } /* BDecGeneralNamesContent */
1698 GDecComponentGeneralNames PARAMS (( mem_op,b, v, bytesDecoded, mode),
1701 ComponentGeneralNames **v _AND_
1702 AsnLen *bytesDecoded _AND_
1705 char* peek_head,*peek_head2;
1706 int i, strLen,strLen2, rc, old_mode = mode;
1707 ComponentGeneralNames *k,*t, c_temp;
1711 if ( !(mode & DEC_ALLOC_MODE_1) ) {
1712 memset(&c_temp,0,sizeof(c_temp));
1716 mode = DEC_ALLOC_MODE_2;
1717 AsnListInit( &k->comp_list, sizeof( ComponentGeneralName ) );
1719 if( !(strLen = LocateNextGSERToken(mem_op,b, &peek_head, GSER_PEEK)) ){
1720 Asn1Error("Error during Reading { in encoding");
1721 return LDAP_PROTOCOL_ERROR;
1723 if(*peek_head != '{'){
1724 Asn1Error("Missing { in encoded data");
1725 return LDAP_PROTOCOL_ERROR;
1728 for (ElmtsLen1 = 0; ElmtsLen1 >= INDEFINITE_LEN; ElmtsLen1++)
1730 ComponentGeneralName **tmpVar;
1731 if( !(strLen = LocateNextGSERToken(mem_op,b, &peek_head, GSER_NO_COPY)) ){
1732 Asn1Error("Error during Reading{ in encoding");
1733 return LDAP_PROTOCOL_ERROR;
1735 if(*peek_head == '}') break;
1736 if( !(*peek_head == '{' || *peek_head ==',') ) {
1737 return LDAP_PROTOCOL_ERROR;
1739 tmpVar = (ComponentGeneralName**) CompAsnListAppend (mem_op, &k->comp_list);
1740 if ( tmpVar == NULL ) {
1741 Asn1Error("Error during Reading{ in encoding");
1742 return LDAP_PROTOCOL_ERROR;
1744 rc = GDecComponentGeneralName (mem_op, b, tmpVar, bytesDecoded, mode);
1745 if ( rc != LDAP_SUCCESS ) return rc;
1748 if( !(old_mode & DEC_ALLOC_MODE_1) ) {
1749 *v = t = (ComponentGeneralNames*) CompAlloc( mem_op, sizeof(ComponentGeneralNames) );
1750 if ( !t ) return -1;
1753 t->syntax = (Syntax*)NULL;
1754 t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
1755 if ( !t->comp_desc ) {
1759 t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentGeneralNames ;
1760 t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentGeneralNames ;
1761 t->comp_desc->cd_free = (comp_free_func*)NULL;
1762 t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentGeneralNames;
1763 t->comp_desc->cd_type = ASN_COMPOSITE;
1764 t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
1765 t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentGeneralNames;
1766 return LDAP_SUCCESS;
1767 } /* GDecGeneralNamesContent */
1771 MatchingComponentAuthorityKeyIdentifier ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {
1776 mr = retrieve_matching_rule( oid, csi_attr->csi_comp_desc->cd_type_id);
1777 if ( mr ) return component_value_match( mr, csi_attr, csi_assert );
1781 rc = MatchingComponentKeyIdentifier ( oid, (ComponentSyntaxInfo*)&((ComponentAuthorityKeyIdentifier*)csi_attr)->keyIdentifier, (ComponentSyntaxInfo*)&((ComponentAuthorityKeyIdentifier*)csi_assert)->keyIdentifier );
1782 if ( rc != LDAP_COMPARE_TRUE )
1784 if(COMPONENTNOT_NULL( ((ComponentAuthorityKeyIdentifier*)csi_attr)->authorityCertIssuer ) ) {
1785 rc = MatchingComponentGeneralNames ( oid, (ComponentSyntaxInfo*)((ComponentAuthorityKeyIdentifier*)csi_attr)->authorityCertIssuer, (ComponentSyntaxInfo*)((ComponentAuthorityKeyIdentifier*)csi_assert)->authorityCertIssuer );
1786 if ( rc != LDAP_COMPARE_TRUE )
1789 if(COMPONENTNOT_NULL( ((ComponentAuthorityKeyIdentifier*)csi_attr)->authorityCertSerialNumber ) ) {
1790 rc = MatchingComponentCertificateSerialNumber ( oid, (ComponentSyntaxInfo*)((ComponentAuthorityKeyIdentifier*)csi_attr)->authorityCertSerialNumber, (ComponentSyntaxInfo*)((ComponentAuthorityKeyIdentifier*)csi_assert)->authorityCertSerialNumber );
1791 if ( rc != LDAP_COMPARE_TRUE )
1794 return LDAP_COMPARE_TRUE;
1795 } /* BMatchingComponentAuthorityKeyIdentifier */
1798 ExtractingComponentAuthorityKeyIdentifier ( void* mem_op, ComponentReference* cr, ComponentAuthorityKeyIdentifier *comp )
1801 if ( ( comp->keyIdentifier.identifier.bv_val && strncmp(comp->keyIdentifier.identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->keyIdentifier.id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {
1802 if ( cr->cr_curr->ci_next == NULL )
1803 return &comp->keyIdentifier;
1807 if ( ( comp->authorityCertIssuer->identifier.bv_val && strncmp(comp->authorityCertIssuer->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->authorityCertIssuer->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {
1808 if ( cr->cr_curr->ci_next == NULL )
1809 return comp->authorityCertIssuer;
1811 cr->cr_curr = cr->cr_curr->ci_next;
1812 return ExtractingComponentGeneralNames ( mem_op, cr, comp->authorityCertIssuer );
1815 if ( ( comp->authorityCertSerialNumber->identifier.bv_val && strncmp(comp->authorityCertSerialNumber->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->authorityCertSerialNumber->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {
1816 if ( cr->cr_curr->ci_next == NULL )
1817 return comp->authorityCertSerialNumber;
1819 cr->cr_curr = cr->cr_curr->ci_next;
1820 return ExtractingComponentCertificateSerialNumber ( mem_op, cr, comp->authorityCertSerialNumber );
1824 } /* ExtractingComponentAuthorityKeyIdentifier */
1827 BDecComponentAuthorityKeyIdentifier PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),
1831 AsnLen elmtLen0 _AND_
1832 ComponentAuthorityKeyIdentifier **v _AND_
1833 AsnLen *bytesDecoded _AND_
1836 int seqDone = FALSE;
1837 AsnLen totalElmtsLen1 = 0;
1840 int mandatoryElmtCount1 = 0;
1841 AsnLen totalElmtsLen2 = 0;
1844 int old_mode = mode;
1846 ComponentAuthorityKeyIdentifier *k, *t, c_temp;
1849 if ( !(mode & DEC_ALLOC_MODE_1) ) {
1850 memset(&c_temp,0,sizeof(c_temp));
1854 mode = DEC_ALLOC_MODE_2;
1855 if ((elmtLen0 != INDEFINITE_LEN) && (totalElmtsLen1 == elmtLen0))
1859 tagId1 = BDecTag (b, &totalElmtsLen1 );
1861 if ((elmtLen0 == INDEFINITE_LEN) && (tagId1 == EOC_TAG_ID))
1863 BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1 )
1868 if ((!seqDone) && ((tagId1 == MAKE_TAG_ID (CNTX, PRIM, 0)) ||
1869 (tagId1 == MAKE_TAG_ID (CNTX, CONS, 0))))
1871 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
1872 rc = BDecComponentKeyIdentifier (mem_op, b, tagId1, elmtLen1, (&k->keyIdentifier), &totalElmtsLen1, mode);
1873 if ( rc != LDAP_SUCCESS ) return rc;
1874 (&k->keyIdentifier)->identifier.bv_val = (&k->keyIdentifier)->id_buf;
1875 (&k->keyIdentifier)->identifier.bv_len = strlen("keyIdentifier");
1876 strcpy( (&k->keyIdentifier)->identifier.bv_val, "keyIdentifier");
1877 if ((elmtLen0 != INDEFINITE_LEN) && (totalElmtsLen1 == elmtLen0))
1881 tagId1 = BDecTag (b, &totalElmtsLen1 );
1883 if ((elmtLen0 == INDEFINITE_LEN) && (tagId1 == EOC_TAG_ID))
1885 BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1 )
1891 if ((!seqDone) && ((tagId1 == MAKE_TAG_ID (CNTX, CONS, 1))))
1893 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
1894 rc = BDecComponentGeneralNames (mem_op, b, tagId1, elmtLen1,
1895 (&k->authorityCertIssuer), &totalElmtsLen1, mode);
1896 if ( rc != LDAP_SUCCESS ) return rc;
1897 (k->authorityCertIssuer)->identifier.bv_val = (k->authorityCertIssuer)->id_buf;
1898 (k->authorityCertIssuer)->identifier.bv_len = strlen("authorityCertIssuer");
1899 strcpy( (k->authorityCertIssuer)->identifier.bv_val, "authorityCertIssuer");
1900 if ((elmtLen0 != INDEFINITE_LEN) && (totalElmtsLen1 == elmtLen0))
1904 tagId1 = BDecTag (b, &totalElmtsLen1 );
1906 if ((elmtLen0 == INDEFINITE_LEN) && (tagId1 == EOC_TAG_ID))
1908 BDEC_2ND_EOC_OCTET (b, &totalElmtsLen1 )
1914 if ((!seqDone) && ((tagId1 == MAKE_TAG_ID (CNTX, PRIM, 2))))
1916 elmtLen1 = BDecLen (b, &totalElmtsLen1 );
1917 rc = BDecComponentCertificateSerialNumber (mem_op, b, tagId1, elmtLen1, (&k->authorityCertSerialNumber), &totalElmtsLen1, DEC_ALLOC_MODE_0 ); if ( rc != LDAP_SUCCESS ) return rc;
1918 (k->authorityCertSerialNumber)->identifier.bv_val = (k->authorityCertSerialNumber)->id_buf;
1919 (k->authorityCertSerialNumber)->identifier.bv_len = strlen("authorityCertSerialNumber");
1920 strcpy( (k->authorityCertSerialNumber)->identifier.bv_val, "authorityCertSerialNumber");
1922 if (elmtLen0 == INDEFINITE_LEN)
1923 BDecEoc (b, &totalElmtsLen1 );
1924 else if (totalElmtsLen1 != elmtLen0)
1932 if( !(old_mode & DEC_ALLOC_MODE_1) ) {
1933 *v = t = (ComponentAuthorityKeyIdentifier*) CompAlloc( mem_op, sizeof(ComponentAuthorityKeyIdentifier) );
1934 if ( !t ) return -1;
1937 t->syntax = (Syntax*)NULL;
1938 t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
1939 if ( !t->comp_desc ) {
1943 t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentAuthorityKeyIdentifier ;
1944 t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentAuthorityKeyIdentifier ;
1945 t->comp_desc->cd_free = (comp_free_func*)NULL;
1946 t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentAuthorityKeyIdentifier;
1947 t->comp_desc->cd_type = ASN_COMPOSITE;
1948 t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
1949 t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentAuthorityKeyIdentifier;
1950 (*bytesDecoded) += totalElmtsLen1;
1951 return LDAP_SUCCESS;
1952 } /* BDecAuthorityKeyIdentifier*/
1955 GDecComponentAuthorityKeyIdentifier PARAMS (( mem_op,b, v, bytesDecoded, mode),
1958 ComponentAuthorityKeyIdentifier **v _AND_
1959 AsnLen *bytesDecoded _AND_
1962 char* peek_head,*peek_head2;
1963 int i, strLen,strLen2, rc, old_mode = mode;
1964 ComponentAuthorityKeyIdentifier *k,*t, c_temp;
1967 if ( !(mode & DEC_ALLOC_MODE_1) ) {
1968 memset(&c_temp,0,sizeof(c_temp));
1972 mode = DEC_ALLOC_MODE_2;
1974 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
1975 Asn1Error("Error during Reading { in encoded data");
1976 return LDAP_PROTOCOL_ERROR;
1978 if(*peek_head != '{'){
1979 Asn1Error("Missing { in encoded data");
1980 return LDAP_PROTOCOL_ERROR;
1983 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
1984 Asn1Error("Error during Reading identifier");
1985 return LDAP_PROTOCOL_ERROR;
1987 if ( strncmp( peek_head, "keyIdentifier", strlen("keyIdentifier") ) == 0 ) {
1988 rc = GDecComponentKeyIdentifier (mem_op, b, (&k->keyIdentifier), bytesDecoded, mode);
1989 if ( rc != LDAP_SUCCESS ) return rc;
1990 (&k->keyIdentifier)->identifier.bv_val = peek_head;
1991 (&k->keyIdentifier)->identifier.bv_len = strLen;
1992 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
1993 Asn1Error("Error during Reading , ");
1994 return LDAP_PROTOCOL_ERROR;
1996 if(*peek_head != ','){
1997 Asn1Error("Missing , in encoding");
1998 return LDAP_PROTOCOL_ERROR;
2000 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
2001 Asn1Error("Error during Reading identifier");
2002 return LDAP_PROTOCOL_ERROR;
2005 if ( strncmp( peek_head, "authorityCertIssuer", strlen("authorityCertIssuer") ) == 0 ) {
2006 rc = GDecComponentGeneralNames (mem_op, b, (&k->authorityCertIssuer), bytesDecoded, mode);
2007 if ( rc != LDAP_SUCCESS ) return rc;
2008 ( k->authorityCertIssuer)->identifier.bv_val = peek_head;
2009 ( k->authorityCertIssuer)->identifier.bv_len = strLen;
2010 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
2011 Asn1Error("Error during Reading , ");
2012 return LDAP_PROTOCOL_ERROR;
2014 if(*peek_head != ','){
2015 Asn1Error("Missing , in encoding");
2016 return LDAP_PROTOCOL_ERROR;
2018 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){
2019 Asn1Error("Error during Reading identifier");
2020 return LDAP_PROTOCOL_ERROR;
2023 if ( strncmp( peek_head, "authorityCertSerialNumber", strlen("authorityCertSerialNumber") ) == 0 ) {
2024 rc = GDecComponentCertificateSerialNumber (mem_op, b, (&k->authorityCertSerialNumber), bytesDecoded, DEC_ALLOC_MODE_0 );
2025 if ( rc != LDAP_SUCCESS ) return rc;
2026 ( k->authorityCertSerialNumber)->identifier.bv_val = peek_head;
2027 ( k->authorityCertSerialNumber)->identifier.bv_len = strLen;
2029 if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ) {
2030 Asn1Error("Error during Reading } in encoding");
2031 return LDAP_PROTOCOL_ERROR;
2033 if(*peek_head != '}'){
2034 Asn1Error("Missing } in encoding");
2035 return LDAP_PROTOCOL_ERROR;
2037 if( !(old_mode & DEC_ALLOC_MODE_1) ) {
2038 *v = t = (ComponentAuthorityKeyIdentifier*) CompAlloc( mem_op, sizeof(ComponentAuthorityKeyIdentifier) );
2039 if ( !t ) return -1;
2042 t->syntax = (Syntax*)NULL;
2043 t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
2044 if ( !t->comp_desc ) {
2048 t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentAuthorityKeyIdentifier ;
2049 t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentAuthorityKeyIdentifier ;
2050 t->comp_desc->cd_free = (comp_free_func*)NULL;
2051 t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentAuthorityKeyIdentifier;
2052 t->comp_desc->cd_type = ASN_COMPOSITE;
2053 t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;
2054 t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentAuthorityKeyIdentifier;
2055 return LDAP_SUCCESS;
2056 } /* GDecAuthorityKeyIdentifier*/