aboutsummaryrefslogtreecommitdiffstats
path: root/agent/call-scd.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2009-04-01 10:51:53 +0000
committerWerner Koch <[email protected]>2009-04-01 10:51:53 +0000
commitf8b4cd76501824d56d3cf78a8ba85291a62f0e6d (patch)
treecec902ba7d3dd1a38846805cf491a65b95bb79cd /agent/call-scd.c
parentImplement decryption for TCOS 3 cards. (diff)
downloadgnupg-f8b4cd76501824d56d3cf78a8ba85291a62f0e6d.tar.gz
gnupg-f8b4cd76501824d56d3cf78a8ba85291a62f0e6d.zip
Import/export of pkcs#12 now uses the gpg-agent directly.
Removed duplicated code (percent unescaping).
Diffstat (limited to 'agent/call-scd.c')
-rw-r--r--agent/call-scd.c40
1 files changed, 2 insertions, 38 deletions
diff --git a/agent/call-scd.c b/agent/call-scd.c
index f45e94097..d09812e57 100644
--- a/agent/call-scd.c
+++ b/agent/call-scd.c
@@ -136,6 +136,7 @@ static void
dump_mutex_state (pth_mutex_t *m)
{
#ifdef _W32_PTH_H
+ (void)m;
log_printf ("unknown under W32");
#else
if (!(m->mx_state & PTH_MUTEX_INITIALIZED))
@@ -562,43 +563,6 @@ agent_reset_scd (ctrl_t ctrl)
-/* Return a new malloced string by unescaping the string S. Escaping
- is percent escaping and '+'/space mapping. A binary Nul will
- silently be replaced by a 0xFF. Function returns NULL to indicate
- an out of memory status. */
-static char *
-unescape_status_string (const unsigned char *s)
-{
- char *buffer, *d;
-
- buffer = d = xtrymalloc (strlen ((const char*)s)+1);
- if (!buffer)
- return NULL;
- while (*s)
- {
- if (*s == '%' && s[1] && s[2])
- {
- s++;
- *d = xtoi_2 (s);
- if (!*d)
- *d = '\xff';
- d++;
- s += 2;
- }
- else if (*s == '+')
- {
- *d++ = ' ';
- s++;
- }
- else
- *d++ = *s++;
- }
- *d = 0;
- return buffer;
-}
-
-
-
static int
learn_status_cb (void *opaque, const char *line)
{
@@ -1045,7 +1009,7 @@ card_getattr_cb (void *opaque, const char *line)
if (keywordlen == parm->keywordlen
&& !memcmp (keyword, parm->keyword, keywordlen))
{
- parm->data = unescape_status_string ((const unsigned char*)line);
+ parm->data = percent_plus_unescape ((const unsigned char*)line, 0xff);
if (!parm->data)
parm->error = errno;
}