diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2019-06-13 18:45:49 +0300 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2019-06-19 13:42:05 +0100 |
commit | b515fa46caf8fc5edd782991deeb488560026ca1 (patch) | |
tree | 2802d515addb219334e88d804ff2f88cb4726327 /keyctl.c | |
parent | 6feef507d01880d70d01f1b1415ae42c0be51687 (diff) | |
download | keyutils-b515fa46caf8fc5edd782991deeb488560026ca1.tar.gz |
Fix 'keyctl pkey_query' argument parsing
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>
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'keyctl.c')
-rw-r--r-- | keyctl.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1896,7 +1896,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) { |