Commit Message

On Fri, Apr 13, 2012 at 10:33:33AM +0300, Adrien Bustany wrote:
> In most languages, DBus dictionaries are mapped to either sorted maps> or hash tables, so you can't control the actual ordering of the> generated a{sv}. Relying on ordering in this method is unnecessary and> makes it use from DBus much harder.
In general, this sounds fine, but there are couple of issues with this
patch. Could you please check whether the one in the end of the message
is fine? It could also be worth considering getting this pushed into the
1.x release branch, but I'm not familiar with the D-Bus API to make that
call.
> diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c> @@ -2078,23 +2078,30 @@ DBusMessage * wpas_dbus_handler_p2p_add_service(DBusMessage *message,> + } else if (!os_strcmp(entry.key, "service") &&> + (entry.type == DBUS_TYPE_STRING)) {> + service = os_strdup(entry.str_value);> + } else if (!os_strcmp(entry.key, "query")) {> + if ((entry.type != DBUS_TYPE_ARRAY) ||> + (entry.array_type != DBUS_TYPE_BYTE))> + goto error_clear;> + query = wpabuf_alloc_copy(> + entry.bytearray_value,> + entry.array_len);> + } else if (!os_strcmp(entry.key, "response")) {> + if ((entry.type != DBUS_TYPE_ARRAY) ||> + (entry.array_type != DBUS_TYPE_BYTE))> + goto error_clear;> + resp = wpabuf_alloc_copy(entry.bytearray_value,> + entry.array_len);
Moving these handlers into the shared iteration opened up some memory
leaks (I think the original code already had one on an error path, but
this added few additional cases).
> @@ -2107,20 +2114,6 @@ DBusMessage * wpas_dbus_handler_p2p_add_service(DBusMessage *message,> if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))> goto error;> > - if (!os_strcmp(entry.key, "query")) {
...
Is there any point in leaving the duplicated iteration here with an
empty body? I would assume this was supposed to be removed (as is done
in the patch below).

On Tue, Apr 17, 2012 at 12:19:37PM +0300, Adrien Bustany wrote:
> It seems indeed that I cut/pasted a bit too fast for this patch... Your > version seems better, will you apply it or do you want me to send a > fixed patch?
Thanks, I applied this.