MCPcopy Create free account
hub / github.com/apache/httpd / add_ext

Function add_ext

modules/md/md_crypt.c:1777–1802  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1775}
1776
1777static apr_status_t add_ext(X509 *x, int nid, const char *value, apr_pool_t *p)
1778{
1779 X509_EXTENSION *ext = NULL;
1780 X509V3_CTX ctx;
1781 apr_status_t rv;
1782
1783 ERR_clear_error();
1784 X509V3_set_ctx_nodb(&ctx);
1785 X509V3_set_ctx(&ctx, x, x, NULL, NULL, 0);
1786 if (NULL == (ext = X509V3_EXT_conf_nid(NULL, &ctx, nid, (char*)value))) {
1787 unsigned long err = ERR_get_error();
1788 md_log_perror(MD_LOG_MARK, MD_LOG_ERR, 0, p, "add_ext, create, nid=%d value='%s' "
1789 "(lib=%d, reason=%d)", nid, value, ERR_GET_LIB(err), ERR_GET_REASON(err));
1790 return APR_EGENERAL;
1791 }
1792
1793 ERR_clear_error();
1794 rv = X509_add_ext(x, ext, -1)? APR_SUCCESS : APR_EINVAL;
1795 if (APR_SUCCESS != rv) {
1796 unsigned long err = ERR_get_error();
1797 md_log_perror(MD_LOG_MARK, MD_LOG_ERR, 0, p, "add_ext, add, nid=%d value='%s' "
1798 "(lib=%d, reason=%d)", nid, value, ERR_GET_LIB(err), ERR_GET_REASON(err));
1799 }
1800 X509_EXTENSION_free(ext);
1801 return rv;
1802}
1803
1804static apr_status_t sk_add_alt_names(STACK_OF(X509_EXTENSION) *exts,
1805 apr_array_header_t *domains, apr_pool_t *p)

Callers 3

mk_x509Function · 0.85
md_cert_self_signFunction · 0.85
md_cert_make_tls_alpn_01Function · 0.85

Calls 1

md_log_perrorFunction · 0.85

Tested by

no test coverage detected