All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim Kourt <tim.a.kourt@linux.intel.com>
To: iwd@lists.01.org
Subject: [PATCH 4/5] client: Fail on requests with invalid arguments
Date: Fri, 25 Oct 2019 13:32:07 -0700	[thread overview]
Message-ID: <20191025203208.30628-4-tim.a.kourt@linux.intel.com> (raw)
In-Reply-To: <20191025203208.30628-1-tim.a.kourt@linux.intel.com>

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

---
 client/agent.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/client/agent.c b/client/agent.c
index 40e123d8..78499419 100644
--- a/client/agent.c
+++ b/client/agent.c
@@ -127,7 +127,9 @@ static struct l_dbus_message *request_passphrase_method_call(
 					"'--"COMMAND_OPTION_PASSPHRASE"' "
 						"command-line option.\n");
 
-	l_dbus_message_get_arguments(message, "o", &path);
+	if (!l_dbus_message_get_arguments(message, "o", &path))
+		return agent_reply_failed(message, "Invalid argument");
+
 	if (!path)
 		return agent_reply_failed(message, "Invalid argument");
 
@@ -165,7 +167,9 @@ static struct l_dbus_message *request_private_key_passphrase_method_call(
 					"'--"COMMAND_OPTION_PASSPHRASE"' "
 						"command-line option.\n");
 
-	l_dbus_message_get_arguments(message, "o", &path);
+	if (!l_dbus_message_get_arguments(message, "o", &path))
+		return agent_reply_failed(message, "Invalid argument");
+
 	if (!path)
 		return agent_reply_failed(message, "Invalid argument");
 
@@ -226,7 +230,9 @@ static struct l_dbus_message *request_username_and_password_method_call(
 					"'--"COMMAND_OPTION_PASSWORD"' "
 						"command-line option.\n");
 
-	l_dbus_message_get_arguments(message, "o", &path);
+	if (!l_dbus_message_get_arguments(message, "o", &path))
+		return agent_reply_failed(message, "Invalid argument");
+
 	if (!path)
 		return agent_reply_failed(message, "Invalid argument");
 
@@ -282,7 +288,9 @@ static struct l_dbus_message *request_user_password_method_call(
 					"'--"COMMAND_OPTION_PASSWORD"' "
 					"command-line option.\n");
 
-	l_dbus_message_get_arguments(message, "os", &path, &username);
+	if (!l_dbus_message_get_arguments(message, "os", &path, &username))
+		return agent_reply_failed(message, "Invalid arguments");
+
 	if (!path || !username)
 		return agent_reply_failed(message, "Invalid argument");
 
-- 
2.13.6

  parent reply	other threads:[~2019-10-25 20:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25 20:32 [PATCH 1/5] client: Consolidate cancelation replies Tim Kourt
2019-10-25 20:32 ` [PATCH 2/5] client: Modify error handler to return cancelation msg Tim Kourt
2019-10-25 20:32 ` [PATCH 3/5] client: Respond to invalid agent requests Tim Kourt
2019-10-25 20:32 ` Tim Kourt [this message]
2019-10-25 20:32 ` [PATCH 5/5] doc: Update agent API with possible errors Tim Kourt
2019-10-28 15:49 ` [PATCH 1/5] client: Consolidate cancelation replies Denis Kenzior

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=20191025203208.30628-4-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 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.