[PATCH] Fix new DBus API

Jouni Malinen j
Tue Feb 1 08:45:27 PST 2011


On Wed, Jan 05, 2011 at 12:08:02PM +0200, Tomasz Bursztyka wrote:
> "psk" field, in set_network_properties(), was always getting quoted even when
> containing a raw key (64 characters length representing the hexadecimal value
> of the raw key).

Dan described the design here and it sounds reasonable to allow this as
an alternative approach. However, there is something here that looks a
bit odd to me..

> @@ -273,11 +286,12 @@ static DBusMessage * set_network_properties(DBusMessage *message,
>  		} else if (entry.type == DBUS_TYPE_STRING) {
> -			if (should_quote_opt(entry.key)) {
> -				size = os_strlen(entry.str_value);
> -				if (size <= 0)
> -					goto error;
> +			size = os_strlen(entry.str_value);
> +			if (size <= 0)
> +				goto error;
>  
> +			if (should_quote_opt(entry.key, size,
> +					     entry.str_value)) {

Why is size == 0 an error? I'm not sure it was correct with the previous
quote case either, but now any use of DBUS_TYPE_STRING would trigger an
error if the string is empty. There are number of configuration
parameters for which an empty string is a valid value. Am I missing
something or how is this supposed to work for such cases?
 
-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list