int i;
if (input == NULL)
- return false;
+ return -1;
for (i = 0; input[i] != '\0'; i++)
- if (isspace(input[i]) != 0)
- continue;
+ if (isspace(input[i]) == 0)
+ break;
if (strcasecmp(&input[i], "yes") == 0 ||
strcasecmp(&input[i], "y") == 0)
if (strcasecmp(&input[i], "no") == 0 ||
strcasecmp(&input[i], "n") == 0)
- return 1;
+ return 0;
return -1;
}
{
__connmanctl_save_rl();
- fprintf(stdout, message);
+ fprintf(stdout, "%s", message);
__connmanctl_redraw_rl();
g_dbus_send_message(agent_connection, agent_reply.reply);
agent_reply.reply = NULL;
+
+ pending_message_remove();
+ pending_command_complete("");
+
+ __connmanctl_redraw_rl();
}
static void request_input_append(const char *attribute, char *value)
{
/* TBD passphrase length checking */
- agent_input[PASSPHRASE].requested = false;
- request_input_append(agent_input[PASSPHRASE].attribute, input);
+ if (input != NULL && strlen(input) > 0) {
+ agent_input[PASSPHRASE].requested = false;
+ request_input_append(agent_input[PASSPHRASE].attribute, input);
- if (input != NULL && strlen(input) > 0)
agent_input[WPS].requested = false;
- request_input_next();
+ request_input_next();
+ }
}
static void request_input_string_return(char *input)
fprintf(stdout, "Agent RequestInput %s\n", service);
__connmanctl_dbus_print(&dict, " ", " = ", "\n");
fprintf(stdout, "\n");
- __connmanctl_redraw_rl();
dbus_message_iter_recurse(&iter, &dict);
dbus_message_iter_recurse(&field_entry, &field_value);
- dbus_message_iter_get_basic(&field_value, &value);
-
- if (strcmp(argument, "Type") == 0)
+ if (strcmp(argument, "Type") == 0) {
+ dbus_message_iter_get_basic(&field_value,
+ &value);
attr_type = g_strdup(value);
+ }
dbus_message_iter_next(&dict_entry);
}
return 0;
}
- result = __connmanctl_dbus_method_call(connection, "/",
- "net.connman.Manager", "RegisterAgent",
+ result = __connmanctl_dbus_method_call(connection, CONNMAN_SERVICE,
+ CONNMAN_PATH, "net.connman.Manager", "RegisterAgent",
agent_register_return, connection,
DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID);
g_dbus_unregister_interface(connection, agent_path(), AGENT_INTERFACE);
- result = __connmanctl_dbus_method_call(connection, "/",
- "net.connman.Manager", "UnregisterAgent",
+ result = __connmanctl_dbus_method_call(connection, CONNMAN_SERVICE,
+ CONNMAN_PATH, "net.connman.Manager", "UnregisterAgent",
agent_unregister_return, NULL,
DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID);