[svn] assuan - r320 - in trunk: . src

svn author marcus cvs at cvs.gnupg.org
Fri Nov 20 00:57:35 CET 2009


Author: marcus
Date: 2009-11-20 00:57:35 +0100 (Fri, 20 Nov 2009)
New Revision: 320

Added:
   trunk/src/client.c
   trunk/src/server.c
Removed:
   trunk/src/assuan-connect.c
Modified:
   trunk/NEWS
   trunk/src/ChangeLog
   trunk/src/Makefile.am
   trunk/src/assuan-defs.h
   trunk/src/assuan-listen.c
   trunk/src/assuan-pipe-connect.c
   trunk/src/assuan-pipe-server.c
   trunk/src/assuan-socket-connect.c
   trunk/src/assuan-socket-server.c
   trunk/src/assuan-uds.c
   trunk/src/context.c
Log:
2009-11-19  Marcus Brinkmann  <marcus at g10code.de>

	* Makefile.am (common_sources): Remove assuan-connect.c and add
	client.c.
	* client.c, server.c: New file.
	* assuan-defs.h (_assuan_disconnect): Remove.
	(struct assuan_context_s): Remove members deinit_handler.
	(_assuan_client_release, _assuan_client_finish)
	(_assuan_server_finish, _assuan_server_release): New.
	* assuan-socket-server.c (accept_connection_bottom): Use
	ASSUAN_INVALID_PID, not -1.
	(finish_connection, deinit_socket_server): Remove.
	(assuan_init_socket_server): Use _assuan_server_release.
	* assuan-socket-connect.c (do_finish, do_deinit): Remove.
	(assuan_socket_connect): Use _assuan_client_release.
	* assuan-pipe-connect.c (do_finish, do_deinit): Remove.
	(pipe_connect): Update deinitialization.
	(socketpair_connect): Here as well.
	* context.c (assuan_get_pid): New from ...
	* assuan-connect.c (assuan_get_pid): ... here.  Remove this file.
	* assuan-pipe-server.c (_assuan_deinit_server, accept_connection)
	(deinit_pipe_server, finish_connection): Remove unused function.
	* assuan-listen.c (assuan_accept): Check CTX->accept_handler
	before calling.  Initialize RC.  Do not call finish handler for
	pipe server.
	* assuan-uds.c (_assuan_uds_deinit): Do not call finish handler.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2009-11-10 17:59:41 UTC (rev 319)
+++ trunk/src/ChangeLog	2009-11-19 23:57:35 UTC (rev 320)
@@ -1,3 +1,30 @@
+2009-11-19  Marcus Brinkmann  <marcus at g10code.de>
+
+	* Makefile.am (common_sources): Remove assuan-connect.c and add
+	client.c.
+	* client.c, server.c: New file.
+	* assuan-defs.h (_assuan_disconnect): Remove.
+	(struct assuan_context_s): Remove members deinit_handler.
+	(_assuan_client_release, _assuan_client_finish)
+	(_assuan_server_finish, _assuan_server_release): New.
+	* assuan-socket-server.c (accept_connection_bottom): Use
+	ASSUAN_INVALID_PID, not -1.
+	(finish_connection, deinit_socket_server): Remove.
+	(assuan_init_socket_server): Use _assuan_server_release.
+	* assuan-socket-connect.c (do_finish, do_deinit): Remove.
+	(assuan_socket_connect): Use _assuan_client_release.
+	* assuan-pipe-connect.c (do_finish, do_deinit): Remove.
+	(pipe_connect): Update deinitialization.
+	(socketpair_connect): Here as well.
+	* context.c (assuan_get_pid): New from ...
+	* assuan-connect.c (assuan_get_pid): ... here.  Remove this file.
+	* assuan-pipe-server.c (_assuan_deinit_server, accept_connection)
+	(deinit_pipe_server, finish_connection): Remove unused function.
+	* assuan-listen.c (assuan_accept): Check CTX->accept_handler
+	before calling.  Initialize RC.  Do not call finish handler for
+	pipe server.
+	* assuan-uds.c (_assuan_uds_deinit): Do not call finish handler.
+
 2009-11-10  Marcus Brinkmann  <marcus at g10code.de>
 
 	* assuan-defs.h (struct assuan_context_s): Rename

Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2009-11-10 17:59:41 UTC (rev 319)
+++ trunk/NEWS	2009-11-19 23:57:35 UTC (rev 320)
@@ -54,6 +54,7 @@
 			       CHANGED: Is now what assuan_pipe_connect_ext was.
 assuan_pipe_connect_ext	       REMOVED
 assuan_init_pipe_server        CHANGED: Take ctx arg instead of pointer to ctx.
