int connman_network_connect_hidden(struct connman_network *network,
char *identity, char* passphrase)
{
+ int err = 0;
struct connman_service *service;
DBG("");
__connman_service_set_agent_identity(service, identity);
if (passphrase != NULL)
- __connman_service_add_passphrase(service, passphrase);
+ err = __connman_service_add_passphrase(service, passphrase);
- return __connman_service_connect(service);
+ if (err == -ENOKEY) {
+ __connman_service_indicate_error(service,
+ CONNMAN_SERVICE_ERROR_INVALID_KEY);
+ return err;
+ } else
+ return __connman_service_connect(service);
}
/**
void *user_data)
{
struct connman_device *device;
+ int err = 0;
DBG ("RequestInput return, %p", service);
__connman_service_set_agent_identity(service, identity);
if (passphrase != NULL)
- __connman_service_add_passphrase(service, passphrase);
+ err = __connman_service_add_passphrase(service, passphrase);
- __connman_service_connect(service);
+ if (err >= 0) {
+ __connman_service_connect(service);
- /* Never cache agent provided credentials */
- __connman_service_set_agent_identity(service, NULL);
- __connman_service_set_agent_passphrase(service, NULL);
+ /* Never cache agent provided credentials */
+ __connman_service_set_agent_identity(service, NULL);
+ __connman_service_set_agent_passphrase(service, NULL);
+ } else if (err == -ENOKEY) {
+ __connman_service_indicate_error(service,
+ CONNMAN_SERVICE_ERROR_INVALID_KEY);
+ __connman_agent_report_error(service,
+ error2string(service->error),
+ report_error_cb, NULL);
+ }
}
static void downgrade_connected_services(void)