From ce575f13f777800c042d9d6bb86fbee068247b5f Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Wed, 28 Jul 2010 07:35:34 +0000 Subject: [PATCH] Improved tls certificate creation in https plugin --- src/transport/plugin_transport_https.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/transport/plugin_transport_https.c b/src/transport/plugin_transport_https.c index cf5d3f32b..b37cd4970 100644 --- a/src/transport/plugin_transport_https.c +++ b/src/transport/plugin_transport_https.c @@ -2515,9 +2515,24 @@ libgnunet_plugin_transport_https_init (void *cls) if ((plugin->key==NULL) || (plugin->cert==NULL)) { char * cmd; + int ret = 0; GNUNET_asprintf(&cmd,"gnunet-transport-certificate-creation %s %s", key_file, cert_file); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No usable TLS certificate found, creating certificate \n"); - system(cmd); + ret = system(cmd); + + if (ret != 0) + { + GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, + "https", + _("Could not create a new TLS certificate, shell script `%s' failed!\n"),cmd, + "transport-https"); + GNUNET_free (key_file); + GNUNET_free (cert_file); + libgnunet_plugin_transport_https_done(api); + GNUNET_free (cmd); + return NULL; + } + GNUNET_free (cmd); plugin->key = load_certificate( key_file ); @@ -2525,7 +2540,10 @@ libgnunet_plugin_transport_https_init (void *cls) if ((plugin->key==NULL) || (plugin->cert==NULL)) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No usable TLS certificate found and creating one failed! \n"); + GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, + "https", + _("No usable TLS certificate found and creating one failed! \n"), + "transport-https"); GNUNET_free (key_file); GNUNET_free (cert_file); libgnunet_plugin_transport_https_done(api); -- 2.25.1