From: Patrik Flykt Date: Mon, 5 Sep 2011 04:21:04 +0000 (+0200) Subject: service: Behave properly when RequestInput is cancelled X-Git-Tag: 0.78~270 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7598b4c566568aa49ac2f24677cd17592cbd449a;p=platform%2Fupstream%2Fconnman.git service: Behave properly when RequestInput is cancelled Do the same actions on cancelling RequestInput as when not retrying a service on ReportError. Re-fixes BMC#22542. --- diff --git a/src/service.c b/src/service.c index ea54a79..65255d1 100644 --- a/src/service.c +++ b/src/service.c @@ -3099,45 +3099,6 @@ static connman_bool_t get_reconnect_state(struct connman_service *service) return __connman_device_get_reconnect(device); } -static void request_input_cb (struct connman_service *service, - const char *identity, const char *passphrase, - void *user_data) -{ - DBG ("RequestInput return, %p", service); - - if (identity == NULL && passphrase == NULL && service->wps == FALSE) - return; - - if (identity != NULL) - __connman_service_set_agent_identity(service, identity); - - if (passphrase != NULL) { - switch (service->security) { - case CONNMAN_SERVICE_SECURITY_WEP: - case CONNMAN_SERVICE_SECURITY_PSK: - __connman_service_set_passphrase(service, passphrase); - break; - case CONNMAN_SERVICE_SECURITY_8021X: - __connman_service_set_agent_passphrase(service, - passphrase); - break; - case CONNMAN_SERVICE_SECURITY_UNKNOWN: - case CONNMAN_SERVICE_SECURITY_NONE: - case CONNMAN_SERVICE_SECURITY_WPA: - case CONNMAN_SERVICE_SECURITY_RSN: - DBG("service security '%s' not handled", - security2string(service->security)); - break; - } - } - - __connman_service_connect(service); - - /* Never cache agent provided credentials */ - __connman_service_set_agent_identity(service, NULL); - __connman_service_set_agent_passphrase(service, NULL); -} - static DBusMessage *connect_service(DBusConnection *conn, DBusMessage *msg, void *user_data) { @@ -3898,6 +3859,49 @@ static void report_error_cb(struct connman_service *service, } } +static void request_input_cb (struct connman_service *service, + const char *identity, const char *passphrase, + void *user_data) +{ + DBG ("RequestInput return, %p", service); + + if (identity == NULL && passphrase == NULL && service->wps == FALSE) { + service_complete(service); + services_changed(FALSE); + __connman_device_request_scan(CONNMAN_DEVICE_TYPE_UNKNOWN); + return; + } + + if (identity != NULL) + __connman_service_set_agent_identity(service, identity); + + if (passphrase != NULL) { + switch (service->security) { + case CONNMAN_SERVICE_SECURITY_WEP: + case CONNMAN_SERVICE_SECURITY_PSK: + __connman_service_set_passphrase(service, passphrase); + break; + case CONNMAN_SERVICE_SECURITY_8021X: + __connman_service_set_agent_passphrase(service, + passphrase); + break; + case CONNMAN_SERVICE_SECURITY_UNKNOWN: + case CONNMAN_SERVICE_SECURITY_NONE: + case CONNMAN_SERVICE_SECURITY_WPA: + case CONNMAN_SERVICE_SECURITY_RSN: + DBG("service security '%s' not handled", + security2string(service->security)); + break; + } + } + + __connman_service_connect(service); + + /* Never cache agent provided credentials */ + __connman_service_set_agent_identity(service, NULL); + __connman_service_set_agent_passphrase(service, NULL); +} + static int service_indicate_state(struct connman_service *service) { enum connman_service_state old_state, new_state;