Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: Tim Kourt <tim.a.kourt@linux.intel.com>
To: iwd@lists.01.org
Subject: [PATCH 2/4] client: Respond to invalid agent requests
Date: Thu, 24 Oct 2019 12:53:54 -0700	[thread overview]
Message-ID: <20191024195356.28206-2-tim.a.kourt@linux.intel.com> (raw)
In-Reply-To: <20191024195356.28206-1-tim.a.kourt@linux.intel.com>

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

This allows to send an error back to iwd, instead of returning NULL
and waiting for iwd to timeout on agent request.
---
 client/agent.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/client/agent.c b/client/agent.c
index c8da72dc..4d23e05e 100644
--- a/client/agent.c
+++ b/client/agent.c
@@ -123,11 +123,11 @@ static struct l_dbus_message *request_passphrase_method_call(
 
 	l_dbus_message_get_arguments(message, "o", &path);
 	if (!path)
-		return NULL;
+		return agent_error_reply(message, "Invalid argument");
 
 	proxy = proxy_interface_find(IWD_NETWORK_INTERFACE, path);
 	if (!proxy)
-		return NULL;
+		return agent_error_reply(message, "Invalid network object");
 
 	display("Type the network passphrase for %s.\n",
 				proxy_interface_get_identity_str(proxy));
@@ -164,11 +164,11 @@ static struct l_dbus_message *request_private_key_passphrase_method_call(
 
 	l_dbus_message_get_arguments(message, "o", &path);
 	if (!path)
-		return NULL;
+		return agent_error_reply(message, "Invalid argument");
 
 	proxy = proxy_interface_find(IWD_NETWORK_INTERFACE, path);
 	if (!proxy)
-		return NULL;
+		return agent_error_reply(message, "Invalid network object");
 
 	display("Type the passphrase for the network encrypted private key for "
 			"%s.\n", proxy_interface_get_identity_str(proxy));
@@ -228,11 +228,11 @@ static struct l_dbus_message *request_username_and_password_method_call(
 
 	l_dbus_message_get_arguments(message, "o", &path);
 	if (!path)
-		return NULL;
+		return agent_error_reply(message, "Invalid argument");
 
 	proxy = proxy_interface_find(IWD_NETWORK_INTERFACE, path);
 	if (!proxy)
-		return NULL;
+		return agent_error_reply(message, "Invalid network object");
 
 	display("Type the network credentials for %s.\n",
 				proxy_interface_get_identity_str(proxy));
@@ -287,11 +287,11 @@ static struct l_dbus_message *request_user_password_method_call(
 
 	l_dbus_message_get_arguments(message, "os", &path, &username);
 	if (!path || !username)
-		return NULL;
+		return agent_error_reply(message, "Invalid argument");
 
 	proxy = proxy_interface_find(IWD_NETWORK_INTERFACE, path);
 	if (!proxy)
-		return NULL;
+		return agent_error_reply(message, "Invalid network object");
 
 	display("Type the network password for %s.\n",
 				proxy_interface_get_identity_str(proxy));
-- 
2.13.6

  reply	other threads:[~2019-10-24 19:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-24 19:53 [PATCH 1/4] client: Modify error handler to return error msg Tim Kourt
2019-10-24 19:53 ` Tim Kourt [this message]
2019-10-24 19:53 ` [PATCH 3/4] client: Don't check for errors on agent requests Tim Kourt
2019-10-24 20:18   ` Denis Kenzior
2019-10-24 19:53 ` [PATCH 4/4] client: Fail on requests with invalid arguments Tim Kourt

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=20191024195356.28206-2-tim.a.kourt@linux.intel.com \
    --to=tim.a.kourt@linux.intel.com \
    --cc=iwd@lists.01.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox