summaryrefslogtreecommitdiffstats
path: root/common/homedir.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Require gpgrt 1.51Werner Koch2024-12-041-1/+3
| | | | | | | | | * configure.ac (NEED_GPGRT_VERSION): Bump to 1.51. * g10/keydb.c (internal_keydb_update_keyblock) [!USE_TOFU]: Mark an arg unused. * common/homedir.c (create_common_conf) [!BUILD_WITH_KEYBOXD]: Mark an arg unused.
* common: Fix a race condition in creating socketdir.NIIBE Yutaka2024-10-161-4/+14
| | | | | | | | | | * common/homedir.c (_gnupg_socketdir_internal): Check return code of gnupg_mkdir and handle the case of GPG_ERR_EEXIST. -- GnuPG-bug-id: 7332 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* build: Remove configure option --enable-gpg-is-gpg2Werner Koch2024-09-111-12/+2
| | | | | | | | | | | | | | | | | * configure.ac (--enable-gpg-is-gpg2): Remove option. (USE_GPG2_HACK): Remove var. * common/homedir.c (gnupg_module_name): Remove code for gpg2 installation option. * g10/keygen.c (generate_keypair): Ditto. * g10/Makefile.am (noinst_PROGRAMS): Ditto. * doc/gpg.texi: Ditto. * doc/gpgv.texi: Ditto. -- This option and all its build stuff does not make anymore sense. gpg1 is way too old for anyone to use on a regualar base along with a standard gpg. It is better to rename that single gpg (1.4) binary to gpg1 and adjust any scripts.
* indent: Fix spellingDaniel Kahn Gillmor2024-05-311-2/+2
| | | | | | | | | | | | | -- These are non-substantive corrections for minor spelling mistakes within the GnuPG codebase. With something like this applied to the codebase, and a judiciously tuned spellchecker integrated as part of a standard test suite, it should be possible to keep a uniform orthography within the project. GnuPG-bug-id: 7116
* Allow installation with a gpgconf.ctl changed homedir.Werner Koch2024-03-211-16/+119
| | | | | | | | | | | | | | | | | | | | | | | * common/homedir.c (gpgconf_ctl): Add field "gnupg". (parse_gpgconf_ctl): Support keyword "gnupg". (my_gnupg_dirname): New. (my_fixed_default_homedir): New. (gnupg_registry_dir): New. (standard_homedir): Use my_gnupg_dirname and my_fixed_default_homedir. (default_homedir): Use gnupg_registry_dir and my_fixed_default_homedir. (_gnupg_socketdir_internal): Use my_gnupg_dirname. Increase size of prefixbuffer. (gnupg_sysconfdir): Use my_gnupg_dirname. * tools/gpgconf.c (list_dirs): Use gnupg_registry_dir. (show_other_registry_entries): Ditto. -- This will be useful to install versions of GnuPG VS-Desktop and GnuPG Desktop in addition to a standard GnuPG version. Only basic tests on Unix done; Windows testing is still outstanding. GnuPG-bug-id: 7040
* common: Use a common gpgconf.ctl parser for Unix and Windows.Werner Koch2024-03-211-201/+250
| | | | | | | | | | | | | | | | | * common/homedir.c (gpgconf_ctl): new struct. (string_is_true): New. (parse_gpgconf_ctl): New. Based on the former code in unix_rootdir. (check_portable_app): Use parse_gpgconf_ctl and the new struct. (unix_rootdir): Ditto. -- This is a unification of the gpgconf.ctl mechanism. For backward compatibility we need to keep the empty (or actually only comments) method as used formerly under Windows. Iff one really wants a portable application the new portable keyword should be used, though. Noet that the Windows portable stuff has not been tested for quite some time.
* common,w32: Remove duplicated backslashes when setting the homedir.Werner Koch2024-01-091-0/+27
| | | | | | | | | | | | * common/homedir.c (copy_dir_with_fixup) [W32]: Fold double backslashes. -- This is in general no problem but when we hash or compare the directory to test whether tit is the standard home directory, we may use a different socket file and thus a second instance of a daemon. GnuPG-bug-id: 6833
* common: Add keyword socketdir to gpgconf.ctlWerner Koch2023-12-221-44/+91
| | | | | | | | | | | * common/homedir.c (enum wantdir_values): New enums. (unix_rootdir): Change arg to use the enums. Adjust all callers. Add support for the socketdir keyword. (_gnupg_socketdir_internal): Take care of the socketdir keyword in gpgconf.ctl. * doc/tools.texi (Files used by gpgconf): Briefly explain the gpgconf.ctl syntax.
* common: Improve the parsing of gpgconf.ctl variables.Werner Koch2023-12-191-30/+27
| | | | | | | | * common/homedir.c (unix_rootdir): Simplify. -- This also relaxes the syntax in that the equal sign may now be surrounded by any number of spaces.
* Use keyboxd on a fresh install also on Windows.Werner Koch2023-04-191-32/+40
| | | | | | | | | | * common/homedir.c (gnupg_maybe_make_homedir): Factor some code out to ... (create_common_conf): new. (standard_homedir): Call it also from here. -- Fixes-commit: d9e7488b17fdc617eec735e2c0485b69285ba511
* gpgtar: Read common.conf for the log-file option.Werner Koch2023-04-181-0/+3
| | | | | | | | | | | | | | | * common/util.h (GNUPG_MODULE_NAME_GPGTAR): New. * common/homedir.c (gnupg_module_name): Add it. * tools/gpgtar.c: Include comopt.h. (enum cmd_and_opt_values): Add oDebug. (opts): Add --debug. (any_debug): New. (main): Parse common.conf. -- Having a way to see the output of gpgtar is often useful for debugging. The only effect of the debug option is to show whether common.conf was read.
* Use the keyboxd for a fresh installWerner Koch2023-04-041-2/+36
| | | | | | | | | | | | * common/homedir.c (gnupg_maybe_make_homedir): Also create a common.conf. * g10/keydb.c: Include comopt.h. (maybe_create_keyring_or_box): Detect the creation of a common.conf. * g10/gpg.c (main): Avoid adding more resources in this case. * sm/keydb.c: Include comopt.h. (maybe_create_keybox): Detect the creation of a common.conf. * common/comopt.h (comopt): Remove the conditional "extern".
* tests: Restrict the use of gpgconf.ctl to make check.Werner Koch2022-09-141-1/+29
| | | | | | | | | | | | | | | | | | | * common/homedir.c (unix_rootdir): Add ".enable" statement to gpgconf.ctl * tests/gpgconf.ctl.in: Use this statement. * tests/cms/Makefile.am (OLD_TESTS_ENVIRONMENT): Enable .enable. (TESTS_ENVIRONMENT): Ditto. * tests/gpgme/Makefile.am (TESTS_ENVIRONMENT): Ditto. * tests/migrations/Makefile.am (TESTS_ENVIRONMENT): Ditto. * tests/openpgp/Makefile.am (TESTS_ENVIRONMENT): Ditto. * tests/pkits/Makefile.am (TESTS_ENVIRONMENT): Ditto. * tests/tpm2dtests/Makefile.am (TESTS_ENVIRONMENT): Ditto. -- Without that it was required to delete the gpgconf.ctl to run manual tests. What a hack.
* common: New common option no-autostart.Werner Koch2022-08-221-0/+3
| | | | | | | | | | | | | | | | | | | | * common/comopt.c (opts): Add "no-autostart". (parse_comopt): Set it. * common/comopt.h (comopt): Add no_autostart. * g10/gpg.c (main): Take care of the new option. * sm/gpgsm.c (main): Ditto. * tools/gpg-connect-agent.c (INCLUDED_BY_MAIN_MODULE): Add. (main): Parse common options and handle new option. * tools/gpg-card.c (main): Ditto. (cmd_yubikey): Fix minor error reporting issue. * common/util.h (GNUPG_MODULE_NAME_CARD): New const. * common/homedir.c (gnupg_module_name): Support it. -- Having a global option makes it easier to use disable autostart on a server which is required to use a remote gpg-agent reliable.
* common,w32: Fix early home dir creation.Werner Koch2022-03-251-20/+2
| | | | | | | | * common/homedir.c (w32_try_mkdir): Remove. (standard_homedir): Call gnupg_mkdir directly. (_gnupg_socketdir_internal): Ditto. -- GnuPG-bug-id: 5895
* homedir: Avoid memory leaks on errorsJakub Jelen2021-11-241-0/+2
| | | | | | | | * common/homedir.c (unix_rootdir): Free allocated memory on error path -- GnuPG-bug-id: 5393 Signed-off-by: Jakub Jelen <jjelen@redhat.com>
* common: Support MYPROC_SELF_EXE for SolarisWerner Koch2021-10-271-0/+2
| | | | | | | * common/homedir.c (MYPROC_SELF_EXE): Add case for SunOS. -- GnuPG-bug-id: 5671
* common: Silence warning from unix_rootdir on systems w/o /procWerner Koch2021-10-201-4/+6
| | | | | | | | | * common/homedir.c (unix_rootdir): Silence diagnostic in the common case. (MYPROC_SELF_EXE): Support NetBSD. -- GnuPG-bug-id: 5656
* common: Support gpgconf.ctl also for BSDs.Werner Koch2021-10-011-10/+25
| | | | | | | | | | * common/homedir.c (MYPROC_SELF_EXE): New. (unix_rootdir): Use it here. Also support GNUPG_BUILD_ROOT as fallback. -- In addition this adds a fallback method for AIX etc which do not have an easy way to get the info.
* common: Add keyword sysconfdir to the optional gpgconf.ctl file.Werner Koch2021-10-011-18/+69
| | | | | | | | | | * common/homedir.c (unix_rootdir): Add arg want_sysconfdir. (gnupg_sysconfdir): Return it. -- Our regression test suite has the problem that we can't disable the use of the global config files or test them using the regualr binaries. This new keyword will allow us to overcome the problem.
* common: Support a gpgconf.ctl file under Unix.Werner Koch2021-09-171-17/+252
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/homedir.c (unix_rootdir): New. (gnupg_bindir): Use it. (gnupg_libexecdir): Use it. (gnupg_libdir): Use it. (gnupg_datadir): Use it. (gnupg_localedir): Use it. -- This feature is useful for building and using an AppImage version of gnupg and probably also for some other use cases. GnuPG-bug-id: 5999 Here is a sample gpgconf.ctl file --8<---------------cut here---------------start------------->8--- # gpgconf.ctl # # This file is used to change the directories where the gpg components # are installed. It does not change the configuration directories. # The file is expected in the same directory as gpgconf. The physical # installation directories are evaluated and no symlinks. Blank lines # and lines starting with pound signed are ignored. No errors are # printed for unknown keywords or commands. The only defined key for # now is "rootdir" which must be followed by one optional space, an # equal sign, and the value for the root directory. Environment # variables are substituted in standard shell manner, the final value # must start with a slash, trailing slashed are stripped. rootdir = $APPDIR/gnupg --8<---------------cut here---------------end--------------->8---
* w32: Move socketdir to LCOAL_APPDATAWerner Koch2021-08-111-84/+122
| | | | | | | | | | | | | | | | | | | | | | | * common/homedir.c (is_gnupg_default_homedir): Use standard_homedir instead of the constant which makes a difference on Windows. (_gnupg_socketdir_internal) [W32]: Move the directory to LOCAL_APPDATA. (gnupg_cachedir): Remove unsued function. * common/sysutils.c (gnupg_rmdir): New. * tools/gpgconf.c (main): s/rmdir/gnupg_rmdir/. -- That is actually a more correct directory than APPDATA. This fixes a problem with installations where the APPDATA is non a network drive and the resulting socket filename is truncated in our socket helper function (because we use sockaddr also for our local socket emulation on Windows). LOCAL_APPDATA is expected to be on the local box and thus in the majority of cases the resulting socket file name will be short enough. GnuPG-bug-id: 5537 Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Annotate leaked memory in homedir.cWerner Koch2021-05-211-12/+61
| | | | | | | | | | | | | | | | | | | | | * g10/trustdb.c (how_to_fix_the_trustdb): Use gnupg_homedir. * common/homedir.c (standard_homedir): Annotate leaked memory. (gnupg_daemon_rootdir): Ditto. (gnupg_socketdir): Ditto. (gnupg_sysconfdir): Ditto. (gnupg_bindir): Ditto. (gnupg_libdir): Ditto. (gnupg_datadir): Ditto. (gnupg_localedir): Ditto. (gnupg_cachedir): Ditto. (gpg_agent_socket_name): Ditto. (dirmngr_socket_name): Ditto. (keyboxd_socket_name): Ditto. (get_default_pinentry_name): Ditto. (gnupg_module_name): Ditto. (default_homedir): Ditto. Make static. Signed-off-by: Werner Koch <wk@gnupg.org>
* tpm2d: Add tpm2daemon codeJames Bottomley2021-03-101-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tpm2d: New directory. * Makefile.am (SUBDIRS): Add directory. * configure.ac: Detect libtss and decide whether to build tpm2d. * am/cmacros.am: Add a define. * util.h (GNUPG_MODULE_NAME_TPM2DAEMON): New. * common/homedir.c (gnupg_module_name): Add tpm2d. * common/mapstrings.c (macros): Add "TPM2DAEMON". * tools/gpgconf.h (GC_COMPONENT_TPM2DAEMON): New. * tools/gpgconf-comp.c (known_options_tpm2daemon): New. (gc_component): Add TPM2. (tpm2daemon_runtime_change): New. * tpm2d/Makefile.am: New. * tpm2d/command.c: New. * tpm2d/ibm-tss.h: New. * tpm2d/tpm2.c: New. * tpm2d/tpm2.h: New. * tpm2d/tpm2daemon.c: New. * tpm2d/tpm2daemon.h: New. --- This commit adds and plumbs in a tpm2daemon to the build to mirror the operation of scdaemon. The architecture of the code is that tpm2daemon.c itself is pretty much a clone of scd/scdaemon.c just with updated function prefixes (this argues there could be some further consolidation of the daemon handling code). Note that although this commit causes the daemon to be built and installed, nothing actually starts it or uses it yet. Command handling ---------------- command.c is copied from the command handler in scd.c except that the command implementation is now done in terms of tpm2 commands and the wire protocol is far simpler. The tpm2daemon only responds to 4 commands IMPORT: import a standard s-expression private key and export it to TPM2 format. This conversion cannot be undone and the private key now can *only* be used by the TPM2. To anyone who gets hold of the private key now, it's just an encrypted binary blob. PKSIGN: create a signature from the tpm2 key. The TPM2 form private key is retrieved by KEYDATA and the hash to be signed by EXTRA. Note there is no hash specifier because the tpm2 tss deduces the hash type from the length of the EXTRA data. This is actually a limitation of the tpm2 command API and it will be interesting to see how this fares if the tpm2 ever supports say sha3-256 hashes. PKDECRYPT: decrypt (RSA case) or derive (ECC case) a symmetric key. The tpm2 for private key is retrieved by KEYDATA and the information used to create the symmetric key by EXTRA. KILLTPM2D: stop the daemon All the tpm2 primitives used by command.c are in tpm2.h and all the tpm2 specific gunk is confined to tpm2.c, which is the only piece of this that actually does calls into the tss library. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> Changes from James' patch: - gpgconf: The displayed name is "TPM" and not "TPM2". That string is used by GUIs and should be something the user understands. For example we also use "network" instead of "Dirmngr". - Removed some commented includes. - Use 16 as emulation of GPG_ERR_SOURCE_TPM2. - Silenced a C90 compiler warning and flags unused parameters. - Removed "if HAVE_LIBS" from tpm2/Makefile.am and add missing files so that make distcheck works. Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Fix duplicate implementation of try_make_homedir.Werner Koch2020-11-041-0/+33
| | | | | | | | | | | * g10/openfile.c (try_make_homedir): Move core of the code to ... * common/homedir.c (gnupg_maybe_make_homedir): new. * sm/keydb.c (try_make_homedir): Implement using new function. * common/homedir.c: Include i18n.h. * po/POTFILES.in: Add common/homedir.c. Signed-off-by: Werner Koch <wk@gnupg.org>
* w32: Add another pinentry search pathAndre Heinecke2020-11-041-0/+2
| | | | | | | | | | | | * common/homedir.c (get_default_pinentry_name): Try ../bin/pinentry.exe -- In an installation layout where GnuPG is installed as a component of another software it might be useful to have pinentry placed in a different bin directory without the forced folder name of Gpg4win. (cherry picked from commit b4cb91d5fbe2b8917d76d12eb72aaac0d97ed596)
* Replace all calls to access by gnupg_accessWerner Koch2020-10-201-41/+36
| | | | | | | | | | | | | | | | * common/sysutils.c (gnupg_access): New. Replace all calls to access by this wrapper. * common/homedir.c (w32_shgetfolderpath): Change to return UTF-8 directory name. (standard_homedir): Adjust for change. (w32_commondir, gnupg_cachedir): Ditto. -- Also use SHGetFolderPathW instead of SHGetFolderPathA on Windows. This is required to correctly handle non-ascii filenames on Windows. GnuPG-bug-id: 5098
* keyboxd: Integrate into gpgconf.Werner Koch2020-09-241-1/+13
| | | | | | | | | | | | | | * common/asshelp.c (lock_spawning): Use a dedicated name for keyboxd. * common/homedir.c (keyboxd_socket_name): New. (gnupg_module_name): Put keyboxd into libexecdir. * tools/gpgconf-comp.c (known_options_keyboxd): New. (gc_component): Add entry for keyboxd. (keyboxd_runtime_change): New. (gc_component_launch): Support keyboxd. * tools/gpgconf.c (list_dirs): Emit new item keyboxd-socket. (main): Also remove keyboxd socket. Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Fix name of keyboxd.Werner Koch2020-09-221-1/+1
| | | | * common/homedir.c (gnupg_module_name): Fix name.
* Spelling cleanup.Daniel Kahn Gillmor2020-02-191-1/+1
| | | | | | | | | | | | | | | | No functional changes, just fixing minor spelling issues. --- Most of these were identified from the command line by running: codespell \ --ignore-words-list fpr,stati,keyserver,keyservers,asign,cas,iff,ifset \ --skip '*.po,ChangeLog*,help.*.txt,*.jpg,*.eps,*.pdf,*.png,*.gpg,*.asc' \ doc g13 g10 kbx agent artwork scd tests tools am common dirmngr sm \ NEWS README README.maint TODO Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
* gpgconf,w32: Print a warning for a suspicious homedir.Werner Koch2020-01-171-0/+3
| | | | | | | | * tools/gpgconf.c (list_dirs): Check whether the homedir has been taken from the registry. -- Signed-off-by: Werner Koch <wk@gnupg.org>
* tools: New option --keyboxd for gpg-connect-agent.Werner Koch2019-08-061-0/+7
| | | | | | | | | | | | | | | | | | | | | | | * configure.ac: New option --keyboxd-pgm. (KEYBOXD_NAME, KEYBOXD_DISP_NAME): New ac_defines. * common/util.h: Add substitutes for new error codes. (GNUPG_MODULE_NAME_KEYBOXD): New. * common/homedir.c (gnupg_module_name): Support GNUPG_MODULE_NAME_KEYBOXD. * common/asshelp.c (SECS_TO_WAIT_FOR_KEYBOXD): New. (wait_for_sock): Support keyboxd. (start_new_service): Ditto. (start_new_keyboxd): New. * tools/gpg-connect-agent.c: New options --keyboxd and --keyboxd-program. (start_agent): Implement new option. -- This change allows us to test the new keyboxd using our standard helper. It also provides the necessary code to start keyboxd on the fly. Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Remove code duplication for service starting.Werner Koch2019-08-051-0/+11
| | | | | | | | | | | | | * common/homedir.c (gpg_agent_socket_name): New. * common/asshelp.c (start_new_service): New. Based on start_new_gpg_agent. (start_new_gpg_agent): Divert to start_new_service. (start_new_dirmngr): Ditto. -- This prepares for adding yet another service starting function. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg,w32: Fix empty homedir when only a drive letter is used.Werner Koch2018-04-091-32/+63
| | | | | | | | | | | | | | | | | * common/homedir.c (copy_dir_with_fixup): New. (default_homedir): Use here. (gnupg_set_homedir): And here . -- This actually fixes a couple of cases for Windows. Both --home-dir and GNUPGHOME. The interpretation of "c:" -> "c:/" might not be the correct one but because we need an absolute dir anyway it is the less surprising one. Note that this does not include a full syntax check and fixup and thus it is very well possible that the result is not an absolute directory. GnuPG-bug-id: 3720 Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Use larger buffer for homedir in case of 64 bit UIDs.Werner Koch2017-12-201-1/+1
| | | | | | | | | | | | | | * common/homedir.c (_gnupg_socketdir_internal): Enlarge PREFIX by 6 bytes for "/gnupg". -- The temporary buffer was to short for the extra "/gnupg". However the 20 bytes for the UID is large enough for all 32 bit UIDs and would only fail (detected) if a 64 bit UID is used. Fixes-commit: 17efcd2a2acdc3b7f00711272aa51e5be2476921 Reported-by: Rainer Perske. Signed-off-by: Werner Koch <wk@gnupg.org>
* build: New configure option --enable-run-gnupg-user-socket.Werner Koch2017-12-121-2/+12
| | | | | | | | | | | | | * configure.ac: (USE_RUN_GNUPG_USER_SOCKET): New ac_define. * common/homedir.c (_gnupg_socketdir_internal): Add extra directories. -- This allows to build GnuPG with an extra socketdir below /run. See https://lists.gnupg.org/pipermail/gnupg-devel/2017-November/033250.html for a longer explanation why this is sometimes useful. Suggested-by: Rainer Perske Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Strip trailing slashes from the homedir.Werner Koch2017-07-251-6/+57
| | | | | | | | | | | | | | | | | | * common/homedir.c (default_homedir): Strip trailing slashes. (gnupg_set_homedir): Ditto. -- is_gnupg_default_homedir() does not ignore trailing slashes when comparing directory names. This can lead to multiple agents started on the same directory if the homedir was specified with --homedir or GNUPGHOME without or with a number of slashes. We now make sure that the home directory name never ends in a slash (except for the roo of course). GnuPG-bug-id: 3295 Signed-off-by: Werner Koch <wk@gnupg.org>
* common: New functions gnupg_daemon_rootdir and gnupg_chdir.Werner Koch2017-07-251-0/+28
| | | | | | | | | | | * common/sysutils.c (gnupg_chdir): New. * common/homedir.c (gnupg_daemon_rootdir): New. * agent/gpg-agent.c (main): Use these functions instead chdir("/"). * dirmngr/dirmngr.c (main): Ditto. * scd/scdaemon.c (main): Ditto. -- Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Fix connecting to the agent.Justus Winter2017-03-271-0/+2
| | | | | | | | | | | | | | | * common/homedir.c (_gnupg_socketdir_internal): Fix error handling. -- Prior to 26086b36 the non-existance of the socket directory was considered an error if a non-default home directory is used. Since 26086b36 we now create the directory on demand, but the function still returned the fallback path. This made the agent bind the socket in the socket directory, and the client trying to connect to the socket in the home directory. Fixes-commit: 26086b362ff47d21b1abefaf674a6464bf0a8921 Signed-off-by: Justus Winter <justus@g10code.com>
* common: Implicitly do a gpgconf --create-socketdir.Werner Koch2017-03-231-7/+18
| | | | | | | | | | | | * common/homedir.c (_gnupg_socketdir_internal): Create the sub-directory. -- Although there is no auto cleanup (yet) this should be helpful. Let's see whether possibly leaving stale directories around is better than running into trouble when --create-socketdir was not used. Signed-off-by: Werner Koch <wk@gnupg.org>
* build: Add kludge for "make distcheck" in a release build.Werner Koch2017-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * configure.ac: New option --enable-gnupg-builddir-envvar. (ENABLE_GNUPG_BUILDDIR_ENVVAR): New ac_define. * common/homedir.c (gnupg_set_builddir_from_env): Consider ENABLE_GNUPG_BUILDDIR_ENVVAR. * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): Rename to ... (AM_DISTCHECK_CONFIGURE_FLAGS): this to be future proof. Add option --enable-gnupg-builddir-envvar. -- Our regression test suite makes use of the envvar GNUPG_BUILDDIR. Now the code in gnupg for evaluating this envvar is only included in a development version (that is one with a "-betaNNN" suffix). For a real release the envvar is not considered. However during a "make distcheck" a "make check" is done for the build directory. Without defining that envar we would try to run binaries in the install directory ("_inst" sub-directory) which are not yet installed at that time. Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Support locating components in the build tree.Justus Winter2016-12-141-17/+64
| | | | | | | | | | | | | | | | | | | | | | | | | * 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 <justus@g10code.com>
* Change all http://www.gnu.org in license notices to https://Werner Koch2016-11-051-1/+1
| | | | --
* common: Add GNUPG_MODULE_NAME_GPGV.Werner Koch2016-10-271-0/+7
| | | | | | | * common/util.h (GNUPG_MODULE_NAME_GPGV): New. * common/homedir.c (gnupg_module_name): Implement. Signed-off-by: Werner Koch <wk@gnupg.org>
* dirmngr: Remove all system daemon features.Werner Koch2016-08-181-48/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 <wk@gnupg.org>
* 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 <wk@gnupg.org>
* Implement /run/user/UID/gnupg based sockets.Werner Koch2016-06-081-20/+223
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 <wk@gnupg.org>
* common: New function gnupg_socketdir.Werner Koch2016-06-071-2/+31
| | | | | | | | | | | | | | | * 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 <wk@gnupg.org>
* Replace use of opt.homedir by accessor functions.Werner Koch2016-06-071-1/+31
| | | | | | | | | | | | | | | | | | | * 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 <wk@gnupg.org>
* 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 <wk@gnupg.org>