+                               CHANGED: Swallows fds (are closed at end).
 assuan_set_io_hooks	       REMOVED: Will come back in expanded form.
 assuan_io_hooks_t  	       REMOVED: Will come back in expanded form.
 assuan_io_monitor_t	       CHANGED: Add a hook data argument.

Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am	2009-11-10 17:59:41 UTC (rev 319)
+++ trunk/src/Makefile.am	2009-11-19 23:57:35 UTC (rev 320)
@@ -36,17 +36,14 @@
 
 common_sources = \
 	assuan-defs.h \
-	assuan.c \
-	context.c \
-	system.c \
-	debug.c debug.h \
-	conversion.c \
+	assuan.c context.c system.c \
+	debug.c debug.h conversion.c \
+	client.c server.c \
 	assuan-error.c \
 	assuan-buffer.c \
 	assuan-handler.c \
 	assuan-inquire.c \
 	assuan-listen.c \
-	assuan-connect.c \
 	assuan-client.c \
 	assuan-pipe-server.c \
 	assuan-socket-server.c \

Deleted: trunk/src/assuan-connect.c

Modified: trunk/src/assuan-defs.h
===================================================================
--- trunk/src/assuan-defs.h	2009-11-10 17:59:41 UTC (rev 319)
+++ trunk/src/assuan-defs.h	2009-11-19 23:57:35 UTC (rev 320)
@@ -182,7 +182,6 @@
     int pendingfdscount;  /* Number of received descriptors. */
   } uds;
 
-  void (*deinit_handler)(assuan_context_t);
   gpg_error_t (*accept_handler)(assuan_context_t);
   void (*finish_handler)(assuan_context_t);
 
@@ -364,8 +363,13 @@
 #endif
 
 
-void _assuan_disconnect (assuan_context_t ctx);
+void _assuan_client_finish (assuan_context_t ctx);
+void _assuan_client_release (assuan_context_t ctx);
 
+void _assuan_server_finish (assuan_context_t ctx);
+void _assuan_server_release (assuan_context_t ctx);
+
+
 /* Encode the C formatted string SRC and return the malloc'ed result.  */
 char *_assuan_encode_c_string (assuan_context_t ctx, const char *src);
 

Modified: trunk/src/assuan-listen.c
===================================================================
--- trunk/src/assuan-listen.c	2009-11-10 17:59:41 UTC (rev 319)
+++ trunk/src/assuan-listen.c	2009-11-19 23:57:35 UTC (rev 320)
@@ -72,7 +72,7 @@
 gpg_error_t
 assuan_accept (assuan_context_t ctx)
 {
-  gpg_error_t rc;
+  gpg_error_t rc = 0;
   const char *p, *pend;
 
   if (!ctx)
@@ -80,11 +80,14 @@
 
   if (ctx->pipe_mode > 1)
     return -1; /* second invocation for pipemode -> terminate */
-  ctx->finish_handler (ctx);
+  if (! ctx->pipe_mode)
+    {
+      ctx->finish_handler (ctx);
 
-  rc = ctx->accept_handler (ctx);
-  if (rc)
-    return rc;
+      rc = ctx->accept_handler (ctx);
+      if (rc)
+	return rc;
+    }
 
   /* Send the hello. */
   p = ctx->hello_line;

Modified: trunk/src/assuan-pipe-connect.c
===================================================================
--- trunk/src/assuan-pipe-connect.c	2009-11-10 17:59:41 UTC (rev 319)
+++ trunk/src/assuan-pipe-connect.c	2009-11-19 23:57:35 UTC (rev 320)
@@ -84,36 +84,6 @@
 }
 
 
