mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +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:
parent
2e69ce878f
commit
6685696ada
@ -764,7 +764,8 @@ static int
|
|||||||
change_name (void)
|
change_name (void)
|
||||||
{
|
{
|
||||||
char *surname = NULL, *givenname = NULL;
|
char *surname = NULL, *givenname = NULL;
|
||||||
char *isoname, *p;
|
char *isoname = NULL;
|
||||||
|
char *p;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
surname = get_one_name ("keygen.smartcard.surname",
|
surname = get_one_name ("keygen.smartcard.surname",
|
||||||
@ -775,7 +776,8 @@ change_name (void)
|
|||||||
{
|
{
|
||||||
xfree (surname);
|
xfree (surname);
|
||||||
xfree (givenname);
|
xfree (givenname);
|
||||||
return -1; /*canceled*/
|
rc = gpg_error (GPG_ERR_CANCELED);
|
||||||
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
isoname = xmalloc ( strlen (surname) + 2 + strlen (givenname) + 1);
|
isoname = xmalloc ( strlen (surname) + 2 + strlen (givenname) + 1);
|
||||||
@ -791,14 +793,17 @@ change_name (void)
|
|||||||
tty_printf (_("Error: Combined name too long "
|
tty_printf (_("Error: Combined name too long "
|
||||||
"(limit is %d characters).\n"), 39);
|
"(limit is %d characters).\n"), 39);
|
||||||
xfree (isoname);
|
xfree (isoname);
|
||||||
return -1;
|
rc = gpg_error (GPG_ERR_TOO_LARGE);
|
||||||
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = agent_scd_setattr ("DISP-NAME", isoname, strlen (isoname));
|
rc = agent_scd_setattr ("DISP-NAME", isoname, strlen (isoname));
|
||||||
if (rc)
|
if (rc)
|
||||||
log_error ("error setting Name: %s\n", gpg_strerror (rc));
|
log_error ("error setting Name: %s\n", gpg_strerror (rc));
|
||||||
|
|
||||||
|
leave:
|
||||||
xfree (isoname);
|
xfree (isoname);
|
||||||
|
write_sc_op_status (rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user