From: Lennert Buytenhek <buytenh@wantstofly.org>
To: keyrings@vger.kernel.org
Subject: [PATCH 1/3] Fix 'keyctl pkey_query' argument parsing
Date: Thu, 13 Jun 2019 15:45:49 +0000 [thread overview]
Message-ID: <20190613154549.GD9017@wantstofly.org> (raw)
keyctl's pkey_* operations each have an argument that allows specifying
a key password, but since that feature isn't currently supported, it
is supposed to always be passed in as "0":
if (strcmp(argv[2], "0") != 0) {
fprintf(stderr, "Password passing is not yet supported\n");
exit(2);
}
However, act_keyctl_pkey_query() has an off-by-one that makes it
start parsing key=value style option pairs at the password argument,
which causes the following error if the password argument is not in
key=value format:
$ keyctl pkey_query 541826697 0
Option not in key=val form
$
And this error if the password argument is in key=value format:
$ keyctl pkey_query 541826697 a=b
Password passing is not yet supported
$
This patch fixes act_keyctl_pkey_query() to start parsing key=value
pairs from the right place in its argument list, which gets it a
little further.
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
---
keyctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/keyctl.c b/keyctl.c
index aeb92e8..5b0aeeb 100644
--- a/keyctl.c
+++ b/keyctl.c
@@ -1900,7 +1900,7 @@ static void act_keyctl_pkey_query(int argc, char *argv[])
if (argc < 3)
format();
- pkey_parse_info(argv + 2, info);
+ pkey_parse_info(argv + 3, info);
key = get_key_id(argv[1]);
if (strcmp(argv[2], "0") != 0) {
--
2.21.0
reply other threads:[~2019-06-13 15:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20190613154549.GD9017@wantstofly.org \
--to=buytenh@wantstofly.org \
--cc=keyrings@vger.kernel.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