Page MenuHome GnuPG

No OneTemporary

This document is not UTF8. It was detected as ISO-8859-1 (Latin 1) and converted to UTF8 for display.
diff --git a/ChangeLog b/ChangeLog
index de92d63b..d448e5f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,64 +1,72 @@
+2001-11-20 Marcus Brinkmann <marcus@g10code.de>
+
+ * Makefile.am (SUBDIRS): Support building the assuan library
+ (currently if GPGSM_PATH is set)..
+ * configure.ac: Support building the assuan library.
+ * assuan: New directory, populated with the Assuan library
+ (copied from the newpg repository).
+
2001-11-20 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (NEED_GPGSM_VERSION): New variable. Treat it
similarly to NEED_GPGSM_VERSION.
* acconfig.h: Likewise.
2001-11-18 Marcus Brinkmann <marcus@g10code.de>
* configure.in: Renamed to ...
* configure.ac: ... this. Update to autoconf 2.52. Lots of small
changes in the transition. Support --with-gpg=PATH and
--with-gpgsm=PATH options. Check if test suites can be run.
* acconfig.h: Add GPGSM_PATH.
* Makefile.am: New variable `tests', set to `tests' if
RUN_GPG_TESTS.
(SUBDIRS): Replace string `tests' with variable `tests'.
2001-10-22 Marcus Brinkmann <marcus@g10code.de>
* autogen.sh: Invoke automake with `-a' (add missing files).
Do not invoke configure.
2001-09-17 Werner Koch <wk@gnupg.org>
Released 0.2.3.
* configure.in (NEED_GPG_VERSION): Set to 1.0.6. Incremented LT
current and age.
* Makefile.am (SUBDIRS): Add doc
2001-06-12 Werner Koch <wk@gnupg.org>
Released 0.2.2.
2001-04-05 Werner Koch <wk@gnupg.org>
* configure.in (NEED_GPG_VERSION): Set to 1.0.4g
2001-04-02 Werner Koch <wk@gnupg.org>
Released 0.2.1.
Changed the copyright notices all over the place.
2001-02-28 Werner Koch <wk@gnupg.org>
Released 0.2.0.
2001-01-18 Werner Koch <wk@gnupg.org>
* autogen.sh: Added option --build-w32.
Copyright 2001 g10 Code GmbH
This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without
modifications, as long as this notice is preserved.
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
\ No newline at end of file
diff --git a/Makefile.am b/Makefile.am
index efe8c9ce..d9ef9645 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,42 +1,48 @@
# Copyright (C) 2000 Werner Koch (dd9jn)
# Copyright (C) 2001 g10 Code GmbH
#
# This file is part of GPGME.
#
# GPGME is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# GPGME is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
## Process this file with automake to produce Makefile.in
EXTRA_DIST = README-alpha autogen.sh
+if BUILD_ASSUAN
+assuan = assuan
+else
+assuan =
+endif
+
if BUILD_BONOBO
bonobo = bonobo
else
bonobo =
endif
if BUILD_COMPLUS
complus = complus
else
complus =
endif
if RUN_GPG_TESTS
tests = tests
else
tests =
endif
-SUBDIRS = jnlib gpgme ${tests} doc ${bonobo} ${complus}
+SUBDIRS = ${assuan} jnlib gpgme ${tests} doc ${bonobo} ${complus}
diff --git a/assuan/Makefile.am b/assuan/Makefile.am
new file mode 100644
index 00000000..3c576900
--- /dev/null
+++ b/assuan/Makefile.am
@@ -0,0 +1,43 @@
+# Assuan Makefile for test purposes
+# Copyright (C) 2001 Free Software Foundation, Inc.
+#
+# This file is part of GnuPG.
+#
+# GnuPG is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# GnuPG is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+
+## Process this file with automake to produce Makefile.in
+
+EXTRA_DIST = mkerrors
+INCLUDES = -I.. -I$(top_srcdir)/include
+BUILT_SOURCES = assuan-errors.c
+
+noinst_LIBRARIES = libassuan.a
+
+
+#libassuan_a_LDFLAGS =
+libassuan_a_SOURCES = \
+ assuan.h \
+ assuan-defs.h \
+ assuan-util.c \
+ assuan-errors.c \
+ assuan-buffer.c \
+ assuan-handler.c \
+ assuan-listen.c \
+ assuan-connect.c \
+ assuan-pipe-server.c
+
+
+assuan-errors.c : assuan.h
+ $(srcdir)/mkerrors < $(srcdir)/assuan.h > assuan-errors.c
diff --git a/assuan/assuan-buffer.c b/assuan/assuan-buffer.c
new file mode 100644
index 00000000..912272f1
--- /dev/null
+++ b/assuan/assuan-buffer.c
@@ -0,0 +1,247 @@
+/* assuan-buffer.c - read and send data
+ * Copyright (C) 2001 Free Software Foundation, Inc.
+ *
+ * This file is part of GnuPG.
+ *
+ * GnuPG is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GnuPG is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <assert.h>
+
+#include "assuan-defs.h"
+
+
+static int
+writen ( int fd, const char *buffer, size_t length )
+{
+ while (length)
+ {
+ int nwritten = write (fd, buffer, length);
+
+ if (nwritten < 0)
+ {
+ if (errno == EINTR)
+ continue;
+ return -1; /* write error */
+ }
+ length -= nwritten;
+ buffer += nwritten;
+ }
+ return 0; /* okay */
+}
+
+/* read an entire line */
+static int
+readline (int fd, char *buf, size_t buflen, int *r_nread, int *eof)
+{
+ size_t nleft = buflen;
+ char *p;
+
+ *eof = 0;
+ *r_nread = 0;
+ while (nleft > 0)
+ {
+ int n = read (fd, buf, nleft);
+ if (n < 0)
+ {
+ if (errno == EINTR)
+ continue;
+ return -1; /* read error */
+ }
+ else if (!n)
+ {
+ *eof = 1;
+ break; /* allow incomplete lines */
+ }
+ p = buf;
+ nleft -= n;
+ buf += n;
+ *r_nread += n;
+
+ for (; n && *p != '\n'; n--, p++)
+ ;
+ if (n)
+ break;
+ }
+
+ return 0;
+}
+
+
+int
+_assuan_read_line (ASSUAN_CONTEXT ctx)
+{
+ char *line = ctx->inbound.line;
+ int n, nread;
+ int rc;
+
+ if (ctx->inbound.eof)
+ return -1;
+
+ rc = readline (ctx->inbound.fd, line, LINELENGTH, &nread, &ctx->inbound.eof);
+ if (rc)
+ return ASSUAN_Read_Error;
+ if (!nread)
+ {
+ assert (ctx->inbound.eof);
+ return -1;
+ }
+
+ for (n=nread-1; n>=0 ; n--)
+ {
+ if (line[n] == '\n')
+ {
+ if (n != nread-1)
+ {
+ fprintf (stderr, "DBG-assuan: %d bytes left over after read\n",
+ nread-1 - n);
+ /* fixme: store them for the next read */
+ }
+ if (n && line[n-1] == '\r')
+ n--;
+ line[n] = 0;
+ ctx->inbound.linelen = n;
+ return 0;
+ }
+ }
+
+ *line = 0;
+ ctx->inbound.linelen = 0;
+ return ctx->inbound.eof? ASSUAN_Line_Not_Terminated : ASSUAN_Line_Too_Long;
+}
+
+
+
+
+int
+_assuan_write_line (ASSUAN_CONTEXT ctx, const char *line )
+{
+ int rc;
+
+ /* fixme: we should do some kind of line buffering */
+ rc = writen (ctx->outbound.fd, line, strlen(line));
+ if (rc)
+ rc = ASSUAN_Write_Error;
+ if (!rc)
+ {
+ rc = writen (ctx->outbound.fd, "\n", 1);
+ if (rc)
+ rc = ASSUAN_Write_Error;
+ }
+
+ return rc;
+}
+
+
+
+/* Write out the data in buffer as datalines with line wrapping and
+ percent escaping. This fucntion is used for GNU's custom streams */
+int
+_assuan_cookie_write_data (void *cookie, const char *buffer, size_t size)
+{
+ ASSUAN_CONTEXT ctx = cookie;
+ char *line;
+ size_t linelen;
+
+ if (ctx->outbound.data.error)
+ return 0;
+
+ line = ctx->outbound.data.line;
+ linelen = ctx->outbound.data.linelen;
+ line += linelen;
+ while (size)
+ {
+ /* insert data line header */
+ if (!linelen)
+ {
+ *line++ = 'D';
+ *line++ = ' ';
+ linelen += 2;
+ }
+
+ /* copy data, keep some space for the CRLF and to escape one character */
+ while (size && linelen < LINELENGTH-2-2)
+ {
+ if (*buffer == '%' || *buffer == '\r' || *buffer == '\n')
+ {
+ sprintf (line, "%%%02X", *(unsigned char*)buffer);
+ line += 3;
+ linelen += 3;
+ buffer++;
+ }
+ else
+ {
+ *line++ = *buffer++;
+ linelen++;
+ }
+ size--;
+ }
+
+ if (linelen >= LINELENGTH-2-2)
+ {
+ *line++ = '\n';
+ linelen++;
+ if (writen (ctx->outbound.fd, ctx->outbound.data.line, linelen))
+ {
+ ctx->outbound.data.error = ASSUAN_Write_Error;
+ return 0;
+ }
+ line = ctx->outbound.data.line;
+ linelen = 0;
+ }
+ }
+
+ ctx->outbound.data.linelen = linelen;
+ return 0;
+}
+
+
+/* Write out any buffered data
+ This fucntion is used for GNU's custom streams */
+int
+_assuan_cookie_write_flush (void *cookie)
+{
+ ASSUAN_CONTEXT ctx = cookie;
+ char *line;
+ size_t linelen;
+
+ if (ctx->outbound.data.error)
+ return 0;
+
+ line = ctx->outbound.data.line;
+ linelen = ctx->outbound.data.linelen;
+ line += linelen;
+ if (linelen)
+ {
+ *line++ = '\n';
+ linelen++;
+ if (writen (ctx->outbound.fd, ctx->outbound.data.line, linelen))
+ {
+ ctx->outbound.data.error = ASSUAN_Write_Error;
+ return 0;
+ }
+ ctx->outbound.data.linelen = 0;
+ }
+ return 0;
+}
+
+
+
+
diff --git a/assuan/assuan-connect.c b/assuan/assuan-connect.c
new file mode 100644
index 00000000..778b3a77
--- /dev/null
+++ b/assuan/assuan-connect.c
@@ -0,0 +1,129 @@
+/* assuan-connect.c - Establish a connection (client)
+ * Copyright (C) 2001 Free Software Foundation, Inc.
+ *
+ * This file is part of GnuPG.
+ *
+ * GnuPG is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GnuPG is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <signal.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include "assuan-defs.h"
+
+/* Connect to a server over a pipe, creating the assuan context and
+ returning it in CTX. The server filename is NAME, the argument
+ vector in ARGV. */
+AssuanError
+assuan_pipe_connect (ASSUAN_CONTEXT *ctx, const char *name, char *const argv[])
+{
+ static int fixed_signals = 0;
+ AssuanError err;
+ int rp[2];
+ int wp[2];
+ int fd[2];
+
+ if (!name || !argv || !argv[0])
+ return ASSUAN_General_Error;
+
+ if (!fixed_signals)
+ {
+ struct sigaction act;
+
+ sigaction (SIGPIPE, NULL, &act);
+ if (act.sa_handler == SIG_DFL)
+ {
+ act.sa_handler = SIG_IGN;
+ sigemptyset (&act.sa_mask);
+ act.sa_flags = 0;
+ sigaction (SIGPIPE, &act, NULL);
+ }
+ fixed_signals = 1;
+ /* FIXME: This is not MT safe */
+ }
+
+ if (pipe (rp) < 0)
+ return ASSUAN_General_Error;
+
+ if (pipe (wp) < 0)
+ {
+ close (rp[0]);
+ close (rp[1]);
+ return ASSUAN_General_Error;
+ }
+
+ fd[0] = rp[0]; /* Our inbound is read end of read pipe. */
+ fd[1] = wp[1]; /* Our outbound is write end of write pipe. */
+
+ err = assuan_init_pipe_server (ctx, fd); /* FIXME: Common code should be factored out. */
+ if (err)
+ {
+ close (rp[0]);
+ close (rp[1]);
+ close (wp[0]);
+ close (wp[1]);
+ return err;
+ }
+
+ (*ctx)->pid = fork ();
+ if ((*ctx)->pid < 0)
+ {
+ close (rp[0]);
+ close (rp[1]);
+ close (wp[0]);
+ close (wp[1]);
+ assuan_deinit_pipe_server (*ctx); /* FIXME: Common code should be factored out. */
+ return ASSUAN_General_Error;
+ }
+
+ if ((*ctx)->pid == 0)
+ {
+ close (rp[0]);
+ close (wp[1]);
+ if (rp[1] != STDOUT_FILENO)
+ {
+ dup2 (rp[1], STDOUT_FILENO); /* Child's outbound is write end of read pipe. */
+ close (rp[1]);
+ }
+ if (wp[0] != STDIN_FILENO)
+ {
+ dup2 (wp[0], STDIN_FILENO); /* Child's inbound is read end of write pipe. */
+ close (wp[0]);
+ }
+ execv (name, argv);
+ _exit (1);
+ }
+
+ close (rp[1]);
+ close (wp[0]);
+ _assuan_read_line (*ctx); /* FIXME: Handshake. */
+ return 0;
+}
+
+void
+assuan_pipe_disconnect (ASSUAN_CONTEXT ctx)
+{
+ _assuan_write_line (ctx, "BYE");
+ close (ctx->inbound.fd);
+ close (ctx->outbound.fd);
+ waitpid (ctx->pid, NULL, 0); /* FIXME Check return value. */
+ assuan_deinit_pipe_server (ctx);
+}
diff --git a/assuan/assuan-defs.h b/assuan/assuan-defs.h
new file mode 100644
index 00000000..8723fd31
--- /dev/null
+++ b/assuan/assuan-defs.h
@@ -0,0 +1,110 @@
+/* assuan-defs.c - Internal definitions to Assuan
+ * Copyright (C) 2001 Free Software Foundation, Inc.
+ *
+ * This file is part of GnuPG.
+ *
+ * GnuPG is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GnuPG is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#ifndef ASSUAN_DEFS_H
+#define ASSUAN_DEFS_H
+
+#include <sys/types.h>
+#include "assuan.h"
+
+#define LINELENGTH 1002 /* 1000 + [CR,]LF */
+
+struct cmdtbl_s {
+ const char *name;
+ int cmd_id;
+ int (*handler)(ASSUAN_CONTEXT, char *line);
+};
+
+struct assuan_context_s {
+ AssuanError err_no;
+ const char *err_str;
+
+ void *user_pointer; /* for assuan_[gs]et_pointer () */
+
+ struct {
+ int fd;
+ int eof;
+ char line[LINELENGTH];
+ int linelen; /* w/o CR, LF - might not be the same as
+ strlen(line) due to embedded nuls. However a nul
+ is always written at this pos */
+ } inbound;
+
+ struct {
+ int fd;
+ struct {
+ FILE *fp;
+ char line[LINELENGTH];
+ int linelen;
+ int error;
+ } data;
+ } outbound;
+
+ int pipe_mode; /* We are in pipe mode, i.e. we can handle just one
+ connection and must terminate then */
+ pid_t pid; /* In pipe mode, the pid of the child server process. */
+
+ struct cmdtbl_s *cmdtbl;
+ size_t cmdtbl_used; /* used entries */
+ size_t cmdtbl_size; /* allocated size of table */
+
+
+ int input_fd; /* set by INPUT command */
+ int output_fd; /* set by OUTPUT command */
+
+
+
+};
+
+
+/*-- assuan-handler.c --*/
+int _assuan_register_std_commands (ASSUAN_CONTEXT ctx);
+
+/*-- assuan-buffer.c --*/
+int _assuan_write_line (ASSUAN_CONTEXT ctx, const char *line);
+int _assuan_read_line (ASSUAN_CONTEXT ctx);
+int _assuan_cookie_write_data (void *cookie, const char *buffer, size_t size);
+int _assuan_cookie_write_flush (void *cookie);
+
+
+
+
+/*-- assuan-util.c --*/
+void *_assuan_malloc (size_t n);
+void *_assuan_calloc (size_t n, size_t m);
+void *_assuan_realloc (void *p, size_t n);
+void _assuan_free (void *p);
+
+#define xtrymalloc(a) _assuan_malloc ((a))
+#define xtrycalloc(a,b) _assuan_calloc ((a),(b))
+#define xtryrealloc(a,b) _assuan_realloc((a),(b))
+#define xfree(a) _assuan_free ((a))
+
+#define set_error(c,e,t) assuan_set_error ((c), ASSUAN_ ## e, (t))
+
+
+#endif /*ASSUAN_DEFS_H*/
+
+
+
+
+
+
+
diff --git a/assuan/assuan-handler.c b/assuan/assuan-handler.c
new file mode 100644
index 00000000..472206b0
--- /dev/null
+++ b/assuan/assuan-handler.c
@@ -0,0 +1,431 @@
+/* assuan-handler.c - dispatch commands
+ * Copyright (C) 2001 Free Software Foundation, Inc.
+ *
+ * This file is part of GnuPG.
+ *
+ * GnuPG is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GnuPG is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "assuan-defs.h"
+
+#define digitp(a) ((a) >= '0' && (a) <= '9')
+
+
+static int
+dummy_handler (ASSUAN_CONTEXT ctx, char *line)
+{
+ return set_error (ctx, Server_Fault, "no handler registered");
+}
+
+
+static int
+std_handler_nop (ASSUAN_CONTEXT ctx, char *line)
+{
+ return 0; /* okay */
+}
+
+static int
+std_handler_cancel (ASSUAN_CONTEXT ctx, char *line)
+{
+ return set_error (ctx, Not_Implemented, NULL);
+}
+
+static int
+std_handler_bye (ASSUAN_CONTEXT ctx, char *line)
+{
+ return -1; /* pretty simple :-) */
+}
+
+static int
+std_handler_auth (ASSUAN_CONTEXT ctx, char *line)
+{
+ return set_error (ctx, Not_Implemented, NULL);
+}
+
+static int
+std_handler_reset (ASSUAN_CONTEXT ctx, char *line)
+{
+ return set_error (ctx, Not_Implemented, NULL);
+}
+
+static int
+std_handler_end (ASSUAN_CONTEXT ctx, char *line)
+{
+ return set_error (ctx, Not_Implemented, NULL);
+}
+
+static int
+parse_cmd_input_output (ASSUAN_CONTEXT ctx, char *line, int *rfd)
+{
+ char *endp;
+
+ if (strncmp (line, "FD=", 3))
+ return set_error (ctx, Syntax_Error, "FD=<n> expected");
+ line += 3;
+ if (!digitp (*line))
+ return set_error (ctx, Syntax_Error, "number required");
+ *rfd = strtoul (line, &endp, 10);
+ if (*endp)
+ return set_error (ctx, Syntax_Error, "garbage found");
+ if (*rfd == ctx->inbound.fd)
+ return set_error (ctx, Parameter_Conflict, "fd same as inbound fd");
+ if (*rfd == ctx->outbound.fd)
+ return set_error (ctx, Parameter_Conflict, "fd same as outbound fd");
+ return 0;
+}
+
+/* Format is INPUT FD=<n> */
+static int
+std_handler_input (ASSUAN_CONTEXT ctx, char *line)
+{
+ int rc, fd;
+
+ rc = parse_cmd_input_output (ctx, line, &fd);
+ if (rc)
+ return rc;
+ ctx->input_fd = fd;
+ return 0;
+}
+
+/* Format is OUTPUT FD=<n> */
+static int
+std_handler_output (ASSUAN_CONTEXT ctx, char *line)
+{
+ int rc, fd;
+
+ rc = parse_cmd_input_output (ctx, line, &fd);
+ if (rc)
+ return rc;
+ ctx->output_fd = fd;
+ return 0;
+}
+
+
+
+
+
+/* This is a table with the standard commands and handler for them.
+ The table is used to initialize a new context and assuciate strings
+ and handlers with cmd_ids */
+static struct {
+ const char *name;
+ int cmd_id;
+ int (*handler)(ASSUAN_CONTEXT, char *line);
+ int always; /* always initializethis command */
+} std_cmd_table[] = {
+ { "NOP", ASSUAN_CMD_NOP, std_handler_nop, 1 },
+ { "CANCEL", ASSUAN_CMD_CANCEL, std_handler_cancel, 1 },
+ { "BYE", ASSUAN_CMD_BYE, std_handler_bye, 1 },
+ { "AUTH", ASSUAN_CMD_AUTH, std_handler_auth, 1 },
+ { "RESET", ASSUAN_CMD_RESET, std_handler_reset, 1 },
+ { "END", ASSUAN_CMD_END, std_handler_end, 1 },
+
+ { "INPUT", ASSUAN_CMD_INPUT, std_handler_input },
+ { "OUTPUT", ASSUAN_CMD_OUTPUT, std_handler_output },
+ { NULL }
+};
+
+
+/**
+ * assuan_register_command:
+ * @ctx: the server context
+ * @cmd_id: An ID value for the command
+ * @cmd_name: A string with the command name
+ * @handler: The handler function to be called
+ *
+ * Register a handler to be used for a given command.
+ *
+ * The @cmd_name must be %NULL or an empty string for all @cmd_ids
+ * below %ASSUAN_CMD_USER because predefined values are used.
+ *
+ * Return value:
+ **/
+int
+assuan_register_command (ASSUAN_CONTEXT ctx,
+ int cmd_id, const char *cmd_name,
+ int (*handler)(ASSUAN_CONTEXT, char *))
+{
+ int i;
+
+ if (cmd_name && !*cmd_name)
+ cmd_name = NULL;
+
+ if (cmd_id < ASSUAN_CMD_USER)
+ {
+ if (cmd_name)
+ return ASSUAN_Invalid_Value; /* must be NULL for these values*/
+
+ for (i=0; std_cmd_table[i].name; i++)
+ {
+ if (std_cmd_table[i].cmd_id == cmd_id)
+ {
+ cmd_name = std_cmd_table[i].name;
+ if (!handler)
+ handler = std_cmd_table[i].handler;
+ break;
+ }
+ }
+ if (!std_cmd_table[i].name)
+ return ASSUAN_Invalid_Value; /* not a pre-registered one */
+ }
+
+ if (!handler)
+ handler = dummy_handler;
+
+ if (!cmd_name)
+ return ASSUAN_Invalid_Value;
+
+/* fprintf (stderr, "DBG-assuan: registering %d as `%s'\n", cmd_id, cmd_name); */
+
+ if (!ctx->cmdtbl)
+ {
+ ctx->cmdtbl_size = 50;
+ ctx->cmdtbl = xtrycalloc ( ctx->cmdtbl_size, sizeof *ctx->cmdtbl);
+ if (!ctx->cmdtbl)
+ return ASSUAN_Out_Of_Core;
+ ctx->cmdtbl_used = 0;
+ }
+ else if (ctx->cmdtbl_used >= ctx->cmdtbl_size)
+ {
+ struct cmdtbl_s *x;
+
+ x = xtryrealloc ( ctx->cmdtbl, (ctx->cmdtbl_size+10) * sizeof *x);
+ if (!x)
+ return ASSUAN_Out_Of_Core;
+ ctx->cmdtbl = x;
+ ctx->cmdtbl_size += 50;
+ }
+
+ ctx->cmdtbl[ctx->cmdtbl_used].name = cmd_name;
+ ctx->cmdtbl[ctx->cmdtbl_used].cmd_id = cmd_id;
+ ctx->cmdtbl[ctx->cmdtbl_used].handler = handler;
+ ctx->cmdtbl_used++;
+ return 0;
+}
+
+/* Helper to register the standards commands */
+int
+_assuan_register_std_commands (ASSUAN_CONTEXT ctx)
+{
+ int i, rc;
+
+ for (i=0; std_cmd_table[i].name; i++)
+ {
+ if (std_cmd_table[i].always)
+ {
+ rc = assuan_register_command (ctx, std_cmd_table[i].cmd_id,
+ NULL, NULL);
+ if (rc)
+ return rc;
+ }
+ }
+ return 0;
+}
+
+
+
+/* Process the special data lines. The "D " has already been removed
+ from the line. As all handlers this function may modify the line. */
+static int
+handle_data_line (ASSUAN_CONTEXT ctx, char *line, int linelen)
+{
+ return set_error (ctx, Not_Implemented, NULL);
+}
+
+
+/* Parse the line, break out the command, find it in the command
+ table, remove leading and white spaces from the arguments, all the
+ handler with the argument line and return the error */
+static int
+dispatch_command (ASSUAN_CONTEXT ctx, char *line, int linelen)
+{
+ char *p;
+ const char *s;
+ int shift, i;
+
+ if (*line == 'D' && line[1] == ' ') /* divert to special handler */
+ return handle_data_line (ctx, line+2, linelen-2);
+
+ for (p=line; *p && *p != ' ' && *p != '\t'; p++)
+ ;
+ if (p==line)
+ return set_error (ctx, Invalid_Command, "leading white-space");
+ if (*p)
+ { /* Skip over leading WS after the keyword */
+ *p++ = 0;
+ while ( *p == ' ' || *p == '\t')
+ p++;
+ }
+ shift = p - line;
+
+ for (i=0; (s=ctx->cmdtbl[i].name); i++)
+ if (!strcmp (line, s))
+ break;
+ if (!s)
+ return set_error (ctx, Unknown_Command, NULL);
+ line += shift;
+ linelen -= shift;
+
+/* fprintf (stderr, "DBG-assuan: processing %s `%s'\n", s, line); */
+ return ctx->cmdtbl[i].handler (ctx, line);
+}
+
+
+
+
+/**
+ * assuan_process:
+ * @ctx: assuan context
+ *
+ * This fucntion is used to handle the assuan protocol after a
+ * connection has been established using assuan_accept(). This is the
+ * main protocol handler.
+ *
+ * Return value: 0 on success or an error code if the assuan operation
+ * failed. Note, that no error is returned for operational errors.
+ **/
+int
+assuan_process (ASSUAN_CONTEXT ctx)
+{
+ int rc;
+
+ do {
+ /* Read the line but skip comments */
+ do
+ {
+ rc = _assuan_read_line (ctx);
+ if (rc)
+ return rc;
+
+/* fprintf (stderr, "DBG-assuan: got %d bytes `%s'\n", */
+/* ctx->inbound.linelen, ctx->inbound.line); */
+ }
+ while ( *ctx->inbound.line == '#' || !ctx->inbound.linelen);
+
+ ctx->outbound.data.error = 0;
+ ctx->outbound.data.linelen = 0;
+ /* dispatch command and return reply */
+ rc = dispatch_command (ctx, ctx->inbound.line, ctx->inbound.linelen);
+ /* check from data write errors */
+ if (ctx->outbound.data.fp)
+ { /* Flush the data lines */
+ fclose (ctx->outbound.data.fp);
+ ctx->outbound.data.fp = NULL;
+ if (!rc && ctx->outbound.data.error)
+ rc = ctx->outbound.data.error;
+ }
+ /* Error handling */
+ if (!rc)
+ {
+ rc = _assuan_write_line (ctx, "OK");
+ }
+ else if (rc == -1)
+ { /* No error checking because the peer may have already disconnect */
+ _assuan_write_line (ctx, "OK Bye, bye - hope to meet you again");
+ }
+ else
+ {
+ char errline[256];
+
+ if (rc < 100)
+ sprintf (errline, "ERR %d server fault (%.50s)",
+ ASSUAN_Server_Fault, assuan_strerror (rc));
+ else
+ {
+ const char *text = ctx->err_no == rc? ctx->err_str:NULL;
+
+ sprintf (errline, "ERR %d %.50s%s%.100s",
+ rc, assuan_strerror (rc), text? " - ":"", text?text:"");
+ }
+ rc = _assuan_write_line (ctx, errline);
+ }
+ } while (!rc);
+
+ if (rc == -1)
+ rc = 0;
+
+ return rc;
+}
+
+
+/* Return a FP to be used for data output. The FILE pointer is valid
+ until the end of a handler. So a close is not needed. Assuan does
+ all the buffering needed to insert the status line as well as the
+ required line wappping and quoting for data lines.
+
+ We use GNU's custom streams here. There should be an alternative
+ implementaion for systems w/o a glibc, a simple implementation
+ could use a child process */
+FILE *
+assuan_get_data_fp (ASSUAN_CONTEXT ctx)
+{
+ cookie_io_functions_t cookie_fnc;
+
+ if (ctx->outbound.data.fp)
+ return ctx->outbound.data.fp;
+
+ cookie_fnc.read = NULL;
+ cookie_fnc.write = _assuan_cookie_write_data;
+ cookie_fnc.seek = NULL;
+ cookie_fnc.close = _assuan_cookie_write_flush;
+
+ ctx->outbound.data.fp = fopencookie (ctx, "wb", cookie_fnc);
+ ctx->outbound.data.error = 0;
+ return ctx->outbound.data.fp;
+}
+
+
+void
+assuan_write_status (ASSUAN_CONTEXT ctx, const char *keyword, const char *text)
+{
+ char buffer[256];
+ char *helpbuf;
+ size_t n;
+
+ if ( !ctx || !keyword)
+ return;
+ if (!text)
+ text = "";
+
+ n = 2 + strlen (keyword) + 1 + strlen (text) + 1;
+ if (n < sizeof (buffer))
+ {
+ strcpy (buffer, "S ");
+ strcat (buffer, keyword);
+ if (*text)
+ {
+ strcat (buffer, " ");
+ strcat (buffer, text);
+ }
+ _assuan_write_line (ctx, buffer);
+ }
+ else if ( (helpbuf = xtrymalloc (n)) )
+ {
+ strcpy (helpbuf, "S ");
+ strcat (helpbuf, keyword);
+ if (*text)
+ {
+ strcat (helpbuf, " ");
+ strcat (helpbuf, text);
+ }
+ _assuan_write_line (ctx, helpbuf);
+ xfree (helpbuf);
+ }
+}
diff --git a/assuan/assuan-listen.c b/assuan/assuan-listen.c
new file mode 100644
index 00000000..f8ccb270
--- /dev/null
+++ b/assuan/assuan-listen.c
@@ -0,0 +1,86 @@
+/* assuan-listen.c - Wait for a connection (server)
+ * Copyright (C) 2001 Free Software Foundation, Inc.
+ *
+ * This file is part of GnuPG.
+ *
+ * GnuPG is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GnuPG is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "assuan-defs.h"
+
+
+
+/**
+ * assuan_accept:
+ * @ctx: context
+ *
+ * Cancel any existing connectiion and wait for a connection from a
+ * client. The initial handshake is performed which may include an
+ * initial authentication or encryption negotiation.
+ *
+ * Return value: 0 on success or an error if the connection could for
+ * some reason not be established.
+ **/
+int
+assuan_accept (ASSUAN_CONTEXT ctx)
+{
+ int rc;
+
+ if (!ctx)
+ return ASSUAN_Invalid_Value;
+
+ /* fixme: cancel existing connection */
+ if (ctx->pipe_mode > 1)
+ return -1; /* second invocation for pipemode -> terminate */
+
+ if (!ctx->pipe_mode)
+ {
+
+ /* fixme: wait for request */
+ }
+
+ /* send the hello */
+
+ rc = _assuan_write_line (ctx,
+ "OK Hello dear client - what can I do for you?");
+ if (rc)
+ return rc;
+
+ if (ctx->pipe_mode)
+ ctx->pipe_mode = 2;
+
+ return 0;
+}
+
+
+int
+assuan_get_input_fd (ASSUAN_CONTEXT ctx)
+{
+ return ctx? ctx->input_fd : -1;
+}
+
+
+int
+assuan_get_output_fd (ASSUAN_CONTEXT ctx)
+{
+ return ctx? ctx->output_fd : -1;
+}
+
+
diff --git a/assuan/assuan-pipe-server.c b/assuan/assuan-pipe-server.c
new file mode 100644
index 00000000..018d05df
--- /dev/null
+++ b/assuan/assuan-pipe-server.c
@@ -0,0 +1,69 @@
+/* assuan-pipe-server.c - Assuan server working over a pipe
+ * Copyright (C) 2001 Free Software Foundation, Inc.
+ *
+ * This file is part of GnuPG.
+ *
+ * GnuPG is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GnuPG is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "assuan-defs.h"
+
+
+int
+assuan_init_pipe_server (ASSUAN_CONTEXT *r_ctx, int filedes[2])
+{
+ ASSUAN_CONTEXT ctx;
+ int rc;
+
+ *r_ctx = NULL;
+ ctx = xtrycalloc (1, sizeof *ctx);
+ if (!ctx)
+ return ASSUAN_Out_Of_Core;
+ ctx->input_fd = -1;
+ ctx->output_fd = -1;
+
+ ctx->inbound.fd = filedes[0];
+ ctx->outbound.fd = filedes[1];
+
+ ctx->pipe_mode = 1;
+
+ rc = _assuan_register_std_commands (ctx);
+ if (rc)
+ xfree (ctx);
+ else
+ *r_ctx = ctx;
+ return rc;
+}
+
+void
+assuan_deinit_pipe_server (ASSUAN_CONTEXT ctx)
+{
+ xfree (ctx);
+}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assuan/assuan-util.c b/assuan/assuan-util.c
new file mode 100644
index 00000000..3eeee9ab
--- /dev/null
+++ b/assuan/assuan-util.c
@@ -0,0 +1,98 @@
+/* assuan-util.c - Utility functions for Assuan
+ * Copyright (C) 2001 Free Software Foundation, Inc.
+ *
+ * This file is part of GnuPG.
+ *
+ * GnuPG is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GnuPG is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "assuan-defs.h"
+
+
+static void *(*alloc_func)(size_t n) = malloc;
+static void *(*realloc_func)(void *p, size_t n) = realloc;
+static void (*free_func)(void*) = free;
+
+
+
+void
+assuan_set_malloc_hooks ( void *(*new_alloc_func)(size_t n),
+ void *(*new_realloc_func)(void *p, size_t n),
+ void (*new_free_func)(void*) )
+{
+ alloc_func = new_alloc_func;
+ realloc_func = new_realloc_func;
+ free_func = new_free_func;
+}
+
+void *
+_assuan_malloc (size_t n)
+{
+ return alloc_func (n);
+}
+
+void *
+_assuan_realloc (void *a, size_t n)
+{
+ return realloc_func (a, n);
+}
+
+void *
+_assuan_calloc (size_t n, size_t m)
+{
+ void *p = _assuan_malloc (n*m);
+ if (p)
+ memset (p, 0, n* m);
+ return p;
+}
+
+void
+_assuan_free (void *p)
+{
+ if (p)
+ free_func (p);
+}
+
+
+
+/* Store the error in the context so that the error sending function
+ can take out a descriptive text. Inside the assuan code, use the
+ macro set_error instead of this function. */
+int
+assuan_set_error (ASSUAN_CONTEXT ctx, int err, const char *text)
+{
+ ctx->err_no = err;
+ ctx->err_str = text;
+ return err;
+}
+
+void
+assuan_set_pointer (ASSUAN_CONTEXT ctx, void *pointer)
+{
+ if (ctx)
+ ctx->user_pointer = pointer;
+}
+
+void *
+assuan_get_pointer (ASSUAN_CONTEXT ctx)
+{
+ return ctx? ctx->user_pointer : NULL;
+}
+
diff --git a/assuan/assuan.h b/assuan/assuan.h
new file mode 100644
index 00000000..97462fb9
--- /dev/null
+++ b/assuan/assuan.h
@@ -0,0 +1,120 @@
+/* assuan.c - Definitions for the Assuna protocol
+ * Copyright (C) 2001 Free Software Foundation, Inc.
+ *
+ * This file is part of GnuPG.
+ *
+ * GnuPG is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GnuPG is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#ifndef ASSUAN_H
+#define ASSUAN_H
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+ }
+#endif
+#endif
+
+typedef enum {
+ ASSUAN_No_Error = 0,
+ ASSUAN_General_Error = 1,
+ ASSUAN_Out_Of_Core = 2,
+ ASSUAN_Invalid_Value = 3,
+ ASSUAN_Timeout = 4,
+ ASSUAN_Read_Error = 5,
+ ASSUAN_Write_Error = 6,
+
+ /* error codes above 99 are meant as status codes */
+ ASSUAN_Not_Implemented = 100,
+ ASSUAN_Server_Fault = 101,
+ ASSUAN_Invalid_Command = 102,
+ ASSUAN_Unknown_Command = 103,
+ ASSUAN_Syntax_Error = 104,
+ ASSUAN_Parameter_Error = 105,
+ ASSUAN_Parameter_Conflict = 106,
+ ASSUAN_Line_Too_Long = 107,
+ ASSUAN_Line_Not_Terminated = 108,
+ ASSUAN_No_Input = 109,
+ ASSUAN_No_Output = 110,
+
+ ASSUAN_Cert_Revoked = 301,
+ ASSUAN_No_CRL_For_Cert = 302,
+ ASSUNA_CRL_Too_Old = 303,
+
+} AssuanError;
+
+/* This is a list of pre-registered ASSUAN commands */
+typedef enum {
+ ASSUAN_CMD_NOP = 0,
+ ASSUAN_CMD_CANCEL, /* cancel the current request */
+ ASSUAN_CMD_BYE,
+ ASSUAN_CMD_AUTH,
+ ASSUAN_CMD_RESET,
+ ASSUAN_CMD_DATA,
+ ASSUAN_CMD_END,
+ ASSUAN_CMD_INPUT,
+ ASSUAN_CMD_OUTPUT,
+
+ ASSUAN_CMD_USER = 256 /* Other commands should be used with this offset*/
+} AssuanCommand;
+
+
+struct assuan_context_s;
+typedef struct assuan_context_s *ASSUAN_CONTEXT;
+
+/*-- assuan-handler.c --*/
+int assuan_register_command (ASSUAN_CONTEXT ctx,
+ int cmd_id, const char *cmd_string,
+ int (*handler)(ASSUAN_CONTEXT, char *));
+int assuan_process (ASSUAN_CONTEXT ctx);
+FILE *assuan_get_data_fp (ASSUAN_CONTEXT ctx);
+void assuan_write_status (ASSUAN_CONTEXT ctx,
+ const char *keyword, const char *text);
+
+
+/*-- assuan-listen.c --*/
+int assuan_accept (ASSUAN_CONTEXT ctx);
+int assuan_get_input_fd (ASSUAN_CONTEXT ctx);
+int assuan_get_output_fd (ASSUAN_CONTEXT ctx);
+
+
+/*-- assuan-pipe-server.c --*/
+int assuan_init_pipe_server (ASSUAN_CONTEXT *r_ctx, int filedes[2]);
+void assuan_deinit_pipe_server (ASSUAN_CONTEXT ctx);
+
+
+/*-- assuan-connect.c --*/
+AssuanError assuan_pipe_connect (ASSUAN_CONTEXT *ctx, const char *name,
+ char *const argv[]);
+void assuan_pipe_disconnect (ASSUAN_CONTEXT ctx);
+
+/*-- assuan-util.c --*/
+void assuan_set_malloc_hooks ( void *(*new_alloc_func)(size_t n),
+ void *(*new_realloc_func)(void *p, size_t n),
+ void (*new_free_func)(void*) );
+int assuan_set_error (ASSUAN_CONTEXT ctx, int err, const char *text);
+void assuan_set_pointer (ASSUAN_CONTEXT ctx, void *pointer);
+void *assuan_get_pointer (ASSUAN_CONTEXT ctx);
+
+
+/*-- assuan-errors.c (built) --*/
+const char *assuan_strerror (AssuanError err);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*ASSUAN_H*/
diff --git a/assuan/mkerrors b/assuan/mkerrors
new file mode 100755
index 00000000..13eabde7
--- /dev/null
+++ b/assuan/mkerrors
@@ -0,0 +1,71 @@
+#!/bin/sh
+# mkerrors - Extract error strings from assuan.h
+# and create C source for assuan_strerror
+# Copyright (C) 2001 Free Software Foundation, Inc.
+#
+# This file is part of GnuPG.
+#
+# GnuPG is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# GnuPG is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+
+cat <<EOF
+/* Generated automatically by mkerrors */
+/* Do not edit! */
+
+#include <stdio.h>
+#include "assuan.h"
+
+/**
+ * assuan_strerror:
+ * @err: Error code
+ *
+ * This function returns a textual representaion of the given
+ * errorcode. If this is an unknown value, a string with the value
+ * is returned (Beware: it is hold in a static buffer).
+ *
+ * Return value: String with the error description.
+ **/
+const char *
+assuan_strerror (AssuanError err)
+{
+ const char *s;
+ static char buf[25];
+
+ switch (err)
+ {
+EOF
+
+awk '
+/ASSUAN_No_Error/ { okay=1 }
+!okay {next}
+/}/ { exit 0 }
+/ASSUAN_[A-Za-z_]*/ { print_code($1) }
+
+
+function print_code( s )
+{
+printf " case %s: s=\"", s ;
+gsub(/_/, " ", s );
+printf "%s\"; break;\n", tolower(substr(s,8));
+}
+'
+
+cat <<EOF
+ default: sprintf (buf, "ec=%d", err ); s=buf; break;
+ }
+
+ return s;
+}
+
+EOF
\ No newline at end of file
diff --git a/configure.ac b/configure.ac
index 55ab067f..bf3a5719 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,206 +1,210 @@
# configure.in for GPGME
# Copyright (C) 2000 Werner Koch (dd9jn)
# Copyright (C) 2001 g10 Code GmbH
#
# This file is part of GPGME.
#
# GPGME is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# GPGME is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
# (Process this file with autoconf to produce a configure script.)
AC_INIT(gpgme, 0.2.3a, [gnupg-devel@gnupg.org])
AC_PREREQ(2.52)
AC_REVISION($Revision$)
AC_CONFIG_SRCDIR(gpgme/gpgme.h)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(gpgme, 0.2.3a)
AM_MAINTAINER_MODE
AC_PROG_CC
# Version numbers (Remember to change them just before a release.)
# (Interfaces removed: CURRENT++, AGE=0, REVISION=0)
# (Interfaces added: CURRENT++, AGE++, REVISION=0)
# (No interfaces changed: REVISION++)
# XXXX new functions
LIBGPGME_LT_CURRENT=4
LIBGPGME_LT_AGE=4
LIBGPGME_LT_REVISION=0
NEED_GPG_VERSION=1.0.6
NEED_GPGSM_VERSION=0.0.0
##############################################
AC_SUBST(LIBGPGME_LT_CURRENT)
AC_SUBST(LIBGPGME_LT_AGE)
AC_SUBST(LIBGPGME_LT_REVISION)
AC_DEFINE_UNQUOTED(NEED_GPG_VERSION, "$NEED_GPG_VERSION")
AC_DEFINE_UNQUOTED(NEED_GPGSM_VERSION, "$NEED_GPGSM_VERSION")
dnl Don't default to build static libs.
dnl AC_DISABLE_STATIC
AC_PROG_LIBTOOL
GPG_DEFAULT=no
GPGSM_DEFAULT=no
component_system=None
case "${target}" in
*-*-mingw32* | i?86-emx-os2 | i?86-*-os2*emx | i?86-*-msdosdjgpp* )
# special stuff for Windoze NT
# OS/2 with the EMX environment
# DOS with the DJGPP environment
AC_DEFINE(HAVE_DRIVE_LETTERS)
AC_DEFINE(HAVE_DOSISH_SYSTEM)
GPG_DEFAULT='c:\\gnupg\\gpg.exe'
GPGSM_DEFAULT='c:\\gnupg\\gpgsm.exe'
#component_system='COM+'
;;
*)
dnl # XXX: Probably use exec-prefix here?
dnl GPG_DEFAULT='/usr/bin/gpg'
dnl GPGSM_DEFAULT='/usr/bin/gpgsm'
;;
esac
dnl
dnl Checks for libraries.
dnl
dnl FIXME: check whether Bonobo is installed
dnl
dnl Checks for header files.
dnl
dnl
dnl Checks for typedefs and structures.
dnl
GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
# We should not use them in this software;
# However jnlib/types.h needs them - so we take the easy way.
AC_CHECK_SIZEOF(unsigned short)
AC_CHECK_SIZEOF(unsigned int)
AC_CHECK_SIZEOF(unsigned long)
dnl
dnl Checks for compiler features.
dnl
if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
fi
dnl
dnl Checks for library functions.
dnl
dnl These are needed by libjnlib
AC_CHECK_FUNCS(memicmp stpcpy strlwr strtoul memmove stricmp)
dnl
dnl Checks for system services
dnl
NO_OVERRIDE=no
AC_ARG_WITH(gpg,
AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]),
GPG=$withval, NO_OVERRIDE=yes)
if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
GPG=
NO_OVERRIDE=yes
if test "$cross_compiling" != "yes"; then
AC_PATH_PROG(GPG, gpg)
fi
if test -z "$GPG"; then
GPG="$GPG_DEFAULT"
fi
fi
if test "$GPG" = no; then
if test "$NO_OVERRIDE" = "yes"; then
if test "$cross_compiling" != "yes"; then
AC_MSG_WARN([Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it])
else
AC_MSG_ERROR([Can not determine path to GnuPG when cross-compiling, use --with-gpg=PATH])
fi
fi
else
AC_DEFINE_UNQUOTED(GPG_PATH, "$GPG")
fi
AM_CONDITIONAL(RUN_GPG_TESTS,
[test "$cross_compiling" != "yes" && test -n "$GPG" && test -r "$GPG"])
NO_OVERRIDE=no
AC_ARG_WITH(gpgsm,
AC_HELP_STRING([--with-gpgsm=PATH], [use GpgSM binary at PATH]),
GPGSM=$withval, NO_OVERRIDE=yes)
if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
GPGSM=
NO_OVERRIDE=yes
if test "$cross_compiling" != "yes"; then
AC_PATH_PROG(GPGSM, gpgsm)
fi
if test -z "$GPGSM"; then
GPGSM="$GPGSM_DEFAULT"
fi
fi
if test "$GPGSM" = no; then
if test "$NO_OVERRIDE" = "yes"; then
if test "$cross_compiling" != "yes"; then
AC_MSG_WARN([Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it])
else
AC_MSG_ERROR([Can not determine path to GpgSM when cross-compiling, use --with-gpgsm=PATH])
fi
fi
else
AC_DEFINE_UNQUOTED(GPGSM_PATH, "$GPGSM")
fi
AM_CONDITIONAL(RUN_GPGSM_TESTS,
[test "$cross_compiling" != "yes" && test -n "$GPGSM" && test -r "$GPGSM"])
dnl
dnl Create config files
dnl
+/* FIXME: Only build if supported. */
+AM_CONDITIONAL(BUILD_ASSUAN, test "$GPGSM" != "no")
+
AM_CONDITIONAL(BUILD_COMPLUS, test "$component_system" = "COM+")
AM_CONDITIONAL(BUILD_BONOBO, test "$component_system" = "Bonobo")
dnl Make the version number in gpgme/gpgme.h the same as the one here.
dnl (this is easier than to have a *.in file just for one substitution)
GNUPG_FIX_HDR_VERSION(gpgme/gpgme.h, GPGME_VERSION)
dnl Substitution used for gpgme-config
GPGME_LIBS="-L${libdir} -lgpgme"
GPGME_CFLAGS=""
AC_SUBST(GPGME_LIBS)
AC_SUBST(GPGME_CFLAGS)
-AC_CONFIG_FILES(Makefile jnlib/Makefile gpgme/Makefile tests/Makefile
- doc/Makefile bonobo/Makefile complus/Makefile)
+AC_CONFIG_FILES(Makefile assuan/Makefile jnlib/Makefile gpgme/Makefile
+ tests/Makefile doc/Makefile
+ bonobo/Makefile complus/Makefile)
AC_CONFIG_FILES(gpgme/gpgme-config, chmod +x gpgme/gpgme-config)
AC_OUTPUT
echo "
GPGME v${VERSION} has been configured as follows:
GnuPG version: min. $NEED_GPG_VERSION
GnuPG path: $GPG
GpgSM version: min. $NEED_GPGSM_VERSION
GpgSM path: $GPGSM
"
diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog
index b539b9f9..6e28bbfa 100644
--- a/gpgme/ChangeLog
+++ b/gpgme/ChangeLog
@@ -1,489 +1,496 @@
+2001-11-20 Marcus Brinkmann <marcus@g10code.de>
+
+ * Makefile.am (libgpgme_la_INCLUDES): Remove obsolete directive.
+ (AM_CPPFLAGS): New directive [BUILD_ASSUAN].
+ (libgpgme_la_LIBADD): Likewise.
+
2001-11-20 Marcus Brinkmann <marcus@g10code.de>
* version.c: Remove global variables lineno and
tmp_engine_version.
(version_handler): Removed.
(_gpgme_get_program_version): New function.
(get_engine_info): Don't use context and version_handler,
but _gpgme_get_program_version.
* ops.h (_gpgme_get_program_version): Add prototype for
_gpgme_get_program_version (we expect to use it elsewhere soon).
+>>>>>>> 1.44
2001-11-18 Marcus Brinkmann <marcus@g10code.de>
* version.c (get_engine_info): If GnuPG is not available, return
an error message.
* posix-util.c (_gpgme_get_gpg_path): Allow GPG_PATH to be
undefined.
(_gpgme_get_gpgsm_path): New function.
* w32-util.c (find_program_in_registry): New static function.
(_gpgme_get_gpg_path): Allow GPG_PATH to be undefined. Rework
to use find_program_in_registry.
(_gpgme_get_gpgsm_path): New function.
(util.h): Prototype _gpgme_get_gpgsm_path).
* rungpg.c (_gpgme_gpg_spawn): Verify that _gpgme_get_gpg_path()
returns non-null.
2001-11-16 Marcus Brinkmann <marcus@g10code.de>
* decrypt-verify.c: New file.
* Makefile.am (libgpgme_la_SOURCES): Add decrypt-verify.c.
* types.h: Add decrypt-verify types.
* ops.h: Likewise.
* context.h: Add result type for decrypt-verify.
* gpgme.h: Add decrypt-verify prototypes.
* decrypt.c (decrypt_status_handler): Renamed to ...
(_gpgme_decrypt_status_handler): ... this. Make non-static.
(_gpgme_decrypt_start): New function, derived from
gpgme_op_decrypt_start.
(gpgme_op_decrypt_start): Reimplement in terms of
_gpgme_decrypt_start.
(_gpgme_decrypt_result): New function to retrieve error value.
(gpgme_op_decrypt): Use _gpgme_decrypt_result.
* ops.h: Add prototypes for new functions.
* verify.c (verify_status_handler): Renamed to ...
(_gpgme_verify_status_handler): ... this. Make non-static.
(gpgme_op_verify_start): Use new function name.
(intersect_stati): Renamed to ...
(_gpgme_intersect_stati): ... this. Make non-static.
(gpgme_op_verify): Use new name.
* ops.h: Add prototypes for new functions.
2001-11-16 Marcus Brinkmann <marcus@g10code.de>
* passphrase.c: New file.
* Makefile.am (libgpgme_la_SOURCES): Add passphrase.c.
* ops.h (_gpgme_passphrase_result): Add prototypes from
passphrase.c.
* types.h: Likewise.
* context.h: Add member passphrase to result.
* gpgme.c (_gpgme_release_result): Release passphrase member.
* decrypt.c: Some formatting and variable name changes (like
CTX instead C).
(struct decrypt_result_s): Remove members now found in
passphrase result.
(_gpgme_release_decrypt_result): Don't release removed members.
(decrypt_status_handler): Call _gpgme_passphrase_status_handler,
and don't handle the cases catched there.
(command_handler): Removed.
(gpgme_op_decrypt_start): Don't set command handler, but invoke
_gpgme_passphrase_start which does it.
(gpgme_op_decrypt): Invoke _gpgme_passphrase_result and drop the
cases covered by it.
* sign.c Some formatting and variable name changes (like
CTX instead C).
(struct sign_result_s): Remove members now found in
passphrase result.
(_gpgme_release_sign_result): Don't release removed members.
(sign_status_handler): Call _gpgme_passphrase_status_handler,
and don't handle the cases catched there.
(command_handler): Removed.
(gpgme_op_sign_start): Don't set command handler, but invoke
_gpgme_passphrase_start which does it.
(gpgme_op_sign): Invoke _gpgme_passphrase_result and drop the
cases covered by it.
2001-11-15 Marcus Brinkmann <marcus@g10code.de>
* decrypt.c (command_handler): Fix last change.
2001-11-15 Marcus Brinkmann <marcus@g10code.de>
* verify.c (_gpgme_release_verify_result): Rename RES to RESULT.
Rename R2 to NEXT_RESULT.
(intersect_stati): Rename RES to RESULT.
(gpgme_get_sig_status): Likewise. Do not check return_type, but
the member verify of result.
(gpgme_get_sig_key): Likewise.
* sign.c (_gpgme_release_sign_result): Rename RES to RESULT. If
RESULT is zero, return.
(sign_status_handler, command_handler): Do not check return_type,
but the member sign of result.
(gpgme_op_sign): Likewise. Drop assertion.
* encrypt.c (_gpgme_release_encrypt_result): Rename RES to RESULT.
If RESULT is zero, return.
(encrypt_status_handler): Do not check return_type, but the member
encrypt of result.
(gpgme_op_encrypt): Likewise. Drop assertion.
* decrypt.c (_gpgme_release_decrypt_result): Rename RES to RESULT.
(create_result_struct): Do not set result_type.
(command_handler, decrypt_status_handler): Do not check
return_type, but the member decrypt of result.
(gpgme_op_decrypt): Likewise. Drop assertion.
* context.h (enum ResultType): Removed.
(struct gpgme_context_s): Remove member result_type.
(struct result): Replaces union result.
* gpgme.c: Include string.h.
(_gpgme_release_result): Release all members of c->result, which
is now a struct. Zero out all members of the struct afterwards.
2001-11-11 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (_gpgme_gpg_release): Release GPG->cmd.cb_data.
Release all members of the list GPG->arglist.
Reported by Michael Schmidt <mschmidt@cs.uni-sb.de>.
2001-11-02 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (pipemode_copy): Change type of NBYTES to size_t.
* key.c: Include string.h.
* data.c: Likewise.
* recipient.c: Likewise.
2001-10-29 Marcus Brinkmann <marcus@g10code.de>
* context.h: New member signers_len.
* signers.c (gpgme_signers_clear): Require that signers are
non-NULL with assertion. Use signers_len to determine how much
keys to release. Add documentation.
(gpgme_signers_add): Use signers_len to determine if the buffer is
large enough. Use xtryrealloc rather than xtrymalloc and copying.
Add documentation.
(gpgme_signers_enum): Use signers_len to determine if key is
available. Add documentation.
2001-10-22 Marcus Brinkmann <marcus@g10code.de>
* data.c (_gpgme_data_append): Check if LENGTH is smaller than
ALLOC_CHUNK, not DH->length.
2001-10-17 Marcus Brinkmann <marcus@g10code.de>
* gpgme.c (gpgme_set_protocol): Fix last change.
2001-10-15 Werner Koch <wk@gnupg.org>
* gpgme.h (GpgmeProtocol): New.
* gpgme.c (gpgme_set_protocol): New.
2001-09-26 Werner Koch <wk@gnupg.org>
* gpgme.c (gpgme_set_passphrase_cb): Ignore a NULL context.
(gpgme_set_progress_cb): Ditto. Suggested by Mark Mutz.
2001-09-17 Werner Koch <wk@gnupg.org>
* keylist.c (finish_key): Shortcut for no tmp_key. Changed all
callers to use this function without a check for tmp_key.
* keylist.c (gpgme_op_keylist_next): Reset the key_cond after
emptying the queue. Bug reported by Stéphane Corthésy.
2001-09-12 Werner Koch <wk@gnupg.org>
* data.c (gpgme_data_rewind): Allow rewind for callbacks.
2001-09-07 Werner Koch <wk@gnupg.org>
* rungpg.h: Add NO_RECP.
* encrypt.c (encrypt_status_handler): Take on No_RECP.
(gpgme_op_encrypt): Better error return.
* verify.c (verify_status_handler): Take on NODATA.
2001-09-03 Werner Koch <wk@gnupg.org>
* rungpg.h: Added STATUS_INV_RECP.
* gpgme.c (_gpgme_release_result): Add support for new
EncryptResult object.
* encrypt.c (append_xml_encinfo): New.
(encrypt_status_handler): Add some status parsing.
(_gpgme_release_encrypt_result): New.
2001-08-29 Werner Koch <wk@gnupg.org>
* recipient.c (gpgme_recipients_release): Free the list. By Timo.
* keylist.c (keylist_colon_handler): Do a finish key if we receive
an EOF here. This is probably the reason for a lot of bugs
related to keylisting. It is so obvious. Kudos to Enno Cramer
for pointing that out.
2001-08-28 Werner Koch <wk@gnupg.org>
* gpgme.c, gpgme.h (gpgme_get_op_info): New.
(_gpgme_set_op_info): New.
(_gpgme_release_result): Reset the op_info here.
* sign.c (append_xml_siginfo): New.
(sign_status_handler): Store the sig create information.
2001-07-31 Werner Koch <wk@gnupg.org>
* encrypt.c (gpgme_op_encrypt): Hack to detect no valid recipients.
2001-07-30 Werner Koch <wk@gnupg.org>
* gpgme.c (gpgme_get_armor,gpgme_get_textmode): New.
* rungpg.c (build_argv): Disable armor comments
* w32-io.c (build_commandline): Need to add quotes here
2001-07-24 Werner Koch <wk@gnupg.org>
* data.c (gpgme_data_read): Add a a way to return the available bytes.
2001-07-23 Werner Koch <wk@gnupg.org>
* util.c: Removed stpcpy() because we use the version from jnlib.
2001-07-19 Werner Koch <wk@gnupg.org>
* mkstatus: Define the collating sequence for sort.
2001-06-26 Werner Koch <wk@gnupg.org>
* rungpg.h: Add STATUS_UNEXPECTED as suggested by Timo.
2001-06-15 Werner Koch <wk@gnupg.org>
* keylist.c (set_userid_flags): Fixed the assigned values. Kudos
to Timo for pointing this out.
2001-06-01 Werner Koch <wk@gnupg.org>
* debug.c (_gpgme_debug_begin): Fixed a /tmp race. Noted by
Johannes Poehlmann.
2001-05-28 Werner Koch <wk@gnupg.org>
* version.c (gpgme_check_engine): Stop version number parsing at
the opening angle and not the closing one. By Tommy Reynolds.
2001-05-01 José Carlos García Sogo <jose@jaimedelamo.eu.org>
* encrypt.c (gpgme_op_encrypt_start): Deleted the assert ( !c->gpg )
line, because it gave an error if another operation had been made
before using the same context.
* decrypt.c (gpgme_op_decrypt_start): The same as above. Also added
one line to release the gpg object in the context (if any).
2001-04-26 Werner Koch <wk@gnupg.org>
* key.c, key.h (_gpgme_key_cache_init): New.
(_gpgme_key_cache_add): New.
(_gpgme_key_cache_get): New.
* version.c (do_subsystem_inits): Init the cache.
* keylist.c (finish_key): Put key into the cache
* verify.c (gpgme_get_sig_key): First look into the cache.
2001-04-19 Werner Koch <wk@gnupg.org>
* keylist.c (parse_timestamp): Adjusted for the changed
--fixed-list-mode of gpg 1.0.4h.
2001-04-05 Werner Koch <wk@gnupg.org>
* verify.c (gpgme_op_verify_start): Enabled pipemode for detached sigs.
2001-04-04 Werner Koch <wk@gnupg.org>
* w32-io.c (_gpgme_io_select): Don't select on the writer if there
are still bytes pending. Timo found this not easy to track down
race condition.
2001-04-02 Werner Koch <wk@gnupg.org>
* gpgme.h: Add GPGME_ATTR_KEY_{EXPIRED,DISABLED}.
* key.c (gpgme_key_get_ulong_attr): And return those attribs.
* verify.c (gpgme_get_sig_key): Set keyliosting mode depending on
the mode set in the current context. Suggested by Timo.
* key.c (gpgme_key_get_ulong_attr): Return can_certify and not
can_encrypt. By Timo.
2001-03-30 Werner Koch <wk@gnupg.org>
* debug.c (debug_init): Allow to specify a debug file.
(_gpgme_debug_level): New.
* posix-io.c (_gpgme_io_read, _gpgme_io_write): Print output.
(_gpgme_io_select): Debug only with level > 2.
2001-03-15 Werner Koch <wk@gnupg.org>
* rungpg.c: Included time.h.
* key.h: New keyflags for capabilities.
* keylist.c (set_mainkey_capability, set_subkey_capability): New.
(keylist_colon_handler): Parse them.
* gpgme.h: New attribute values for capabilties.
* key.c (gpgme_key_get_string_attr): Return them.
(capabilities_to_string): New.
(gpgme_key_get_ulong_attr): Return the global caps.
2001-03-14 Werner Koch <wk@gnupg.org>
* w32-io.c (destroy_reader,destroy_writer): Fixed syntax error.
Thanks to Jan Oliver Wagner.
2001-03-13 Werner Koch <wk@gnupg.org>
* context.h: Add invalid and revoke flags to user_id structure.
* keylist.c (gpgme_op_keylist_start): Use --fixed-list-mode.
(keylist_colon_handler): Adjust for that.
(set_userid_flags): New.
(set_mainkey_trust_info): Handle new key invalid flag
(set_subkey_trust_info): Ditto.
* gpgme.h: Add new attributes for key and user ID flags.
* key.c (_gpgme_key_append_name): Init these flags
(gpgme_key_get_as_xml): Print them.
(one_uid_as_xml): New helper for above.
(gpgme_key_get_string_attr, gpgme_key_get_ulong_attr):
Return the new attributes. Enhanced, so that subkey information
can be returned now.
2001-02-28 Werner Koch <wk@gnupg.org>
* w32-io.c (destroy_reader): Set stop_me flag.
(writer,create_writer,destroy_writer,find_writer,kill_writer): New.
(_gpgme_io_write): Use a writer thread to avaoid blocking.
(_gpgme_io_close): Cleanup a writer thread
(_gpgme_io_select): Repalce tthe faked wait on writing by a real
waiting which is now possible due to the use of a writer thread.
2001-02-20 Werner Koch <wk@gnupg.org>
* w32-io.c (destroy_reader,kill_reader): New.
(create_reader, reader): Add a new event to stop the thread.
(_gpgme_io_close): Kill the reader thread.
* posix-io.c (_gpgme_io_select): Handle frozen fds here.
* 32-io.c (_gpgme_io_select): Ditto. Removed a bunch of unused code.
* wait.c: Reworked the whole thing.
* rungpg.c (_gpgme_gpg_new): Init pid to -1.
(_gpgme_gpg_release): Remove the process from the wait queue.
2001-02-19 Werner Koch <wk@gnupg.org>
* w32-io.c (_gpgme_io_set_close_notify): New.
(_gpgme_io_close): Do the notification.
* posix-io.c (_gpgme_io_select): Use a 1 sec timeout and not 200
microseconds.
* wait.c (remove_process): Don't close the fd here.
(do_select): Set the fd to -1 and remove the is_closed flag everywhere.
(_gpgme_wait_on_condition): Remove the assert on the queue and
break out if we could not find the queue. The whole thing should
be reworked.
* posix-io.c (_gpgme_io_set_close_notify): New.
(_gpgme_io_close): Do the notification.
* rungpg.c (close_notify_handler): New.
(_gpgme_gpg_new): Register a callback for the fd.
(_gpgme_gpg_set_colon_line_handler): Ditto.
(build_argv): Ditto
2001-02-13 Werner Koch <wk@gnupg.org>
* rungpg.c (struct reap_s): Replaced pid_t by int.
* types.h: Add ulong typedef.
* rungpg.c (do_reaping,_gpgme_gpg_housecleaning): New.
(_gpgme_gpg_release): Reap children.
* io.h, posix-io.c (_gpgme_io_kill): New.
* w32-io.c (_gpgme_io_kill): New (dummy).
* keylist.c (gpgme_op_keylist_start): Cancel a pending request.
* posix-io.c (_gpgme_io_read): Add some debug output.
(_gpgme_io_write): Ditto.
(_gpgme_io_select): Increased the timeout.
2001-02-12 Werner Koch <wk@gnupg.org>
Enhanced the signature verification, so that it can how handle
more than one signature and is able to return more information on
the signatures.
* verify.c (gpgme_get_sig_key): New.
(gpgme_get_sig_status): New.
* gpgme.h: Add stdio.h.
(GpgmeSigStat): New status DIFF.
2001-02-01 Werner Koch <wk@gnupg.org>
* w32-io.c (set_synchronize): Add EVENT_MODIFY_STATE. Add Debug
code to all Set/ResetEvent().
* rungpg.c (read_status): Check for end of stream only if we have
an r. By Timo.
2001-01-31 Werner Koch <wk@gnupg.org>
* wait.c (_gpgme_wait_on_condition): Removed all exit code processing.
(propagate_term_results,clear_active_fds): Removed.
(count_active_fds): Renamed to ..
(count_active_and_thawed_fds): .. this and count only thawed fds.
* rungpg.c (gpg_colon_line_handler): Return colon.eof and not
status.eof ;-)
2001-01-30 Werner Koch <wk@gnupg.org>
* w32-io.c (_gpgme_io_spawn): Use the supplied path arg.
* version.c (get_engine_info): Return better error information.
* posix-util.c, w32-util.c: New.
(_gpgme_get_gpg_path): New, suggested by Jan-Oliver.
* rungpg.c (_gpgme_gpg_spawn): Use new function to get GPG's path.
* signers.c (gpgme_signers_add): Ooops, one should test code and
not just write it; the newarr was not assigned. Thanks to José
for pointing this out. Hmmm, still not tested, why shoudl a coder
test his fix :-)
* w32-io.c: Does now use reader threads, so that we can use
WaitForMultipleObjects.
* sema.h, posix-sema.c, w32-sema.c: Support for Critcial sections.
Does currently only work for W32.
* debug.c, util.h : New. Changed all fprintfs to use this new
set of debugging functions.
2001-01-23 Werner Koch <wk@gnupg.org>
* data.c (_gpgme_data_release_and_return_string): Fixed string
termination.
2001-01-22 Werner Koch <wk@gnupg.org>
* delete.c: New.
* signers.c: New.
* key.c (gpgme_key_ref, gpgme_key_unref): New.
* sign.c (gpgme_op_sign_start): Allow the use of other keys.
* version.c (gpgme_get_engine_info,gpgme_check_engine): New.
* rungpg.c (_gpgme_gpg_set_simple_line_handler): New.
2001-01-05 Werner Koch <wk@gnupg.org>
* data.c (gpgme_data_rewind): Allow to rewind data_type_none.
Copyright 2001 g10 Code GmbH
This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without
modifications, as long as this notice is preserved.
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/gpgme/Makefile.am b/gpgme/Makefile.am
index 41b513cb..79155e3b 100644
--- a/gpgme/Makefile.am
+++ b/gpgme/Makefile.am
@@ -1,70 +1,73 @@
# Copyright (C) 2000 Werner Koch (dd9jn)
# Copyright (C) 2001 g10 Code GmbH
#
# This file is part of GPGME.
#
# GPGME is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# GPGME is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
## Process this file with automake to produce Makefile.in
EXTRA_DIST = gpgme-config.in gpgme.m4 mkerrors mkstatus
BUILT_SOURCES = errors.c status-table.h
bin_SCRIPTS = gpgme-config
m4datadir = $(datadir)/aclocal
m4data_DATA = gpgme.m4
include_HEADERS = gpgme.h
lib_LTLIBRARIES = libgpgme.la
libgpgme_la_LDFLAGS = -version-info \
@LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
-libgpgme_la_INCLUDES = -I$(top_srcdir)/lib
+if BUILD_ASSUAN
+AM_CPPFLAGS = -I$(top_srcdir)/assuan
+libgpgme_la_LIBADD = -L../assuan -lassuan
+endif
libgpgme_la_SOURCES = \
gpgme.h types.h \
util.h util.c posix-util.c w32-util.c \
context.h ops.h \
data.c recipient.c signers.c \
wait.c wait.h \
encrypt.c \
decrypt.c \
decrypt-verify.c \
verify.c \
sign.c \
passphrase.c \
key.c key.h \
keylist.c \
trustlist.c \
import.c \
export.c \
genkey.c \
delete.c \
rungpg.c rungpg.h status-table.h \
sema.h posix-sema.c w32-sema.c \
syshdr.h io.h posix-io.c w32-io.c \
gpgme.c debug.c version.c errors.c
errors.c : gpgme.h
$(srcdir)/mkerrors < $(srcdir)/gpgme.h > errors.c
status-table.h : rungpg.h
$(srcdir)/mkstatus < $(srcdir)/rungpg.h > status-table.h

File Metadata

Mime Type
text/x-diff
Expires
Mon, Dec 23, 2:10 PM (16 h, 2 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
bc/53/b8f8a9096afc6e249267a4df2fd3

Event Timeline