-static void
-do_finish (assuan_context_t ctx)
-{
-  if (ctx->inbound.fd != ASSUAN_INVALID_FD)
-    {
-      _assuan_close (ctx, ctx->inbound.fd);
-      if (ctx->inbound.fd == ctx->outbound.fd)
-        ctx->outbound.fd = ASSUAN_INVALID_FD;
-      ctx->inbound.fd = ASSUAN_INVALID_FD;
-    }
-  if (ctx->outbound.fd != ASSUAN_INVALID_FD)
-    {
-      _assuan_close (ctx, ctx->outbound.fd);
-      ctx->outbound.fd = ASSUAN_INVALID_FD;
-    }
-  if (ctx->pid != ASSUAN_INVALID_PID && ctx->pid)
-    {
-      _assuan_waitpid (ctx, ctx->pid, ctx->flags.no_waitpid, NULL, 0);
-      ctx->pid = ASSUAN_INVALID_PID;
-    }
-}
-
-
-static void
-do_deinit (assuan_context_t ctx)
-{
-  do_finish (ctx);
-}
-
-
 /* Helper for pipe_connect. */
 static gpg_error_t
 initial_handshake (assuan_context_t ctx)
@@ -220,16 +190,15 @@
   _assuan_close (ctx, rp[1]);
   _assuan_close (ctx, wp[0]);
 
-  ctx->engine.release = _assuan_disconnect;
+  ctx->engine.release = _assuan_client_release;
   ctx->engine.readfnc = _assuan_simple_read;
   ctx->engine.writefnc = _assuan_simple_write;
   ctx->engine.sendfd = NULL;
   ctx->engine.receivefd = NULL;
+  ctx->finish_handler = _assuan_client_finish;
   ctx->pipe_mode = 1;
   ctx->inbound.fd  = rp[0];  /* Our inbound is read end of read pipe. */
   ctx->outbound.fd = wp[1];  /* Our outbound is write end of write pipe. */
-  ctx->deinit_handler = do_deinit;
-  ctx->finish_handler = do_finish;
   ctx->pid = pid;
 
   rc = initial_handshake (ctx);
@@ -370,11 +339,11 @@
 
   _assuan_close (ctx, fds[1]);
 
+  ctx->engine.release = _assuan_client_release;
+  ctx->finish_handler = _assuan_client_finish;
   ctx->pipe_mode = 1;
   ctx->inbound.fd  = fds[0]; 
   ctx->outbound.fd = fds[0]; 
-  ctx->deinit_handler = _assuan_uds_deinit;
-  ctx->finish_handler = do_finish;
   _assuan_init_uds_io (ctx);
   
   err = initial_handshake (ctx);
@@ -424,7 +393,7 @@
   TRACE2 (ctx, ASSUAN_LOG_CTX, "assuan_pipe_connect_ext", ctx,
 	  "name=%s,flags=0x%x", name ? name : "(null)", flags);
 
-  if ((flags & 1))
+  if (flags & ASSUAN_PIPE_CONNECT_FDPASSING)
     {
 #ifdef HAVE_W32_SYSTEM
       return _assuan_error (ctx, GPG_ERR_NOT_IMPLEMENTED);

Modified: trunk/src/assuan-pipe-server.c
===================================================================
--- trunk/src/assuan-pipe-server.c	2009-11-10 17:59:41 UTC (rev 319)
+++ trunk/src/assuan-pipe-server.c	2009-11-19 23:57:35 UTC (rev 320)
@@ -34,26 +34,6 @@
 #include "assuan-defs.h"
 
 
-static void
-deinit_pipe_server (assuan_context_t ctx)
-{
-  /* nothing to do for this simple server */
-}
-
-static gpg_error_t
-accept_connection (assuan_context_t ctx)
-{
-  /* This is a NOP for a pipe server */
-  return 0;
-}
-
-static void
-finish_connection (assuan_context_t ctx)
-{
-  /* This is a NOP for a pipe server */
-}
-
-
 /* Returns true if atoi(S) denotes a valid socket. */
 #ifndef HAVE_W32_SYSTEM
 static int
@@ -114,7 +94,7 @@
 #endif
 
   ctx->is_server = 1;
-  ctx->engine.release = deinit_pipe_server;
+  ctx->engine.release = _assuan_server_release;
   ctx->engine.readfnc = _assuan_simple_read;
   ctx->engine.writefnc = _assuan_simple_write;
   ctx->engine.sendfd = NULL;
@@ -126,35 +106,13 @@
     ctx->pid = (pid_t)ul;
   else
     ctx->pid = (pid_t)-1;
-  ctx->accept_handler = accept_connection;
-  ctx->finish_handler = finish_connection;
-  ctx->deinit_handler = deinit_pipe_server;
+  ctx->accept_handler = NULL;
+  ctx->finish_handler = _assuan_server_finish;
   ctx->inbound.fd = infd;
   ctx->outbound.fd = outfd;
 
   if (is_usd)
-    {
-      _assuan_init_uds_io (ctx);
-      ctx->deinit_handler = _assuan_uds_deinit;
-    }
+    _assuan_init_uds_io (ctx);
 
   return 0;
 }
