gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] 30/39: http3: Autogenerate certificate when there is no certifi


From: gnunet
Subject: [gnunet] 30/39: http3: Autogenerate certificate when there is no certificate in the configuration file.
Date: Sun, 25 Aug 2024 15:16:26 +0200

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

commit 9e8c81abb04ae363b9d475e80b8bb8b9f9c9e877
Author: Shichao <mrrr61@outlook.com>
AuthorDate: Tue Jul 30 12:07:06 2024 +0800

    http3: Autogenerate certificate when there is no certificate in the 
configuration file.
---
 src/service/transport/gnunet-communicator-http3.c | 58 +++++++++++++++--------
 1 file changed, 38 insertions(+), 20 deletions(-)

diff --git a/src/service/transport/gnunet-communicator-http3.c 
b/src/service/transport/gnunet-communicator-http3.c
index cdf8c4b15..3b0ba227e 100644
--- a/src/service/transport/gnunet-communicator-http3.c
+++ b/src/service/transport/gnunet-communicator-http3.c
@@ -3188,28 +3188,46 @@ run (void *cls,
     return;
   }
 
-  if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_filename (cfg,
-                                               COMMUNICATOR_CONFIG_SECTION,
-                                               "KEY_FILE",
-                                               &key_file))
+  key_file = NULL;
+  cert_file = NULL;
+  if ((GNUNET_OK !=
+       GNUNET_CONFIGURATION_get_value_filename (cfg,
+                                                COMMUNICATOR_CONFIG_SECTION,
+                                                "KEY_FILE",
+                                                &key_file)) ||
+      (GNUNET_OK !=
+       GNUNET_CONFIGURATION_get_value_filename (cfg,
+                                                COMMUNICATOR_CONFIG_SECTION,
+                                                "CERT_FILE",
+                                                &cert_file)))
   {
-    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
-                               COMMUNICATOR_CONFIG_SECTION,
-                               "KEY_FILE");
-    return;
-  }
-  if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_filename (cfg,
-                                               COMMUNICATOR_CONFIG_SECTION,
-                                               "CERT_FILE",
-                                               &cert_file))
-  {
-    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
-                               COMMUNICATOR_CONFIG_SECTION,
-                               "CERT_FILE");
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Creating new certificate\n");
     GNUNET_free (key_file);
-    return;
+    GNUNET_free (cert_file);
+    key_file = GNUNET_strdup("https.key");
+    cert_file = GNUNET_strdup("https.crt");
+
+    struct GNUNET_OS_Process *cert_creation;
+
+    cert_creation = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
+                                             NULL, NULL, NULL,
+                                             
"gnunet-transport-certificate-creation",
+                                             
"gnunet-transport-certificate-creation",
+                                             key_file,
+                                             cert_file,
+                                             NULL);
+    if (NULL == cert_creation)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "Can't create new certificate\n");
+      GNUNET_free (key_file);
+      GNUNET_free (cert_file);
+
+      return;
+    }
+    GNUNET_OS_process_wait (cert_creation);
+    GNUNET_OS_process_destroy (cert_creation);
   }
 
   disable_v6 = GNUNET_NO;

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]