Hi Marcel,

I found myself expecting the Remove method of Service to clear any
stored passphrase of the service so attached is a patch to do so.

I also patched the save method of the service so that it clears the
Passphrase key from the keyfile if passphrase is NULL.

Regards,
Joshua
-- 
Joshua Lock
        Intel Open Source Technology Centre
>From aa2ea68c3e3023646f203d53893f2700b7682933 Mon Sep 17 00:00:00 2001
From: Joshua Lock <[email protected]>
Date: Thu, 2 Jul 2009 11:57:29 +0100
Subject: [PATCH 1/2] Clear passphrase from storage when it's not set

---
 src/service.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/service.c b/src/service.c
index 6400d10..5d5ff87 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1469,6 +1469,9 @@ update:
 	if (service->passphrase != NULL)
 		g_key_file_set_string(keyfile, service->identifier,
 					"Passphrase", service->passphrase);
+	else
+		g_key_file_remove_key(keyfile, service->identifier,
+					"Passphrase", NULL);
 
 	__connman_ipconfig_save(service->ipconfig, keyfile,
 					service->identifier, "IPv4.");
-- 
1.6.2.5

>From 1f467c0e9a3ba94d098f9aac8d39d19cd7653037 Mon Sep 17 00:00:00 2001
From: Joshua Lock <[email protected]>
Date: Thu, 2 Jul 2009 12:00:53 +0100
Subject: [PATCH 2/2] Have services remove method also clear the passphrase

---
 doc/service-api.txt |    3 +++
 src/service.c       |    2 ++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/doc/service-api.txt b/doc/service-api.txt
index 6866137..e9349fc 100644
--- a/doc/service-api.txt
+++ b/doc/service-api.txt
@@ -60,6 +60,9 @@ Methods		dict GetProperties()
 			can be removed this way. If it is connected, it will
 			be automatically disconnected first.
 
+			If the service requires a passphrase it will be
+			cleared and forgotten when removing.
+
 			This is similar to setting the Favorite property
 			to false, but that is currently not supported.
 
diff --git a/src/service.c b/src/service.c
index 5d5ff87..06faa03 100644
--- a/src/service.c
+++ b/src/service.c
@@ -550,6 +550,8 @@ static DBusMessage *remove_service(DBusConnection *conn,
 	if (service->network != NULL)
 		__connman_network_disconnect(service->network);
 
+	g_free (service->passphrase);
+	service->passphrase = NULL;
 	connman_service_set_favorite(service, FALSE);
 	__connman_storage_save_service(service);
 
-- 
1.6.2.5

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to