aboutsummaryrefslogtreecommitdiffstats
path: root/common (follow)
Commit message (Collapse)AuthorAgeFilesLines
* doc: Consistently use 'keyserver'.Werner Koch2016-06-141-1/+1
| | | | | | | -- GnuPG-bug-id: 2383 Signed-off-by: Werner Koch <[email protected]>
* common: Fix bad printf format in t-stringhelp.cWerner Koch2016-06-121-1/+1
| | | | --
* common: New function split_fields.Werner Koch2016-06-113-0/+120
| | | | | | | | | * common/stringhelp.c (split_fields): New. * common/t-stringhelp.c: Include assert.h. (test_split_fields): New. (main): Call test. Signed-off-by: Werner Koch <[email protected]>
* Explicitly restrict socket permissions.Werner Koch2016-06-081-1/+1
| | | | | | | | | | * agent/gpg-agent.c (create_server_socket): Call chmod before listen. * scd/scdaemon.c (create_server_socket): Ditto. * dirmngr/dirmngr.c (main): Ditto. -- This is just in case of a improperly set umask. Note that a connect requires a write permissions.
* w32: Fix recent build regression.Werner Koch2016-06-081-0/+2
| | | | | | | | | | | * common/homedir.c (_gnupg_socketdir_internal) [W32]: Add definition for NAME. * g10/gpg.c (main) [W32]: Fix use og gnupg_homedir. * agent/gpg-agent.c (remove_socket): Remove unused var P. * scd/scdaemon.c (cleanup): Ditto. Signed-off-by: Werner Koch <[email protected]>
* Implement /run/user/UID/gnupg based sockets.Werner Koch2016-06-082-20/+226
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/homedir.c: Include sys/stat.h and zb32.h. (w32_portable_app, w32_bin_is_bin): Change type from int to byte. (non_default_homedir): New. (is_gnupg_default_homedir): New. (default_homedir): Set non_default_homedir. (gnupg_set_homedir): Set non_default_homedir and make the_gnupg_homedir and absolute directory name. (gnupg_homedir): Return an absolute directory name. (_gnupg_socketdir_internal): New. (gnupg_socketdir): Implement /run/user/ based sockets. * tools/gpg-connect-agent.c (get_var_ext): Replace now obsolete make_filename by xstrdup. * tools/gpgconf.c (main): Sue gnupg_homedir for the "homedir:" output. -- If a [/var]/run/user/$(id -u)/ directory exists, a gnupg subdir is created as needed and the permissions of the directories are checked. If that all matches that directory name is returned instead of the homedir. To cope with non standard homedirs (via GNUPGHOME or --homedir) the SHA-1 hash of the homedir is computed, left truncated to 120 bits, zBase-32 encoded, prefixed with "d.", and appended to "[/var]/run/user/$(id -u)/gnupg/". If that directory exists and has proper permissions it is returned as socket dir - if not the homedir is used. Due to cleanup issues, this directory will not be auto-created but needs to be created by the user in advance. The required permissions are: directory owned by the user, group and others bits not set. Signed-off-by: Werner Koch <[email protected]>
* common: New function gnupg_socketdir.Werner Koch2016-06-073-3/+40
| | | | | | | | | | | | | | | * common/homedir.c (gnupg_socketdir): New. * agent/gpg-agent.c (create_socket_name): Use new function instead of gnupg_homedir. (check_own_socket): Ditto. (check_for_running_agent): Ditto. * agent/preset-passphrase.c (main): Ditto. * common/asshelp.c (start_new_gpg_agent): Ditto. * scd/scdaemon.c (create_socket_name): Ditto. * tools/gpgconf.c (main): Ditto. * tools/symcryptrun.c (main): Ditto. Signed-off-by: Werner Koch <[email protected]>
* common: Remove homedir arg from start_new_{dirmngr,gpg_agent}.Werner Koch2016-06-074-15/+5
| | | | | | | | | | * common/asshelp.c (start_new_gpg_agent): Remove arg 'homedir' in favor of gnupg_homedir (). Change all callers. (start_new_dirmngr): Ditto. * common/get-passphrase.c (gnupg_prepare_get_passphrase): Remove arg 'homedir'. Signed-off-by: Werner Koch <[email protected]>
* Replace use of opt.homedir by accessor functions.Werner Koch2016-06-072-1/+33
| | | | | | | | | | | | | | | | | | | * common/homedir.c (the_gnupg_homedir): New var. (gnupg_set_homedir): New. (gnupg_homedir): New. * g10/options.h (struct opt): Remove 'homedir' and replace all users by the new accessor functions. * g13/g13-common.h (struct opt): Ditto. * scd/scdaemon.h (struct opt): Ditto. * sm/gpgsm.h (struct opt): Ditto. * dirmngr/dirmngr.h (struct opt): Ditto. * agent/preset-passphrase.c (opt_homedir): Ditto. * agent/protect-tool.c (opt_homedir): Ditto. -- This will make detection of a non-default homedir easier. Signed-off-by: Werner Koch <[email protected]>
* common: New function openpgp_is_curve_supported.Werner Koch2016-06-022-4/+31
| | | | | | | | | * common/openpgp-oid.c: Include openpgpdefs.h. (oidtable): Add field pubkey_algo. (openpgp_is_curve_supported): New. -- Signed-off-by: Werner Koch <[email protected]>
* common: Add comments on how to enable backtrace().Werner Koch2016-06-021-1/+14
| | | | --
* gpg: New status code NOTATION_FLAGS.Werner Koch2016-05-311-0/+1
| | | | | | | | * common/status.h (STATUS_NOTATION_FLAGS: New. * g10/packet.h (struct notation): Add flags.human. (notation_t): New typedef. * g10/build-packet.c (sig_to_notation): Set flags.human. * g10/keylist.c (show_notation): Write STATUS_NOTATION_FLAGS.
* common: Add a status callback to gnupg_exec_tool_stream.Werner Koch2016-05-272-14/+94
| | | | | | | | | | | | * common/exectool.h (exec_tool_status_cb_t): New. * common/exectool.c: Include missing exectool.h. (read_and_log_buffer_t): Replace array by pointer. (gnupg_exec_tool_stream): Add args 'status_cb' and 'status_cb_value'. Change all callers to pass NULL for them. Malloc buffer for FDERRSTATE. (read_and_log_stderr): Implement status_fd feature. Signed-off-by: Werner Koch <[email protected]>
* common: Allow a second input stream for gnupg_exec_tool_stream.Werner Koch2016-05-276-31/+119
| | | | | | | | | | | | | | | | | | * common/exechelp-posix.c (do_exec): Add arg 'except' and pass to close_all_fds. (gnupg_spawn_process): Add arg 'except'. Change callers to pass NULL for it. * common/exechelp-w32.c (gnupg_spawn_process): Add dummy arg 'except'. * common/exechelp-w32ce.c (gnupg_spawn_process): Ditto. * common/exectool.c (copy_buffer_do_copy): Allow NULL for SINK. (gnupg_exec_tool_stream): Add arg 'inextra'. Change callers to pass NULL for it. Allow NULL for OUTPUT. -- This hack is a first step to allow calling gpg for verification of signatures. Signed-off-by: Werner Koch <[email protected]>
* common: Simplify the fd closing patch 512c56a.Werner Koch2016-05-271-3/+1
| | | | | | * common/exechelp-posix.c (get_max_fds): Use /proc/self. Signed-off-by: Werner Koch <[email protected]>
* common: Speedup closing fds before an exec.Werner Koch2016-05-271-0/+44
| | | | | | | | * common/exechelp-posix.c [__linux__]: Include dirent.h. (get_max_fds) [__linux__]: Return the actual used highest fd. -- Signed-off-by: Werner Koch <[email protected]>
* common: Extend gnupg_create_inbound_pipe et al.Werner Koch2016-05-275-24/+50
| | | | | | | | | | | | | | * common/exechelp-posix.c (gnupg_create_inbound_pipe): Add args 'r_fp' and 'nonblock'. (gnupg_create_outbound_pipe): Ditto. * common/exechelp-w32.c (gnupg_create_inbound_pipe): Add non yet functional args 'r_fp' and 'nonblock'. (gnupg_create_outbound_pipe): Ditto. * common/exechelp-w32ce.c (gnupg_create_inbound_pipe): Ditto. (gnupg_create_outbound_pipe): Ditto. -- Signed-off-by: Werner Koch <[email protected]>
* common: Make use of default_errsource in exechelp.Werner Koch2016-05-275-47/+57
| | | | | | | | | | | | | | | | | * common/exechelp-posix.c (my_error_from_syserror, my_error): New. Use them instead of gpg_error and gpg_error_from_syserror. (create_pipe_and_estream): Remove arg ERRSOURCE and fix use of OUTBOUND which has a wrong name. Adjust callers. (gnupg_spawn_process): Remove arg ERRSOURCE and replace by use of DEFAULT_ERRSOURCE. * common/exechelp-w32.c (gnupg_spawn_process): Ditto. * common/exechelp-w32ce.c (gnupg_spawn_process): Ditto. * common/exectool.c (gnupg_exec_tool_stream): Do not pass GPG_ERROR_FROM_SYSERROR. * tools/gpgconf-comp.c (gc_component_check_options): Ditto. (retrieve_options_from_program): Ditto. Signed-off-by: Werner Koch <[email protected]>
* common: Add simple dynamic array function.Werner Koch2016-05-244-1/+294
| | | | | | | | | | | * common/ccparray.c: New. * common/ccparray.h: New. * common/t-ccparray.c: New. * common/Makefile.am (common_sources): Add files. (module_tests): Add test file. (t_ccparray_LDADD): New. Signed-off-by: Werner Koch <[email protected]>
* common,w32: Silence an unused arg warning message.Werner Koch2016-05-241-0/+2
| | | | --
* gpg: Emit new status line KEY_CONSIDERED.Werner Koch2016-05-171-0/+1
| | | | | | | | | | | | | * common/status.h (STATUS_KEY_CONSIDERED): New. * g10/getkey.c: Include status.h. (LOOKUP_NOT_SELECTED, LOOKUP_ALL_SUBKEYS_EXPIRED): New. (finish_lookup): Add arg R_FLAGS. Count expired and revoked keys and set flag. Check a requested usage before checking for expiraion or revocation. (print_status_key_considered): New. (lookup): Print new status. Signed-off-by: Werner Koch <[email protected]>
* Some minor string changes and fixed a printf format.Werner Koch2016-05-041-1/+1
| | | | | | | * g10/build-packet.c (notation_value_to_human_readable_string): Use %zu for size_t. Signed-off-by: Werner Koch <[email protected]>
* common: Print https URLs in help messages.Werner Koch2016-05-031-4/+4
| | | | | | * common/argparse.c (strusage): Print https URLS. Signed-off-by: Werner Koch <[email protected]>
* tests: Silence output of some tests.Werner Koch2016-05-032-12/+24
| | | | | | | | | | | | | | * common/t-exechelp.c (print_open_fds): Silence non-verbose output. (test_close_all_fds): Ditto. * common/t-session-env.c (show_stdnames): Indent output. * g10/test.c (TEST): Silence non-verbose okay output. (exit_tests): Ditto. * tools/gpg-zip.in (tar_verbose_opt): Add option --quiet. * tests/openpgp/gpgtar.test (GPGZIP): Pass option --quiet. * tests/openpgp/mds.test: Indent MD5 notice. * tests/openpgp/version.test: Indent --version output. Signed-off-by: Werner Koch <[email protected]>
* gpg: Re-format some tofu messages.Werner Koch2016-05-021-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/status.h (STATUS_TOFU_USER, STATUS_TOFU_STATS) (STATUS_TOFU_STATS_SHORT, STATUS_TOFU_STATS_LONG): New. * g10/tofu.c (NO_WARNING_THRESHOLD): New. (record_binding, tofu_register): Take care of --dry-run. (show_statistics): Print STATUS_TOFU_USER. Reformat some messages. Fix the ngettext/strcmp thing. Use log_string instead of log_info. Use NO_WARNING_THRESHOLD constant. (get_trust): Use format_text and print a compact fingerprint. -- The use of log_string makes long messages better readable; instead of gpg: Warning: if you think you've seen more[...] key, then this key might be a forgery! Car[...] address for small variations. If the key i[...] we now have gpg: Warning: if you think you've seen more[...] key, then this key might be a forgery![...] address for small variations. If the [...] We also put the key information after the message and not between the user id and the last used info like here: gpg: Verified 7 messages signed by "Werner Koch <[email protected]>" in the past 4 days, 16 hours. The most recent message was verified 3 days, 13 hours ago. (key: 8061 5870 F5BA D690 3336 [...] 1E42 B367, policy: auto) This also makes the key info a separate translatable string. Further a compact version of the fingerprint (hex w/o spaces) is printed in some messages. Signed-off-by: Werner Koch <[email protected]>
* common: Extend log_string to indent lines.Werner Koch2016-04-291-3/+18
| | | | | | | * common/logging.c (do_logv): Add indentation when called via log_string. Signed-off-by: Werner Koch <[email protected]>
* common: Improve log_assert.Werner Koch2016-04-292-15/+39
| | | | | | | | | * common/logging.c (bug_at): Do not i18n the string. (_log_assert): New. * common/logging.h (log_assert): Use new function and pass line information. Signed-off-by: Werner Koch <[email protected]>
* common: Minor fixes for the new private-keys.c.Werner Koch2016-04-251-31/+41
| | | | | | | | | | | | | | | | | | | | | | | * common/private-keys.c (my_error_from_syserror): New. Use it in place of gpg_error_from_syserror. (_pkc_add, pkc_lookup, pke_next_value): Use ascii_strcasecmp. (pkc_parse): Use xtrystrdup and append_to_strlist_try as intended. (_pkc_add): Add braces around if-statement. -- We should have a macro so that we do not need to define a wrapper function like my_error_from_syserror in files where it is needed. I am not sure about a proper name, "my_" seems to be the easiest replacement. Note that the global DEFAULT_ERRSOURCE is relatively new to replace the need to convey the error source in function calls; we want that function from common/ return the error source of the main binary. We require that a key is ASCII and thus we better use ascii_strcasecmp to avoid problems with strange locales. Signed-off-by: Werner Koch <[email protected]>
* common: Use new function to print a failure of xtrymalloc.Werner Koch2016-04-253-3/+17
| | | | | | | | * common/miscellaneous.c (xoutofcore): New. * common/strlist.c (append_to_strlist): Use instead of abort. (append_to_strlist_try): Use xtrymalloc instead of xmalloc. Signed-off-by: Werner Koch <[email protected]>
* common: Drop unused variables, fix warnings.Justus Winter2016-04-212-3/+1
| | | | | -- Signed-off-by: Justus Winter <[email protected]>
* common: Add support for the new extended private key format.Justus Winter2016-04-215-2/+1400
| | | | | | | | | | | | | | | | | | | | | | | | | | * agent/findkey.c (write_extended_private_key): New function. (agent_write_private_key): Detect if an existing file is in extended format and update the key within if it is. (read_key_file): Handle the new format. * agent/keyformat.txt: Document the new format. * common/Makefile.am: Add the new files. * common/private-keys.c: New file. * common/private-keys.h: Likewise. * common/t-private-keys.c: Likewise. * common/util.h (alphap, alnump): New macros. * tests/migrations: Add test demonstrating that we can cope with the new format. -- GnuPG 2.3+ will use a new format to store private keys that is both more flexible and easier to read and edit by human beings. The new format stores name,value-pairs using the common mail and http header convention. This patch adds the parser and support code and prepares GnuPG 2.1 for the new format. Signed-off-by: Justus Winter <[email protected]>
* common: Add 'free_strlist_wipe' which wipes memory.Justus Winter2016-04-212-0/+16
| | | | | | | * common/strlist.c (free_strlist_wipe): New function. * common/strlist.h (free_strlist_wipe): New prototype. Signed-off-by: Justus Winter <[email protected]>
* common: Add 'append_to_strlist_try' which can fail.Justus Winter2016-04-212-0/+16
| | | | | | | | * common/strlist.c (append_to_strlist): Use the new function. (append_to_strlist_try): New function. * common/strlist.h (append_to_strlist_try): New prototype. Signed-off-by: Justus Winter <[email protected]>
* w32: Replace libiconv DLL by iconv feature of libgpg-error.Werner Koch2016-04-211-4/+12
| | | | | | | | | | | * configure.ac: Do nor require libiconv for W32. * common/utf8conv.c [W32]: Do not incluce iconv.h. Request libgpg-error iconv macros. (jnlib_iconv): Use ICONV_CONST macro. * build-aux/speedo/w32/inst.nsi [!WITH_GUI]: Do not install libiconv. * build-aux/speedo.mk (speedo_spkgs) [!WITH_GUI]: Likewise. Signed-off-by: Werner Koch <[email protected]>
* agent: Sanitize permissions of the private key directory.Justus Winter2016-04-202-24/+50
| | | | | | | | | | | | | * agent/gpg-agent.c (create_private_keys_directory): Set permissions. * common/sysutils.c (modestr_to_mode): New function. (gnupg_mkdir): Use new function. (gnupg_chmod): New function. * common/sysutils.h (gnupg_chmod): New prototype. * tests/migrations/from-classic.test: Test migration with existing directory. GnuPG-bug-id: 2312 Signed-off-by: Justus Winter <[email protected]>
* doc: Note that the persistant passphrase format is unimplemented.Werner Koch2016-04-121-1/+1
| | | | --
* Now build "gpg" binary but install as "gpg2"Werner Koch2016-04-041-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (USE_GPG2_HACK): New ac_define am_conditional. * common/homedir.c (gnupg_module_name): Replace use of macro NAME_OF_INSTALLED_GPG. * g10/keygen.c (generate_keypair): Ditto. * g10/Makefile.am (bin_PROGRAMS): Remove. (noinst_PROGRAMS): Add gpg or gpg2 and gpgv or gpg2. (gpg2_hack_list): New. (use_gpg2_hack): New. (gpg2_SOURCES): Rename to gpg_SOURCES. (gpgv2_SOURCES): Rename to gpgv_SOURCES. (gpg2_LDADD): Rename to gpg_LDADD. (gpgv2_LDADD): Rename to gpgv_LDADD. (gpg2_LDFLAGS): Rename to gpg_LDFLAGS. (gpgv2_LDFLAGS): Rename to gpgv2_LDFLAGS. (install-exec-hook): Remove WinCE specific rules and add new rules. (uninstall-local): Uninstall gpg/gpg2 and gpgv/gpgv2. * tests/openpgp/Makefile.am (required_pgms): s/gpg2/gpg/. * tests/openpgp/defs.inc: Ditto. * tests/openpgp/gpgtar.test: Ditto. * tests/openpgp/mkdemodirs: Ditto. * tests/openpgp/signdemokey: Ditto. * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): Remove obsolete --enable-mailto, add --enable-gpg2-is-gpg. -- Although we need to duplicate some automake generated code this method allows to easily switch the name of the installed target using the configure option "--enable-gpg2-is-gpg". Signed-off-by: Werner Koch <[email protected]>
* common: Provide a function for mapping packet types to strings.Neal H. Walfield2016-03-021-0/+28
| | | | | | | * common/openpgpdefs.h (pkttype_str): New function. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Rename pop_filter to iobuf_pop_filter and export it.Neal H. Walfield2016-03-022-11/+19
| | | | | | | | * common/iobuf.c (pop_filter): Rename from this... (iobuf_pop_filter): ... to this. Don't mark it as static. -- Signed-off-by: Neal H. Walfield <[email protected]>
* common: Update README.Justus Winter2016-03-021-11/+1
| | | | | -- Signed-off-by: Justus Winter <[email protected]>
* common: Consolidate Assuan server argument handling.Justus Winter2016-03-023-1/+201
| | | | | | | | | | | | | | | * common/Makefile.am (common_sources): Add new files. * common/server-help.c: New file. * common/server-help.h: Likewise. * agent/command.c: Drop argument handling primitives in favor of using the consolidated ones. * dirmngr/server.c: Likewise. * g10/server.c: Likewise. * g13/server.c: Likewise. * scd/command.c: Likewise. * sm/server.c: Likewise. Signed-off-by: Justus Winter <[email protected]>
* common: Reduce buffer size.Neal H. Walfield2016-02-231-2/+2
| | | | | | | | | | * common/iobuf.c (iobuf_copy): Change buffer size from 1 MB to 32 KB. -- Change suggested by Werner based on the observation that other buffers are of a similar size. Signed-off-by: Neal H. Walfield <[email protected]>
* common: Improve a function's documentation and comments.Neal H. Walfield2016-02-231-10/+14
| | | | | | | | * common/iobuf.c (iobuf_set_partial_body_length_mode): Fix documentation and comment. Add an assert. -- Signed-off-by: Neal H. Walfield <[email protected]>
* common: Add log_assert.Neal H. Walfield2016-02-231-0/+4
| | | | | | | * common/logging.h (log_assert): New macro. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Use higher-level functions.Neal H. Walfield2016-02-231-0/+3
| | | | | | | | | | * g10/build-packet.c (do_symkey_enc): Use iobuf_write instead of iobuf_put in a loop. Use iobuf_copy instead of iobuf_read and iobuf_write in a loop. Move the memory wiping from here... * common/iobuf.c (iobuf_copy): ... to here. -- Signed-off-by: Neal H. Walfield <[email protected]>
* common: Check for an error before reading.Neal H. Walfield2016-02-231-0/+3
| | | | | | | | * common/iobuf.c (iobuf_copy): If DEST has a pending error, don't start copying. -- Signed-off-by: Neal H. Walfield <[email protected]>
* common: More accurately name function.Neal H. Walfield2016-02-232-2/+2
| | | | | | | | * common/iobuf.c (iobuf_set_partial_block_mode): Rename from this... (iobuf_set_partial_body_length_mode): ... to this. Update callers. -- Signed-off-by: Neal H. Walfield <[email protected]>
* common/exechelp: Provide a way to wait for multiple processes.Justus Winter2016-02-234-75/+144
| | | | | | | | | | * common/exechelp-posix.c (gnupg_wait_process): Generalize to 'gnupg_wait_processes'. * common/exechelp-w32.c (gnupg_wait_process): Likewise. * common/exechelp-w32ce.c (gnupg_wait_process): New function stub. * common/exechelp.h (gnupg_wait_process): New prototype. Signed-off-by: Justus Winter <[email protected]>
* common/exechelp: Add general pipe function.Justus Winter2016-02-234-31/+59
| | | | | | | | | | | | | | | * common/exechelp-posix.c (gnupg_create_pipe): New function. * common/exechelp-w32.c (INHERIT_{READ,WRITE,BOTH}): New macros. (create_inheritable_pipe): Generalize so that both ends can be inherited. (do_create_pipe): Rename argument accordingly. (gnupg_create_{in,out}bound_pipe): Use new flags. (gnupg_create_pipe): New function. (gnupg_spawn_process): Use new flags. * common/exechelp-w32ce.c (gnupg_create_pipe): New stub. * common/exechelp.h (gnupg_create_pipe): New prototype. Signed-off-by: Justus Winter <[email protected]>
* common/exechelp: Mute the Windows version.Justus Winter2016-02-231-3/+4
| | | | | | | | * common/exechelp-w32.c (gnupg_wait_process): Do not print an error if the exit code can be returned. This makes the Windows version behave like the POSIX version. Signed-off-by: Justus Winter <[email protected]>