[PATCH 2/4] service: Add CONNMAN_SERVICE_ERROR_INVALID_KEY to service error enum

patrik.flykt at nokia.com patrik.flykt at nokia.com
Mon Jan 24 04:20:56 PST 2011


From: Patrik Flykt <patrik.flykt at nokia.com>

Add invalid key/passphrase definition for a service and unset the
current passphrase when this error is indicated.
---
 include/service.h |    1 +
 src/service.c     |    7 +++++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/include/service.h b/include/service.h
index dd857e2..42c24d9 100644
--- a/include/service.h
+++ b/include/service.h
@@ -83,6 +83,7 @@ enum connman_service_error {
 	CONNMAN_SERVICE_ERROR_PIN_MISSING    = 2,
 	CONNMAN_SERVICE_ERROR_DHCP_FAILED    = 3,
 	CONNMAN_SERVICE_ERROR_CONNECT_FAILED = 4,
+	CONNMAN_SERVICE_ERROR_INVALID_KEY    = 5,
 };
 
 enum connman_service_proxy_method {
diff --git a/src/service.c b/src/service.c
index 0ea1223..edb599c 100644
--- a/src/service.c
+++ b/src/service.c
@@ -260,6 +260,8 @@ static const char *error2string(enum connman_service_error error)
 		return "dhcp-failed";
 	case CONNMAN_SERVICE_ERROR_CONNECT_FAILED:
 		return "connect-failed";
+	case CONNMAN_SERVICE_ERROR_INVALID_KEY:
+		return "invalid-key";
 	}
 
 	return NULL;
@@ -271,6 +273,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;
 }
@@ -3202,6 +3206,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);
 }
-- 
1.7.2.3




More information about the connman mailing list