--- bluez-pin-0.30/pin-dbus.c.orig 2006-03-14 14:35:18.000000000 +0000 +++ bluez-pin-0.30/pin-dbus.c 2006-03-14 14:40:11.000000000 +0000 @@ -81,45 +81,24 @@ bluez_pin_handle_dbus_request (DBusConne unsigned char *bytes; int nbytes; BluetoothPinRequest *req; + DBusError error = { 0 }; - dbus_message_iter_init (message, &iter); - - type = dbus_message_iter_get_arg_type (&iter); - if (type != DBUS_TYPE_BOOLEAN) - { - reply = dbus_message_new_error (message, WRONG_ARGS_ERROR, - "Boolean expected, other type given"); + memset(&bdaddr, 0, 6); + dbus_error_init(&error); + dbus_message_get_args(message, &error, + DBUS_TYPE_BOOLEAN, &out, + DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &bytes, &nbytes, + DBUS_TYPE_INVALID); + if (dbus_error_is_set(&error)) { + reply = dbus_message_new_error(message, WRONG_ARGS_ERROR, + "Incorrect argument types"); + /* Is it static storage of the name? */ + dbus_error_free(&error); goto error; } - -#ifdef HAVE_DBUS_MESSAGE_ITER_GET_BASIC - dbus_message_iter_get_basic (&iter, &out); -#else - out = dbus_message_iter_get_boolean (&iter); -#endif - - if (! dbus_message_iter_next (&iter)) - { - reply = dbus_message_new_error (message, WRONG_ARGS_ERROR, - "Byte array expected but missing"); - goto error; - } - - type = dbus_message_iter_get_arg_type (&iter); - -#ifdef HAVE_DBUS_MESSAGE_ITER_GET_BASIC - nbytes = 0; - if (type == DBUS_TYPE_ARRAY) - dbus_message_iter_get_fixed_array (&iter, &bytes, &nbytes); - if (nbytes != sizeof (bdaddr)) -#else - if (type != DBUS_TYPE_ARRAY - || ! dbus_message_iter_get_byte_array (&iter, &bytes, &nbytes) - || nbytes != sizeof (bdaddr)) -#endif - { + if (nbytes != sizeof(bdaddr)) { reply = dbus_message_new_error (message, WRONG_ARGS_ERROR, - "Byte array expected, other type given"); + "Byte array incorrect size"); goto error; }