Skip to content

Commit

Permalink
p11-kit tool: make "no matching object/token" error user friendly
Browse files Browse the repository at this point in the history
Signed-off-by: Zoltan Fridrich <[email protected]>
  • Loading branch information
ZoltanFridrich committed Sep 22, 2023
1 parent e8872bf commit 921aa29
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
5 changes: 2 additions & 3 deletions p11-kit/add-profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,8 @@ add_profile (const char *token_str,
}

p11_kit_iter_begin (iter, modules);
rv = p11_kit_iter_next (iter);
if (rv != CKR_OK) {
p11_message (_("failed to find the token: %s"), p11_kit_strerror (rv));
if (p11_kit_iter_next (iter) != CKR_OK) {
p11_message (_("no matching token"));
goto cleanup;
}

Expand Down
5 changes: 2 additions & 3 deletions p11-kit/delete-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ delete_object (const char *token_str)
}

p11_kit_iter_begin (iter, modules);
rv = p11_kit_iter_next (iter);
if (rv != CKR_OK) {
p11_message (_("failed to find the object: %s"), p11_kit_strerror (rv));
if (p11_kit_iter_next (iter) != CKR_OK) {
p11_message (_("no matching object"));
goto cleanup;
}

Expand Down
5 changes: 2 additions & 3 deletions p11-kit/generate-keypair.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,8 @@ generate_keypair (const char *token_str,
}

p11_kit_iter_begin (iter, modules);
rv = p11_kit_iter_next (iter);
if (rv != CKR_OK) {
p11_message (_("failed to find the token: %s"), p11_kit_strerror (rv));
if (p11_kit_iter_next (iter) != CKR_OK) {
p11_message (_("no matching token"));
goto cleanup;
}

Expand Down

0 comments on commit 921aa29

Please sign in to comment.