Return-Path: MIME-Version: 1.0 In-Reply-To: <1346996989.21200.120.camel@aeonflux> References: <1345272662-2850-1-git-send-email-lucas.demarchi@profusion.mobi> <1345272662-2850-7-git-send-email-lucas.demarchi@profusion.mobi> <1346961700.21200.116.camel@aeonflux> <1346996989.21200.120.camel@aeonflux> Date: Fri, 7 Sep 2012 11:35:43 +0300 Message-ID: Subject: Re: [PATCH BlueZ v3 06/15] gdbus: Implement DBus.Properties.Set method From: Luiz Augusto von Dentz To: Marcel Holtmann Cc: Lucas De Marchi , linux-bluetooth@vger.kernel.org Content-Type: text/plain; charset=ISO-8859-1 List-ID: Hi Marcel, On Fri, Sep 7, 2012 at 8:49 AM, Marcel Holtmann wrote: > Hi Luiz, > >> >> Contrary to Get() and GetAll(), Set is asynchronous so we pass on the >> >> DBusMessage so user is able to create the response. It's the only use of >> >> this parameter. >> >> --- >> >> gdbus/gdbus.h | 7 +++++++ >> >> gdbus/object.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- >> >> 2 files changed, 64 insertions(+), 2 deletions(-) >> >> >> >> diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h >> >> index b2e78c4..3e4aa16 100644 >> >> --- a/gdbus/gdbus.h >> >> +++ b/gdbus/gdbus.h >> >> @@ -31,6 +31,8 @@ extern "C" { >> >> #include >> >> #include >> >> >> >> +typedef enum GDBusPropertySetReturn GDBusPropertySetReturn; >> >> + >> >> typedef enum GDBusMethodFlags GDBusMethodFlags; >> >> typedef enum GDBusSignalFlags GDBusSignalFlags; >> >> typedef enum GDBusPropertyFlags GDBusPropertyFlags; >> >> @@ -69,6 +71,10 @@ typedef DBusMessage * (* GDBusMethodFunction) (DBusConnection *connection, >> >> typedef gboolean (*GDBusPropertyGetter)(const GDBusPropertyTable *property, >> >> DBusMessageIter *iter, void *data); >> >> >> >> +typedef DBusMessage *(*GDBusPropertySetter)(const GDBusPropertyTable *property, >> >> + DBusMessageIter *value, >> >> + DBusMessage *msg, void *data); >> >> + >> > >> > I am not really happy with this. We just need a unique handle here since >> > the return value is either success or an error. I rather don't send >> > messages around for no other reason to create the error. >> > >> > Inside the authorization code I am using GDBusPendingReply as unique >> > token. What about using the same approach? >> >> It would be perfect, but Im afraid sometimes the properties can have >> restriction on which sender can set them, so perhaps we need to add >> the name of the sender as parameter in addiction to just the handle? > > that should be done through the same security handling we have for the > method calls. Don't try to invent something new. Im afraid you will have to go in detail what you want here, the security table seems to be meant for checking privileges in a method level while we can probably extend it for properties and have privileges also in the properties table, but the security table seems to be global not per interface. -- Luiz Augusto von Dentz