service: Add CONNMAN_SERVICE_ERROR_INVALID_KEY to service error enum
authorPatrik Flykt <patrik.flykt@nokia.com>
Fri, 4 Feb 2011 13:14:20 +0000 (15:14 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 7 Feb 2011 23:59:00 +0000 (00:59 +0100)
Add invalid key/passphrase definition for a service and unset the
current passphrase when this error is indicated.

include/service.h
src/service.c

index faa6cf8..910fe1b 100644 (file)
@@ -85,6 +85,7 @@ enum connman_service_error {
        CONNMAN_SERVICE_ERROR_CONNECT_FAILED = 4,
        CONNMAN_SERVICE_ERROR_LOGIN_FAILED  = 5,
        CONNMAN_SERVICE_ERROR_AUTH_FAILED    = 6,
+       CONNMAN_SERVICE_ERROR_INVALID_KEY    = 7,
 };
 
 enum connman_service_proxy_method {
index 5081763..4c9fad9 100644 (file)
@@ -265,6 +265,8 @@ static const char *error2string(enum connman_service_error error)
                return "login-failed";
        case CONNMAN_SERVICE_ERROR_AUTH_FAILED:
                return "auth-failed";
+       case CONNMAN_SERVICE_ERROR_INVALID_KEY:
+               return "invalid-key";
        }
 
        return NULL;
@@ -276,6 +278,8 @@ static enum connman_service_error string2error(const char *error)
                return CONNMAN_SERVICE_ERROR_DHCP_FAILED;
        else if (g_strcmp0(error, "pin-missing") == 0)
                return CONNMAN_SERVICE_ERROR_PIN_MISSING;
+       else if (g_strcmp0(error, "invalid-key") == 0)
+               return CONNMAN_SERVICE_ERROR_INVALID_KEY;
 
        return CONNMAN_SERVICE_ERROR_UNKNOWN;
 }
@@ -3252,6 +3256,9 @@ int __connman_service_indicate_error(struct connman_service *service,
 
        service->error = error;
 
+       if (service->error == CONNMAN_SERVICE_ERROR_INVALID_KEY)
+               __connman_service_set_passphrase(service, NULL);
+
        return __connman_service_indicate_state(service,
                                        CONNMAN_SERVICE_STATE_FAILURE);
 }