aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_http.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-08-01 20:55:56 +0000
committerChristian Grothoff <christian@grothoff.org>2011-08-01 20:55:56 +0000
commitde5f7ca7ed2e9aaca009c8015848b956bb23c11d (patch)
tree6167cf769e386e985859fccf52cd1f627dc1dc76 /src/transport/plugin_transport_http.c
parent070a124b2a307accd0cc9a755a409668f5483704 (diff)
downloadgnunet-de5f7ca7ed2e9aaca009c8015848b956bb23c11d.tar.gz
gnunet-de5f7ca7ed2e9aaca009c8015848b956bb23c11d.zip
a bit cleanr
Diffstat (limited to 'src/transport/plugin_transport_http.c')
-rw-r--r--src/transport/plugin_transport_http.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c
index 955b622b7..528098f05 100644
--- a/src/transport/plugin_transport_http.c
+++ b/src/transport/plugin_transport_http.c
@@ -3482,7 +3482,7 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
3482 3482
3483 if ( (plugin->key==NULL) || (plugin->cert==NULL) ) 3483 if ( (plugin->key==NULL) || (plugin->cert==NULL) )
3484 { 3484 {
3485 struct GNUNET_OS_Process *certcreation = NULL; 3485 struct GNUNET_OS_Process *certcreation;
3486 enum GNUNET_OS_ProcessStatusType status_type = GNUNET_OS_PROCESS_UNKNOWN; 3486 enum GNUNET_OS_ProcessStatusType status_type = GNUNET_OS_PROCESS_UNKNOWN;
3487 unsigned long code = 0; 3487 unsigned long code = 0;
3488 int ret = 0; 3488 int ret = 0;
@@ -3491,15 +3491,21 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
3491 plugin->key = NULL; 3491 plugin->key = NULL;
3492 GNUNET_free_non_null (plugin->cert); 3492 GNUNET_free_non_null (plugin->cert);
3493 plugin->cert = NULL; 3493 plugin->cert = NULL;
3494#if DEBUG_HTTP
3494 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3495 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3495 "No usable TLS certificate found, creating certificate\n"); 3496 "No usable TLS certificate found, creating certificate\n");
3497#endif
3496 errno = 0; 3498 errno = 0;
3497 certcreation = GNUNET_OS_start_process (NULL, NULL, "gnunet-transport-certificate-creation", "gnunet-transport-certificate-creation", key_file, cert_file, NULL); 3499 certcreation = GNUNET_OS_start_process (NULL, NULL,
3498 if (certcreation == NULL 3500 "gnunet-transport-certificate-creation",
3499 || (ret = 1) != 1 || GNUNET_OS_process_wait (certcreation) != GNUNET_OK 3501 "gnunet-transport-certificate-creation",
3500 || (ret = 2) != 2 || (GNUNET_OS_process_status (certcreation, &status_type, &code) != GNUNET_OK 3502 key_file, cert_file,
3501 || (ret = 3) != 3 || status_type != GNUNET_OS_PROCESS_EXITED 3503 NULL);
3502 || (ret = 4) != 4 || code != 0)) 3504 if ( (certcreation == NULL) ||
3505 (1 != (ret = 1) ) || (GNUNET_OS_process_wait (certcreation) != GNUNET_OK) ||
3506 (2 != (ret = 2) ) || (GNUNET_OS_process_status (certcreation, &status_type, &code) != GNUNET_OK) ||
3507 (3 != (ret = 3) ) || (status_type != GNUNET_OS_PROCESS_EXITED) ||
3508 (4 != (ret = 4) ) || (code != 0) )
3503 { 3509 {
3504 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, 3510 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
3505 "https", 3511 "https",
@@ -3509,11 +3515,11 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
3509 GNUNET_free (cert_file); 3515 GNUNET_free (cert_file);
3510 GNUNET_free (component_name); 3516 GNUNET_free (component_name);
3511 if (certcreation != NULL) 3517 if (certcreation != NULL)
3512 { 3518 {
3513 GNUNET_OS_process_kill (certcreation, SIGTERM); 3519 GNUNET_OS_process_kill (certcreation, SIGTERM);
3514 GNUNET_OS_process_close (certcreation); 3520 GNUNET_OS_process_close (certcreation);
3515 } 3521 }
3516 LIBGNUNET_PLUGIN_TRANSPORT_DONE(api); 3522 LIBGNUNET_PLUGIN_TRANSPORT_DONE (api);
3517 return NULL; 3523 return NULL;
3518 } 3524 }
3519 GNUNET_OS_process_close (certcreation); 3525 GNUNET_OS_process_close (certcreation);
@@ -3537,9 +3543,11 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
3537 GNUNET_free (cert_file); 3543 GNUNET_free (cert_file);
3538 3544
3539 GNUNET_assert((plugin->key!=NULL) && (plugin->cert!=NULL)); 3545 GNUNET_assert((plugin->key!=NULL) && (plugin->cert!=NULL));
3546#if DEBUG_HTTP
3540 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3547 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3541 "TLS certificate loaded\n"); 3548 "TLS certificate loaded\n");
3542#endif 3549#endif
3550#endif
3543 3551
3544 GNUNET_assert ((port > 0) && (port <= 65535)); 3552 GNUNET_assert ((port > 0) && (port <= 65535));
3545 plugin->port_inbound = port; 3553 plugin->port_inbound = port;