<GPG Agent> - invalid length of cacheID

Thomas-Bahn Thomas-Bahn at gmx.net
Tue Oct 27 21:28:45 CET 2009


Hello,

i have the problem, that gpg-agent throws errors when launching the pinentry.
I analyzed the problem and would give you my results in the hope, that the bug can be fixed.
I have no idea what else can be faulty… 
I searched the code snippet for you to help simplify the work on this problem as good as i can. 
I think its the code snippet that causes this error but i can't analyze this furthermore because my skills not as good as needed.

Following the gpg-agent.conf:

   debug-level guru
   log-file socket:///home/thomas/.gnupg/log-socket 
   pinentry-program /usr/bin/pinentry-gtk-2
   no-grab 
   default-cache-ttl 1800

The settings are correct i'm sure.
Here is a part of the log from KWatchGnuPG:

  5 - 2009-10-27 19:22:17 gpg-agent[3840.9] DBG: <- GET_PASSPHRASE --data --repeat=0 -- X X Passphrase: Please+enter+the+passphrase+to+unprotect+the+PKCS#12+object.
  5 - 2009-10-27 19:22:17 gpg-agent[3840]: starting a new PIN Entry
  5 - 2009-10-27 19:22:17 gpg-agent[3840]: DBG: connection to PIN entry established
  5 - 2009-10-27 19:22:17 gpg-agent[3840.9] DBG: -> INQUIRE PINENTRY_LAUNCHED 4205
  5 - 2009-10-27 19:22:17 gpg-agent[3840.9] DBG: <- END
  5 - 2009-10-27 19:22:17 gpg-agent[3840]: command get_passphrase failed: End of File
  5 - 2009-10-27 19:22:17 gpg-agent[3840.9] DBG: -> OK closing connection

But this log wasn't enough information so i looked for reproducing the error directly in gpg-agent. And i found gpg-connect-agent.
Here the error when i connect to gpg-agent and give him the command:

   gpg-connect-agent
   > GET_PASSPHRASE
   ERR 67109144 IPC Parameterfehler <GPG Agent> - invalid length of cacheID
   >

This error was enough information for me and i found following code in gnupg-2.0.13/agent/command.c :
In function cmd_get_passphrase:

static int
cmd_get_passphrase (assuan_context_t ctx, char *line)
{
  ctrl_t ctrl = assuan_get_pointer (ctx);
  int rc;
  const char *pw;
  char *response;
  char *cacheid = NULL, *desc = NULL, *prompt = NULL, *errtext = NULL;
  const char *desc2 = _("Please re-enter this passphrase");
  char *p;
  void *cache_marker;
  int opt_data, opt_check, opt_no_ask, opt_qualbar;
  int opt_repeat = 0;
  char *repeat_errtext = NULL;

  opt_data = has_option (line, "--data");
  opt_check = has_option (line, "--check");
  opt_no_ask = has_option (line, "--no-ask");
  if (has_option_name (line, "--repeat"))
    {
      p = option_value (line, "--repeat");
      if (p)
        opt_repeat = atoi (p);
      else
        opt_repeat = 1;
    }
  opt_qualbar = has_option (line, "--qualitybar");
  line = skip_options (line);

  cacheid = line;
  p = strchr (cacheid, ' ');
  if (p)
    {
      *p++ = 0;
      while (*p == ' ')
        p++;
      errtext = p;
      p = strchr (errtext, ' ');
      if (p)
        {
          *p++ = 0;
          while (*p == ' ')
            p++;
          prompt = p;
          p = strchr (prompt, ' ');
          if (p)
            {
              *p++ = 0;
              while (*p == ' ')
                p++;
              desc = p;
              p = strchr (desc, ' ');
              if (p)
                *p = 0; /* Ignore trailing garbage. */
            }
        }
    }

  if (!cacheid || !*cacheid || strlen (cacheid) > 50)
    return set_error (GPG_ERR_ASS_PARAMETER, "invalid length of cacheID");
  if (!desc)
    return set_error (GPG_ERR_ASS_PARAMETER, "no description given");

--- CUT --- (the pasted code is long enough ;))


if (!cacheid || !*cacheid || strlen (cacheid) > 50)
    return set_error (GPG_ERR_ASS_PARAMETER, "invalid length of cacheID");

This statement must be the cause of the error... but what value was in cacheid and why it can be faulty? I can't answer this question and hope you can?



More information about the Gnupg-devel mailing list