aboutsummaryrefslogtreecommitdiffstats
path: root/common (follow)
Commit message (Collapse)AuthorAgeFilesLines
* common: New function log_debug_with_string.Werner Koch2017-01-112-37/+106
| | | | | | | | | | | | | | | * common/logging.c (do_logv): Factor some code out to ... (print_prefix): new. (log_logv): Add arg EXTRASTRING and print it. Change all callers to pass NULL for it. (log_debug_with_string): New. Uses EXTRASTRING. -- This function can be used to print a human readable buffer in addition to a log message to the log stream. This function will keep all lines together and prefix them with ">> ". Signed-off-by: Werner Koch <[email protected]>
* common: Avoid unnecessary ambiguity in argparse.Daniel Kahn Gillmor2017-01-111-1/+3
| | | | | | | | | | | | | * common/argparse.c (find_long_option): Avoid unnecessary ambiguity. -- If two struct ARGPARSE_OPTS share a prefix in their long_opt name, but have the exact same short_opt and flags, they are aliases and not distinct options. Avoid reporting this as an ambiguity, so that (for example) both --clearsign and --clear-sign can be invoked as --clear. Signed-off-by: Daniel Kahn Gillmor <[email protected]> Debian-Bug-Id: 850475
* common: Fix fallback code.Justus Winter2017-01-102-2/+2
| | | | | | | | * common/logging.c (_log_assert): Fix the variant for compilers that do not support __FUNCTION__. * common/logging.h (_log_assert): Likewise. Signed-off-by: Justus Winter <[email protected]>
* agent,w32: Fix annoying output to DebugView.Werner Koch2017-01-061-5/+8
| | | | | | | | | * agent/gpg-agent.c (startup_fd_list): Do not define for W32. (main) [W32]: Do not call get_all_open_fds. -- GnuPG-bug-id: 2267 Signed-off-by: Werner Koch <[email protected]>
* Silence two -Wlogical-op warnings.Werner Koch2017-01-051-2/+2
| | | | | | | | * common/tlv.c (parse_ber_header): Avoid compiler warning about a duplicate condition. * tools/gpgtar-create.c (pattern_valid_p): Likewise. Signed-off-by: Werner Koch <[email protected]>
* common: Turn assertions into expressions.Justus Winter2017-01-021-8/+8
| | | | | | | * common/logging.h (log_assert): Turn this into an expression so it can be used in expressions. Signed-off-by: Justus Winter <[email protected]>
* Replace use of variable-length-arrays.Werner Koch2017-01-021-2/+4
| | | | | | | | | | | | | * common/t-iobuf.c (main): Replace variable-length-array. * g10/gpgcompose.c (mksubpkt_callback): Ditto. (encrypted): Ditto. * g10/t-stutter.c (log_hexdump): Ditto. (oracle_test): Ditto. * g10/tofu.c (get_policy): Ditto. Use "%zu" for size_t. * scd/app-openpgp.c (ecc_writekey): Replace variable-length-array. Check for zero length OID_LEN. Signed-off-by: Werner Koch <[email protected]>
* tests: Avoid skipping exectool tests.Werner Koch2016-12-201-18/+31
| | | | | | | | | | | | | | * common/t-exectool.c (test_executing_true): Try also /usr/bin/true. (test_executing_false): Try also /usr/bin/false. -- Reported-by: Nelson H. F. Beebe I then ran a test on all our test lab systems, and found that /bin/false is missing on DragonFlyBSD, FreeBSD, GhostBSD, HardenedBSD, Mac OS X, MidnightBSD, Minix, one version of MirBSD, NetBSD, OpenBSD, PacBSD, PCBSD, and TrueOS. Signed-off-by: Werner Koch <[email protected]>
* Remove unused debug flags and add "dns" and "network".Werner Koch2016-12-191-0/+2
| | | | | | | | | | | | | | | | | | * g10/options.h (DBG_CARD_IO_VALUE, DBG_CARD_IO): Remove. * g10/gpg.c (debug_flags): Remove "cardio". * agent/agent.h (DBG_COMMAND_VALUE, DBG_COMMAND): Remove. * agent/gpg-agent.c (debug_flags): Remove "command". * scd/scdaemon.h (DBG_COMMAND_VALUE, DBG_COMMAND): Remove. * scd/scdaemon.c (debug_flags): Remove "command". * dirmngr/dirmngr.h (DBG_DNS_VALUE, DBG_DNS): New. (DBG_NETWORK_VALUE, DNG_NETWORK): New. * dirmngr/dirmngr.c (debug_flags): Add "dns" and "network". -- Note that "dns" and "network" are not yet used but will soon be added to dirmngr. Signed-off-by: Werner Koch <[email protected]>
* common: Support locating components in the build tree.Justus Winter2016-12-142-17/+65
| | | | | | | | | | | | | | | | | | | | | | | | | * common/homedir.c (gnupg_build_directory): New variable. (gnupg_module_name_called): Likewise. (gnupg_set_builddir): New function. (gnupg_set_builddir_from_env): Likewise. (gnupg_module_name): Support locating components in the build tree. * common/util.h (gnupg_set_builddir): New prototype. * tests/openpgp/defs.scm (tools): Drop 'gpg and 'gpg-agent. (tool): Rename to 'tool-hardcoded. (gpg-conf): New function, with accessors for the results. (gpg-components): New variable. (tool): New function. * tools/gpgconf.c (enum cmd_and_opt_values): New key. (opts): New option '--build-prefix'. (main): Handle new option. -- This change makes sure that the components from the build tree are used, and not some older installed version in PATH. It also lets us make GPGME use components from the build tree, making it possible to execute GPGME's test suite with them. Signed-off-by: Justus Winter <[email protected]>
* common: Fix typo.Justus Winter2016-12-141-1/+1
| | | | | -- Signed-off-by: Justus Winter <[email protected]>
* common: Add replacements for error codes from gpg-error 1.26.Werner Koch2016-12-141-1/+13
| | | | Signed-off-by: Werner Koch <[email protected]>
* common: Skip the Byte Order Mark in conf files.Werner Koch2016-12-081-1/+19
| | | | | | * common/argparse.c (optfile_parse): Detect and skip the UTF-8 BOM. Signed-off-by: Werner Koch <[email protected]>
* gpg: New option --default-new-key-algo.Werner Koch2016-12-022-6/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/openpgp-oid.c (openpgp_is_curve_supported): Add optional arg R_ALGO and change all callers. * common/util.h (GPG_ERR_UNKNOWN_FLAG): New error code. * g10/options.h (struct opt): Add field DEF_NEW_KEY_ALGO. * g10/gpg.c (oDefaultNewKeyAlgo): New enum. (opts): New option "--default-new-key-algo". (main): Set the option. * g10/keygen.c: Remove DEFAULT_STD_ FUTURE_STD_ constants and replace them by ... (DEFAULT_STD_KEY_PARAM, FUTURE_STD_KEY_PARAM): new string constants. (get_keysize_range): Remove arg R_DEF and return that value instead. Change all callers. (gen_rsa): Use get_keysize_range instead of the removed DEFAULT_STD_KEYSIZE. (parse_key_parameter_part): New function. (parse_key_parameter_string): New function. (quick_generate_keypair): Refactor using parse_key_parameter_string. (generate_keypair): Ditto. (parse_algo_usage_expire): Ditto. -- This new option is intended to be used in the forthcoming --set-profile command of gpgconf. It allows to provide a gpg configuration with custom defaults for a new key using the simple commands which use the default algorithm set. Signed-off-by: Werner Koch <[email protected]>
* gpg,sm: Merge the two versions of check_special_filename.Werner Koch2016-11-294-41/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * sm/gpgsm.c (check_special_filename): Move to .. * common/sysutils.c (check_special_filename): here. Add arg NOTRANSLATE. (allow_special_filenames): New local var. (enable_special_filenames): New public functions. * sm/gpgsm.c (allow_special_filenames): Remove var. (main): Call enable_special_filenames instead of setting the var. (open_read, open_es_fread, open_es_fwrite): Call check_special_filename with 0 for NOTRANSLATE. * common/iobuf.c (special_names_enabled): Remove var. (iobuf_enable_special_filenames): Remove func. (check_special_filename): Remove func. (iobuf_is_pipe_filename): Call new version of the function with NOTRANSLATE set. (do_open): Ditto. * g10/gpg.c (main): Call enable_special_filenames instead of iobuf_enable_special_filenames. * g10/gpgv.c (main): Ditto. -- Note that we keep the iobuf.c:translate_file_handle because it is a bit different (for whatever reasons) than the translate function from sysutils. Signed-off-by: Werner Koch <[email protected]>
* common: Rename keybox_file_rename to gnupg_rename_file.Werner Koch2016-11-162-0/+72
| | | | | | | * kbx/keybox-util.c (keybox_file_rename): Rename to ... * common/sysutils.c (gnupg_rename_file): this. Change all callers. Signed-off-by: Werner Koch <[email protected]>
* common,w32: Simplify locking.Justus Winter2016-11-081-49/+0
| | | | | | | | * common/asshelp.c (lock_spawning): Use the same code on Windows that we use on all other platforms. (unlock_spawning): Likewise. Signed-off-by: Justus Winter <[email protected]>
* Change all http://www.gnu.org in license notices to https://Werner Koch2016-11-05123-123/+123
| | | | --
* common: Improve compare_string_versions.Werner Koch2016-11-022-45/+83
| | | | | | | | | | | | | | | * common/stringhelp.c: Include limits.h. (compare_version_strings): Change semantics to behave like strcmp. Include the patch lebel in the comparison. Allow checking a single version string. * common/t-stringhelp.c (test_compare_version_strings): Adjust test vectors and a few new vectors. * g10/call-agent.c (warn_version_mismatch): Adjust to new sematics. * g10/call-dirmngr.c (warn_version_mismatch): Ditto. * sm/call-agent.c (warn_version_mismatch): Ditto. * sm/call-dirmngr.c (warn_version_mismatch): Ditto. Signed-off-by: Werner Koch <[email protected]>
* common: New function gnupg_usleep.Werner Koch2016-10-312-1/+46
| | | | | | | | | | | * configure.ac (HAVE_NANOSLEEP): Test for nanosleep. * common/sysutils.c: Always include time.h. (gnupg_usleep): New. -- This function has been compiled from nPth and Libassuan. Signed-off-by: Werner Koch <[email protected]>
* common: Add GNUPG_MODULE_NAME_GPGV.Werner Koch2016-10-272-0/+8
| | | | | | | * common/util.h (GNUPG_MODULE_NAME_GPGV): New. * common/homedir.c (gnupg_module_name): Implement. Signed-off-by: Werner Koch <[email protected]>
* Fix typos.Justus Winter2016-10-273-3/+3
| | | | | -- Signed-off-by: Justus Winter <[email protected]>
* common: Remove debug output from gnupg_get_socket_name.Werner Koch2016-10-271-4/+4
| | | | | | | * common/sysutils.c (gnupg_get_socket_name): Remove debug message and use my_error_from_syserror. Signed-off-by: Werner Koch <[email protected]>
* common: Fix gnupg_inotify_has_name, differently.NIIBE Yutaka2016-10-271-21/+15
| | | | | | | | | | | * common/sysutils.c (gnupg_inotify_has_name): Use void * to stop the warning. -- According to the man page of inotify(7), it is aligned by null bytes. So, bc28f320fa6f5b9fcdb73dba5e6c582daf7992c5 is reverted. Signed-off-by: NIIBE Yutaka <[email protected]>
* agent,common: move get_socket_name() into common.Daniel Kahn Gillmor2016-10-272-0/+50
| | | | | | | | | | * agent/gpg-agent.c (get_socket_name): move to ... * common/sysutils.c (gnupg_get_socket_name): ... here. -- This allows us to use the same functionality in dirmngr as well. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* common: Fix gnupg_inotify_has_name.NIIBE Yutaka2016-10-271-14/+22
| | | | | | | | | * common/sysutils.c (gnupg_inotify_has_name): Take care of the alignment. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* common: Use GPG_ERR_INV_VALUE instead of GPG_ERR_EINVAL.Werner Koch2016-10-261-1/+1
| | | | | | | | | | | | * common/sysutils.c (gnupg_inotify_watch_socket): Return GPG_ERR_INV_VALUE for a missing socket name and set proper error source. -- By using a different value we can easier see whether the error is due to a system call or from GnuPG code. Signed-off-by: Werner Koch <[email protected]>
* common: avoid segfaultDaniel Kahn Gillmor2016-10-261-0/+3
| | | | | | | * common/sysutils.c (gnupg_inotify_watch_socket): return EINVAL if socket_name is NULL, rather than segfaulting -- Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* common: Use strconcat in gnupg_setenv.Werner Koch2016-10-251-22/+22
| | | | | | | | * common/sysutils.c (gnupg_setenv): Replace malloc+stpcpy by strconcat. Indent cpp conditionals. (gnupg_unsetenv): Indent cpp conditionals. Signed-off-by: Werner Koch <[email protected]>
* common: Fix openpgp_is_curve_supported.NIIBE Yutaka2016-10-241-2/+2
| | | | | | | | | | * common/openpgp-oid.c (openpgp_is_curve_supported): Support both of canonical name of the curve and alias. -- Only alias (the name for print) was allowed before this change. Signed-off-by: NIIBE Yutaka <[email protected]>
* Fix use cases of snprintf.NIIBE Yutaka2016-10-211-4/+2
| | | | | | | | | | | * agent/call-pinentry.c, agent/call-scd.c, agent/command.c, build-aux/speedo/w32/g4wihelp.c, common/get-passphrase.c, dirmngr/dirmngr.c, g10/call-agent.c, g10/cpr.c, g10/keygen.c, g10/openfile.c, g10/passphrase.c, scd/app-openpgp.c, scd/scdaemon.c, sm/call-agent.c, sm/call-dirmngr.c, sm/certreqgen.c: Fix assuming C99. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* common,w32: Fix setting environment variables on Windows.Justus Winter2016-10-201-39/+62
| | | | | | | | | * common/sysutils.c (gnupg_setenv): Also update the environment block maintained by the C runtime. (gnupg_unsetenv): Likewise. * tests/gpgscm/ffi.c (do_setenv): Fix error handling. Signed-off-by: Justus Winter <[email protected]>
* common: Fix copying data to estreams.Justus Winter2016-10-181-5/+7
| | | | | | | * common/exectool.c (copy_buffer_do_copy): Correctly account for partially written data in the event of errors. Signed-off-by: Justus Winter <[email protected]>
* common,w32: Communicate with child in non-blocking mode.Justus Winter2016-10-181-3/+4
| | | | | | | | * common/exechelp-w32.c (gnupg_spawn_process): Open streams in non-blocking mode if requested. Fixes-commit: 83811e3f1f0c615b2b63bafdb49a35a0fc198088 Signed-off-by: Justus Winter <[email protected]>
* common,w32: Extend gnupg_create_inbound_pipe et al.Justus Winter2016-10-181-10/+27
| | | | | | | | | | | | * common/exechelp-w32.c (do_create_pipe): Rename, add arguments, and create a stream if reqested. (gnupg_create_inbound_pipe): Use the extended function to open the stream if requested. (gnupg_create_outbound_pipe): Likewise. (gnupg_create_pipe): Update call site. Fixes-commit: 5d991e333a1885adc40abd9d00c01fec4bd5d9d7 Signed-off-by: Justus Winter <[email protected]>
* common,w32: Make use of default_errsource in exechelp.Justus Winter2016-10-181-7/+21
| | | | | | | | * common/exechelp-posix.c (my_error_from_syserror, my_error): New. Use them instead of gpg_error and gpg_error_from_syserror. Fixes-commit: 96c7901ec1c79be732570811223d3ea54875abfe Signed-off-by: Justus Winter <[email protected]>
* agent: Move inotify code to common and improve it.Werner Koch2016-10-152-0/+131
| | | | | | | | | | | | | | | | | | | | | | | * common/sysutils.c: Include sys/inotify.h. (my_error_from_syserror, my_error): New. (gnupg_inotify_watch_socket): New. (gnupg_inotify_has_name): New. * agent/gpg-agent.c: Do not include sys/inotify.h. (my_inotify_is_name): Remove. (handle_connections): Remove HAVE_INOTIFY_INIT protected code and use the new functions. -- When removing not a simple socket file but the entire directory the old code missed most events and thus did not worked properly. IN_DELETE_SELF has also been added to the watch list to detect a removal of the directory. However, in all tests that event was not triggered. The only way it could be triggered was by not watching the socket dir but an arbitary directory and rmdir that. GnuPG-bug-id: 2756 Signed-off-by: Werner Koch <[email protected]>
* agent, dirmngr, scd: Fix init_common_subsystems.NIIBE Yutaka2016-10-071-11/+0
| | | | | | | | | | | * common/init.c (_init_common_subsystems): Don't call gpgrt_set_syscall_clamp in this function. * agent/gpg-agent.c, dirmngr/dirmngr.c, scd/scdaemon.c: Call gpgrt_set_syscall_clamp after npth_init. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* common: Avoid pointer arithmetic on string literals.Justus Winter2016-10-062-4/+4
| | | | | * common/gettime.c (rfctimestamp): Use indexing instead. * common/signal.c (got_fatal_signal): Likewise.
* build: Fix build against libiconv.Justus Winter2016-09-301-1/+1
| | | | | | | | * agent/Makefile.am: Add INCICONV and LIBICONV. * common/Makefile.am: Likewise. * tools/Makefile.am: Likewise. Signed-off-by: Justus Winter <[email protected]>
* common: Correctly handle modules relying on npth.Justus Winter2016-09-271-2/+4
| | | | | | | | * common/Makefile.am (common_sources): Drop 'call-gpg.{c,h}'. (with_npth_sources): New variable. (libcommonpth_a_SOURCES): Use the new variable. Signed-off-by: Justus Winter <[email protected]>
* Fix more spellingDaniel Kahn Gillmor2016-09-173-3/+3
| | | | | | | | | | | | | | | | | | | * NEWS, acinclude.m4, agent/command-ssh.c, agent/command.c, agent/gpg-agent.c, agent/keyformat.txt, agent/protect-tool.c, common/asshelp.c, common/b64enc.c, common/recsel.c, doc/DETAILS, doc/HACKING, doc/Notes, doc/TRANSLATE, doc/dirmngr.texi, doc/faq.org, doc/gpg-agent.texi, doc/gpg.texi, doc/gpgsm.texi, doc/instguide.texi, g10/armor.c, g10/gpg.c, g10/keyedit.c, g10/mainproc.c, g10/pkclist.c, g10/tofu.c, g13/sh-cmd.c, g13/sh-dmcrypt.c, kbx/keybox-init.c, m4/pkg.m4, sm/call-dirmngr.c, sm/gpgsm.c, tests/Makefile.am, tests/gpgscm/Manual.txt, tests/gpgscm/scheme.c, tests/openpgp/gpgv-forged-keyring.scm, tests/openpgp/multisig.test, tests/openpgp/verify.scm, tests/pkits/README, tools/applygnupgdefaults, tools/gpg-connect-agent.c, tools/mime-maker.c, tools/mime-parser.c: minor spelling cleanup. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* common: Restore a simpler variant of 'gnupg_wait_process'.Justus Winter2016-09-051-1/+53
| | | | | | | * common/exechelp-posix.c (gnupg_wait_process): Use the code prior to 5ba4f604. Signed-off-by: Justus Winter <[email protected]>
* common: Fix error handling.Justus Winter2016-09-051-2/+6
| | | | | | | * common/exechelp-posix.c (store_result): Use xtrymalloc. (gnupg_wait_processes): Likewise, and check result. Signed-off-by: Justus Winter <[email protected]>
* common: Improve waiting for processes on POSIX.Justus Winter2016-09-051-30/+112
| | | | | | | | | | | | | | | | * common/exechelp-posix.c (struct terminated_child): New definition. (terminated_children): New variable. (store_result): New function. (get_result): Likewise. (gnupg_wait_process): Store results that were not requested and consider previously stored results. waitpid(2) may return information about terminated children that we did not yet request, and there is no portable way to wait for a specific set of children. As a workaround, we store the results of children for later use. Signed-off-by: Justus Winter <[email protected]>
* common: Fix typo.Justus Winter2016-09-051-1/+1
| | | | | -- Signed-off-by: Justus Winter <[email protected]>
* common: Add an assuan logging monitor.Werner Koch2016-09-052-4/+19
| | | | | | | | | * common/asshelp.c (my_log_monitor): New var. (my_libassuan_log_handler): Run that monitor. (setup_libassuan_logging): Add arg to set a log monitor and change all callers. Signed-off-by: Werner Koch <[email protected]>
* common: Add string operator gt,ge,le,lt to recsel.Werner Koch2016-09-052-2/+88
| | | | | | | | * common/recsel.c (recsel_parse_expr): Add them. (recsel_dump): Print them. (recsel_select): Evaluate them. Signed-off-by: Werner Koch <[email protected]>
* common: Check read errors in name-value.cWerner Koch2016-09-021-1/+6
| | | | | | * common/name-value.c: Check for read errors. Signed-off-by: Werner Koch <[email protected]>
* w32: Fix build regression due to 2aa0701.Werner Koch2016-08-291-1/+1
| | | | | | | | * common/logging.c (fun_writer): Always declare 'name_for_err'. -- Regression-due-to: 2aa0701013f703ad93e17da3345c493c08aa04ee Signed-off-by: Werner Koch <[email protected]>