1. 13 Mar, 2018 3 commits
  2. 12 Mar, 2018 2 commits
  3. 28 Feb, 2018 1 commit
  4. 21 Feb, 2018 4 commits
  5. 11 Dec, 2017 1 commit
  6. 08 Dec, 2017 1 commit
    • Werner Koch's avatar
      core: Rename the gpgrt_log_levels enum values. · de167fa9
      Werner Koch authored
      
      
      * src/gpg-error.h.in (gprt_log_levels): Rename to GPGRT_LOGLVL.
      --
      
      Explicitly naming them and not distinguishing them from the other log
      constants is a Good Thing anyway.  It also helps against the symbol name
      clash with the GPGRT enum values from gnupg's logging module.
      
      Signed-off-by: default avatarWerner Koch <wk@gnupg.org>
      de167fa9
  7. 29 Nov, 2017 4 commits
    • Werner Koch's avatar
      4acf116b
    • Werner Koch's avatar
      core: Unify syscall_clamp functions. · adc786d0
      Werner Koch authored
      
      
      * src/estream.c (_gpgrt_set_syscall_clamp)
      (_gpgrt_get_syscall_clamp): Move to ...
      * src/syscall-clamp.c: new file.
      (_gpgrt_pre_syscall, _gpgrt_post_syscall): New.
      * src/Makefile.am (libgpg_error_la_SOURCES): Add that file.
      * src/estream.c: Replace the syscall wrapper with the new functions.
      * src/posix-lock.c: Ditto.
      * src/w32-lock.c: Ditto.
      * src/posix-thread.c: Ditto.
      * src/w32-thread.c: Ditto.
      
      Signed-off-by: default avatarWerner Koch <wk@gnupg.org>
      adc786d0
    • Werner Koch's avatar
      core: Implement the spawn functions. · 1865c0ba
      Werner Koch authored
      
      
      * src/gpg-error.h.in  (GPGRT_SPAWN_NONBLOCK): New const.
      (GPGRT_SPAWN_RUN_ASFW): New const.
      (GPGRT_SPAWN_DETACHED): New const.
      (gpgrt_make_pipe): New function.
      (gpgrt_create_pipe): New macro.
      (gpgrt_create_inbound_pipe): New macro.
      (gpgrt_create_outbound_pipe): New macro.
      (gpgrt_spawn_process): New function.
      (gpgrt_spawn_process_fd): New function.
      (gpgrt_spawn_process_detached): New function.
      (gpgrt_wait_process): New function.
      (gpgrt_wait_processes): New function.
      (gpgrt_kill_process): New function.
      (gpgrt_release_process): New function.
      * src/gpg-error.def.in, src/gpg-error.vers: Add new functions.
      * src/visibility.c, src/visibility.h: Add wrappers for new functions.
      * src/spawn-posix.c: Rework to better fit the use in gpgrt.  Rename
      all public function with a _gpgrt prefix.
      * src/spawn-w32.c: Ditto.
      * src/gpgrt-int.h: Likewise.
      * src/Makefile.am (arch_sources): Add spawn-posix.c and spawn-w32.c.
      * src/w32-add.h: Add pid_t typedef as a temporary hack.
      * configure.ac: Check for signal.h and getrlimit.
      (AC_FUNC_FORK): New.
      --
      
      This does build but porting the tests and further changes are
      required.  Don't assume that the API for the new fucntions is stable.
      
      Signed-off-by: default avatarWerner Koch <wk@gnupg.org>
      1865c0ba
    • Werner Koch's avatar
      Import and relicense exechelp* functions from GnuPG. · 8f41cc23
      Werner Koch authored
      
      
      * src/spawn-posix.c: New.  Taken from GnuPG's exechelp-posix.c.
      * src/spawn-w32.c: New.  Taken from GnuPG's exechelp-w32.c.
      * src/gpgrt-int.h: Include prototypes from GnuPG's exechelp.h.
      --
      
      The original files were under (LGPL-3.0+ OR GPL-2.0+) and have
      entirely been written by g10 Code employees.  Being the responsible
      person at g10 Code, I endorse the license change to LGPL-2.1.
      
      Signed-off-by: default avatarWerner Koch <wk@gnupg.org>
      8f41cc23
  8. 28 Nov, 2017 5 commits
    • Werner Koch's avatar
      core: Change new functions to return gpg_err_code_t. · 513415c7
      Werner Koch authored
      
      
      * src/gpg-error.h.in (gpgrt_sentenv, gpgrt_mkdir, gpgrt_chdir): Change
      return type to gpg_err_code_t.
      * src/sysutils.c (_gpgrt_setenv): Implement that.
      (_gpgrt_mkdir): Ditto.
      (_gpgrt_chdir): Ditto.
      * gpgscm/ffi.c (do_setenv, do_mkdir): Adjust for this change.
      --
      
      The functions are already a bit different and thus it is useful to let
      them return a gpg-error style error code and don't let the user
      implement that for each call.
      
      Signed-off-by: default avatarWerner Koch <wk@gnupg.org>
      513415c7
    • Werner Koch's avatar
      gpgscm: Some adjustments for use in gpgrt. · 930d27ba
      Werner Koch authored
      
      
      * gpgscm/Makefile.am: Remove cruft leftover from GnuPG.  Link to the
      just build libgpg-error.
      * gpgscm/private.h: Include gpgrt.h and provide i18n macros.
      (xfree, xtrymalloc, xtrycalloc, xtryrealloc): New macros.
      (xmalloc, xstrdup): New inline functions.
      * gpgscm/main.c: Remove inclusion of gcrypt.h and gpg-error.h.  Remove
      all other gnupg specific headers.
      (opts, parse_arguments): Temporary comment out.
      (main): Adjust for use with gpgrt.  Temporary comment out some stuff.
      * gpgscm/ffi-private.h: Include local gpgrt.h instead of gpg-error.h.
      * gpgscm/ffi.h: Ditto.
      * gpgscm/ffi.c: Remove gpg-error.h and headers from GnuPG.
      (do_getenv): Use gpgrt_getenv.
      (do_setenv): Use gpgrt_setenv.
      (do_mkdtemp): Temporary return an error.
      (unlink_recursively): Use gpgrt_bsprintf.
      (do_getcwd): Use gpgrt_getcwd.
      (do_mkdir): Use gpgrt_mkdir.
      (do_get_isotime): Temporary return an error.
      (do_get_time): Directly use time().
      --
      
      Note that this does not yet compile because the spawn functions from
      GnuPG are missing.  There are two other problems as well:
      
       - We don't have GnuPG's isotime fucntions.  We need to see whether we
         want to support them in gpgrt.  That might be useful in libksba.
      
       - gpgrt_mkdtemp does not work.  We do not want to link to Libgcrypt,
         which is the way mkdtemp was written for GnuPG.  We should get a
         more straight implementation.
      
      Signed-off-by: default avatarWerner Koch <wk@gnupg.org>
      930d27ba
    • Werner Koch's avatar
      core: New API functions gpgrt_mkdir, gpgrt_chdir, gpgrt_getcwd. · 4a2538e6
      Werner Koch authored
      
      
      * src/gpg-error.h.in (gpgrt_mkdir, gpgrt_chdir, gpgrt_getcwd): New.
      * src/visibility.c, src/visibility.h: Add wrappers.
      * src/gpg-error.vers, src/gpg-error.def.in: Add them.
      * src/sysutils.c (modestr_to_mode): New.
      (_gpgrt_mkdir, _gpgrt_chdir, _gpgrt_getcwd): New.
      * m4/gnupg-misc.m4: New.
      * m4/Makefile.am (EXTRA_DIST): Add new M4 file.
      * configure.ac: Call new GNUPG_FUNC_MKDIR_TAKES_ONE_ARG.
      (AC_CHECK_FUNCS): Add stat.
      --
      
      The code has been taken from GnuPG.  _gpgrt_mkdir was originally
      written by me as gnupg_mkdir and here relicensed to LGPLv2.1+.
      _gpgrt_getcwd was originally written by in 2007 and also here
      relicensed to LGPLv2.1.  The new M4 macro was also written by me for
      use in in GnuPG; it has been taken from GnUPG's acinclude.m4, moved to
      its own file here, and relicensed to FSFULLR.
      
      Signed-off-by: default avatarWerner Koch <wk@gnupg.org>
      4a2538e6
    • Werner Koch's avatar
      core: Prepare to build with gpgscm. · 241e9a73
      Werner Koch authored
      
      
      * configure.ac: New option --enable-gpgscm.  Create gpgscm/Makefile.
      (GPGRT_ENABLE_LOG_MACROS): Define.
      * Makefile.am (SUBDIRS): Add gpgscm
      * src/logging.c (_gpgrt_logv_clock): Do not use the log_debug macro.
      --
      
      Note that gpscm does not yet build.
      
      Signed-off-by: default avatarWerner Koch <wk@gnupg.org>
      241e9a73
    • Werner Koch's avatar
      core: New API functions gpgrt_getenv and gpgrt_setenv. · b67daca5
      Werner Koch authored
      
      
      * src/gpg-error.h.in (gpgrt_getenv, gpgrt_setenv): New.
      (gpgrt_unsetenv): New macro.
      * src/gpg-error.vers, src/gpg-error.def.in: Add them.
      * src/visibility.c (gpgrt_getenv, gpgrt_setenv): New.
      * src/visibility.h: Add them.
      * src/sysutils.c: Include string.h and on Windows windows.h.
      (_gpgrt_getenv): New.
      (_gpgrt_setenv): New.
      --
      
      These functions are wrappers to cope with Windows problems.  The code
      is similar to what we have in GnuPG but not identical.
      
      Requires better testing.
      
      Signed-off-by: default avatarWerner Koch <wk@gnupg.org>
      b67daca5
  9. 27 Nov, 2017 4 commits
  10. 22 Nov, 2017 1 commit
  11. 17 Nov, 2017 6 commits
    • Werner Koch's avatar
      w32: Avoid unused code warning. · a950326d
      Werner Koch authored
      
      
      * src/w32-estream.c (_gpgrt_w32_poll) [!ENABLE_TRACING]: Do not use
      waitinfo.
      --
      
      Signed-off-by: default avatarWerner Koch <wk@gnupg.org>
      a950326d
    • Werner Koch's avatar
      w32: Add new API fucntion gpgrt_w32_reg_query_string. · b5c4a272
      Werner Koch authored
      
      
      * src/w32-reg.c: New.
      * src/w32-add.h: Add gpgrt_w32_reg_query_string.
      * src/visibility.c (gpgrt_w32_reg_query_string): New wrapper.
      * src/gpg-error.def.in: Add gpgrt_w32_reg_query_string.
      * configure.ac (ac_check_funcs): Add stpcpy.
      * src/Makefile.am (arch_sources): Add w32-reg.c
      (socklibs): New.
      (libgpg_error_la_LIBADD): Add socklibs.
      * src/gpgrt-int.h (xfree, xtrymalloc, xtrycalloc)
      (xtryrealloc): New internal macros.
      (_gpgrt_stpcpy, stpcpy): New replacement fucntion and macro.
      * src/logging.c (_gpgrt_logv_internal): Use new registry query
      function and add standard registry key.
      --
      
      This also fixes the build failure on Widnwos for logging.c.
      
      The code for gpgrt_w32_reg_query_string has been taken from the
      function read_w32_registry_string in w32-utils.c in the GPGME package.
      
      Signed-off-by: default avatarWerner Koch <wk@gnupg.org>
      b5c4a272
    • Werner Koch's avatar
      core: New API functions gpgrt_strdup and gpgrt_strconcat. · 0d8d46c7
      Werner Koch authored
      
      
      * src/visibility.c (gpgrt_strdup): New API fucntion.
      (gpgrt_strconcat): New API fucntion.
      * src/visibility.h: Add corresponding macros.
      * src/gpg-error.def.in: Add them.
      * src/gpg-error.vers: Add them.
      * src/gpgrt-int.h (DIM): New macro.
      * src/init.c (_gpgrt_strdup): New.
      (_gpgrt_strconcat_core): New.
      (_gpgrt_strconcat): New.
      --
      
      Signed-off-by: default avatarWerner Koch <wk@gnupg.org>
      0d8d46c7
    • Werner Koch's avatar
      core: New API functions gpgrt_malloc, gpgrt_calloc, and gpgrt_realloc. · 80c18e1b
      Werner Koch authored
      
      
      * src/visibility.c (gpgrt_realloc): New API function.
      (gpgrt_malloc): New API function.
      (gpgrt_calloc): New API function.
      * src/visibility.h: Add corresponding macros.
      * src/gpg-error.def.in: Add them.
      * src/gpg-error.vers: Add them.
      * src/init.c (_gpgrt_calloc): New.
      * src/gpg-error.h.in: Add prototypes.
      
      Signed-off-by: default avatarWerner Koch <wk@gnupg.org>
      80c18e1b
    • Werner Koch's avatar
      core: Add logging API. · 1b653e7f
      Werner Koch authored
      
      
      * src/visibility.c (gpgrt_get_errorcount): New API.
      (gpgrt_inc_errorcount): New API.
      (gpgrt_log_set_sink): New API.
      (gpgrt_log_set_socket_dir_cb): New API.
      (gpgrt_log_set_pid_suffix_cb): New API.
      (gpgrt_log_set_prefix): New API.
      (gpgrt_log_get_prefix): New API.
      (gpgrt_log_test_fd): New API.
      (gpgrt_log_get_fd): New API.
      (gpgrt_log_get_stream): New API.
      (gpgrt_log): New API.
      (gpgrt_logv): New API.
      (gpgrt_logv_prefix): New API.
      (gpgrt_log_string): New API.
      (gpgrt_log_info): New API.
      (gpgrt_log_error): New API.
      (gpgrt_log_fatal): New API.
      (gpgrt_log_bug): New API.
      (gpgrt_log_debug): New API.
      (gpgrt_log_debug_string): New API.
      (gpgrt_log_printf): New API.
      (gpgrt_log_flush): New API.
      (gpgrt_log_printhex): New API.
      (gpgrt_log_clock): New API.
      (_gpgrt_log_assert): New function for the ABI.
      * src/visibility.h: Add corresponding macros.
      * src/gpg-error.def.in: Add new functions.
      * src/gpg-error.vers: Add new functions.
      * src/gpg-error.h.in (GPGRT_LOG_WITH_PREFIX): New constant.
      (GPGRT_LOG_WITH_TIME): New constant.
      (GPGRT_LOG_WITH_PID): New constant.
      (GPGRT_LOG_RUN_DETACHED): New constant.
      (GPGRT_LOG_NO_REGISTRY): New constant.
      (GPGRT_LOG_BEGIN): New enum value.
      (GPGRT_LOG_CONT): New enum value.
      (GPGRT_LOG_INFO): New enum value.
      (GPGRT_LOG_WARN): New enum value.
      (GPGRT_LOG_ERROR): New enum value.
      (GPGRT_LOG_FATAL): New enum value.
      (GPGRT_LOG_BUG): New enum value.
      (GPGRT_LOG_DEBUG): New enum value.
      (log_get_errorcount, log_inc_errorcount, log_set_file, log_set_fd)
      (log_set_stream, log_set_socket_dir_cb, log_set_pid_suffix_cb)
      (log_set_prefix, log_get_prefix, log_test_fd, log_get_fd)
      (log_get_stream, log_log, log_logv, log_logv_prefix, log_string)
      (log_bug, log_fatal, log_error, log_info, log_debug, log_debug_string)
      (log_printf, log_printhex, log_clock)
      (log_flush) [GPGRT_ENABLE_LOG_MACROS]: New wrapper macros.
      (gpgrt_assert): New macro.
      * src/gpgrt-int.h: Add prototypes for logging.c.
      (gpgrt_assert): Redefine for internal use.
      * src/logging.h: Remove.
      * src/logging.c: Include gpgrt-int.h instead of the stuff from GnuPG.
      Use _gpgrt malloc funcsions and the internal versions of the estream
      functions.  Rename all public fucntions with a _gpgrt_ prefix.
      (print_prefix): Return the printed length.
      (_gpgrt_logv_internal): Ditto.
      (_gpgrt_log_printhex): Change order of args and turn into a printf
      like function.
      (_gpgrt_logv_printhex): New. Take the core of the former
      log_printhex.
      (_gpgrt_log_clock): Turn into a printf like functions.
      (_gpgrt_logv_clock): New.  Take the core of the former log_clock.
      --
      
      This logging API is a slightly modified version of what we are using
      in GnuPG.
      
      Signed-off-by: default avatarWerner Koch <wk@gnupg.org>
      1b653e7f
    • Werner Koch's avatar
      New configure options and macros for internal use. · 9c904765
      Werner Koch authored
      
      
      * configure.ac: Add option --enable-log-clock.
      * configure.ac: Add option --enable-werror.
      * src/sysutils.c: New.
      * src/Makefile.am (libgpg_error_la_SOURCES): Add sysutils.c
      * src/gpgrt-int.h: Add internal i18n macros and hacks to make working
      with sockets easier.
      (es_stdin, es_stdout, es_stderr): New internal macros.
      (snprintf): New macro.
      
      Signed-off-by: default avatarWerner Koch <wk@gnupg.org>
      9c904765
  12. 05 Oct, 2017 6 commits
  13. 21 Aug, 2017 1 commit
  14. 08 Aug, 2017 1 commit
    • Werner Koch's avatar
      build: New configure option --enable-all-tests. · 3aa37d80
      Werner Koch authored
      
      
      * configure.ac: New option --enable-all-tests.
      * tests/gpgscm/ffi.c (ffi_init): New gloabl var *run-all-tests*.
      * tests/openpgp/all-tests.scm (all-tests): Use that var instead
      of *maintainer-mode*.
      * Makefile.am (AM_DISTCHECK_CONFIGURE_FLAGS): Add --enable-all-tests.
      --
      
      It is better to have a separate option to run all tests than to put
      this on top of --enable-maintainer-mode.  This way we can also make
      sure to run all tests during "make distcheck".
      
      Signed-off-by: default avatarWerner Koch <wk@gnupg.org>
      3aa37d80