All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guillaume Zajac <guillaume.zajac@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH 2/3] cdma-connman: Add D-Bus API to remove credentials
Date: Tue, 09 Aug 2011 16:48:06 +0200	[thread overview]
Message-ID: <1312901287-30032-3-git-send-email-guillaume.zajac@linux.intel.com> (raw)
In-Reply-To: <1312901287-30032-1-git-send-email-guillaume.zajac@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 1669 bytes --]

---
 src/cdma-connman.c |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/src/cdma-connman.c b/src/cdma-connman.c
index 3967080..9f40104 100644
--- a/src/cdma-connman.c
+++ b/src/cdma-connman.c
@@ -510,16 +510,50 @@ static DBusMessage *cdma_connman_set_property(DBusConnection *conn,
 	return __ofono_error_invalid_args(msg);
 }
 
+static DBusMessage *cdma_connman_remove_credentials(DBusConnection *conn,
+							DBusMessage *msg,
+							void *data)
+{
+	struct ofono_cdma_connman *cm = data;
+	const char *path;
+
+	DBG("");
+
+	strcpy(cm->username, "");
+	strcpy(cm->password, "");
+
+	if (cm->powered == TRUE)
+		cm->driver->deactivate(cm, deactivate_callback, cm);
+
+	if (cm->credentials) {
+		g_key_file_remove_group(cm->credentials, CREDENTIALS_GROUP,
+					NULL);
+		storage_sync(cm->serial, CREDENTIALS_STORE, cm->credentials);
+	}
+
+	g_dbus_send_reply(conn, msg, DBUS_TYPE_INVALID);
+
+	path = __ofono_atom_get_path(cm->atom);
+	g_dbus_emit_signal(conn, path, OFONO_CONNECTION_MANAGER_INTERFACE,
+				"CredentialsRemoved", DBUS_TYPE_INVALID);
+
+	return NULL;
+}
+
 static GDBusMethodTable cdma_connman_methods[] = {
 	{ "GetProperties",	"",	"a{sv}",
 						cdma_connman_get_properties },
 	{ "SetProperty",	"sv",	"",	cdma_connman_set_property,
 						G_DBUS_METHOD_FLAG_ASYNC },
+	{ "RemoveCredentials",	"",	"",
+					cdma_connman_remove_credentials,
+						G_DBUS_METHOD_FLAG_ASYNC },
 	{ }
 };
 
 static GDBusSignalTable cdma_connman_signals[] = {
 	{ "PropertyChanged",	"sv" },
+	{ "CredentialsRemoved",	"" },
 	{ }
 };
 
-- 
1.7.1


  parent reply	other threads:[~2011-08-09 14:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-09 14:48 [PATCH 0/3] Add CDMA features to load/save/remove credentials Guillaume Zajac
2011-08-09 14:48 ` [PATCH 1/3] cdma-connman: add feature to load/save credentials Guillaume Zajac
2011-08-09 18:52   ` Denis Kenzior
2011-08-11 13:15     ` Guillaume Zajac
2011-08-11  3:36       ` Denis Kenzior
2011-08-09 14:48 ` Guillaume Zajac [this message]
2011-08-09 18:37   ` [PATCH 2/3] cdma-connman: Add D-Bus API to remove credentials Denis Kenzior
2011-08-11 10:19     ` Guillaume Zajac
2011-08-09 14:48 ` [PATCH 3/3] test: Add cdma-remove-credentials script Guillaume Zajac

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1312901287-30032-3-git-send-email-guillaume.zajac@linux.intel.com \
    --to=guillaume.zajac@linux.intel.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.