aboutsummaryrefslogtreecommitdiffstats
path: root/common (unfollow)
Commit message (Collapse)AuthorFilesLines
2016-04-21common: Drop unused variables, fix warnings.Justus Winter2-3/+1
-- Signed-off-by: Justus Winter <[email protected]>
2016-04-21common: Add support for the new extended private key format.Justus Winter5-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]>
2016-04-21common: Add 'free_strlist_wipe' which wipes memory.Justus Winter2-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]>
2016-04-21common: Add 'append_to_strlist_try' which can fail.Justus Winter2-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]>
2016-04-21w32: Replace libiconv DLL by iconv feature of libgpg-error.Werner Koch1-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]>
2016-04-20agent: Sanitize permissions of the private key directory.Justus Winter2-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]>
2016-04-12doc: Note that the persistant passphrase format is unimplemented.Werner Koch1-1/+1
--
2016-04-04Now build "gpg" binary but install as "gpg2"Werner Koch1-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]>
2016-03-02common: Provide a function for mapping packet types to strings.Neal H. Walfield1-0/+28
* common/openpgpdefs.h (pkttype_str): New function. -- Signed-off-by: Neal H. Walfield <[email protected]>
2016-03-02gpg: Rename pop_filter to iobuf_pop_filter and export it.Neal H. Walfield2-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]>
2016-03-02common: Update README.Justus Winter1-11/+1
-- Signed-off-by: Justus Winter <[email protected]>
2016-03-02common: Consolidate Assuan server argument handling.Justus Winter3-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]>
2016-02-23common: Reduce buffer size.Neal H. Walfield1-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]>
2016-02-23common: Improve a function's documentation and comments.Neal H. Walfield1-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]>
2016-02-23common: Add log_assert.Neal H. Walfield1-0/+4
* common/logging.h (log_assert): New macro. -- Signed-off-by: Neal H. Walfield <[email protected]>
2016-02-23gpg: Use higher-level functions.Neal H. Walfield1-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]>
2016-02-23common: Check for an error before reading.Neal H. Walfield1-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]>
2016-02-23common: More accurately name function.Neal H. Walfield2-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]>
2016-02-23common/exechelp: Provide a way to wait for multiple processes.Justus Winter4-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]>
2016-02-23common/exechelp: Add general pipe function.Justus Winter4-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]>
2016-02-23common/exechelp: Mute the Windows version.Justus Winter1-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]>
2016-02-23common/exechelp: Avoid magic numbers.Justus Winter1-2/+2
* common/exechelp-w32.c (do_create_pipe): Use symbolic names. Signed-off-by: Justus Winter <[email protected]>
2016-02-23common/exechelp: Disable debugging by default.Justus Winter1-1/+1
* common/exechelp-w32.c (DEBUG_W32_SPAWN): Set to 0. Signed-off-by: Justus Winter <[email protected]>
2016-02-23common/exechelp: Fix handle leak.Justus Winter1-0/+1
* common/exechelp-w32.c (gnupg_spawn_process_detached): Close process handle. Signed-off-by: Justus Winter <[email protected]>
2016-02-23common/exechelp: Fix opening the 'nul' device.Justus Winter1-5/+5
* common/exechelp-w32.c (gnupg_spawn_process): Fix opening the 'nul' device. Signed-off-by: Justus Winter <[email protected]>
2016-02-23common/exechelp: Fix error handling.Justus Winter1-2/+2
* common/exechelp-w32.c (gnupg_spawn_process): Close the right handle. Signed-off-by: Justus Winter <[email protected]>
2016-02-23common/exechelp: Fix pipe creation.Justus Winter1-1/+1
* common/exechelp-w32.c (gnupg_spawn_process): Fix the creation of the input pipe. Signed-off-by: Justus Winter <[email protected]>
2016-02-16w32: Do not error out if gpgconf is not installed.Werner Koch1-3/+1
* common/homedir.c (check_portable_app): Remove error message. -- It is sometimes useful to install just gpgv and no other parts. Our test for a portable application returned an error if gpgconf is not installed. That error is not required but was merely a debug aid. Signed-off-by: Werner Koch <[email protected]>
2016-02-15common, g10: Fix indentation to silence GCC-6.NIIBE Yutaka1-5/+5
* common/iobuf.c (iobuf_ioctl): Fix. * g10/encrypt.c (encrypt_filter): Likewise. * g10/keyring.c (prepare_search): Likewise. -- Signed-off-by: NIIBE Yutaka <[email protected]>
2016-02-14common: Fix comment.Neal H. Walfield1-1/+1
* common/iobuf.c (iobuf_flush_temp): Fix comment. -- Signed-off-by: Neal H. Walfield <[email protected]>
2016-02-13common: Make gnupg_exec_tool conform to spec.Werner Koch1-9/+18
* common/exectool.c (gnupg_exec_tool): Allocate extra byte. Allow zero length read. Append hidden byte. Release memory on error. -- Signed-off-by: Werner Koch <[email protected]>
2016-02-12common: Change simple_query to ignore status messages.Neal H. Walfield1-28/+67
* common/simple-pwquery.c (simple_query): Ignore status messages. -- Signed-off-by: Neal H. Walfield <[email protected]> GnuPG-bug-id: 2229
2016-01-26Update copyright years.Werner Koch1-2/+2
--
2016-01-26gpgtar,w32: Fix gpgtar 8 bit encoding handling on W32Andre Heinecke2-10/+57
* common/utf8conv.c (wchar_to_utf8): Factor code out to ... (wchar_to_cp): new. (utf8_to_wchar): Factor code out to ... (cp_to_wchar): new. (wchar_to_native): New. (native_to_wchar): New. * tools/gpgtar-create.c (fillup_entry_w32): Use native_to_wchar. (scan_directory): Use wchar_to_native. -- Gpgtar needs to handle filenames in the local 8 bit encoding on Windows as it uses the 8 bit file io functions. GnuPG-bug-id: 1624, 1746 Patch from bug 1624 modified to fit into GnuPG 2.1 by wk. Signed-off-by: Werner Koch <[email protected]>
2016-01-19common: Add substitute code for libgpg-error < 1.22.Werner Koch1-2/+4
* common/util.h (GPG_ERR_DB_CORRUPTED): New.
2016-01-13common: Make sure dotlock functions set a proper ERRNO.Werner Koch1-17/+87
* common/dotlock.c (map_w32_to_errno): New. (read_lockfile): Return a proper ERRNO. (dotlock_create_unix): Do not let log functions clobber ERRNO. (dotlock_take_unix): Ditto. (dotlock_release_unix): Ditto. (dotlock_create_w32): Set proper ERRNO. (dotlock_take_w32): Ditto. (dotlock_release_w32): Ditto. Signed-off-by: Werner Koch <[email protected]>
2016-01-12common: Fix iobuf API of filter function for alignment.NIIBE Yutaka1-2/+1
* common/iobuf.h: Fix comment. -- Signed-off-by: NIIBE Yutaka <[email protected]>
2016-01-12common: Fix iobuf API of filter function for alignment.NIIBE Yutaka3-26/+39
* common/iobuf.h (IOBUFCTRL_DESC): Change the call semantics. * common/iobuf.c (iobuf_desc): Add the second argument DESC. (print_chain, iobuf_close, do_open, iobuf_sockopen, iobuf_ioctl) (iobuf_push_filter2, pop_filter, iobuf_write_temp): Change calls of iobuf_desc. (file_filter, file_es_filter, sock_filter, block_filter): Fill the description. * common/t-iobuf.c (every_other_filter, double_filter): Likewise. * g10/armor.c, g10/cipher.c, g10/compress-bz2.c, g10/compress.c, g10/decrypt-data.c, g10/encrypt.c, g10/mdfilter.c, g10/progress.c, g10/textfilter.c: Likewise. -- Newer GCC warns against possible alignment difference of pointers. This change can silence those warnings. Signed-off-by: NIIBE Yutaka <[email protected]>
2016-01-08Print warnings if old daemon versions are used.Werner Koch1-0/+1
* common/status.h (STATUS_WARNING): New. * g10/call-agent.c (warn_version_mismatch): New. (start_agent): Call warn function. * g10/call-dirmngr.c: Include status.h. (warn_version_mismatch): New. (create_context): Call warn function. * sm/call-agent.c (warn_version_mismatch): New. (start_agent): Call warn function. (gpgsm_agent_learn): Call warn function. * sm/call-dirmngr.c (warn_version_mismatch): New. (prepare_dirmngr): Call warn function. -- We have seen too often bug reports which are due to still running old versions of the daemons. To catch this problematic use we now print warning messages and also provide the warning via the status interface. Signed-off-by: Werner Koch <[email protected]>
2016-01-08common: New function compare_version_strings.Werner Koch3-1/+150
* common/stringhelp.c (parse_version_number): New. (parse_version_string): New. (compare_version_strings): New. * common/t-stringhelp.c (test_compare_version_strings): New. (main): Call test. Return ERRCOUNT instead of 0. -- The code for that function is based on code from libgcrypt. Similar code is in all GnuPG related libraries this function is a candidates for inclusion in libgpg-error. Signed-off-by: Werner Koch <[email protected]>
2016-01-08common: New function get_assuan_server_version.Werner Koch2-0/+42
* common/asshelp.c: Include membuf.h. (get_assuan_server_version): New. * g10/call-agent.c (agent_get_version): Use new function. -- Signed-off-by: Werner Koch <[email protected]>
2016-01-08common: New put_membuf_cb to replace static membuf_data_cb.Werner Koch3-12/+16
* common/membuf.c (put_membuf_cb): New. * agent/call-scd.c (membuf_data_cb): Remove. Change callers to use put_membuf_cb. * common/get-passphrase.c (membuf_data_cb): Ditto. * g10/call-agent.c (membuf_data_cb): Ditto. * sm/call-agent.c (membuf_data_cb): Ditto. -- Signed-off-by: Werner Koch <[email protected]>
2016-01-06common: Avoid warnings about useless assignments.Werner Koch4-5/+0
* common/b64enc.c (b64enc_finish): Remove var assignment which is not used later. * common/iobuf.c (file_filter): Ditto. * common/tlv.c (do_find_tlv): Ditto. * common/userids.c (classify_user_id): Ditto. Signed-off-by: Werner Koch <[email protected]>
2016-01-06common: Do not deref vars in tests after a fail().Werner Koch4-38/+41
* common/t-convert.c (test_bin2hex): Turn if conditions into if-else chains to avoid accessing unchecked data. (test_bin2hexcolon): Ditto. * common/t-mapstrings.c (test_map_static_macro_string): Ditto. * common/t-stringhelp.c (test_percent_escape): Ditto. (test_make_filename_try): Ditto. (test_make_absfilename_try): Ditto. * common/t-timestuff.c (test_timegm): Ditto. -- Note that these dereference only occur after failed regression tests. Signed-off-by: Werner Koch <[email protected]>
2015-12-21common: New file fwddecl.h.Werner Koch4-13/+45
* common/util.h (server_control_s, ctrl_t): Move to ... * common/fwddecl.h: New file. * common/call-gpg.h: Replace typedef by fwddecl.h. Change include protection macro name. * common/Makefile.am (common_sources): Add fwddecl.h. -- It seems some compilers do not grok a re-declaration. Thus we factor it out into a separate file and use the include protection macro to protect against re-declaration. GnuPG-bug-id: 2200 Signed-off-by: Werner Koch <[email protected]>
2015-12-15common: Use default_errsource for call-gpg and exectool.Werner Koch2-22/+42
* common/call-gpg.c (my_error_from_syserror, my_error_from_errno): New. Use these wrappers. * common/exectool.c (my_error_from_syserror): New. Use these wrappers. -- Function in common should use the error source of the component which links them. The global variable DEFAULT_ERRSOURCE is set early by each component to make this possible. Signed-off-by: Werner Koch <[email protected]>
2015-12-14common: Change license of isascii.c to all-premissive,Werner Koch1-13/+6
* common/isascii.c: Change. -- Actually this code is too trivial to claim any copyright at all.
2015-12-14common: Change license of some modules to LGPLv3+/GPLv2+.Werner Koch6-30/+90
* common/status.c: Change from GPLv3 to LGPLv3+/GPLv2+. * common/status.h: Ditto. * common/yesno.c: Ditto. * common/common-defs.h: Ditto. * common/gettime.h: Ditto. * common/keyserver.h: Ditto. -- This is shared code and trivial enough to allow use under GPLv2+ so to allow use by GPLv2only software. Some of the headers are simply adjusted to the license of their implementation. Signed-off-by: Werner Koch <[email protected]>
2015-12-14common: Change license for exectool to LGPLv3+/GPLv2+.Werner Koch2-10/+30
* common/exectool.c, common/exectool.h: Change license. -- We always try to use this license for shared code. Signed-off-by: Werner Koch <[email protected]>
2015-12-14common: Rename sh-exectool to exectool.Werner Koch3-17/+17
* common/sh-exectool.c: Rename to exectool.c. * common/sh-exectool.h: Rename to exectool.h. * common/Makefile.am (common_sources): Adjust for rename. * common/exectool.c (sh_exec_tool_stream): Rename to gnupg_exec-tool-stream. (sh_exec_tool): Rename to gnupg_exec_tool. * tools/gpgtar-create.c (gpgtar_create): Adjust for changes. * tools/gpgtar-extract.c: Adjust for changes. * tools/gpgtar-list.c: Adjust for changes. -- The "sh-" presifx is used by g13 for system helpers which are used by processes created via userv. A generic function in common/ should also have a generic name. Signed-off-by: Werner Koch <[email protected]>