mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
Use has_leading_keyword in the assuan callbacks.
* agent/call-pinentry.c (inq_quality): Use has_leading_keyword. * agent/call-scd.c (inq_needpin, inq_writekey_parms): Ditto. * g10/call-agent.c (inq_writecert_parms, keyinfo_status_cb): Ditto. (inq_genkey_parms, inq_ciphertext_cb, inq_import_key_parms): Ditto. * g10/call-dirmngr.c (ks_put_inq_cb): Ditto. * sm/call-agent.c (default_inq_cb, inq_ciphertext_cb): Ditto. (inq_genkey_parms, istrusted_status_cb, learn_status_cb): Ditto. (keyinfo_status_cb, inq_import_key_parms): Ditto. * sm/call-dirmngr.c (inq_certificate, isvalid_status_cb): Ditto. (lookup_status_cb, run_command_inq_cb, run_command_status_cb): Ditto.
This commit is contained in:
parent
c6b8f05517
commit
585d5c62ee
6 changed files with 61 additions and 80 deletions
|
@ -596,18 +596,15 @@ static gpg_error_t
|
|||
inq_quality (void *opaque, const char *line)
|
||||
{
|
||||
assuan_context_t ctx = opaque;
|
||||
const char *s;
|
||||
char *pin;
|
||||
int rc;
|
||||
int percent;
|
||||
char numbuf[20];
|
||||
|
||||
if (!strncmp (line, "QUALITY", 7) && (line[7] == ' ' || !line[7]))
|
||||
if ((s = has_leading_keyword (line, "QUALITY")))
|
||||
{
|
||||
line += 7;
|
||||
while (*line == ' ')
|
||||
line++;
|
||||
|
||||
pin = unescape_passphrase_string (line);
|
||||
pin = unescape_passphrase_string (s);
|
||||
if (!pin)
|
||||
rc = gpg_error_from_syserror ();
|
||||
else
|
||||
|
|
|
@ -701,17 +701,15 @@ static gpg_error_t
|
|||
inq_needpin (void *opaque, const char *line)
|
||||
{
|
||||
struct inq_needpin_s *parm = opaque;
|
||||
const char *s;
|
||||
char *pin;
|
||||
size_t pinlen;
|
||||
int rc;
|
||||
|
||||
parm->any_inq_seen = 1;
|
||||
if (!strncmp (line, "NEEDPIN", 7) && (line[7] == ' ' || !line[7]))
|
||||
if ((s = has_leading_keyword (line, "NEEDPIN")))
|
||||
{
|
||||
line += 7;
|
||||
while (*line == ' ')
|
||||
line++;
|
||||
|
||||
line = s;
|
||||
pinlen = 90;
|
||||
pin = gcry_malloc_secure (pinlen);
|
||||
if (!pin)
|
||||
|
@ -722,17 +720,11 @@ inq_needpin (void *opaque, const char *line)
|
|||
rc = assuan_send_data (parm->ctx, pin, pinlen);
|
||||
xfree (pin);
|
||||
}
|
||||
else if (!strncmp (line, "POPUPPINPADPROMPT", 17)
|
||||
&& (line[17] == ' ' || !line[17]))
|
||||
else if ((s = has_leading_keyword (line, "POPUPPINPADPROMPT")))
|
||||
{
|
||||
line += 17;
|
||||
while (*line == ' ')
|
||||
line++;
|
||||
|
||||
rc = parm->getpin_cb (parm->getpin_cb_arg, line, NULL, 1);
|
||||
rc = parm->getpin_cb (parm->getpin_cb_arg, s, NULL, 1);
|
||||
}
|
||||
else if (!strncmp (line, "DISMISSPINPADPROMPT", 19)
|
||||
&& (line[19] == ' ' || !line[19]))
|
||||
else if ((s = has_leading_keyword (line, "DISMISSPINPADPROMPT")))
|
||||
{
|
||||
rc = parm->getpin_cb (parm->getpin_cb_arg, "", NULL, 0);
|
||||
}
|
||||
|
@ -1069,7 +1061,7 @@ inq_writekey_parms (void *opaque, const char *line)
|
|||
{
|
||||
struct writekey_parm_s *parm = opaque;
|
||||
|
||||
if (!strncmp (line, "KEYDATA", 7) && (line[7]==' '||!line[7]))
|
||||
if (has_leading_keyword (line, "KEYDATA"))
|
||||
return assuan_send_data (parm->ctx, parm->keydata, parm->keydatalen);
|
||||
else
|
||||
return inq_needpin (opaque, line);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue