ExecImpl* ExecImpl::start() { state_ = SIMIX_RUNNING; if (not MC_is_active() && not MC_record_replay_is_active()) { if (hosts_.size() == 1) { surf_action_ = hosts_.front()->pimpl_cpu->execution_start(flops_amounts_.front()); surf_action_->set_priority(priority_); surf_action_->set_category(get_tracing_category()); if (bound_ > 0) surf_action_->set_bound(bound_); } else { surf_action_ = surf_host_model->execute_parallel(hosts_, flops_amounts_.data(), bytes_amounts_.data(), -1); } surf_action_->set_activity(this); } XBT_DEBUG("Create execute synchro %p: %s", this, get_cname()); ExecImpl::on_creation(*this); return this; }
int openssl_cert_match_name(SSL *ssl, const char *verify_name) { X509 *cert; STACK_OF(GENERAL_NAME) *gnames; const GENERAL_NAME *gn; const char *dnsname; bool dns_names = FALSE; unsigned int i, count; int ret; cert = SSL_get_peer_certificate(ssl); i_assert(cert != NULL); /* verify against SubjectAltNames */ gnames = X509_get_ext_d2i(cert, NID_subject_alt_name, NULL, NULL); count = gnames == NULL ? 0 : sk_GENERAL_NAME_num(gnames); for (i = 0; i < count; i++) { gn = sk_GENERAL_NAME_value(gnames, i); if (gn->type == GEN_DNS) { dns_names = TRUE; dnsname = get_general_dns_name(gn); if (openssl_hostname_equals(dnsname, verify_name)) break; } } sk_GENERAL_NAME_pop_free(gnames, GENERAL_NAME_free); /* verify against CommonName only when there wasn't any DNS SubjectAltNames */ if (dns_names) ret = i < count ? 0 : -1; else if (openssl_hostname_equals(get_cname(cert), verify_name)) ret = 0; else ret = -1; X509_free(cert); return ret; }
int CertX509ReadStrProperty(X509 *cert, int property, char *pBuf, int len) { int result = CERT_OK; int dataIdx = 0; X509_NAME *cName; // ASN1_STRING *data; int lproperty; if (NULL == cert) { result = CERT_BAD_CERTIFICATE; return result; } lproperty= make_property_ssl_equiv(property); cName= get_cname(property,cert); if(lproperty==NID_subject_alt_name){ // if 1 dataIdx= get_subjectaltname(cert,pBuf, len); } //end 1 else{ //### dataIdx = X509_NAME_get_text_by_NID(cName, lproperty, pBuf, len); char *sub_str = pBuf; int space_taken = 0; int space_left = len; //int loc; X509_NAME_ENTRY *e; //loc = -1; int lastpos = -1; int atleast_one_entry = 0; for (;;) { lastpos = X509_NAME_get_index_by_NID(cName, lproperty, lastpos); //(nm, NID_commonName, lastpos); if (lastpos == -1){ if(atleast_one_entry) dataIdx = 1; else dataIdx = -1; break; } atleast_one_entry = 1; e = X509_NAME_get_entry(cName, lastpos); /* Do something with e */ ASN1_IA5STRING *data; data = X509_NAME_ENTRY_get_data(e); syslog(LOG_INFO,"all common name: %s", (char *) data->data); if(0 < space_left) space_taken= copy_csv_to_buffer(sub_str, (char *)data->data, len, space_left); space_left= space_left - space_taken; } } if (0 > dataIdx) { return CERT_PROPERTY_NOT_FOUND; } else { // trim trailing ',' int pBufLen = strlen(pBuf); if (pBuf[pBufLen-1] == ',') pBuf[pBufLen-1] = '\0'; return CERT_OK; } // return CERT_PROPERTY_STRING_NOT_FOUND; }
XBT_ATTRIB_DEPRECATED_v323("Please use Actor::get_cname()") const char* getCname() const { return get_cname(); }