aboutsummaryrefslogtreecommitdiffstats
path: root/assuan/assuan-listen.c
diff options
context:
space:
mode:
authorMarcus Brinkmann <[email protected]>2009-10-20 15:39:15 +0000
committerMarcus Brinkmann <[email protected]>2009-10-20 15:39:15 +0000
commite782b1ab06a2d3325bc487c28ab678c95d9675b3 (patch)
tree87aacb82e59e4d7d8b60d2c55d66b12eed01af2e /assuan/assuan-listen.c
parentAdd new debug helper (diff)
downloadgpgme-e782b1ab06a2d3325bc487c28ab678c95d9675b3.tar.gz
gpgme-e782b1ab06a2d3325bc487c28ab678c95d9675b3.zip
2009-10-20 Marcus Brinkmann <[email protected]>
* configure.ac: Replace internal libassuan by external libassuan. * m4/libassuan.m4: New file. * Makefile.am (assuan): Remove variable. (SUBDIRS): Remove ${assuan}. * assuan/: Removed. src/ 2009-10-20 Marcus Brinkmann <[email protected]> * Makefile.am (assuan_cppflags, assuan_libobjs): Removed. (gpgsm_components): Move engine-assuan.c to ... (assuan_components): ... this new variable. (main_sources): Add this new variable. (AM_CPPFLAGS): Remove $(assuan_cppflags). (AM_CFLAGS): Add @LIBASSUAN_CFLAGS@. (libgpgme_la_DEPENDENCIES, libgpgme_pth_la_DEPENDENCIES) (libgpgme_glib_la_DEPENDENCIES, libgpgme_qt_la_DEPENDENCIES) (libgpgme_pthread_la_DEPENDENCIES): Remove $(assuan_libobjs). (libgpgme_la_LIBADD, libgpgme_pth_la_LIBADD) (libgpgme_glib_la_LIBADD, libgpgme_qt_la_LIBADD)) (libgpgme_pthread_la_LIBADD): Replace $(assuan_libobjs) by @LIBASSUAN_LIBS@. * priv-io.h [!HAVE_W32_SYSTEM]: Declare _gpgme_io_recvmsg, _gpgme_io_sendmsg, _gpgme_io_waitpid. * engine-backend.h: Define with [ENABLE_ASSUAN] instead of [ENABLE_GPGSM]. * posix-io.c (_gpgme_io_waitpid): Make non-static. * util.h (ENABLE_ASSUAN): Declar _gpgme_assuan_system_hooks, _gpgme_assuan_malloc_hooks, _gpgme_assuan_log_cb. * engine-gpgsm.c: Don't map assuan error codes. Use assuan_release instead of assuan_disconnect. (map_assuan_error): Remove function. (gpgsm_new): Use new assuan context interface. * engine-assuan.c: Use assuan_release instead of assuan_disconnect. (llass_new): Use new assuan context interface.
Diffstat (limited to 'assuan/assuan-listen.c')
-rw-r--r--assuan/assuan-listen.c155
1 files changed, 0 insertions, 155 deletions
diff --git a/assuan/assuan-listen.c b/assuan/assuan-listen.c
deleted file mode 100644
index 2ef93340..00000000
--- a/assuan/assuan-listen.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/* assuan-listen.c - Wait for a connection (server)
- * Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
- *
- * This file is part of Assuan.
- *
- * Assuan is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * Assuan 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include "assuan-defs.h"
-
-assuan_error_t
-assuan_set_hello_line (assuan_context_t ctx, const char *line)
-{
- if (!ctx)
- return _assuan_error (ASSUAN_Invalid_Value);
- if (!line)
- {
- xfree (ctx->hello_line);
- ctx->hello_line = NULL;
- }
- else
- {
- char *buf = xtrymalloc (3+strlen(line)+1);
- if (!buf)
- return _assuan_error (ASSUAN_Out_Of_Core);
- if (strchr (line, '\n'))
- strcpy (buf, line);
- else
- {
- strcpy (buf, "OK ");
- strcpy (buf+3, line);
- }
- xfree (ctx->hello_line);
- ctx->hello_line = buf;
- }
- return 0;
-}
-
-
-/**
- * assuan_accept:
- * @ctx: context
- *
- * Cancel any existing connection 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.
- **/
-assuan_error_t
-assuan_accept (assuan_context_t ctx)
-{
- int rc;
- const char *p, *pend;
-
- if (!ctx)
- return _assuan_error (ASSUAN_Invalid_Value);
-
- if (ctx->pipe_mode > 1)
- return -1; /* second invocation for pipemode -> terminate */
- ctx->finish_handler (ctx);
-
- rc = ctx->accept_handler (ctx);
- if (rc)
- return rc;
-
- /* Send the hello. */
- p = ctx->hello_line;
- if (p && (pend = strchr (p, '\n')))
- { /* This is a multi line hello. Send all but the last line as
- comments. */
- do
- {
- rc = _assuan_write_line (ctx, "# ", p, pend - p);
- if (rc)
- return rc;
- p = pend + 1;
- pend = strchr (p, '\n');
- }
- while (pend);
- rc = _assuan_write_line (ctx, "OK ", p, strlen (p));
- }
- else if (p)
- rc = assuan_write_line (ctx, p);
- else
- rc = assuan_write_line (ctx, "OK Pleased to meet you");
- if (rc)
- return rc;
-
- if (ctx->pipe_mode)
- ctx->pipe_mode = 2;
-
- return 0;
-}
-
-
-
-assuan_fd_t
-assuan_get_input_fd (assuan_context_t ctx)
-{
- return ctx? ctx->input_fd : ASSUAN_INVALID_FD;
-}
-
-
-assuan_fd_t
-assuan_get_output_fd (assuan_context_t ctx)
-{
- return ctx? ctx->output_fd : ASSUAN_INVALID_FD;
-}
-
-
-/* Close the fd descriptor set by the command INPUT FD=n. We handle
- this fd inside assuan so that we can do some initial checks */
-assuan_error_t
-assuan_close_input_fd (assuan_context_t ctx)
-{
- if (!ctx || ctx->input_fd == ASSUAN_INVALID_FD)
- return _assuan_error (ASSUAN_Invalid_Value);
- _assuan_close (ctx->input_fd);
- ctx->input_fd = ASSUAN_INVALID_FD;
- return 0;
-}
-
-/* Close the fd descriptor set by the command OUTPUT FD=n. We handle
- this fd inside assuan so that we can do some initial checks */
-assuan_error_t
-assuan_close_output_fd (assuan_context_t ctx)
-{
- if (!ctx || ctx->output_fd == ASSUAN_INVALID_FD)
- return _assuan_error (ASSUAN_Invalid_Value);
-
- _assuan_close (ctx->output_fd);
- ctx->output_fd = ASSUAN_INVALID_FD;
- return 0;
-}
-