Validating Message Parameters

Thiago Macieira thiago at kde.org
Sun Aug 20 23:18:52 UTC 2017


On Sunday, 20 August 2017 15:22:02 PDT Lawrence D'Oliveiro wrote:
> In libdbus, when you call one of the dbus_message_new_xxx methods and
> pass something invalid for the destination, path, interface or
> method/member arguments, all you get back is a result of false, with no
> indication of what you did wrong. It is up to you to make prior calls
> as necessary to dbus_validate_{bus_name,path,interface,member} to
> ensure that all these strings have the valid form.

Or you get an assertion failure and your application crashes.

> My Python wrappers for these validation calls in DBussy
> <https://github.com/ldo/dbussy>, as with all the wrappers for calls that
> take a DBusError argument, let you omit the corresponding Python Error
> object. If you do this, they will create a temporary one internally, and
> automatically raise an exception if it gets filled in with an error
> indication. Luckily, this gives you a much better description of what
> you did wrong:
[cut]

QtDBus also pre-validates the input and provides better error messages.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center



More information about the dbus mailing list