⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 certificate.c

📁 ldap服务器源码
💻 C
📖 第 1 页 / 共 5 页
字号:
		Asn1Error("Error during Reading { in encoded data");		return LDAP_PROTOCOL_ERROR;	}	if(*peek_head != '{'){		Asn1Error("Missing { in encoded data");		return LDAP_PROTOCOL_ERROR;	}	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){		Asn1Error("Error during Reading identifier");		return LDAP_PROTOCOL_ERROR;	}	if ( strncmp( peek_head, "extnID", strlen("extnID") ) == 0 ) {		rc = 	GDecComponentOid (mem_op, b, (&k->extnID), bytesDecoded, mode);		if ( rc != LDAP_SUCCESS ) return rc;	(&k->extnID)->identifier.bv_val = peek_head;	(&k->extnID)->identifier.bv_len = strLen;	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){		Asn1Error("Error during Reading , ");		return LDAP_PROTOCOL_ERROR;	}	if(*peek_head != ','){		Asn1Error("Missing , in encoding");		return LDAP_PROTOCOL_ERROR;	}	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){	  Asn1Error("Error during Reading identifier");		return LDAP_PROTOCOL_ERROR;	}	}	if ( strncmp( peek_head, "critical", strlen("critical") ) == 0 ) {		rc = 	GDecComponentBool (mem_op, b, (&k->critical), bytesDecoded, DEC_ALLOC_MODE_0 );		if ( rc != LDAP_SUCCESS ) return rc;	( k->critical)->identifier.bv_val = peek_head;	( k->critical)->identifier.bv_len = strLen;	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){		Asn1Error("Error during Reading , ");		return LDAP_PROTOCOL_ERROR;	}	if(*peek_head != ','){		Asn1Error("Missing , in encoding");		return LDAP_PROTOCOL_ERROR;	}	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){	  Asn1Error("Error during Reading identifier");		return LDAP_PROTOCOL_ERROR;	}	}	else {(k->critical) = CompAlloc( mem_op, sizeof(ComponentBool));			(k->critical)->value = 0;	}	if ( strncmp( peek_head, "extnValue", strlen("extnValue") ) == 0 ) {		rc = 	GDecComponentOcts (mem_op, b, (&k->extnValue), bytesDecoded, mode);		if ( rc != LDAP_SUCCESS ) return rc;	(&k->extnValue)->identifier.bv_val = peek_head;	(&k->extnValue)->identifier.bv_len = strLen;	}	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ) {		Asn1Error("Error during Reading } in encoding");		return LDAP_PROTOCOL_ERROR;	}	if(*peek_head != '}'){		Asn1Error("Missing } in encoding");		return LDAP_PROTOCOL_ERROR;	}	if( !(old_mode & DEC_ALLOC_MODE_1) ) {	*v = t = (ComponentExtension*) CompAlloc( mem_op, sizeof(ComponentExtension) );	if ( !t ) return -1;	*t = *k;	}	t->syntax = (Syntax*)NULL;	t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );	if ( !t->comp_desc ) {		free ( t );		return -1;	}	t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentExtension ;	t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentExtension ;	t->comp_desc->cd_free = (comp_free_func*)NULL;	t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentExtension;	t->comp_desc->cd_type = ASN_COMPOSITE;	t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;	t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentExtension;	return LDAP_SUCCESS;}  /* GDecExtension*/intMatchingComponentAttributeTypeAndValue ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {	int rc;	MatchingRule* mr;	if ( oid ) {		mr = retrieve_matching_rule( oid, csi_attr->csi_comp_desc->cd_type_id);		if ( mr ) return component_value_match( mr, csi_attr, csi_assert );	}	rc = 1;	rc =	MatchingComponentAttributeType ( oid, (ComponentSyntaxInfo*)&((ComponentAttributeTypeAndValue*)csi_attr)->type, (ComponentSyntaxInfo*)&((ComponentAttributeTypeAndValue*)csi_assert)->type );	if ( rc != LDAP_COMPARE_TRUE )		return rc;	rc =	SetAnyTypeByComponentOid ((ComponentSyntaxInfo*)&((ComponentAttributeTypeAndValue*)csi_attr)->value, (&((ComponentAttributeTypeAndValue*)csi_attr)->type));	rc = MatchingComponentAnyDefinedBy ( oid, (ComponentAny*)&((ComponentAttributeTypeAndValue*)csi_attr)->value, (ComponentAny*)&((ComponentAttributeTypeAndValue*)csi_assert)->value);	if ( rc != LDAP_COMPARE_TRUE )		return rc;	return LDAP_COMPARE_TRUE;}  /* BMatchingComponentAttributeTypeAndValue */void*ExtractingComponentAttributeTypeAndValue ( void* mem_op, ComponentReference* cr, ComponentAttributeTypeAndValue *comp ){	if ( ( comp->type.identifier.bv_val && strncmp(comp->type.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_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {		if ( cr->cr_curr->ci_next == NULL )		return &comp->type;		else		return NULL;	}	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 ) ) {		if ( cr->cr_curr->ci_next == NULL )		return &comp->value;		else if ( cr->cr_curr->ci_next->ci_type == LDAP_COMPREF_SELECT ) {			cr->cr_curr = cr->cr_curr->ci_next;			return &comp->value;	 } else {		return NULL;		}	}	return NULL;}  /* ExtractingComponentAttributeTypeAndValue */intBDecComponentAttributeTypeAndValue PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),void* mem_op _AND_GenBuf * b _AND_AsnTag tagId0 _AND_AsnLen elmtLen0 _AND_ComponentAttributeTypeAndValue **v _AND_AsnLen *bytesDecoded _AND_int mode){	int seqDone = FALSE;	AsnLen totalElmtsLen1 = 0;	AsnLen elmtLen1;	AsnTag tagId1;	int mandatoryElmtCount1 = 0;	int old_mode = mode;	int rc;	ComponentAttributeTypeAndValue *k, *t, c_temp;	if ( !(mode & DEC_ALLOC_MODE_1) ) {		memset(&c_temp,0,sizeof(c_temp));		 k = &c_temp;	} else		 k = t = *v;	mode = DEC_ALLOC_MODE_2;    tagId1 = BDecTag (b, &totalElmtsLen1 );    if (((tagId1 == MAKE_TAG_ID (UNIV, PRIM, OID_TAG_CODE))))    {    elmtLen1 = BDecLen (b, &totalElmtsLen1 );	rc = BDecComponentAttributeType (mem_op, b, tagId1, elmtLen1, (&k->type), &totalElmtsLen1, mode);		if ( rc != LDAP_SUCCESS ) return rc;		(&k->type)->identifier.bv_val = (&k->type)->id_buf;		(&k->type)->identifier.bv_len = strlen("type");		strcpy( (&k->type)->identifier.bv_val, "type");    }    else        return -1;    {	rc = SetAnyTypeByComponentOid ((&k->value), (&k->type)); 	rc = BDecComponentAnyDefinedBy (mem_op,b, (&k->value), &totalElmtsLen1, mode );		if ( rc != LDAP_SUCCESS ) return rc;		(&k->value)->identifier.bv_val = (&k->value)->id_buf;		(&k->value)->identifier.bv_len = strlen("value");		strcpy( (&k->value)->identifier.bv_val, "value");        seqDone = TRUE;        if (elmtLen0 == INDEFINITE_LEN)            BDecEoc (b, &totalElmtsLen1 );        else if (totalElmtsLen1 != elmtLen0)        return -1;    }    if (!seqDone)        return -1;	if( !(old_mode & DEC_ALLOC_MODE_1) ) {	*v = t = (ComponentAttributeTypeAndValue*) CompAlloc( mem_op, sizeof(ComponentAttributeTypeAndValue) );	if ( !t ) return -1;	*t = *k;	}	t->syntax = (Syntax*)NULL;	t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );	if ( !t->comp_desc ) {		free ( t );		return -1;	}	t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentAttributeTypeAndValue ;	t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentAttributeTypeAndValue ;	t->comp_desc->cd_free = (comp_free_func*)NULL;	t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentAttributeTypeAndValue;	t->comp_desc->cd_type = ASN_COMPOSITE;	t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;	t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentAttributeTypeAndValue;    (*bytesDecoded) += totalElmtsLen1;	return LDAP_SUCCESS;}  /* BDecAttributeTypeAndValue*/intGDecComponentAttributeTypeAndValue PARAMS (( mem_op,b, v, bytesDecoded, mode),void* mem_op _AND_GenBuf * b _AND_ComponentAttributeTypeAndValue **v _AND_AsnLen *bytesDecoded _AND_int mode){	char* peek_head,*peek_head2;	int i, strLen,strLen2, rc, old_mode = mode;	ComponentAttributeTypeAndValue *k,*t, c_temp;	if ( !(mode & DEC_ALLOC_MODE_1) ) {		memset(&c_temp,0,sizeof(c_temp));		 k = &c_temp;	} else		 k = t = *v;	mode = DEC_ALLOC_MODE_2;	*bytesDecoded = 0;	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){		Asn1Error("Error during Reading { in encoded data");		return LDAP_PROTOCOL_ERROR;	}	if(*peek_head != '{'){		Asn1Error("Missing { in encoded data");		return LDAP_PROTOCOL_ERROR;	}	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){		Asn1Error("Error during Reading identifier");		return LDAP_PROTOCOL_ERROR;	}	if ( strncmp( peek_head, "type", strlen("type") ) == 0 ) {		rc = 	GDecComponentAttributeType (mem_op, b, (&k->type), bytesDecoded, mode);		if ( rc != LDAP_SUCCESS ) return rc;	(&k->type)->identifier.bv_val = peek_head;	(&k->type)->identifier.bv_len = strLen;	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){		Asn1Error("Error during Reading , ");		return LDAP_PROTOCOL_ERROR;	}	if(*peek_head != ','){		Asn1Error("Missing , in encoding");		return LDAP_PROTOCOL_ERROR;	}	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){	  Asn1Error("Error during Reading identifier");		return LDAP_PROTOCOL_ERROR;	}	}	if ( strncmp( peek_head, "value", strlen("value") ) == 0 ) {		rc = 	rc = SetAnyTypeByComponentOid ((&k->value), (&k->type));	rc = GDecComponentAnyDefinedBy (mem_op, b, (&k->value), bytesDecoded, mode );		if ( rc != LDAP_SUCCESS ) return rc;	(&k->value)->identifier.bv_val = peek_head;	(&k->value)->identifier.bv_len = strLen;	}	if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ) {		Asn1Error("Error during Reading } in encoding");		return LDAP_PROTOCOL_ERROR;	}	if(*peek_head != '}'){		Asn1Error("Missing } in encoding");		return LDAP_PROTOCOL_ERROR;	}	if( !(old_mode & DEC_ALLOC_MODE_1) ) {	*v = t = (ComponentAttributeTypeAndValue*) CompAlloc( mem_op, sizeof(ComponentAttributeTypeAndValue) );	if ( !t ) return -1;	*t = *k;	}	t->syntax = (Syntax*)NULL;	t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );	if ( !t->comp_desc ) {		free ( t );		return -1;	}	t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentAttributeTypeAndValue ;	t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentAttributeTypeAndValue ;	t->comp_desc->cd_free = (comp_free_func*)NULL;	t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentAttributeTypeAndValue;	t->comp_desc->cd_type = ASN_COMPOSITE;	t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE;	t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentAttributeTypeAndValue;	return LDAP_SUCCESS;}  /* GDecAttributeTypeAndValue*/intMatchingComponentValidity ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) {	int rc;	MatchingRule* mr;	if ( oid ) {		mr = retrieve_matching_rule( oid, csi_attr->csi_comp_desc->cd_type_id);		if ( mr ) return component_value_match( mr, csi_attr, csi_assert );	}	rc = 1;	rc =	MatchingComponentTime ( oid, (ComponentSyntaxInfo*)((ComponentValidity*)csi_attr)->notBefore, (ComponentSyntaxInfo*)((ComponentValidity*)csi_assert)->notBefore );	if ( rc != LDAP_COMPARE_TRUE )		return rc;	rc =	MatchingComponentTime ( oid, (ComponentSyntaxInfo*)((ComponentValidity*)csi_attr)->notAfter, (ComponentSyntaxInfo*)((ComponentValidity*)csi_assert)->notAfter );	if ( rc != LDAP_COMPARE_TRUE )		return rc;	return LDAP_COMPARE_TRUE;}  /* BMatchingComponentValidity */void*ExtractingComponentValidity ( void* mem_op, ComponentReference* cr, ComponentValidity *comp ){	if ( ( comp->notBefore->identifier.bv_val && strncmp(comp->notBefore->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->notBefore->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {		if ( cr->cr_curr->ci_next == NULL )			return comp->notBefore;		else {			cr->cr_curr = cr->cr_curr->ci_next;			return 	ExtractingComponentTime ( mem_op, cr, comp->notBefore );		}	}	if ( ( comp->notAfter->identifier.bv_val && strncmp(comp->notAfter->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->notAfter->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) {		if ( cr->cr_curr->ci_next == NULL )			return comp->notAfter;		else {			cr->cr_curr = cr->cr_curr->ci_next;			return 	ExtractingComponentTime ( mem_op, cr, comp->notAfter );		}	}	return NULL;}  /* ExtractingComponentValidity */intBDecComponentValidity PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),void* mem_op _AND_GenBuf * b _AND_AsnTag tagId0 _AND_AsnLen elmtLen0 _AND_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -