Merge pull request #5292 from Icinga/fix/openssl-0.9.8-subjectaltname

Build fix for OpenSSL 0.9.8 and stack_st_X509_EXTENSION

fixes #5292
This commit is contained in:
Gunnar Beutner 2017-05-29 09:45:34 +02:00 committed by GitHub
commit c9039e1850
1 changed files with 2 additions and 1 deletions

View File

@ -409,7 +409,8 @@ int MakeX509CSR(const String& cn, const String& keyfile, const String& csrfile,
String san = "DNS:" + cn; String san = "DNS:" + cn;
X509_EXTENSION *subjectAltNameExt = X509V3_EXT_conf_nid(NULL, NULL, NID_subject_alt_name, const_cast<char *>(san.CStr())); X509_EXTENSION *subjectAltNameExt = X509V3_EXT_conf_nid(NULL, NULL, NID_subject_alt_name, const_cast<char *>(san.CStr()));
if (subjectAltNameExt) { if (subjectAltNameExt) {
stack_st_X509_EXTENSION *exts = sk_X509_EXTENSION_new_null(); /* OpenSSL 0.9.8 requires STACK_OF(X509_EXTENSION), otherwise we would just use stack_st_X509_EXTENSION. */
STACK_OF(X509_EXTENSION) *exts = sk_X509_EXTENSION_new_null();
sk_X509_EXTENSION_push(exts, subjectAltNameExt); sk_X509_EXTENSION_push(exts, subjectAltNameExt);
X509_REQ_add_extensions(req, exts); X509_REQ_add_extensions(req, exts);
sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free); sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free);