1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

gpg: Return SUCCESS/FAILURE status also for --card-edit/name.

* g10/card-util.c (change_name): Call write_sc_op_status.
--

Reported-by: Joey Berkovitz
This commit is contained in:
Werner Koch 2021-08-19 14:08:14 +02:00
parent 661c2ae966
commit c1a23c3664
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -787,7 +787,8 @@ static int
change_name (void)
{
char *surname = NULL, *givenname = NULL;
char *isoname, *p;
char *isoname = NULL;
char *p;
int rc;
surname = get_one_name ("keygen.smartcard.surname",
@ -798,7 +799,8 @@ change_name (void)
{
xfree (surname);
xfree (givenname);
return -1; /*canceled*/
rc = gpg_error (GPG_ERR_CANCELED);
goto leave;
}
isoname = xmalloc ( strlen (surname) + 2 + strlen (givenname) + 1);
@ -814,14 +816,17 @@ change_name (void)
tty_printf (_("Error: Combined name too long "
"(limit is %d characters).\n"), 39);
xfree (isoname);
return -1;
rc = gpg_error (GPG_ERR_TOO_LARGE);
goto leave;
}
rc = agent_scd_setattr ("DISP-NAME", isoname, strlen (isoname));
if (rc)
log_error ("error setting Name: %s\n", gpg_strerror (rc));
leave:
xfree (isoname);
write_sc_op_status (rc);
return rc;
}