[PATCH] wpa_supplicant: send a dbus reply only if requested by the caller

Dan Williams dcbw
Mon Feb 9 08:18:24 PST 2009


On Mon, 2009-02-09 at 17:12 +0100, Helmut Schaa wrote:
> wpa_supplicant should not send a dbus reply as response to a method call if
> no reply was requested by the caller. Sending a reply even if not requested
> is basically no problem but triggers dbus warnings like the one below.
> 
> Feb  9 07:31:23 linux-gvjr dbus-daemon: Rejected send message, 2 matched rules;
> type="error", sender=":1.129" (uid=0 pid=30228 comm="/usr/sbin/wpa_supplicant
> -c /etc/wpa_supplicant/wp") interface="(unset)" member="(unset)" error
> name="fi.epitest.hostap.WPASupplicant.InvalidInterface" requested_reply=0
> destination=":1.128" (uid=0 pid=30226 comm="/usr/sbin/NetworkManager "))

Seems fine to me; upstream dbus devs recommend that language bindings
handle the no-reply bits themselves, but of course since we're not using
bindings here (since wpa_supplicant itself can't link to glib or qt or
whatever) it's got to be done manually.

Marcel and I have talked about implementing a replacement dbus interface
that would also support introspection; which would probably fix many of
these warnings.  Might be a good time to start using a dbus helper
library too.

Dan

> Signed-off-by: Helmut Schaa <helmut.schaa at googlemail.com>
> ---
> diff --git a/wpa_supplicant/ctrl_iface_dbus.c b/wpa_supplicant/ctrl_iface_dbus.c
> index b772247..e7138d7 100644
> --- a/wpa_supplicant/ctrl_iface_dbus.c
> +++ b/wpa_supplicant/ctrl_iface_dbus.c
> @@ -548,7 +548,8 @@ static DBusHandlerResult wpas_iface_message_handler(DBusConnection *connection,
>  
>  	/* If the message was handled, send back the reply */
>  	if (reply) {
> -		dbus_connection_send(connection, reply, NULL);
> +		if(!dbus_message_get_no_reply(message))
> +			dbus_connection_send(connection, reply, NULL);
>  		dbus_message_unref(reply);
>  	}
>  
> @@ -607,7 +608,8 @@ static DBusHandlerResult wpas_message_handler(DBusConnection *connection,
>  
>  	/* If the message was handled, send back the reply */
>  	if (reply) {
> -		dbus_connection_send(connection, reply, NULL);
> +		if (!dbus_message_get_no_reply(message))
> +			dbus_connection_send(connection, reply, NULL);
>  		dbus_message_unref(reply);
>  	}
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap




More information about the Hostap mailing list