[gnome-remote-desktop] context: Use GKeyFile as fallback for TPM



commit 9345c8340ce1fe4ef52c5c4e1abc025c3057644c
Author: Alynx Zhou <alynx zhou gmail com>
Date:   Mon Aug 8 16:27:55 2022 +0800

    context: Use GKeyFile as fallback for TPM

 src/grd-context.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/src/grd-context.c b/src/grd-context.c
index 564228a0..f57b0438 100644
--- a/src/grd-context.c
+++ b/src/grd-context.c
@@ -24,6 +24,7 @@
 
 #include "grd-context.h"
 
+#include "grd-credentials-file.h"
 #include "grd-credentials-libsecret.h"
 #include "grd-credentials-tpm.h"
 #include "grd-egl-thread.h"
@@ -111,13 +112,21 @@ grd_context_new (GrdRuntimeMode   runtime_mode,
                  GError         **error)
 {
   g_autoptr (GrdContext) context = NULL;
+  g_autoptr (GError) local_error = NULL;
 
   context = g_object_new (GRD_TYPE_CONTEXT, NULL);
 
   switch (runtime_mode)
     {
     case GRD_RUNTIME_MODE_HEADLESS:
-      context->credentials = GRD_CREDENTIALS (grd_credentials_tpm_new (error));
+      context->credentials = GRD_CREDENTIALS (grd_credentials_tpm_new (&local_error));
+      if (!context->credentials)
+        {
+          g_warning ("Init TPM credentials failed because %s, using GKeyFile as fallback",
+                     local_error->message);
+          context->credentials =
+            GRD_CREDENTIALS (grd_credentials_file_new (error));
+        }
       break;
     case GRD_RUNTIME_MODE_SCREEN_SHARE:
       context->credentials = GRD_CREDENTIALS (grd_credentials_libsecret_new ());


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