[Gambas-user] Dbus unique name seems incorrect

Brian G brian at westwoodsvcs.com
Sun Jan 16 23:26:52 CET 2022

Hi Benoît,

  When working with the policykit1, some of the methods require a unique name. By the DBus standard a unique name must start with a colon. Normally the Hello method would return a unique id, but that crashes when I try to us it.

When I try to pass the dbus name to the Kit I get an invalid name error. Upon research the name must start with a : to be unique.

When working with the PolicyKit1:

  Dim Proxy As New DBusProxy(App, "/org/freedesktop/PolicyKit1/Authority", "org.freedesktop.PolicyKit1.Authority")
  Dim System_Bus_Name As String = DBus.name
  Dim subject As Variant = ["system-bus-name", ["name": System_Bus_Name]]
  Dim action_id As String = "org.freedesktop.policykit.exec"
  Dim Details As Variant = New Collection
  Dim flags As Integer = 1
  Dim cancellation_id As String = ""
  Dim sresult As Variant = Proxy.CheckAuthorization(subject, action_id, details, flags, cancellation_id)
            org.freedesktop.PolicyKit1.Error.Failed:Error getting subject: Error Parsing system-bus-name subject: 'org.gambas.Auth-537384' is not a unique name.

  Would it be possible to change how the naming works?

"Failure is the key to success; 
 each mistake teaches us something"  .. Morihei Ueshiba
Brian G

----- On Jan 16, 2022, at 1:05 PM, Benoît Minisini g4mba5 at gmail.com wrote:

> Le 16/01/2022 à 03:26, Brian G a écrit :
>> In the db.dbus module
>> the dbus.unique is false to start but seems to try and create a unique name
>> When set to true it appears to create a non unique name.
>> And as far as a unique name goes, it must start with a : for the system
>> to recognize it as unique...
> Where did you see that?
> Setting DBus.Unique changes just the name used for registering to the D-Bus.
> If not set, the name includes the application name and the process PID.
> If set, just the application name, so that two instances of the same
> application will use the same name.
> It's just a trick, and D-Bus is not concerned by it.
> Regards,
> --
> Benoît Minisini
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----

More information about the User mailing list