eldbus - make method calls less crasy since libdbus likes to abort
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Sun, 4 Oct 2015 08:53:46 +0000 (17:53 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Sun, 4 Oct 2015 08:53:46 +0000 (17:53 +0900)
changes zmike made to e's systray make e abort due to libdbus seeing
the bus name as invalid. it actually is. it's
/org/ayatana/NotificationItem/steam for example - instead of
or.whatever.blah - thuis e aborts continually if you run steam at all.
eldbus should be more crash-proof thus this adds checks so dbus fun
doesnt cause an app to crash if it happens to call incorrect dbus names.

@fix

src/lib/eldbus/eldbus_message.c

index 54cba80..56f87d2 100644 (file)
@@ -108,6 +108,22 @@ eldbus_message_method_call_new(const char *dest, const char *path, const char *i
    EINA_SAFETY_ON_NULL_RETURN_VAL(iface, NULL);
    EINA_SAFETY_ON_NULL_RETURN_VAL(method, NULL);
 
+   if (!dbus_validate_bus_name(dest, NULL))
+     {
+        ERR("Invalid bus name '%s'", dest);
+        return NULL;
+     }
+   if (!dbus_validate_path(path, NULL))
+     {
+        ERR("Invalid path '%s'", path);
+        return NULL;
+     }
+   if (!dbus_validate_interface(iface, NULL))
+     {
+        ERR("Invalid interface '%s'", iface);
+        return NULL;
+     }
+
    msg = eldbus_message_new(EINA_TRUE);
    EINA_SAFETY_ON_NULL_GOTO(msg, fail);