[gnome-remote-desktop] settings: Allow overriding RDP password with env var



commit 9aa9181e930f69d063949c69191304b11342dea6
Author: Pascal Nowack <Pascal Nowack gmx de>
Date:   Tue Feb 2 09:35:53 2021 +0100

    settings: Allow overriding RDP password with env var
    
    For testing purposes. Also overrides the username when env var is set.

 src/grd-settings.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/src/grd-settings.c b/src/grd-settings.c
index 3af87be..d2f31d2 100644
--- a/src/grd-settings.c
+++ b/src/grd-settings.c
@@ -137,10 +137,15 @@ char *
 grd_settings_get_rdp_username (GrdSettings  *settings,
                                GError      **error)
 {
+  const char *test_password_override;
   GVariant *credentials;
   char *credentials_string;
   char *username = NULL;
 
+  test_password_override = g_getenv ("GNOME_REMOTE_DESKTOP_TEST_RDP_PASSWORD");
+  if (test_password_override)
+    return g_strdup ("TEST");
+
   credentials_string = secret_password_lookup_sync (GRD_RDP_CREDENTIALS_SCHEMA,
                                                     NULL, error,
                                                     NULL);
@@ -164,10 +169,15 @@ char *
 grd_settings_get_rdp_password (GrdSettings  *settings,
                                GError      **error)
 {
+  const char *test_password_override;
   GVariant *credentials;
   char *credentials_string;
   char *password = NULL;
 
+  test_password_override = g_getenv ("GNOME_REMOTE_DESKTOP_TEST_RDP_PASSWORD");
+  if (test_password_override)
+    return g_strdup (test_password_override);
+
   credentials_string = secret_password_lookup_sync (GRD_RDP_CREDENTIALS_SCHEMA,
                                                     NULL, error,
                                                     NULL);


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