| 1775 | } |
| 1776 | |
| 1777 | static 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 | |
| 1804 | static apr_status_t sk_add_alt_names(STACK_OF(X509_EXTENSION) *exts, |
| 1805 | apr_array_header_t *domains, apr_pool_t *p) |
no test coverage detected