-
-
-void
-_assuan_deinit_server (assuan_context_t ctx)
-{
-  /* We use this function pointer to avoid linking other server when
-     not needed but still allow for a generic deinit function.  */
-  ctx->deinit_handler (ctx);
-  ctx->deinit_handler = NULL;
- 
-  _assuan_inquire_release (ctx);
-  _assuan_free (ctx, ctx->hello_line);
-  ctx->hello_line = NULL;
-  _assuan_free (ctx, ctx->okay_line);
-  ctx->okay_line = NULL;
-  _assuan_free (ctx, ctx->cmdtbl);
-  ctx->cmdtbl = NULL;
-}

Modified: trunk/src/assuan-socket-connect.c
===================================================================
--- trunk/src/assuan-socket-connect.c	2009-11-10 17:59:41 UTC (rev 319)
+++ trunk/src/assuan-socket-connect.c	2009-11-19 23:57:35 UTC (rev 320)
@@ -52,30 +52,7 @@
 	               + strlen ((ptr)->sun_path))
 #endif
 
- 
-static void
-do_finish (assuan_context_t ctx)
-{
-  if (ctx->inbound.fd != ASSUAN_INVALID_FD)
-    {
-      _assuan_close (ctx, ctx->inbound.fd);
-      ctx->inbound.fd = ASSUAN_INVALID_FD;
-    }
-  if (ctx->outbound.fd != ASSUAN_INVALID_FD)
-    {
-      _assuan_close (ctx, ctx->outbound.fd);
-      ctx->outbound.fd = ASSUAN_INVALID_FD;
-    }
-}
 
-
-static void
-do_deinit (assuan_context_t ctx)
-{
-  do_finish (ctx);
-}
-
-
 /* Make a connection to the Unix domain socket NAME and return a new
    Assuan context in CTX.  SERVER_PID is currently not used but may
    become handy in the future.  With flags set to 1 sendmsg and
@@ -130,17 +107,16 @@
       return _assuan_error (ctx, GPG_ERR_ASS_CONNECT_FAILED);
     }
  
-  ctx->engine.release = _assuan_disconnect;
+  ctx->engine.release = _assuan_client_release;
   ctx->engine.readfnc = _assuan_simple_read;
   ctx->engine.writefnc = _assuan_simple_write;
   ctx->engine.sendfd = NULL;
   ctx->engine.receivefd = NULL;
-  ctx->deinit_handler = ((flags&1))? _assuan_uds_deinit :  do_deinit;
-  ctx->finish_handler = do_finish;
+  ctx->finish_handler = _assuan_client_finish;
   ctx->inbound.fd = fd;
   ctx->outbound.fd = fd;
 
-  if (flags & 1)
+  if (flags & ASSUAN_SOCKET_CONNECT_FDPASSING)
     _assuan_init_uds_io (ctx);
 
   /* initial handshake */

Modified: trunk/src/assuan-socket-server.c
===================================================================
--- trunk/src/assuan-socket-server.c	2009-11-10 17:59:41 UTC (rev 319)
+++ trunk/src/assuan-socket-server.c	2009-11-19 23:57:35 UTC (rev 320)
@@ -61,7 +61,7 @@
 
          /* This overrides any already set PID if the function returns
             a valid one. */
-         if (cr.pid != (pid_t)-1 && cr.pid) 
+         if (cr.pid != ASSUAN_INVALID_PID && cr.pid) 
            ctx->pid = cr.pid;
       }
   }
@@ -107,37 +107,6 @@
 }
 
 
-static void
-finish_connection (assuan_context_t ctx)
-{
-  if (ctx->inbound.fd != ASSUAN_INVALID_FD)
-    {
-      _assuan_close (ctx, ctx->inbound.fd);
-      ctx->inbound.fd = ASSUAN_INVALID_FD;
-    }
-  if (ctx->outbound.fd != ASSUAN_INVALID_FD)
-    {
-      _assuan_close (ctx, ctx->outbound.fd);
-      ctx->outbound.fd = ASSUAN_INVALID_FD;
-    }
-}
-
-
-static void
-deinit_socket_server (assuan_context_t ctx)
-{
-  finish_connection (ctx);
-
-  _assuan_inquire_release (ctx);
-  _assuan_free (ctx, ctx->hello_line);
-  ctx->hello_line = NULL;
-  _assuan_free (ctx, ctx->okay_line);
-  ctx->okay_line = NULL;
-  _assuan_free (ctx, ctx->cmdtbl);
-  ctx->cmdtbl = NULL;
-}
-
-
 /* 
    Flag bits: 0 - use sendmsg/recvmsg to allow descriptor passing
               1 - FD has already been accepted.
@@ -152,13 +121,13 @@
   if (rc)
     return rc;
 
-  ctx->engine.release = deinit_socket_server;
+  ctx->engine.release = _assuan_server_release;
   ctx->engine.readfnc = _assuan_simple_read;
   ctx->engine.writefnc = _assuan_simple_write;
   ctx->engine.sendfd = NULL;
   ctx->engine.receivefd = NULL;
   ctx->is_server = 1;
-  if (flags & 2)
+  if (flags & ASSUAN_SOCKET_SERVER_ACCEPTED)
     ctx->pipe_mode = 1; /* We want a second accept to indicate EOF. */
   ctx->input_fd = ASSUAN_INVALID_FD;
   ctx->output_fd = ASSUAN_INVALID_FD;
@@ -166,7 +135,7 @@
   ctx->inbound.fd = ASSUAN_INVALID_FD;
   ctx->outbound.fd = ASSUAN_INVALID_FD;
 
-  if ((flags & 2))
+  if (flags & ASSUAN_SOCKET_SERVER_ACCEPTED)
     {
       ctx->listen_fd = ASSUAN_INVALID_FD;
       ctx->connected_fd = fd;
@@ -176,13 +145,12 @@
       ctx->listen_fd = fd;
       ctx->connected_fd = ASSUAN_INVALID_FD;
     }
