2001-11-22 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c: Include stdlib.h and string.h. Also include, for now, rungpg.h and status-table.h. (gpgsm_status_handler): Implement more of the status handler.
This commit is contained in:
parent
884de0606b
commit
d1ded512c4
@ -1,3 +1,9 @@
|
|||||||
|
2001-11-22 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
|
* engine-gpgsm.c: Include stdlib.h and string.h. Also include,
|
||||||
|
for now, rungpg.h and status-table.h.
|
||||||
|
(gpgsm_status_handler): Implement more of the status handler.
|
||||||
|
|
||||||
2001-11-22 Marcus Brinkmann <marcus@g10code.de>
|
2001-11-22 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
* engine.c (_gpgme_engine_op_decrypt): Implement CMS case.
|
* engine.c (_gpgme_engine_op_decrypt): Implement CMS case.
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
#ifdef ENABLE_GPGSM
|
#ifdef ENABLE_GPGSM
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
@ -40,6 +42,9 @@
|
|||||||
#undef xtryrealloc
|
#undef xtryrealloc
|
||||||
#undef xfree
|
#undef xfree
|
||||||
|
|
||||||
|
#include "rungpg.h"
|
||||||
|
#include "status-table.h"
|
||||||
|
|
||||||
#include "gpgme.h"
|
#include "gpgme.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
@ -423,6 +428,15 @@ _gpgme_gpgsm_op_verify (GpgsmObject gpgsm, GpgmeData sig, GpgmeData text)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
status_cmp (const void *ap, const void *bp)
|
||||||
|
{
|
||||||
|
const struct status_table_s *a = ap;
|
||||||
|
const struct status_table_s *b = bp;
|
||||||
|
|
||||||
|
return strcmp (a->name, b->name);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
gpgsm_status_handler (void *opaque, int pid, int fd)
|
gpgsm_status_handler (void *opaque, int pid, int fd)
|
||||||
{
|
{
|
||||||
@ -452,6 +466,26 @@ gpgsm_status_handler (void *opaque, int pid, int fd)
|
|||||||
}
|
}
|
||||||
/* FIXME: Parse the status and call the handler. */
|
/* FIXME: Parse the status and call the handler. */
|
||||||
|
|
||||||
|
if (actx->inbound.linelen > 2
|
||||||
|
&& actx->inbound.line[0] == 'S' && actx->inbound.line[1] == ' ')
|
||||||
|
{
|
||||||
|
struct status_table_s t, *r;
|
||||||
|
char *rest;
|
||||||
|
|
||||||
|
rest = strchr (actx->inbound.line + 2, ' ');
|
||||||
|
if (!rest)
|
||||||
|
rest = actx->inbound.line + actx->inbound.linelen; /* set to an empty string */
|
||||||
|
else
|
||||||
|
*rest++ = 0;
|
||||||
|
|
||||||
|
t.name = actx->inbound.line + 2;
|
||||||
|
r = bsearch (&t, status_table, DIM(status_table) - 1,
|
||||||
|
sizeof t, status_cmp);
|
||||||
|
|
||||||
|
if (gpgsm->status.fnc)
|
||||||
|
gpgsm->status.fnc (gpgsm->status.fnc_value, r->code, rest);
|
||||||
|
}
|
||||||
|
else
|
||||||
fprintf (stderr, "[UNCAUGHT STATUS]%s", actx->inbound.line);
|
fprintf (stderr, "[UNCAUGHT STATUS]%s", actx->inbound.line);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user