aboutsummaryrefslogtreecommitdiffstats
path: root/common (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* 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]>
* common: Add a default socket name feature.Werner Koch2016-08-293-12/+45
| | | | | | | | | | | | | | | | | * common/logging.c (log_set_socket_dir_cb): New. (socket_dir_cb): New. (set_file_fd): Allow "socket://". (fun_writer): Implement default socket name. * common/init.c (_init_common_subsystems): Register default socket. -- This change allows the use of log-file socket:// in any configuration file. Signed-off-by: Werner Koch <[email protected]>
* common: Rename an odd named function.Werner Koch2016-08-252-5/+5
| | | | | | | | | | | | | * common/openpgp-oid.c (oid_crv25519): Rename to oid_cv25519. (openpgp_oid_is_crv25519): Rename to openpgp_oid_is_cv25519. Change callers. -- We use "cv25519" everywhere else and thus the test function should not have a surprising name. Signed-off-by: Werner Koch <[email protected]>
* common: Guarantee that gnupg_get_time does not return an error.Werner Koch2016-08-241-16/+10
| | | | | | | | | | | | | * common/gettime.c (gnupg_get_time): Abor if time() failed. (gnupg_get_isotime): Remove now useless check. (make_timestamp): Remove check becuase we already checked this modulo the faked time thing. -- In reality a call foo = time (NULL) can never fail because the only defined error is EFAULT, but we don't provide a buffer. Signed-off-by: Werner Koch <[email protected]>
* doc: Some additional source commentsWerner Koch2016-08-241-0/+4
| | | | --
* common: Change license of mbox-util to LGPLv2.1+.Werner Koch2016-08-222-28/+8
| | | | | | | | -- Noet that the code has entirely been written by me. Signed-off-by: Werner Koch <[email protected]>
* common: Remove unused vars in simple-pwquery.Werner Koch2016-08-221-16/+5
| | | | | | | | | * common/simple-pwquery.c (agent_send_option): Remove unused vars. (simple_query): Ditto. (agent_open): Ditto. Return RC on error. (simple_pwquery): Remove unused vars. Remove shadowing of 'p'. Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Remove all system daemon features.Werner Koch2016-08-183-90/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dirmngr/dirmngr.h (opts): Remove fields 'system_service' and 'system_daemon'. * common/homedir.c (dirmngr_sys_socket_name): Remove. (dirmngr_user_socket_name): Rename to ... (dirmngr_socket_name): this. Change call callers. * common/asshelp.c (start_new_dirmngr): Remove the system socket feature. * tools/gpgconf.c (list_dirs): Do not print "dirmngr-sys-socket". * sm/server.c (gpgsm_server): Adjust for removed system socket feature. * dirmngr/server.c (cmd_getinfo): Ditto. (cmd_killdirmngr): Remove check for system daemon. (cmd_reloaddirmngr): Ditto. * dirmngr/dirmngr.c (USE_W32_SERVICE): Remove macro. (aService): Remove. (opts): Remove --service. (w32_service_control): Remove. (real_main, call_real_main) [W32]: Remove wrapper. (main): Remove Windows system service feature. Remove system dameon feature. Use only the "~/.gnupg/dirmngr_ldapservers.conf" file. * dirmngr/certcache.c (load_certs_from_dir): Remove warning in the system dameon case. * dirmngr/crlcache.c (DBDIR_D): Always use "~/.gnupg/crls.d". * dirmngr/ocsp.c (validate_responder_cert): Do not call validate_cert_chain which was used only in system daemon mode. * dirmngr/validate.c (validate_cert_chain): Always use the code. -- We are now starting dirmngr as needed as a user daemon. The deprecated system daemon mode does not anymore make sense. In case a system wide daemon is required, it is better to setup a dedicated account to run dirmngr and tweak socket permissions accordingly. Signed-off-by: Werner Koch <[email protected]>
* g13: New command --find-device.Werner Koch2016-08-131-0/+1
| | | | | | | | | | | | | | | | * common/status.h (STATUS_BLOCKDEV: New. * g13/call-syshelp.c: Include "call-syshelp.h". (finddevice_status_cb, call_syshelp_find_device): New. * g13/g13.c (aFindDevice): New. (opts): Add "--find-device". (main): Implement --find-device. * g13/sh-cmd.c (cmd_finddevice): New. (register_commands): Register new command. -- This might be useful for scripting. Signed-off-by: Werner Koch <[email protected]>