mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
* assuan-buffer.c (_assuan_read_line): Add output logging.
(assuan_write_line): Ditto. (_assuan_cookie_write_data): Ditto. (_assuan_cookie_write_flush): Ditto. * assuan-util.c (_assuan_log_print_buffer): New. (assuan_set_log_stream): New. (assuan_begin_confidential): New. (assuan_end_confidential): New. * assuan-defs.h: Add a few handler variables. * assuan-pipe-server.c (assuan_deinit_pipe_server): Removed. (deinit_pipe_server): New. (assuan_deinit_server): New. Changed all callers to use this. * assuan-listen.c (assuan_accept): Use the accept handler. * assuan-handler.c (process_request): Use the close Handler. * assuan-socket-server.c: New.
This commit is contained in:
parent
6af684c118
commit
f58da1883a
11 changed files with 311 additions and 19 deletions
|
@ -96,3 +96,57 @@ assuan_get_pointer (ASSUAN_CONTEXT ctx)
|
|||
return ctx? ctx->user_pointer : NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
assuan_set_log_stream (ASSUAN_CONTEXT ctx, FILE *fp)
|
||||
{
|
||||
if (ctx)
|
||||
{
|
||||
if (ctx->log_fp)
|
||||
fflush (ctx->log_fp);
|
||||
ctx->log_fp = fp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
assuan_begin_confidential (ASSUAN_CONTEXT ctx)
|
||||
{
|
||||
if (ctx)
|
||||
{
|
||||
ctx->confidential = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
assuan_end_confidential (ASSUAN_CONTEXT ctx)
|
||||
{
|
||||
if (ctx)
|
||||
{
|
||||
ctx->confidential = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_assuan_log_print_buffer (FILE *fp, const void *buffer, size_t length)
|
||||
{
|
||||
const unsigned char *s;
|
||||
int n;
|
||||
|
||||
for (n=length,s=buffer; n; n--, s++)
|
||||
{
|
||||
if (*s < ' ' || (*s >= 0x7f && *s <= 0xa0))
|
||||
break;
|
||||
}
|
||||
s = buffer;
|
||||
if (!n && *s != '[')
|
||||
fwrite (buffer, length, 1, fp);
|
||||
else
|
||||
{
|
||||
putc ('[', fp);
|
||||
for (n=0; n < length; n++, s++)
|
||||
fprintf (fp, " %02x", *s);
|
||||
putc (' ', fp);
|
||||
putc (']', fp);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue