D-Bus/P2P: Treat PIN as string

wpa_supplicant returns the PIN in reply to the connect method. Treating
this value as an integer runs the risk of not returning the correct
value if the first digit(s) happens to be a zero(es). To return the
correct PIN it needs to be returned as a string.

Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Angie Chinchilla <angie.v.chinchilla@intel.com>
This commit is contained in:
Reinette Chatre 2011-09-13 09:27:29 -07:00 committed by Jouni Malinen
parent a57db49c32
commit 97a8cbb88d
2 changed files with 7 additions and 3 deletions

View File

@ -2204,7 +2204,7 @@ static const struct wpa_dbus_method_desc wpas_dbus_interface_methods[] = {
(WPADBusMethodHandler)wpas_dbus_handler_p2p_connect,
{
{ "args", "a{sv}", ARG_IN },
{ "generated_pin", "i", ARG_OUT },
{ "generated_pin", "s", ARG_OUT },
END_ARGS
}
},

View File

@ -510,9 +510,13 @@ DBusMessage * wpas_dbus_handler_p2p_connect(DBusMessage *message,
go_intent, freq);
if (new_pin >= 0) {
char npin[9];
char *generated_pin;
os_snprintf(npin, sizeof(npin), "%08d", new_pin);
generated_pin = npin;
reply = dbus_message_new_method_return(message);
dbus_message_append_args(reply, DBUS_TYPE_INT32,
&new_pin, DBUS_TYPE_INVALID);
dbus_message_append_args(reply, DBUS_TYPE_STRING,
&generated_pin, DBUS_TYPE_INVALID);
} else {
switch (new_pin) {
case -2: