[svn] gpgme - r1358 - in trunk: . assuan src
svn author marcus
cvs at cvs.gnupg.org
Fri Mar 6 23:29:49 CET 2009
Author: marcus
Date: 2009-03-06 23:29:49 +0100 (Fri, 06 Mar 2009)
New Revision: 1358
Modified:
trunk/ChangeLog
trunk/assuan/ChangeLog
trunk/assuan/assuan-buffer.c
trunk/assuan/assuan-client.c
trunk/assuan/assuan-connect.c
trunk/assuan/assuan-defs.h
trunk/assuan/assuan-handler.c
trunk/assuan/assuan-inquire.c
trunk/assuan/assuan-io.c
trunk/assuan/assuan-listen.c
trunk/assuan/assuan-logging.c
trunk/assuan/assuan-pipe-connect.c
trunk/assuan/assuan-pipe-server.c
trunk/assuan/assuan-socket-connect.c
trunk/assuan/assuan-socket-server.c
trunk/assuan/assuan-socket.c
trunk/assuan/assuan-uds.c
trunk/assuan/assuan-util.c
trunk/assuan/assuan.h
trunk/assuan/mkerrors
trunk/src/debug.c
trunk/src/version.c
Log:
assuan/
2009-03-06 Marcus Brinkmann <marcus at g10code.de>
* assuan/: Update to libassuan SVN 2009-03-06.
src/
2009-03-06 Marcus Brinkmann <marcus at g10code.de>
* version.c (do_subsystem_inits): Do not set assuan log level.
* debug.c (debug_init): Likewise.
[The diff below has been truncated]
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-02-24 15:13:01 UTC (rev 1357)
+++ trunk/ChangeLog 2009-03-06 22:29:49 UTC (rev 1358)
@@ -1,3 +1,7 @@
+2009-03-06 Marcus Brinkmann <marcus at g10code.de>
+
+ * assuan/: Update to libassuan SVN 2009-03-06.
+
2009-01-26 Werner Koch <wk at g10code.com>
* configure.ac (AC_CONFIG_FILES): Add tests/opassuan/Makefile.
Modified: trunk/assuan/ChangeLog
===================================================================
--- trunk/assuan/ChangeLog 2009-02-24 15:13:01 UTC (rev 1357)
+++ trunk/assuan/ChangeLog 2009-03-06 22:29:49 UTC (rev 1358)
@@ -3,68 +3,262 @@
* assuan-buffer.c (assuan_send_data): Add hack to optionally send
a final "CAN".
-2008-11-03 Marcus Brinkmann <marcus at g10code.com>
+2008-11-03 Marcus Brinkmann <marcus at g10code.de>
- * Makefile.am (INCLUDES): Replace gpgme path with src.
+ * assuan-handler.c (std_handler_help): Make I unsigned to silence
+ gcc -W warning.
+ * assuan-logging.c (_assuan_log_print_buffer): Likewise for N.
+ * funopen.c (_assuan_funopen): Remove initializer to silence gcc
+ -W warning.
+ * assuan-handler.c (std_cmd_table): Add missing initializer to
+ silence gcc -W warning.
+ * assuan-socket-server.c (io): Likewise.
+ * assuan-socket-connect.c (assuan_socket_connect_ext): Likewise.
-2008-10-30 Marcus Brinkmann <marcus at g10code.de>
+2008-10-29 Marcus Brinkmann <marcus at g10code.de>
- * assuan-pipe-connect.c: Fix prototype for _gpgme_io_spawn. Cast
- second argument in its invocation to silence gcc warning.
+ * assuan.h (assuan_error_t) (_ASSUAN_ONLY_GPG_ERRORS): Make
+ unsigned int.
+ (assuan_transact): Change return type of callback handlers to
+ assuan_error_t.
-2008-06-25 Marcus Brinkmann <marcus at g10code.de>
+2008-10-15 Werner Koch <wk at g10code.com>
- * assuan-pipe-connect.c (struct spawn_fd_item_s): Add new members.
- (HANDLE_TRANSLATION): New macro.
- (pipe_connect_gpgme): Adjust caller of _gpgme_io_spawn.
- [HANDLE_TRANSLATION]: Return translated handles.
+ * assuan-logging.c (_assuan_log_printf): Flush if the format
+ string ends with a LF.
-2008-02-14 Werner Koch <wk at g10code.com>
+2008-09-01 Werner Koch <wk at g10code.com>
- * assuan-pipe-connect.c (_gpgme_io_spawn): Adjust prototype.
- (pipe_connect_gpgme, pipe_connect_gpgme): Adjust call.
+ * assuan-io.c: Include time.h. Fixes bug#951.
+ (_assuan_usleep): Use nanosleep only is available.
-2008-01-04 Marcus Brinkmann <marcus at g10code.de>
+2008-03-25 Marcus Brinkmann <marcus at g10code.de>
- * assuan-pipe-connect.c (_gpgme_io_pipe)
- (_gpgme_io_spawn) [_ASSUAN_IN_GPGME_BUILD_ASSUAN]: Add prototypes
- to silence compiler warning. Reported by Alon Bar-Lev.
+ * assuan-inquire.c (assuan_inquire): Loop over _assuan_read_line
+ for EAGAIN.
+2008-03-21 Marcus Brinkmann <marcus at g10code.de>
+
+ * assuan-defs.h (_assuan_usleep): New prototype.
+ * assuan-io.c (_assuan_usleep): New function.
+ * assuan-io-pth.c (_assuan_usleep): New function.
+ * mkerrors: Do not incude <windows.h>, but assuan-defs.h.
+ (_assuan_error_is_eagain): Call _assuan_usleep.
+
+ * mkerrors [HAVE_W32_SYSTEM]: Include <windows.h>
+ (_assuan_error_is_eagain) [HAVE_W32_SYSTEM]: Wait the tenth of a
+ second.
+
+2007-11-23 Marcus Brinkmann <marcus at g10code.de>
+
+ * assuan-inquire.c (_assuan_inquire_ext_cb): Pass through return
+ value from callback function.
+ Suggested by Ben Kibbey <bjk at luxsci.net>.
+
+2007-11-14 Werner Koch <wk at g10code.com>
+
+ * assuan-pipe-connect.c (pipe_connect_unix): Add dummy arg FLAGS.
+ (pipe_connect_w32): Add arg FLAGS and start process detached if
+ requested. Changed callers to pass 0.
+ (assuan_pipe_connect_ext): Pass FLAG.
+
+2007-11-12 Marcus Brinkmann <marcus at g10code.de>
+
+ * assuan-inquire.c (_assuan_inquire_ext_cb): Clear
+ CTX->inquire_membuf after deallocating it.
+
+2007-10-18 Marcus Brinkmann <marcus at g10code.de>
+
+ * assuan-handler.c (std_handler_help): New function.
+ (std_cmd_table): Add new command HELP.
+
+2007-10-08 Werner Koch <wk at g10code.com>
+
+ * assuan-util.c (assuan_set_io_hooks): New.
+ * assuan.h (struct assuan_io_hooks): New.
+ (assuan_set_io_hooks, _assuan_io_hooks): Add prefix macros.
+ * assuan-defs.h (_assuan_io_hooks): New.
+ * assuan-io.c (do_io_read): Take all code from _assuan_io_read.
+ (_assuan_io_read, _assuan_simple_read): Add hook feature.
+ (do_io_write): Take all code from _assuan_io_write.
+ (_assuan_io_write, _assuan_simple_write): Add hook feature.
+ * assuan-io-pth.c (_assuan_simple_read, _assuan_simple_write)
+ (_assuan_io_read, _assuan_io_write): Add hook feature.
+
+2007-10-05 Marcus Brinkmann <marcus at g10code.de>
+
+ * assuan.h (_assuan_error_is_eagain): Add prefix macro.
+
+ * assuan-defs.h (_assuan_error_is_eagain): New prototype.
+ * mkerrors (_assuan_error_is_eagain): New function.
+ * assuan-handler.c (process_next): Leave on EAGAIN.
+ * assuan-handler.c (process_request),
+ assuan-client.c (_assuan_read_from_server),
+ assuan-buffer.c (assuan_read_line): Busy loop over EAGAIN.
+
+2007-10-05 Werner Koch <wk at g10code.com>
+
+ * assuan-socket.c (_assuan_sock_wsa2errno): Map WSANOTINITIALISED.
+ (_assuan_sock_new): Use assuan_fd_t.
+ * assuan.h (_assuan_sock_wsa2errno): Add prefix macro.
+
+2007-10-05 Marcus Brinkmann <marcus at g10code.de>
+
+ * assuan-defs.h (_assuan_sock_wsa2errno) [HAVE_W32_SYSTEM]: Add prototype.
+ * assuan-uds.c (wsa2errno) [HAVE_W32_SYSTEM]: Move and rename to ...
+ * assuan-socket.c (_assuan_sock_wsa2errno) [HAVE_W32_SYSTEM]: ... this.
+ (_assuan_close, _assuan_sock_new, _assuan_sock_connect, _assuan_sock_bind):
+ Always set errno on error.
+
+ * assuan-uds.c (wsa2errno) [HAVE_W32_SYSTEM]: New function.
+ (uds_reader, uds_writer) [HAVE_W32_SYSTEM]: Set errno.
+
+2007-10-04 Werner Koch <wk at g10code.com>
+
+ * mkerrors: Map EAGAIN to GPG_ERR_EAGAIN for read and write
+ errors.
+
+2007-10-02 Werner Koch <wk at g10code.com>
+
+ * assuan-io.c (_assuan_io_read) [W32]: Map WSAEWOULDBLOCK to EAGAIN.
+ * assuan-socket.c (_assuan_sock_check_nonce): N needs to be signed.
+
+ * assuan-defs.h (struct assuan_context_s): Add LISTEN_NONCE.
+ * assuan-socket-server.c (assuan_set_sock_nonce): New.
+ (accept_connection): Check the nonce.
+
+2007-10-01 Werner Koch <wk at g10code.com>
+
+ * assuan.h (ASSUAN_INT2FD, ASSUAN_FD2INT): New.
+
+ * assuan-socket.c: Rewritten.
+ (assuan_sock_new, assuan_sock_connect, assuan_sock_bind)
+ (assuan_sock_get_nonce, assuan_sock_check_nonce): New APIs.
+
+ * assuan-io.c (_assuan_simple_read, _assuan_simple_write):
+ Factored code out to ...
+ (_assuan_io_read, _assuan_io_write): .. new.
+ * assuan-io-pth.c (_assuan_io_read, _assuan_io_write): New.
+
2007-09-25 Werner Koch <wk at g10code.com>
* assuan.h (_assuan_gpg_strerror_r, _assuan_gpg_strsource): Add
- new wrappers.
+ wrappers for these new internal functions.
+2007-09-24 Marcus Brinkmann <marcus at g10code.de>
+
+ * assuan-uds.c (uds_reader) [HAVE_W32_SYSTEM]: Do not touch the
+ UDS structure in the context. Reported by Frank Osterfeld.
+ (uds_writer): Clarify code.
+
+2007-09-14 Marcus Brinkmann <marcus at g10code.de>
+
+ * assuan-pipe-connect.c (do_finish) [HAVE_W32_SYSTEM]: Close
+ ctx->pid as handle.
+ (pipe_connect_w32): Save the spawned processes handle.
+
+2007-09-13 Werner Koch <wk at g10code.com>
+
+ * assuan-socket.c (_assuan_close): Add inactive debug outputs.
+
+2007-09-11 Marcus Brinkmann <marcus at g10code.de>
+
+ * assuan.h: Use _WIN32 instead of HAVE_W32_SYSTEM.
+
+2007-09-07 Marcus Brinkmann <marcus at g10code.de>
+
+ * assuan-inquire.c (assuan_inquire_ext): If MAXLEN is 0, still
+ initialize MEMBUF.
+
+ * assuan-inquire.c (_assuan_inquire_ext_cb): Clear CTX->in_inquire
+ before invoking callback and returning.
+
+2007-09-05 Marcus Brinkmann <marcus at g10code.de>
+
+ * assuan-handler.c (dispatch_command): Return non-critical errors
+ with PROCESS_DONE ().
+
2007-09-03 Marcus Brinkmann <marcus at g10code.de>
* assuan.h [_ASSUAN_EXT_SYM_PREFIX]: Add missing symbol renames
with _ASSUAN_PREFIX.
-2007-08-02 Werner Koch <wk at g10code.com>
+2007-09-03 Marcus Brinkmann <marcus at g10code.de>
- * assuan-pipe-connect.c (pipe_connect_w32): A bit more debug output.
- (pipe_connect_w32): Use DETACHED_PROCESS flag.
- * assuan-logging.c (log_level): New. Use this to disable logging.
- (assuan_set_assuan_log_level): New.
- * assuan.h: Add prototype.
+ * assuan.h [_ASSUAN_EXT_SYM_PREFIX]: Add missing symbol renames
+ with _ASSUAN_PREFIX.
+ * assuan.h (assuan_inquire_ext): Move buffer and buffer_length
+ arguments callback in prototype.
+ * assuan-defs.h (struct assuan_context_s): Remove members
+ inquire_r_buffer and inquire_r_buffer_len. Add buffer and buffer
+ length arguments to inquire_cb.
+ * assuan-inquire.c (_assuan_inquire_ext_cb): Return buffer and
+ buffer length via callback.
+ (assuan_inquire_ext): Move buffer and buffer length arguments to
+ callback.
+
+2007-08-24 Werner Koch <wk at g10code.com>
+
+ Switched license to back to LGPLv2.1.
+
+2007-08-09 Marcus Brinkmann <marcus at g10code.de>
+
+ * assuan.h (assuan_process_done, assuan_inquire_ext): New
+ prototypes.
+ * assuan-defs.h (struct assuan_context_s): New members
+ in_process_next, in_command, inquire_cb, inquire_cb_data,
+ inquire_r_buffer, inquire_r_buffer_len, inquire_membuf.
+ (_assuan_inquire_ext_cb, _assuan_inquire_release): New prototypes.
+ * assuan-handler.c (PROCESS_DONE): New macro.
+ (dummy_handler, std_handler_nop, std_handler_cancel)
+ (std_handler_option, std_handler_bye, std_handler_auth)
+ (std_handler_reset, std_handler_end): Use PROCESS_DONE to
+ optionally call assuan_process_done if CTX->in_process_next is
+ true.
+ (assuan_process_done, process_next): New functions.
+ (assuan_process_next): Rewritten to support external event
+ handling.
+ * mkerrors: Do not clear high bits of -1 for old style EOF.
+ * assuan-inquire.c (_assuan_inquire_release)
+ (_assuan_inquire_ext_cb, assuan_inquire_ext): New functions.
+ * assuan-pipe-server.c (_assuan_release_context): Call
+ _assuan_inquire_release.
+
2007-07-12 Werner Koch <wk at g10code.com>
- * assuan-handler.c (assuan_get_active_fds): Use get_osfhandle for
- the data fp.
- * assuan-socket.c (_assuan_close) [W32]: Use CloseHandle and not close.
+ * assuan.h (assuan_fd_t): New.
+ (ASSUAN_INVALID_FD): New. Use it everywhere.
+ * assuan-defs.h (SOCKET2HANDLE, HANDLE2SOCKET) [W32]: New. Use
+ them to cast descriptors for socket fucntions.
+ * assuan-pipe-connect.c (fd_to_handle, handle_to_fd): Remove
+ definition and all uses.
+ (pid_to_handle, handle_to_pid): Remove as they are ununsed.
+ * assuan-io.c (_assuan_simple_write, _assuan_simple_read) [W32]:
+ Make use of HANDLE2SOCKET.
+ * assuan-socket.c (_assuan_close) [W32]: Use CloseHandle and not
+ close.
+ * assuan-handler.c (assuan_get_active_fds) [W32]: Use
+ _get_osfhandle for the data fp.
- * assuan-io.c (_assuan_simple_write, _assuan_simple_read): Map
- ERROR_BROKEN_PIPE to EPIPE.
-
+ * assuan-io.c (_assuan_simple_write): Return EPIPE on a closed pipe.
+ (_assuan_simple_read): Likewise
+
2007-07-08 Marcus Brinkmann <marcus at g10code.de>
- * assuan-defs.h (struct assuan_context_s): Have partial peercred
- structure even if HAVE_W32_SYSTEM, and have full peercred
- structure only if HAVE_SO_PEERCRED.
+ * assuan-defs.h (struct assuan_context_s): Have full peercred
+ structure for HAVE_SO_PEERCRED.
* assuan-connect.c (assuan_get_peercred) [!HAVE_SO_PEERCRED]: Do
not try to set PID, UID and GID.
+2007-07-05 Werner Koch <wk at g10code.com>
+
+ * assuan-defs.h (struct assuan_context_s): Have peercred.valid
+ even for Windows. This makes some other code cleaner.
+
+ * assuan.h (ASSUAN_CONFIDENTIAL): New flag.
+ * assuan-util.c (assuan_set_flag, assuan_get_flag): Support flag.
+
2007-07-04 Marcus Brinkmann <marcus at g10code.de>
Change _WIN32 to HAVE_W32_SYSTEM for consistency.
@@ -382,28 +576,63 @@
to silence gcc warning.
* assuan-inquire.c (assuan_inquire): Likewise.
-2005-08-19 Werner Koch <wk at g10code.com>
+2005-09-08 Marcus Brinkmann <marcus at g10code.com>
- * funopen.c, assuan-socket.c: Copied from libassuan CVS.
* assuan-pipe-connect.c (assuan_pipe_connect2): Add missing
declaration of PID.
2005-08-09 Werner Koch <wk at g10code.com>
- * README.1st: Adjusted to cope with changes done in upstream Assuan.
+ * mkerrors: Include config.h into assuan-errors.c. This is
+ required so that assuan.h knows about the W32 macro.
- Merged changes for W32 support from libassuan.
-
* assuan.h [_ASSUAN_EXT_SYM_PREFIX]: New.
* assuan-io.c [_ASSUAN_NO_PTH]: New.
* assuan-pipe-connect.c (fix_signals) [_ASSUAN_NO_FIXED_SIGNALS]: New.
(assuan_pipe_connect2) [_ASSUAN_USE_DOUBLE_FORK]: Use double fork.
(fix_signals) [_ASSUAN_USE_DOUBLE_FORK]: Do not wait..
- * assuan-logging.c, assuan-io.c: Include config.h
- Replaced all usages of _WIN32 by the new HAVE_W32_SYSTEM because
- there is nothing winning in this API.
- * assuan-pipe-connect.c (assuan_pipe_connect2) [_WIN32]: Return
- error Not Imlemented.
+
+2005-05-21 Werner Koch <wk at g10code.com>
+
+ * assuan-util.c (assuan_set_flag, assuan_get_flag): New.
+ * assuan-defs.h (struct assuan_context_s): New field flags.
+ * assuan.h (assuan_flag_t): New with one flag value
+ ASSUAN_NO_WAITPID for now.
+ * assuan-pipe-connect.c (do_finish): Take care of the no_waitpid
+ flag.
+
+2005-04-04 Werner Koch <wk at g10code.com>
+
+ * assuan-util.c (_assuan_calloc): Avoid integer overflow.
+
+2005-03-22 Werner Koch <wk at g10code.com>
+
+ * assuan-defs.h (struct assuan_io): Renamed elements READ and
+ WRITE to READFNC and WRITEFNC to avoid problems with read defined
+ as macros. Changed callers. Noted by Ville Skyttä.
+
+2005-02-24 Werner Koch <wk at g10code.com>
+
+ * assuan-client.c (assuan_transact): Handle empty and comment
+ commands correctly.
+
+2004-12-20 Werner Koch <wk at g10code.com>
+
+ * assuan-socket-connect.c (assuan_socket_connect) [W32]: Allow for
+ a drive letter in the path.
+
+2004-12-19 Werner Koch <wk at g10code.com>
+
+ * assuan-pipe-server.c (assuan_init_pipe_server) [W32]: Map file
+ descriptors using _get_osfhandle.
+
+2004-12-19 Moritz Schulte <moritz at g10code.com>
+
+ * assuan-pipe-connect.c (assuan_pipe_connect2): Removed "`"
+ character at beginning of line 532.
+
+2004-12-18 Werner Koch <wk at g10code.com>
+
* assuan-logging.c (_assuan_w32_strerror): New.
* assuan-defs.h (w32_strerror): new.
* assuan-pipe-connect.c (assuan_pipe_connect2, fix_signals):
@@ -411,58 +640,96 @@
(build_w32_commandline, create_inheritable_pipe): New. Taken
from gnupg 1.9.
(assuan_pipe_connect2) [W32]: Implemented for W32.
- * assuan-pipe-server.c (assuan_init_pipe_server) [W32]: Map file
- descriptors using _get_osfhandle.
- * assuan-socket-connect.c (assuan_socket_connect) [W32]: Allow for
- a drive letter in the path.
- * assuan-client.c (assuan_transact): Handle empty and comment
- commands correctly.
- * assuan-util.c (_assuan_calloc): Avoid integer overflow.
- * assuan-util.c (assuan_set_flag, assuan_get_flag): New.
- * assuan-defs.h (struct assuan_context_s): New field flags.
- * assuan.h (assuan_flag_t): New with one flag value
- ASSUAN_NO_WAITPID for now.
- * assuan-pipe-connect.c (do_finish): Take care of the no_waitpid
- flag.
- * mkerrors: Include config.h into assuan-errors.c. This is
- required so that assuan.h knows about the W32 macro.
-2005-08-09 Timo Schulz <twoaday at g10code.com> (ported from libassuan by wk)
+2004-12-14 Werner Koch <wk at g10code.com>
+
+ * assuan-socket-connect.c (assuan_socket_connect): Always allow
+ NAME to start with a froward slash.
+
+2004-12-07 Werner Koch <wk at g10code.com>
+
+ * assuan-logging.c, assuan-io.c: Include config.h
+
+ Replaced all usages of _WIN32 by the new HAVE_W32_SYSTEM because
+ there is nothing winning in this API.
+
+ * assuan-pipe-connect.c (assuan_pipe_connect2) [_WIN32]: Return
+ error Not Imlemented.
+
+2004-11-27 Werner Koch <wk at g10code.com>
+
+ * assuan-socket.c: Include sys/types.h. Noted by Michael
+ Nottebrock.
+
+2004-11-26 Werner Koch <wk at g10code.com>
+
+ * assuan-io.c [_WIN32]: Avoid warnings about unknown pragmas.
+
+2004-11-24 Werner Koch <wk at g10code.com>
+
+ * assuan-logging.c (_assuan_log_printf): New.
+ * assuan-domain-connect.c (LOG): Removed and replaced all callers
+ by _assuan_log_printf. This is needed for C89 and gcc 2.95 which
+ both don't have C99 style variable arg macros.
+ * assuan-pipe-connect.c (LOG): Ditto.
+ * assuan-socket-connect.c (LOG): Ditto.
+
+ * assuan-socket.c[!_WIN32]: Fixed includes.
+
+2004-11-23 Timo Schulz <twoaday at g10code.com>
+
+ * assuan-socket.c (_assuan_sock_connect): Get local port from
+ the sun_path[] file.
+ (_assuan_sock_bind): Write local port to the sun_path[] file.
+ * assuan-socket-connect.c (assuan_socket_connect): Use DIRSEP_C
+ for a better portability.
+ (assuan-defs.h): Define DIRSEP_C.
+2004-11-19 Werner Koch <wk at g10code.com>
+
+ * assuan-handler.c (assuan_write_status): Return an error code.
+
+2004-11-22 Timo Schulz <twoaday at g10code.com>
+
* assuan-io.c (_assuan_simple_read, _assuan_simple_write): W32
support.
* assuan-socket.c (_assuan_close): New.
(_assuan_sock_new): New.
(_assuan_sock_bind): New.
+
+2004-11-16 Werner Koch <wk at g10code.com>
-2005-03-22 Werner Koch <wk at g10code.com>
+ * assuan-socket-connect.c (LOG): Fixed macro to print not only the
+ prefix.
+ * assuan-domain-connect.c, assuan-socket-connect.c (LOG): Ditto.
- * assuan-defs.h (struct assuan_io): Renamed elements READ and
- WRITE to READFNC and WRITEFNC to avoid problems with read defined
- as macro. Changed callers. Noted by Ville Skyttä.
+2004-10-02 Werner Koch <wk at g10code.com>
-2004-12-16 Marcus Brinkmann <marcus at g10code.de>
+ * assuan-socket-connect.c: Define SUN_LEN, AF_LOCAL and PF_LOCAL
+ if they are not available.
+ * assuan-domain-connect.c: Define PF_LOCAL and AF_LOCAL if needed.
- * assuan-pipe-connect.c (do_finish): Do not wait for child to finish.
- (assuan_pipe_connect): Use double-fork approach.
- * assuan-connect.c (assuan_disconnect): Do not write BYE to the
- status line.
+2004-06-23 Marcus Brinkmann <marcus at g10code.de>
-2004-12-07 Marcus Brinkmann <marcus at g10code.de>
+ * assuan-domain-connect.c [HAVE_SYS_UIO_H]: Include <sys/uio.h>.
- * README.1st: Add copyright notice.
+2004-05-11 Werner Koch <wk at gnupg.org>
-2004-06-23 Marcus Brinkmann <marcus at g10code.de>
+ * assuan-listen.c (assuan_set_hello_line, assuan_accept): Allow
+ for multi line hello strings.
- * assuan-domain-connect.c [HAVE_SYS_UIO_H]: Include <sys/uio.h>.
+ * assuan-buffer.c (_assuan_write_line): New with parts of ..
+ (assuan_write_line): .. factored out.
- * assuan-handler.c: Include <errno.h>.
+2004-04-29 Werner Koch <wk at gnupg.org>
-2004-06-08 Marcus Brinkmann <marcus at g10code.de>
+ * assuan-socket-connect.c: Include string.h.
+ * assuan-logging.c: Ditto.
- * assuan-buffer.c (assuan_write_line): If the line is longer than
- the maximum line length, bail out early.
+2004-04-22 Marcus Brinkmann <marcus at g10code.de>
+ * libassuan.m4: Quote first argument to AC_DEFUN.
+
2004-04-21 Werner Koch <wk at gnupg.org>
* assuan-socket-server.c (accept_connection_bottom): Save the pid
@@ -1039,7 +1306,7 @@
* assuan-defs.h: Add space in the context for this.
- Copyright 2001, 2002, 2006 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2006, 2007 Free Software Foundation, Inc.
This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without
Modified: trunk/assuan/assuan-buffer.c
===================================================================
--- trunk/assuan/assuan-buffer.c 2009-02-24 15:13:01 UTC (rev 1357)
+++ trunk/assuan/assuan-buffer.c 2009-03-06 22:29:49 UTC (rev 1358)
@@ -14,9 +14,7 @@
* 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
+ * License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
@@ -53,9 +51,10 @@
return 0; /* okay */
}
-/* Read an entire line. Returns 0 on success or -1 and ERRNo on
+/* Read an entire line. Returns 0 on success or -1 and ERRNO on
failure. EOF is indictated by setting the integer at address
- R_EOF. */
+ R_EOF. Note: BUF, R_NREAD and R_EOF contain a valid result even if
+ an error is returned. */
static int
readline (assuan_context_t ctx, char *buf, size_t buflen,
int *r_nread, int *r_eof)
@@ -94,7 +93,7 @@
}
-/* Function returns an Assuan error. */
+/* Function returns an Assuan error. */
assuan_error_t
_assuan_read_line (assuan_context_t ctx)
{
@@ -134,11 +133,23 @@
&nread, &ctx->inbound.eof);
if (rc)
{
+ int saved_errno = errno;
+
if (ctx->log_fp)
- fprintf (ctx->log_fp, "%s[%u.%d] DBG: <- [Error: %s (%d)]\n",
- assuan_get_assuan_log_prefix (),
- (unsigned int)getpid (), ctx->inbound.fd,
- strerror (errno), errno);
+ fprintf (ctx->log_fp, "%s[%u.%d] DBG: <- [Error: %s]\n",
+ assuan_get_assuan_log_prefix (),
+ (unsigned int)getpid (), (int)ctx->inbound.fd,
+ strerror (errno));
+
+ if (saved_errno == EAGAIN)
+ {
+ /* We have to save a partial line. */
+ memcpy (ctx->inbound.attic.line, line, atticlen + nread);
+ ctx->inbound.attic.pending = 0;
+ ctx->inbound.attic.linelen = atticlen + nread;
+ }
+
+ errno = saved_errno;
return _assuan_error (ASSUAN_Read_Error);
}
if (!nread)
@@ -147,7 +158,7 @@
if (ctx->log_fp)
fprintf (ctx->log_fp, "%s[%u.%d] DBG: <- [EOF]\n",
assuan_get_assuan_log_prefix (),
- (unsigned int)getpid (), ctx->inbound.fd);
+ (unsigned int)getpid (), (int)ctx->inbound.fd);
return _assuan_error (-1);
}
@@ -191,7 +202,7 @@
{
fprintf (ctx->log_fp, "%s[%u.%d] DBG: <- ",
assuan_get_assuan_log_prefix (),
- (unsigned int)getpid (), ctx->inbound.fd);
+ (unsigned int)getpid (), (int)ctx->inbound.fd);
if (ctx->confidential)
fputs ("[Confidential data not shown]", ctx->log_fp);
else
@@ -207,7 +218,7 @@
if (ctx->log_fp)
fprintf (ctx->log_fp, "%s[%u.%d] DBG: <- [Invalid line]\n",
assuan_get_assuan_log_prefix (),
- (unsigned int)getpid (), ctx->inbound.fd);
+ (unsigned int)getpid (), (int)ctx->inbound.fd);
*line = 0;
ctx->inbound.linelen = 0;
return _assuan_error (ctx->inbound.eof
@@ -234,7 +245,12 @@
if (!ctx)
return _assuan_error (ASSUAN_Invalid_Value);
- err = _assuan_read_line (ctx);
+ do
+ {
+ err = _assuan_read_line (ctx);
+ }
+ while (_assuan_error_is_eagain (err));
+
*line = ctx->inbound.line;
*linelen = ctx->inbound.linelen;
return err;
@@ -265,7 +281,7 @@
fprintf (ctx->log_fp, "%s[%u.%d] DBG: -> "
"[supplied line too long -truncated]\n",
assuan_get_assuan_log_prefix (),
- (unsigned int)getpid (), ctx->inbound.fd);
+ (unsigned int)getpid (), (int)ctx->inbound.fd);
if (prefixlen > 5)
prefixlen = 5;
if (len > ASSUAN_LINELENGTH - prefixlen - 2)
@@ -281,7 +297,7 @@
{
fprintf (ctx->log_fp, "%s[%u.%d] DBG: -> ",
assuan_get_assuan_log_prefix (),
- (unsigned int)getpid (), ctx->inbound.fd);
+ (unsigned int)getpid (), (int)ctx->inbound.fd);
if (ctx->confidential)
fputs ("[Confidential data not shown]", ctx->log_fp);
else
@@ -333,7 +349,7 @@
fprintf (ctx->log_fp, "%s[%u.%d] DBG: -> "
"[supplied line contained a LF - truncated]\n",
assuan_get_assuan_log_prefix (),
- (unsigned int)getpid (), ctx->inbound.fd);
+ (unsigned int)getpid (), (int)ctx->inbound.fd);
return _assuan_write_line (ctx, NULL, line, len);
}
@@ -398,7 +414,7 @@
{
fprintf (ctx->log_fp, "%s[%u.%d] DBG: -> ",
assuan_get_assuan_log_prefix (),
- (unsigned int)getpid (), ctx->inbound.fd);
+ (unsigned int)getpid (), (int)ctx->inbound.fd);
if (ctx->confidential)
fputs ("[Confidential data not shown]", ctx->log_fp);
@@ -454,7 +470,7 @@
{
fprintf (ctx->log_fp, "%s[%u.%d] DBG: -> ",
assuan_get_assuan_log_prefix (),
- (unsigned int)getpid (), ctx->inbound.fd);
+ (unsigned int)getpid (), (int)ctx->inbound.fd);
if (ctx->confidential)
fputs ("[Confidential data not shown]", ctx->log_fp);
else
@@ -524,11 +540,11 @@
}
assuan_error_t
-assuan_sendfd (assuan_context_t ctx, int fd)
+assuan_sendfd (assuan_context_t ctx, assuan_fd_t fd)
{
/* It is explicitly allowed to use (NULL, -1) as a runtime test to
check whether descriptor passing is available. */
- if (!ctx && fd == -1)
+ if (!ctx && fd == ASSUAN_INVALID_FD)
#ifdef USE_DESCRIPTOR_PASSING
return 0;
#else
@@ -543,7 +559,7 @@
}
assuan_error_t
-assuan_receivefd (assuan_context_t ctx, int *fd)
+assuan_receivefd (assuan_context_t ctx, assuan_fd_t *fd)
{
if (! ctx->io->receivefd)
return set_error (ctx, Not_Implemented,
Modified: trunk/assuan/assuan-client.c
===================================================================
--- trunk/assuan/assuan-client.c 2009-02-24 15:13:01 UTC (rev 1357)
+++ trunk/assuan/assuan-client.c 2009-03-06 22:29:49 UTC (rev 1358)
@@ -14,9 +14,7 @@
* 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
+ * License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
@@ -44,7 +42,11 @@
*off = 0;
do
{
- rc = _assuan_read_line (ctx);
+ do
+ {
+ rc = _assuan_read_line (ctx);
+ }
+ while (_assuan_error_is_eagain (rc));
if (rc)
return rc;
line = ctx->inbound.line;
Modified: trunk/assuan/assuan-connect.c
===================================================================
--- trunk/assuan/assuan-connect.c 2009-02-24 15:13:01 UTC (rev 1357)
+++ trunk/assuan/assuan-connect.c 2009-03-06 22:29:49 UTC (rev 1358)
@@ -14,9 +14,7 @@
* 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
+ * License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
@@ -60,8 +58,8 @@
#ifndef HAVE_W32_SYSTEM
-/* Return user credentials. PID, UID and GID amy be gived as NULL if
- you are not interested in this value. For getting the pid of the
+/* Return user credentials. PID, UID and GID may be given as NULL if
+ you are not interested in a value. For getting the pid of the
peer the assuan_get_pid is usually better suited. */
assuan_error_t
assuan_get_peercred (assuan_context_t ctx, pid_t *pid, uid_t *uid, gid_t *gid)
Modified: trunk/assuan/assuan-defs.h
===================================================================
--- trunk/assuan/assuan-defs.h 2009-02-24 15:13:01 UTC (rev 1357)
+++ trunk/assuan/assuan-defs.h 2009-03-06 22:29:49 UTC (rev 1358)
@@ -1,5 +1,5 @@
/* assuan-defs.c - Internal definitions to Assuan
- * Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2002, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
*
* This file is part of Assuan.
*
@@ -40,17 +40,6 @@
#endif
#ifdef HAVE_W32_SYSTEM
-#define AF_LOCAL AF_UNIX
-/* We need to prefix the structure with a sockaddr_in header so we can
- use it later for sendto and recvfrom. */
-struct sockaddr_un
-{
- short sun_family;
- unsigned short sun_port;
- struct in_addr sun_addr;
- char sun_path[108-2-4]; /* Path name. */
-};
-
/* Not needed anymore because the current mingw32 defines this in
sys/types.h */
/* typedef int ssize_t; */
@@ -80,12 +69,16 @@
/* Routine to write to output_fd. */
ssize_t (*writefnc) (assuan_context_t, const void *, size_t);
/* Send a file descriptor. */
- assuan_error_t (*sendfd) (assuan_context_t, int);
+ assuan_error_t (*sendfd) (assuan_context_t, assuan_fd_t);
/* Receive a file descriptor. */
- assuan_error_t (*receivefd) (assuan_context_t, int *);
+ assuan_error_t (*receivefd) (assuan_context_t, assuan_fd_t *);
};
+/* The global variable with the optional hook fucntions. */
+extern struct assuan_io_hooks _assuan_io_hooks;
+
+
/* The context we use with most functions. */
struct assuan_context_s
{
@@ -103,6 +96,14 @@
int confidential;
int is_server; /* Set if this is context belongs to a server */
int in_inquire;
+ int in_process_next;
+ int in_command;
+
+ /* The following members are used by assuan_inquire_ext. */
+ int (*inquire_cb) (void *cb_data, int rc, unsigned char *buf, size_t len);
+ void *inquire_cb_data;
+ void *inquire_membuf;
+
char *hello_line;
char *okay_line; /* See assuan_set_okay_line() */
@@ -111,7 +112,7 @@
FILE *log_fp;
struct {
- int fd;
+ assuan_fd_t fd;
int eof;
char line[LINELENGTH];
int linelen; /* w/o CR, LF - might not be the same as
@@ -125,7 +126,7 @@
} inbound;
struct {
- int fd;
+ assuan_fd_t fd;
struct {
FILE *fp;
char line[LINELENGTH];
@@ -137,8 +138,10 @@
int pipe_mode; /* We are in pipe mode, i.e. we can handle just one
connection and must terminate then. */
pid_t pid; /* The pid of the peer. */
- int listen_fd; /* The fd we are listening on (used by socket servers) */
- int connected_fd; /* helper */
+ assuan_fd_t listen_fd; /* The fd we are listening on (used by
+ socket servers) */
+ assuan_sock_nonce_t listen_nonce; /* Used with LISTEN_FD. */
+ assuan_fd_t connected_fd; /* helper */
struct {
int valid; /* Whether this structure has valid information. */
@@ -162,7 +165,7 @@
int bufferoffset; /* Offset of start of buffer. */
int buffersize; /* Bytes buffered. */
- int pendingfds[5]; /* Array to save received descriptors. */
+ assuan_fd_t pendingfds[5]; /* Array to save received descriptors. */
int pendingfdscount; /* Number of received descriptors. */
} uds;
@@ -188,15 +191,15 @@
/* If set, this is called right before logging an I/O line. With
DIRECTION set to 1 it is called for an output oeration; 0 means
an input operation. If bit 0 is set in the return value, the
- logging of the will be suppressed. With bit 1 set, the entire
- line will be ignored. */
+ logging of the line will be suppressed. With bit 1 set, the
+ entire line will be ignored. */
unsigned int (*io_monitor)(assuan_context_t ctx,
int direction,
const char *line,
size_t linelen);
- int input_fd; /* set by INPUT command */
- int output_fd; /* set by OUTPUT command */
+ assuan_fd_t input_fd; /* Set by the INPUT command. */
+ assuan_fd_t output_fd; /* Set by the OUTPUT command. */
/* io routines. */
struct assuan_io *io;
@@ -228,17 +231,22 @@
/*-- assuan-error.c --*/
+/*-- assuan-inquire.c --*/
+int _assuan_inquire_ext_cb (assuan_context_t ctx);
+void _assuan_inquire_release (assuan_context_t ctx);
-/* Map error codes as used in this implementaion to the libgpg-error
+/* Map error codes as used in this implementation to the libgpg-error
codes. */
assuan_error_t _assuan_error (int oldcode);
+/* Check if ERR means EAGAIN. */
+int _assuan_error_is_eagain (assuan_error_t err);
-/* Extrac the erro code from A. This works for both the old and the
- new style error codes. This needs to be whenever an error code is
- compared. */
+/* Extract the error code from A. This works for both the old and the
+ new style error codes. This needs to be used whenever an error
+ code is compared. */
#define err_code(a) ((a) & 0x00ffffff)
-/* Check whether A is the erro code for EOF. We allow forold and new
+/* Check whether A is the erro code for EOF. We allow for old and new
style EOF error codes here. */
#define err_is_eof(a) ((a) == (-1) || err_code (a) == 16383)
@@ -284,6 +292,8 @@
ssize_t _assuan_simple_read (assuan_context_t ctx, void *buffer, size_t size);
ssize_t _assuan_simple_write (assuan_context_t ctx, const void *buffer,
size_t size);
+ssize_t _assuan_io_read (assuan_fd_t fd, void *buffer, size_t size);
+ssize_t _assuan_io_write (assuan_fd_t fd, const void *buffer, size_t size);
#ifdef HAVE_W32_SYSTEM
int _assuan_simple_sendmsg (assuan_context_t ctx, void *msg);
int _assuan_simple_recvmsg (assuan_context_t ctx, void *msg);
@@ -292,11 +302,21 @@
ssize_t _assuan_simple_recvmsg (assuan_context_t ctx, struct msghdr *msg);
#endif
+void _assuan_usleep (unsigned int usec);
+
+
/*-- assuan-socket.c --*/
-int _assuan_close (int fd);
-int _assuan_sock_new (int domain, int type, int proto);
-int _assuan_sock_bind (int sockfd, struct sockaddr *addr, int addrlen);
-int _assuan_sock_connect (int sockfd, struct sockaddr *addr, int addrlen);
+int _assuan_close (assuan_fd_t fd);
+assuan_fd_t _assuan_sock_new (int domain, int type, int proto);
+int _assuan_sock_connect (assuan_fd_t sockfd,
+ struct sockaddr *addr, int addrlen);
+int _assuan_sock_bind (assuan_fd_t sockfd, struct sockaddr *addr, int addrlen);
+int _assuan_sock_get_nonce (struct sockaddr *addr, int addrlen,
+ assuan_sock_nonce_t *nonce);
+int _assuan_sock_check_nonce (assuan_fd_t fd, assuan_sock_nonce_t *nonce);
+#ifdef HAVE_W32_SYSTEM
+int _assuan_sock_wsa2errno (int err);
+#endif
#ifdef HAVE_FOPENCOOKIE
/* We have to implement funopen in terms of glibc's fopencookie. */
@@ -329,4 +349,13 @@
#define DIMof(type,member) DIM(((type *)0)->member)
+#if HAVE_W32_SYSTEM
+#define SOCKET2HANDLE(s) ((void *)(s))
+#define HANDLE2SOCKET(h) ((unsigned int)(h))
+#else
+#define SOCKET2HANDLE(s) (s)
+#define HANDLE2SOCKET(h) (h)
+#endif
+
+
#endif /*ASSUAN_DEFS_H*/
Modified: trunk/assuan/assuan-handler.c
===================================================================
--- trunk/assuan/assuan-handler.c 2009-02-24 15:13:01 UTC (rev 1357)
+++ trunk/assuan/assuan-handler.c 2009-03-06 22:29:49 UTC (rev 1358)
@@ -1,5 +1,5 @@
/* assuan-handler.c - dispatch commands
- * Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
*
* This file is part of Assuan.
*
@@ -14,9 +14,7 @@
* 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
+ * License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
@@ -35,18 +33,21 @@
static int my_strcasecmp (const char *a, const char *b);
+#define PROCESS_DONE(ctx, rc) \
+ ((ctx)->in_process_next ? assuan_process_done ((ctx), (rc)) : (rc))
static int
dummy_handler (assuan_context_t ctx, char *line)
{
- return set_error (ctx, Server_Fault, "no handler registered");
+ return
+ PROCESS_DONE (ctx, set_error (ctx, Server_Fault, "no handler registered"));
}
static int
std_handler_nop (assuan_context_t ctx, char *line)
{
- return 0; /* okay */
+ return PROCESS_DONE (ctx, 0); /* okay */
}
static int
@@ -54,7 +55,7 @@
{
if (ctx->cancel_notify_fnc)
ctx->cancel_notify_fnc (ctx);
- return set_error (ctx, Not_Implemented, NULL);
+ return PROCESS_DONE (ctx, set_error (ctx, Not_Implemented, NULL));
}
static int
@@ -65,9 +66,12 @@
for (key=line; spacep (key); key++)
;
if (!*key)
- return set_error (ctx, Syntax_Error, "argument required");
+ return
+ PROCESS_DONE (ctx, set_error (ctx, Syntax_Error, "argument required"));
if (*key == '=')
- return set_error (ctx, Syntax_Error, "no option name given");
+ return
+ PROCESS_DONE (ctx, set_error (ctx, Syntax_Error,
+ "no option name given"));
for (value=key; *value && !spacep (value) && *value != '='; value++)
;
if (*value)
@@ -82,7 +86,9 @@
for (; spacep (value); value++)
;
if (!*value)
- return set_error (ctx, Syntax_Error, "option argument expected");
+ return
+ PROCESS_DONE (ctx, set_error (ctx, Syntax_Error,
+ "option argument expected"));
}
if (*value)
{
@@ -96,12 +102,13 @@
if (*key == '-' && key[1] == '-' && key[2])
key += 2; /* the double dashes are optional */
if (*key == '-')
- return set_error (ctx, Syntax_Error,
- "option should not begin with one dash");
+ return PROCESS_DONE (ctx,
+ set_error (ctx, Syntax_Error,
+ "option should not begin with one dash"));
if (ctx->option_handler_fnc)
- return ctx->option_handler_fnc (ctx, key, value);
- return 0;
+ return PROCESS_DONE (ctx, ctx->option_handler_fnc (ctx, key, value));
+ return PROCESS_DONE (ctx, 0);
}
static int
@@ -111,13 +118,13 @@
ctx->bye_notify_fnc (ctx);
assuan_close_input_fd (ctx);
assuan_close_output_fd (ctx);
- return -1; /* pretty simple :-) */
+ return PROCESS_DONE (ctx, _assuan_error (-1)); /* pretty simple :-) */
}
static int
std_handler_auth (assuan_context_t ctx, char *line)
{
- return set_error (ctx, Not_Implemented, NULL);
+ return PROCESS_DONE (ctx, set_error (ctx, Not_Implemented, NULL));
}
static int
@@ -128,17 +135,35 @@
assuan_close_input_fd (ctx);
assuan_close_output_fd (ctx);
_assuan_uds_close_fds (ctx);
- return 0;
+ return PROCESS_DONE (ctx, 0);
}
static int
+std_handler_help (assuan_context_t ctx, char *line)
+{
+ unsigned int i;
+ char buf[ASSUAN_LINELENGTH];
+
+ for (i = 0; i < ctx->cmdtbl_used; i++)
+ {
+ snprintf (buf, sizeof (buf), "# %s", ctx->cmdtbl[i].name);
+ buf[ASSUAN_LINELENGTH - 1] = '\0';
+ assuan_write_line (ctx, buf);
+ }
+
+ return PROCESS_DONE (ctx, 0);
+}
+
+
+static int
std_handler_end (assuan_context_t ctx, char *line)
{
- return set_error (ctx, Not_Implemented, NULL);
+ return PROCESS_DONE (ctx, set_error (ctx, Not_Implemented, NULL));
}
+
assuan_error_t
-assuan_command_parse_fd (assuan_context_t ctx, char *line, int *rfd)
+assuan_command_parse_fd (assuan_context_t ctx, char *line, assuan_fd_t *rfd)
{
char *endp;
@@ -151,7 +176,13 @@
line ++;
if (!digitp (*line))
return set_error (ctx, Syntax_Error, "number required");
+#ifdef HAVE_W32_SYSTEM
+ /* Fixme: For a W32/64bit system we will need to change the cast
+ and the conversion fucntion. */
+ *rfd = (void*)strtoul (line, &endp, 10);
+#else
*rfd = strtoul (line, &endp, 10);
+#endif
/* Remove that argument so that a notify handler won't see it. */
memset (line, ' ', endp? (endp-line):strlen(line));
@@ -166,34 +197,37 @@
return assuan_receivefd (ctx, rfd);
}
+
/* Format is INPUT FD=<n> */
static int
std_handler_input (assuan_context_t ctx, char *line)
{
- int rc, fd;
+ int rc;
+ assuan_fd_t fd;
rc = assuan_command_parse_fd (ctx, line, &fd);
if (rc)
- return rc;
+ return PROCESS_DONE (ctx, rc);
ctx->input_fd = fd;
if (ctx->input_notify_fnc)
ctx->input_notify_fnc (ctx, line);
- return 0;
+ return PROCESS_DONE (ctx, 0);
}
/* Format is OUTPUT FD=<n> */
static int
std_handler_output (assuan_context_t ctx, char *line)
{
- int rc, fd;
+ int rc;
+ assuan_fd_t fd;
rc = assuan_command_parse_fd (ctx, line, &fd);
if (rc)
- return rc;
+ return PROCESS_DONE (ctx, rc);
ctx->output_fd = fd;
if (ctx->output_notify_fnc)
ctx->output_notify_fnc (ctx, line);
- return 0;
+ return PROCESS_DONE (ctx, 0);
}
@@ -215,11 +249,12 @@
{ "AUTH", std_handler_auth, 1 },
{ "RESET", std_handler_reset, 1 },
{ "END", std_handler_end, 1 },
+ { "HELP", std_handler_help, 1 },
- { "INPUT", std_handler_input },
- { "OUTPUT", std_handler_output },
+ { "INPUT", std_handler_input, 0 },
+ { "OUTPUT", std_handler_output, 0 },
{ "OPTION", std_handler_option, 1 },
- { NULL }
+ { NULL, NULL, 0 }
};
@@ -406,9 +441,10 @@
return *a == *b? 0 : (((*a >= 'a' && *a <= 'z')? (*a&~0x20):*a) - *b);
}
+
/* Parse the line, break out the command, find it in the command
table, remove leading and white spaces from the arguments, call the
- handler with the argument line and return the error */
+ handler with the argument line and return the error. */
static int
dispatch_command (assuan_context_t ctx, char *line, int linelen)
{
@@ -416,13 +452,21 @@
const char *s;
int shift, i;
+ /* Note that as this function is invoked by assuan_process_next as
+ well, we need to hide non-critical errors with PROCESS_DONE. */
+
if (*line == 'D' && line[1] == ' ') /* divert to special handler */
- return handle_data_line (ctx, line+2, linelen-2);
+ /* FIXME: Depending on the final implementation of
+ handle_data_line, this may be wrong here. For example, if a
+ user callback is invoked, and that callback is responsible for
+ calling assuan_process_done, then this is wrong. */
+ return PROCESS_DONE (ctx, handle_data_line (ctx, line+2, linelen-2));
for (p=line; *p && *p != ' ' && *p != '\t'; p++)
;
if (p==line)
- return set_error (ctx, Syntax_Error, "leading white-space");
+ return PROCESS_DONE
+ (ctx, set_error (ctx, Syntax_Error, "leading white-space"));
if (*p)
{ /* Skip over leading WS after the keyword */
*p++ = 0;
@@ -445,7 +489,7 @@
}
}
if (!s)
- return set_error (ctx, Unknown_Command, NULL);
+ return PROCESS_DONE (ctx, set_error (ctx, Unknown_Command, NULL));
line += shift;
linelen -= shift;
@@ -453,42 +497,34 @@
return ctx->cmdtbl[i].handler (ctx, line);
}
-
-
-static int
-process_request (assuan_context_t ctx)
+/* Call this to acknowledge the current command. */
+int
+assuan_process_done (assuan_context_t ctx, int rc)
{
- int rc;
+ if (!ctx->in_command)
+ return _assuan_error (ASSUAN_General_Error);
- if (ctx->in_inquire)
- return _assuan_error (ASSUAN_Nested_Commands);
+ ctx->in_command = 0;
- rc = _assuan_read_line (ctx);
- if (rc)
- return rc;
- if (*ctx->inbound.line == '#' || !ctx->inbound.linelen)
- return 0; /* comment line - ignore */
-
- 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 */
+ /* Check for data write errors. */
if (ctx->outbound.data.fp)
- { /* Flush the data lines */
+ {
+ /* 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;
+ rc = ctx->outbound.data.error;
}
- else /* flush any data send w/o using the data fp */
+ else
{
+ /* Flush any data send without using the data FP. */
assuan_send_data (ctx, NULL, 0);
if (!rc && ctx->outbound.data.error)
- rc = ctx->outbound.data.error;
+ rc = ctx->outbound.data.error;
}
- /* Error handling */
+
+ /* Error handling. */
if (!rc)
{
rc = assuan_write_line (ctx, ctx->okay_line? ctx->okay_line : "OK");
@@ -501,26 +537,26 @@
else
{
char errline[300];
-
+
if (rc < 100)
sprintf (errline, "ERR %d server fault (%.50s)",
_assuan_error (ASSUAN_Server_Fault), assuan_strerror (rc));
else
{
const char *text = ctx->err_no == rc? ctx->err_str:NULL;
-
+
#if defined(HAVE_W32_SYSTEM)
unsigned int source, code;
char ebuf[50];
const char *esrc;
-
+
source = ((rc >> 24) & 0xff);
code = (rc & 0x00ffffff);
if (source
&& !_assuan_gpg_strerror_r (rc, ebuf, sizeof ebuf)
&& (esrc=_assuan_gpg_strsource (rc)))
{
- /* Assume this is an libgpg-error. */
+ /* Assume this is an libgpg-error. */
sprintf (errline, "ERR %d %.50s <%.30s>%s%.100s",
rc, ebuf, esrc,
text? " - ":"", text?text:"");
@@ -554,7 +590,7 @@
{
/* Assume this is an libgpg-error. */
char ebuf[50];
-
+
gpg_strerror_r (rc, ebuf, sizeof ebuf );
sprintf (errline, "ERR %d %.50s <%.30s>%s%.100s",
rc,
@@ -569,19 +605,123 @@
}
rc = assuan_write_line (ctx, errline);
}
-
+
if (ctx->post_cmd_notify_fnc)
ctx->post_cmd_notify_fnc (ctx, rc);
-
+
ctx->confidential = 0;
if (ctx->okay_line)
{
xfree (ctx->okay_line);
ctx->okay_line = NULL;
}
+
return rc;
}
+
+static int
+process_next (assuan_context_t ctx)
+{
+ int rc;
+
+ /* What the next thing to do is depends on the current state.
+ However, we will always first read the next line. The client is
+ required to write full lines without blocking long after starting
+ a partial line. */
+ rc = _assuan_read_line (ctx);
+ if (_assuan_error_is_eagain (rc))
+ return 0;
+ if (rc)
+ return rc;
+ if (*ctx->inbound.line == '#' || !ctx->inbound.linelen)
+ /* Comment lines are ignored. */
+ return 0;
+
+ /* Now we have a line that really means something. It could be one
+ of the following things: First, if we are not in a command
+ already, it is the next command to dispatch. Second, if we are
+ in a command, it can only be the response to an INQUIRE
+ reply. */
+
+ if (!ctx->in_command)
+ {
+ ctx->in_command = 1;
+
+ ctx->outbound.data.error = 0;
+ ctx->outbound.data.linelen = 0;
+ /* Dispatch command and return reply. */
+ ctx->in_process_next = 1;
+ rc = dispatch_command (ctx, ctx->inbound.line, ctx->inbound.linelen);
+ ctx->in_process_next = 0;
+ }
+ else if (ctx->in_inquire)
+ {
+ /* FIXME: Pick up the continuation. */
+ rc = _assuan_inquire_ext_cb (ctx);
+ }
+ else
+ {
+ /* Should not happen. The client is sending data while we are
+ in a command and not waiting for an inquire. We log an error
+ and discard it. */
+ _assuan_log_printf ("unexpected client data\n");
+ rc = 0;
+ }
+
+ return rc;
+}
+
+
+/* This function should be invoked when the assuan connected FD is
+ ready for reading. If the equivalent to EWOULDBLOCK is returned
+ (this should be done by the command handler), assuan_process_next
+ should be invoked the next time the connected FD is readable.
+ Eventually, the caller will finish by invoking
+ assuan_process_done. */
+int
+assuan_process_next (assuan_context_t ctx)
+{
+ int rc;
+
+ do
+ {
+ rc = process_next (ctx);
+ }
+ while (!rc && assuan_pending_line (ctx));
+
+ return rc;
+}
+
+
+
+static int
+process_request (assuan_context_t ctx)
+{
+ int rc;
+
+ if (ctx->in_inquire)
+ return _assuan_error (ASSUAN_Nested_Commands);
+
+ do
+ {
+ rc = _assuan_read_line (ctx);
+ }
+ while (_assuan_error_is_eagain (rc));
+ if (rc)
+ return rc;
+ if (*ctx->inbound.line == '#' || !ctx->inbound.linelen)
+ return 0; /* comment line - ignore */
+
+ ctx->in_command = 1;
+ 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);
+
+ return assuan_process_done (ctx, rc);
+}
+
/**
* assuan_process:
* @ctx: assuan context
@@ -610,24 +750,6 @@
/**
- * assuan_process_next:
- * @ctx: Assuan context
- *
- * Same as assuan_process() but the user has to provide the outer
- * loop. He should loop as long as the return code is zero and stop
- * otherwise; -1 is regular end.
- *
- * See also: assuan_get_active_fds()
- * Return value: -1 for end of server, 0 on success or an error code
- **/
-int
-assuan_process_next (assuan_context_t ctx)
-{
- return process_request (ctx);
-}
-
-
-/**
* assuan_get_active_fds:
* @ctx: Assuan context
* @what: 0 for read fds, 1 for write fds
@@ -646,7 +768,7 @@
**/
int
assuan_get_active_fds (assuan_context_t ctx, int what,
- int *fdarray, int fdarraysize)
+ assuan_fd_t *fdarray, int fdarraysize)
{
int n = 0;
@@ -655,16 +777,16 @@
if (!what)
{
- if (ctx->inbound.fd != -1)
+ if (ctx->inbound.fd != ASSUAN_INVALID_FD)
fdarray[n++] = ctx->inbound.fd;
}
else
{
- if (ctx->outbound.fd != -1)
+ if (ctx->outbound.fd != ASSUAN_INVALID_FD)
fdarray[n++] = ctx->outbound.fd;
if (ctx->outbound.data.fp)
#ifdef HAVE_W32_SYSTEM
- fdarray[n++] = _get_osfhandle (fileno (ctx->outbound.data.fp));
+ fdarray[n++] = (void*)_get_osfhandle (fileno (ctx->outbound.data.fp));
#else
fdarray[n++] = fileno (ctx->outbound.data.fp);
#endif
Modified: trunk/assuan/assuan-inquire.c
===================================================================
--- trunk/assuan/assuan-inquire.c 2009-02-24 15:13:01 UTC (rev 1357)
+++ trunk/assuan/assuan-inquire.c 2009-03-06 22:29:49 UTC (rev 1358)
@@ -1,5 +1,5 @@
/* assuan-inquire.c - handle inquire stuff
- * Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
*
* This file is part of Assuan.
*
@@ -14,9 +14,7 @@
* 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
+ * License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
@@ -44,7 +42,7 @@
-/* A simple implemnation of a dynamic buffer. Use init_membuf() to
+/* A simple implementation of a dynamic buffer. Use init_membuf() to
create a buffer, put_membuf to append bytes and get_membuf to
release and return the buffer. Allocation errors are detected but
only returned at the final get_membuf(), this helps not to clutter
@@ -171,7 +169,9 @@
{
do
{
- rc = _assuan_read_line (ctx);
+ do
+ rc = _assuan_read_line (ctx);
+ while (_assuan_error_is_eagain (rc));
if (rc)
goto leave;
line = (unsigned char *) ctx->inbound.line;
@@ -234,8 +234,154 @@
return rc;
}
+
+void
+_assuan_inquire_release (assuan_context_t ctx)
+{
+ if (ctx->in_inquire)
+ {
+ if (ctx->inquire_membuf)
+ {
+ free_membuf (ctx->inquire_membuf);
+ free (ctx->inquire_membuf);
+ }
+ ctx->in_inquire = 0;
+ }
+}
+int
+_assuan_inquire_ext_cb (assuan_context_t ctx)
+{
+ int rc;
+ unsigned char *line;
+ int linelen;
+ struct membuf *mb;
+ unsigned char *p;
+ line = (unsigned char *) ctx->inbound.line;
+ linelen = ctx->inbound.linelen;
+ mb = ctx->inquire_membuf;
+ if (line[0] == 'C' && line[1] == 'A' && line[2] == 'N')
+ {
+ rc = _assuan_error (ASSUAN_Canceled);
+ goto leave;
+ }
+ if (line[0] == 'E' && line[1] == 'N' && line[2] == 'D'
+ && (!line[3] || line[3] == ' '))
+ {
+ rc = 0;
+ goto leave;
+ }
+ if (line[0] != 'D' || line[1] != ' ' || mb == NULL)
+ {
+ rc = _assuan_error (ASSUAN_Unexpected_Command);
+ goto leave;
+ }
+
+ if (linelen < 3)
+ return 0;
+ line += 2;
+ linelen -= 2;
+
+ p = line;
+ while (linelen)
+ {
+ for (;linelen && *p != '%'; linelen--, p++)
+ ;
+ put_membuf (mb, line, p-line);
+ if (linelen > 2)
+ { /* handle escaping */
+ unsigned char tmp[1];
+ p++;
+ *tmp = xtoi_2 (p);
+ p += 2;
+ linelen -= 3;
+ put_membuf (mb, tmp, 1);
+ }
+ line = p;
+ }
+ if (mb->too_large)
+ {
+ rc = _assuan_error (ASSUAN_Too_Much_Data);
+ goto leave;
+ }
+
+ return 0;
+
+ leave:
+ {
+ size_t buf_len = 0;
+ unsigned char *buf = NULL;
+
+ if (mb)
+ {
+ buf = get_membuf (mb, &buf_len);
+ if (!buf)
+ rc = _assuan_error (ASSUAN_Out_Of_Core);
+ free_membuf (mb);
+ free (mb);
+ ctx->inquire_membuf = NULL;
+ }
+ ctx->in_inquire = 0;
+ rc = (ctx->inquire_cb) (ctx->inquire_cb_data, rc, buf, buf_len);
+ }
+ return rc;
+}
+
+/**
+ * assuan_inquire_ext:
+ * @ctx: An assuan context
+ * @keyword: The keyword used for the inquire
+ * @maxlen: If not 0, the size limit of the inquired data.
+ * @cb: A callback handler which is invoked after the operation completed.
+ * @cb_data: A user-provided value passed to the callback handler.
+ *
+ * A Server may use this to Send an inquire. r_buffer, r_length and
+ * maxlen may all be NULL/0 to indicate that no real data is expected.
+ * When this function returns,
+ *
+ * Return value: 0 on success or an ASSUAN error code
+ **/
+assuan_error_t
+assuan_inquire_ext (assuan_context_t ctx, const char *keyword, size_t maxlen,
+ int (*cb) (void *cb_data, int rc, unsigned char *buf,
+ size_t len),
+ void *cb_data)
+{
+ assuan_error_t rc;
+ struct membuf *mb = NULL;
+ char cmdbuf[LINELENGTH-10]; /* (10 = strlen ("INQUIRE ")+CR,LF) */
+
+ if (!ctx || !keyword || (10 + strlen (keyword) >= sizeof (cmdbuf)))
+ return _assuan_error (ASSUAN_Invalid_Value);
+ if (!ctx->is_server)
+ return _assuan_error (ASSUAN_Not_A_Server);
+ if (ctx->in_inquire)
+ return _assuan_error (ASSUAN_Nested_Commands);
+
+ mb = malloc (sizeof (struct membuf));
+ if (!mb)
+ return _assuan_error (ASSUAN_Out_Of_Core);
+ init_membuf (mb, maxlen ? maxlen : 1024, maxlen);
+
+ strcpy (stpcpy (cmdbuf, "INQUIRE "), keyword);
+ rc = assuan_write_line (ctx, cmdbuf);
+ if (rc)
+ {
+ free_membuf (mb);
+ free (mb);
+ return rc;
+ }
+
+ ctx->in_inquire = 1;
+
+ /* Set up the continuation. */
+ ctx->inquire_cb = cb;
+ ctx->inquire_cb_data = cb_data;
+ ctx->inquire_membuf = mb;
+
+ return 0;
+}
Modified: trunk/assuan/assuan-io.c
===================================================================
--- trunk/assuan/assuan-io.c 2009-02-24 15:13:01 UTC (rev 1357)
+++ trunk/assuan/assuan-io.c 2009-03-06 22:29:49 UTC (rev 1358)
@@ -1,5 +1,5 @@
/* assuan-io.c - Wraps the read and write functions.
- * Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc.
+ * Copyright (C) 2002, 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
*
* This file is part of Assuan.
*
@@ -14,15 +14,14 @@
* 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
+ * License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
+#include <time.h>
#include <sys/time.h>
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
@@ -48,8 +47,8 @@
#endif
-ssize_t
-_assuan_simple_read (assuan_context_t ctx, void *buffer, size_t size)
+static ssize_t
+do_io_read (assuan_fd_t fd, void *buffer, size_t size)
{
#if defined(HAVE_W32_SYSTEM) && !defined(_ASSUAN_IN_GPGME_BUILD_ASSUAN)
/* Due to the peculiarities of the W32 API we can't use read for a
@@ -57,45 +56,84 @@
read if recv detects that it is not a network socket. */
int n;
- n = recv (ctx->inbound.fd, buffer, size, 0);
- if (n == -1 && WSAGetLastError () == WSAENOTSOCK)
+ n = recv (HANDLE2SOCKET(fd), buffer, size, 0);
+ if (n == -1)
{
- DWORD nread = 0;
-
- n = ReadFile ((HANDLE)ctx->inbound.fd, buffer, size, &nread, NULL);
- if (!n)
+ switch (WSAGetLastError ())
{
- switch (GetLastError())
- {
- case ERROR_BROKEN_PIPE: errno = EPIPE; break;
- default: errno = EIO;
- }
- n = -1;
+ case WSAENOTSOCK:
+ {
+ DWORD nread = 0;
+
+ n = ReadFile (fd, buffer, size, &nread, NULL);
+ if (!n)
+ {
+ switch (GetLastError())
+ {
+ case ERROR_BROKEN_PIPE: errno = EPIPE; break;
+ default: errno = EIO;
+ }
+ n = -1;
+ }
+ else
+ n = (int)nread;
+ }
+ break;
+
+ case WSAEWOULDBLOCK: errno = EAGAIN; break;
+ case ERROR_BROKEN_PIPE: errno = EPIPE; break;
+ default: errno = EIO; break;
}
- else
- n = (int)nread;
}
return n;
#else /*!HAVE_W32_SYSTEM*/
- return read (ctx->inbound.fd, buffer, size);
+ return read (fd, buffer, size);
#endif /*!HAVE_W32_SYSTEM*/
}
+
ssize_t
-_assuan_simple_write (assuan_context_t ctx, const void *buffer, size_t size)
+_assuan_io_read (assuan_fd_t fd, void *buffer, size_t size)
{
+ ssize_t retval;
+
+ if (_assuan_io_hooks.read_hook
+ && _assuan_io_hooks.read_hook (NULL, fd, buffer, size, &retval) == 1)
+ return retval;
+
+ return do_io_read (fd, buffer, size);
+}
+
+ssize_t
+_assuan_simple_read (assuan_context_t ctx, void *buffer, size_t size)
+{
+ ssize_t retval;
+
+ if (_assuan_io_hooks.read_hook
+ && _assuan_io_hooks.read_hook (ctx, ctx->inbound.fd,
+ buffer, size, &retval) == 1)
+ return retval;
+
+ return do_io_read (ctx->inbound.fd, buffer, size);
+}
+
+
+
+static ssize_t
+do_io_write (assuan_fd_t fd, const void *buffer, size_t size)
+{
#if defined(HAVE_W32_SYSTEM) && !defined(_ASSUAN_IN_GPGME_BUILD_ASSUAN)
/* Due to the peculiarities of the W32 API we can't use write for a
network socket and thus we try to use send first and fallback to
write if send detects that it is not a network socket. */
int n;
- n = send (ctx->outbound.fd, buffer, size, 0);
+ n = send (HANDLE2SOCKET(fd), buffer, size, 0);
if (n == -1 && WSAGetLastError () == WSAENOTSOCK)
{
DWORD nwrite;
- n = WriteFile ((HANDLE)ctx->outbound.fd, buffer, size, &nwrite, NULL);
+ n = WriteFile (fd, buffer, size, &nwrite, NULL);
if (!n)
{
switch (GetLastError ())
@@ -111,11 +149,35 @@
}
return n;
#else /*!HAVE_W32_SYSTEM*/
- return write (ctx->outbound.fd, buffer, size);
+ return write (fd, buffer, size);
#endif /*!HAVE_W32_SYSTEM*/
}
+ssize_t
+_assuan_io_write (assuan_fd_t fd, const void *buffer, size_t size)
+{
+ ssize_t retval;
+
+ if (_assuan_io_hooks.write_hook
+ && _assuan_io_hooks.write_hook (NULL, fd, buffer, size, &retval) == 1)
+ return retval;
+ return do_io_write (fd, buffer, size);
+}
+ssize_t
+_assuan_simple_write (assuan_context_t ctx, const void *buffer, size_t size)
+{
+ ssize_t retval;
+
+ if (_assuan_io_hooks.write_hook
+ && _assuan_io_hooks.write_hook (ctx, ctx->outbound.fd,
+ buffer, size, &retval) == 1)
+ return retval;
+
+ return do_io_write (ctx->outbound.fd, buffer, size);
+}
+
+
#ifdef HAVE_W32_SYSTEM
int
_assuan_simple_sendmsg (assuan_context_t ctx, void *msg)
@@ -152,3 +214,32 @@
return ret;
#endif
}
+
+
+void
+_assuan_usleep (unsigned int usec)
+{
+ if (usec)
+ {
+#ifdef HAVE_NANOSLEEP
+ struct timespec req;
+ struct timespec rem;
+
+ req.tv_sec = 0;
+ req.tv_nsec = usec * 1000;
+
+ while (nanosleep (&req, &rem) < 0 && errno == EINTR)
+ req = rem;
+
+#elif defined(HAVE_W32_SYSTEM)
+ Sleep (usec / 1000);
+#else
+ struct timeval tv;
+
+ tv.tv_sec = usec / 1000000;
+ tv.tv_usec = usec % 1000000;
+ select (0, NULL, NULL, NULL, &tv);
+#endif
+ }
+}
+
Modified: trunk/assuan/assuan-listen.c
===================================================================
--- trunk/assuan/assuan-listen.c 2009-02-24 15:13:01 UTC (rev 1357)
+++ trunk/assuan/assuan-listen.c 2009-03-06 22:29:49 UTC (rev 1358)
@@ -14,9 +14,7 @@
* 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
+ * License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
@@ -116,17 +114,17 @@
-int
+assuan_fd_t
assuan_get_input_fd (assuan_context_t ctx)
{
- return ctx? ctx->input_fd : -1;
+ return ctx? ctx->input_fd : ASSUAN_INVALID_FD;
}
-int
+assuan_fd_t
assuan_get_output_fd (assuan_context_t ctx)
{
- return ctx? ctx->output_fd : -1;
+ return ctx? ctx->output_fd : ASSUAN_INVALID_FD;
}
@@ -135,10 +133,10 @@
assuan_error_t
assuan_close_input_fd (assuan_context_t ctx)
{
- if (!ctx || ctx->input_fd == -1)
+ if (!ctx || ctx->input_fd == ASSUAN_INVALID_FD)
return _assuan_error (ASSUAN_Invalid_Value);
_assuan_close (ctx->input_fd);
- ctx->input_fd = -1;
+ ctx->input_fd = ASSUAN_INVALID_FD;
return 0;
}
@@ -147,11 +145,11 @@
assuan_error_t
assuan_close_output_fd (assuan_context_t ctx)
{
- if (!ctx || ctx->output_fd == -1)
+ if (!ctx || ctx->output_fd == ASSUAN_INVALID_FD)
return _assuan_error (ASSUAN_Invalid_Value);
_assuan_close (ctx->output_fd);
- ctx->output_fd = -1;
+ ctx->output_fd = ASSUAN_INVALID_FD;
return 0;
}
Modified: trunk/assuan/assuan-logging.c
===================================================================
--- trunk/assuan/assuan-logging.c 2009-02-24 15:13:01 UTC (rev 1357)
+++ trunk/assuan/assuan-logging.c 2009-03-06 22:29:49 UTC (rev 1358)
@@ -14,9 +14,7 @@
* 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
+ * License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
@@ -37,24 +35,7 @@
static char prefix_buffer[80];
static FILE *_assuan_log;
static int full_logging;
-static int log_level = 1; /* Defaults to logging enabled. */
-
-/* Set the log level for general assuan commands. 0 is no logging at
- all, 1 is the standard logging and the default. Higher leveles may
- be defined in the future. Passing a level of -1 will not change
- the current log level. Returns previosu log level. */
-int
-assuan_set_assuan_log_level (int level)
-{
- int old = log_level;
-
- if (level != -1)
- log_level = level;
- return old;
-}
-
-
void
_assuan_set_default_log_stream (FILE *fp)
More information about the Gnupg-commits
mailing list