-  ctx->deinit_handler = (flags & 1)? _assuan_uds_deinit:deinit_socket_server;
-  ctx->accept_handler = ((flags & 2)
+  ctx->accept_handler = ((flags & ASSUAN_SOCKET_SERVER_ACCEPTED)
                          ? accept_connection_bottom 
                          : accept_connection);
-  ctx->finish_handler = finish_connection;
+  ctx->finish_handler = _assuan_server_finish;
 
-  if ((flags & 1))
+  if (flags & ASSUAN_SOCKET_SERVER_FDPASSING)
     _assuan_init_uds_io (ctx);
 
   rc = _assuan_register_std_commands (ctx);

Modified: trunk/src/assuan-uds.c
===================================================================
--- trunk/src/assuan-uds.c	2009-11-10 17:59:41 UTC (rev 319)
+++ trunk/src/assuan-uds.c	2009-11-19 23:57:35 UTC (rev 320)
@@ -266,8 +266,6 @@
 void
 _assuan_uds_deinit (assuan_context_t ctx)
 {
-  /* First call the finish_handler which should close descriptors etc. */
-  ctx->finish_handler (ctx);
   _assuan_uds_close_fds (ctx);
 }
 

Added: trunk/src/client.c
===================================================================
--- trunk/src/client.c	                        (rev 0)
+++ trunk/src/client.c	2009-11-19 23:57:35 UTC (rev 320)
@@ -0,0 +1,60 @@
+/* client.c - Functions common to all clients.
+   Copyright (C) 2009 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/>.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "assuan-defs.h"
+#include "debug.h"
+
+void
+_assuan_client_finish (assuan_context_t ctx)
+{
+  if (ctx->inbound.fd != ASSUAN_INVALID_FD)
+    {
+      _assuan_close (ctx, ctx->inbound.fd);
+      if (ctx->inbound.fd == ctx->outbound.fd)
+        ctx->outbound.fd = ASSUAN_INVALID_FD;
+      ctx->inbound.fd = ASSUAN_INVALID_FD;
+    }
+  if (ctx->outbound.fd != ASSUAN_INVALID_FD)
+    {
+      _assuan_close (ctx, ctx->outbound.fd);
+      ctx->outbound.fd = ASSUAN_INVALID_FD;
+    }
+  if (ctx->pid != ASSUAN_INVALID_PID && ctx->pid)
+    {
+      _assuan_waitpid (ctx, ctx->pid, ctx->flags.no_waitpid, NULL, 0);
+      ctx->pid = ASSUAN_INVALID_PID;
+    }
+
+  _assuan_uds_deinit (ctx);
+}
+
+
+/* Disconnect and release the context CTX.  */
+void
+_assuan_client_release (assuan_context_t ctx)
+{
+  assuan_write_line (ctx, "BYE");
+
+  _assuan_client_finish (ctx);
+}

Modified: trunk/src/context.c
===================================================================
--- trunk/src/context.c	2009-11-10 17:59:41 UTC (rev 319)
+++ trunk/src/context.c	2009-11-19 23:57:35 UTC (rev 320)
@@ -171,6 +171,16 @@
 }
 
 
+/* Return the PID of the peer or ASSUAN_INVALID_PID if not known.
+   This function works in some situations where assuan_get_ucred
+   fails. */
+pid_t
+assuan_get_pid (assuan_context_t ctx)
+{
+  return (ctx && ctx->pid) ? ctx->pid : ASSUAN_INVALID_PID;
+}
+
+
 /* Return user credentials.  For getting the pid of the peer the
    assuan_get_pid is usually better suited. */
 gpg_error_t

Added: trunk/src/server.c
===================================================================
--- trunk/src/server.c	                        (rev 0)
+++ trunk/src/server.c	2009-11-19 23:57:35 UTC (rev 320)
@@ -0,0 +1,69 @@
+/* server.c - Interfaces for all assuan servers.
+   Copyright (C) 2009 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/>.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "assuan-defs.h"
+#include "debug.h"
+
+
+
+/* Disconnect and release the context CTX.  */
+void
+_assuan_server_finish (assuan_context_t ctx)
+{
+  if (ctx->inbound.fd != ASSUAN_INVALID_FD)
+    {
+      _assuan_close (ctx, ctx->inbound.fd);
+      if (ctx->inbound.fd == ctx->outbound.fd)
+        ctx->outbound.fd = ASSUAN_INVALID_FD;
+      ctx->inbound.fd = ASSUAN_INVALID_FD;
+    }
+  if (ctx->outbound.fd != ASSUAN_INVALID_FD)
+    {
+      _assuan_close (ctx, ctx->outbound.fd);
+      ctx->outbound.fd = ASSUAN_INVALID_FD;
+    }
+  if (ctx->pid != ASSUAN_INVALID_PID && ctx->pid)
+    {
+      _assuan_waitpid (ctx, ctx->pid, ctx->flags.no_waitpid, NULL, 0);
+      ctx->pid = ASSUAN_INVALID_PID;
+    }
+
+  _assuan_uds_deinit (ctx);
+
+  _assuan_inquire_release (ctx);
+}
+
+
+void
+_assuan_server_release (assuan_context_t ctx)
+{
+  _assuan_server_finish (ctx);
+
+  _assuan_free (ctx, ctx->hello_line);
+  ctx->hello_line = NULL;
+  _assuan_free (ctx, ctx->okay_line);
+  ctx->okay_line = NULL;
+  _assuan_free (ctx, ctx->cmdtbl);
+  ctx->cmdtbl = NULL;
+}




More information about the Gnupg-commits mailing list