static readstat_error_t read_attributes(int (*handle_attribute)(char *key, rdata_sexptype_info_t val_info, rdata_ctx_t *ctx), rdata_ctx_t *ctx) { rdata_sexptype_info_t pairlist_info, val_info; readstat_error_t retval = READSTAT_OK; retval = read_sexptype_header(&pairlist_info, ctx); if (retval != READSTAT_OK) goto cleanup; while (pairlist_info.header.type == RDATA_SEXPTYPE_PAIRLIST) { /* value */ if ((retval = read_sexptype_header(&val_info, ctx)) != READSTAT_OK) goto cleanup; if (handle_attribute) { char *key = atom_table_lookup(ctx->atom_table, pairlist_info.ref); if ((retval = handle_attribute(key, val_info, ctx)) != READSTAT_OK) goto cleanup; } else { if ((retval = recursive_discard(val_info.header, ctx)) != READSTAT_OK) goto cleanup; } /* next */ if ((retval = read_sexptype_header(&pairlist_info, ctx)) != READSTAT_OK) goto cleanup; } cleanup: return retval; }
/* * Deocde the CertificateRequestInfo */ void PKCS10_Request::force_decode() { BER_Decoder cert_req_info(m_tbs_bits); size_t version; cert_req_info.decode(version); if(version != 0) throw Decoding_Error("Unknown version code in PKCS #10 request: " + std::to_string(version)); X509_DN dn_subject; cert_req_info.decode(dn_subject); m_info.add(dn_subject.contents()); BER_Object public_key = cert_req_info.get_next_object(); if(public_key.type_tag != SEQUENCE || public_key.class_tag != CONSTRUCTED) throw BER_Bad_Tag("PKCS10_Request: Unexpected tag for public key", public_key.type_tag, public_key.class_tag); m_info.add("X509.Certificate.public_key", PEM_Code::encode( ASN1::put_in_sequence(unlock(public_key.value)), "PUBLIC KEY" ) ); BER_Object attr_bits = cert_req_info.get_next_object(); if(attr_bits.type_tag == 0 && attr_bits.class_tag == ASN1_Tag(CONSTRUCTED | CONTEXT_SPECIFIC)) { BER_Decoder attributes(attr_bits.value); while(attributes.more_items()) { Attribute attr; attributes.decode(attr); handle_attribute(attr); } attributes.verify_end(); } else if(attr_bits.type_tag != NO_OBJECT) throw BER_Bad_Tag("PKCS10_Request: Unexpected tag for attributes", attr_bits.type_tag, attr_bits.class_tag); cert_req_info.verify_end(); if(!this->check_signature(subject_public_key())) throw Decoding_Error("PKCS #10 request: Bad signature detected"); }
int uade_song_and_player_attribute(struct uade_attribute **attributelist, int *flags, char *item, size_t lineno) { size_t i, len; for (i = 0; epconf[i].s != NULL; i++) { if (strcasecmp(item, epconf[i].s) == 0) { *flags |= epconf[i].e; return 1; } } for (i = 0; epconf_variables[i].s != NULL; i++) { len = strlen(epconf_variables[i].s); if (strncasecmp(item, epconf_variables[i].s, len) != 0) continue; handle_attribute(attributelist, &epconf_variables[i], item, len, lineno); return 1; } return 0; }