From a7efd8ab4c570a28d349c3a0dfcd75badfc861ce Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Tue, 11 Aug 2009 22:01:27 +0000 Subject: [PATCH] * add possibility to specify SSL credentials for self-signet certificates so one can have several dev-boxes without firefox and friends getting paranoid. --- webcit/crypto.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/webcit/crypto.c b/webcit/crypto.c index 2e6308491..534e617e9 100644 --- a/webcit/crypto.c +++ b/webcit/crypto.c @@ -187,7 +187,7 @@ void init_ssl(void) if (pk=EVP_PKEY_new(), pk != NULL) { EVP_PKEY_assign_RSA(pk, rsa); if (req = X509_REQ_new(), req != NULL) { - + const char *env; /* Set the public key */ X509_REQ_set_pubkey(req, pk); X509_REQ_set_version(req, 0L); @@ -211,24 +211,37 @@ void init_ssl(void) MBSTRING_ASC, "Mount Kisco", -1, -1, 0); */ + env = getenv("O"); + if (env == NULL) + env = "Organization name", + X509_NAME_add_entry_by_txt( name, "O", MBSTRING_ASC, - (unsigned char*)"Organization name", + (unsigned char*)env, -1, -1, 0 ); + env = getenv("OU"); + if (env == NULL) + env = "Citadel server"; + X509_NAME_add_entry_by_txt( name, "OU", MBSTRING_ASC, - (unsigned char*)"Citadel server1", + (unsigned char*)env, -1, -1, 0 ); + env = getenv("O"); + if (env == NULL) + env = "*"; + X509_NAME_add_entry_by_txt( name, "CN", MBSTRING_ASC, - (unsigned char*)"*", -1, -1, 0 + (unsigned char*)env, + -1, -1, 0 ); X509_REQ_set_subject_name(req, name); -- 2.30.2