[glib: 1/2] Allow guid key in dbus addresses



commit 6a1512ed65091f30eb0d17d19da7eb8d38f17cf6
Author: Emmanuel Fleury <emmanuel fleury u-bordeaux fr>
Date:   Mon Jul 1 16:20:53 2019 +0200

    Allow guid key in dbus addresses
    
    Original patch from William Hua
    
    Fix issue #1018

 gio/gdbusaddress.c          | 6 +++---
 gio/tests/gdbus-addresses.c | 6 ++++++
 2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gio/gdbusaddress.c b/gio/gdbusaddress.c
index e88695139..4a3063a7b 100644
--- a/gio/gdbusaddress.c
+++ b/gio/gdbusaddress.c
@@ -150,7 +150,7 @@ is_valid_unix (const gchar  *address_entry,
         tmpdir = g_hash_table_lookup (key_value_pairs, key);
       else if (g_strcmp0 (key, "abstract") == 0)
         abstract = g_hash_table_lookup (key_value_pairs, key);
-      else
+      else if (g_strcmp0 (key, "guid") != 0)
         {
           g_set_error (error,
                        G_IO_ERROR,
@@ -224,7 +224,7 @@ is_valid_nonce_tcp (const gchar  *address_entry,
         family = g_hash_table_lookup (key_value_pairs, key);
       else if (g_strcmp0 (key, "noncefile") == 0)
         nonce_file = g_hash_table_lookup (key_value_pairs, key);
-      else
+      else if (g_strcmp0 (key, "guid") != 0)
         {
           g_set_error (error,
                        G_IO_ERROR,
@@ -305,7 +305,7 @@ is_valid_tcp (const gchar  *address_entry,
         port = g_hash_table_lookup (key_value_pairs, key);
       else if (g_strcmp0 (key, "family") == 0)
         family = g_hash_table_lookup (key_value_pairs, key);
-      else
+      else if (g_strcmp0 (key, "guid") != 0)
         {
           g_set_error (error,
                        G_IO_ERROR,
diff --git a/gio/tests/gdbus-addresses.c b/gio/tests/gdbus-addresses.c
index b7c81fc06..173383d83 100644
--- a/gio/tests/gdbus-addresses.c
+++ b/gio/tests/gdbus-addresses.c
@@ -108,7 +108,9 @@ test_unix_address (void)
   g_test_skip ("unix transport is not supported on non-Unix platforms");
 #else
   assert_is_supported_address ("unix:path=/tmp/dbus-test");
+  assert_is_supported_address ("unix:path=/tmp/dbus-test,guid=0");
   assert_is_supported_address ("unix:abstract=/tmp/dbus-another-test");
+  assert_is_supported_address ("unix:abstract=/tmp/dbus-another-test,guid=1000");
   assert_not_supported_address ("unix:foo=bar");
   g_assert_false (g_dbus_is_address ("unix:path=/foo;abstract=/bar"));
   assert_is_supported_address ("unix:path=/tmp/concrete;unix:abstract=/tmp/abstract");
@@ -128,9 +130,11 @@ static void
 test_nonce_tcp_address (void)
 {
   assert_is_supported_address ("nonce-tcp:host=localhost,port=42,noncefile=/foo/bar");
+  assert_is_supported_address ("nonce-tcp:host=localhost,port=42,noncefile=/foo/bar,guid=0");
   assert_is_supported_address ("nonce-tcp:host=localhost,port=42,noncefile=/foo/bar,family=ipv6");
   assert_is_supported_address ("nonce-tcp:host=localhost,port=42,noncefile=/foo/bar,family=ipv4");
   assert_is_supported_address ("nonce-tcp:host=localhost");
+  assert_is_supported_address ("nonce-tcp:host=localhost,guid=1000");
 
   assert_not_supported_address ("nonce-tcp:host=localhost,port=42,noncefile=/foo/bar,family=blah");
   assert_not_supported_address ("nonce-tcp:host=localhost,port=420000,noncefile=/foo/bar,family=ipv4");
@@ -148,8 +152,10 @@ static void
 test_tcp_address (void)
 {
   assert_is_supported_address ("tcp:host=localhost");
+  assert_is_supported_address ("tcp:host=localhost,guid=1000");
   assert_not_supported_address ("tcp:host=localhost,noncefile=/tmp/foo");
   assert_is_supported_address ("tcp:host=localhost,port=42");
+  assert_is_supported_address ("tcp:host=localhost,port=42,guid=1000");
   assert_not_supported_address ("tcp:host=localhost,port=-1");
   assert_not_supported_address ("tcp:host=localhost,port=420000");
   assert_not_supported_address ("tcp:host=localhost,port=42x");


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