agent: Handle empty D-Bus message
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Mon, 9 Jan 2012 16:50:20 +0000 (17:50 +0100)
committerDaniel Wagner <daniel.wagner@bmw-carit.de>
Mon, 9 Jan 2012 16:53:37 +0000 (17:53 +0100)
In case the agent sends wrongly an empty reply.

src/agent.c

index 9c789cf..d8d0fe6 100644 (file)
@@ -111,6 +111,9 @@ static void request_input_passphrase_reply(DBusPendingCall *call, void *user_dat
        values_received = TRUE;
 
        dbus_message_iter_init(reply, &iter);
+       if (dbus_message_iter_has_next(&iter) == FALSE)
+               goto done;
+
        dbus_message_iter_recurse(&iter, &dict);
        while (dbus_message_iter_get_arg_type(&dict) == DBUS_TYPE_DICT_ENTRY) {
                DBusMessageIter entry, value;
@@ -337,6 +340,9 @@ static void request_input_login_reply(DBusPendingCall *call, void *user_data)
                goto done;
 
        dbus_message_iter_init(reply, &iter);
+       if (dbus_message_iter_has_next(&iter) == FALSE)
+               goto done;
+
        dbus_message_iter_recurse(&iter, &dict);
        while (dbus_message_iter_get_arg_type(&dict) == DBUS_TYPE_DICT_ENTRY) {
                DBusMessageIter entry, value;