From 344965bd296f434ccbd9ad5b16427590b988d480 Mon Sep 17 00:00:00 2001 From: Ingo Franzki Date: Fri, 15 Jun 2018 07:48:46 +0200 Subject: [PATCH] zkey: Fix APQN validation routine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a zkey generate or change command is used to associate one or multiple APQNs the command succeeds, but no key is generated and no APQNs are associated, because the return code returned by _keystore_apqn_check() is wrong. Signed-off-by: Ingo Franzki Signed-off-by: Jan Höppner --- zkey/keystore.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zkey/keystore.c b/zkey/keystore.c index 063d7c9d..5e27ec5c 100644 --- a/zkey/keystore.c +++ b/zkey/keystore.c @@ -986,6 +986,7 @@ static int _keystore_apqn_check(const char *apqn, bool remove, } if (sscanf(apqn, "%x.%x", &card, &domain) != 2) { + warnx("the APQN '%s' is not valid", apqn); rc = -EINVAL; goto out; } @@ -1003,6 +1004,8 @@ static int _keystore_apqn_check(const char *apqn, bool remove, rc == -1 ? "not a CCA card" : "not online"); rc = -EIO; goto out; + } else { + rc = 0; } out: