diff --git a/agent/cache.c b/agent/cache.c index 19f250217..abbf8c653 100644 --- a/agent/cache.c +++ b/agent/cache.c @@ -35,7 +35,7 @@ we use one context to do all encryption and decryption. */ static pth_mutex_t encryption_lock; /* The encryption context. This is the only place where the - encryption key for all cached entries is available. It would nice + encryption key for all cached entries is available. It would be nice to keep this (or just the key) in some hardware device, for example a TPM. Libgcrypt could be extended to provide such a service. With the current scheme it is easy to retrieve the cached entries diff --git a/common/ChangeLog b/common/ChangeLog index 35dd2d8a4..0c8698bab 100644 --- a/common/ChangeLog +++ b/common/ChangeLog @@ -1,3 +1,12 @@ +2010-09-13 Werner Koch + + * homedir.c (gnupg_bindir) [W32CE]: Change to bin/. + (gnupg_libexecdir) [W32]: Call gnupg_bindir. + (gnupg_libdir, gnupg_datadir, gnupg_localedir) [W32]: Simplify by + using xstrconcat. + (gnupg_module_name): Ditto. + (w32_rootdir): Strip a trailing "bin". + 2010-09-02 Werner Koch * util.h (GPG_ERR_NOT_INITIALIZED): Define if not defined. diff --git a/common/homedir.c b/common/homedir.c index b1bde095c..69a18d76d 100644 --- a/common/homedir.c +++ b/common/homedir.c @@ -217,8 +217,15 @@ w32_rootdir (void) got_dir = 1; p = strrchr (dir, DIRSEP_C); if (p) - *p = 0; - else + { + *p = 0; + /* If we are installed below "bin" we strip that and use + the top directory instead. */ + p = strrchr (dir, DIRSEP_C); + if (p && !strcmp (p+1, "bin")) + *p = 0; + } + if (!p) { log_debug ("bad filename `%s' returned for this process\n", dir); *dir = 0; @@ -291,7 +298,13 @@ gnupg_sysconfdir (void) const char * gnupg_bindir (void) { -#ifdef HAVE_W32_SYSTEM +#if defined (HAVE_W32CE_SYSTEM) + static char *name; + + if (!name) + name = xstrconcat (w32_rootdir (), DIRSEP_S "bin", NULL); + return name; +#elif defined(HAVE_W32_SYSTEM) return w32_rootdir (); #else /*!HAVE_W32_SYSTEM*/ return GNUPG_BINDIR; @@ -305,7 +318,7 @@ const char * gnupg_libexecdir (void) { #ifdef HAVE_W32_SYSTEM - return w32_rootdir (); + return gnupg_bindir (); #else /*!HAVE_W32_SYSTEM*/ return GNUPG_LIBEXECDIR; #endif /*!HAVE_W32_SYSTEM*/ @@ -318,13 +331,7 @@ gnupg_libdir (void) static char *name; if (!name) - { - const char *s1, *s2; - s1 = w32_rootdir (); - s2 = DIRSEP_S "lib" DIRSEP_S "gnupg"; - name = xmalloc (strlen (s1) + strlen (s2) + 1); - strcpy (stpcpy (name, s1), s2); - } + name = xstrconcat (w32_rootdir (), DIRSEP_S "lib" DIRSEP_S "gnupg", NULL); return name; #else /*!HAVE_W32_SYSTEM*/ return GNUPG_LIBDIR; @@ -338,13 +345,7 @@ gnupg_datadir (void) static char *name; if (!name) - { - const char *s1, *s2; - s1 = w32_rootdir (); - s2 = DIRSEP_S "share" DIRSEP_S "gnupg"; - name = xmalloc (strlen (s1) + strlen (s2) + 1); - strcpy (stpcpy (name, s1), s2); - } + name = xstrconcat (w32_rootdir (), DIRSEP_S "share" DIRSEP_S "gnupg", NULL); return name; #else /*!HAVE_W32_SYSTEM*/ return GNUPG_DATADIR; @@ -359,13 +360,8 @@ gnupg_localedir (void) static char *name; if (!name) - { - const char *s1, *s2; - s1 = w32_rootdir (); - s2 = DIRSEP_S "share" DIRSEP_S "locale"; - name = xmalloc (strlen (s1) + strlen (s2) + 1); - strcpy (stpcpy (name, s1), s2); - } + name = xstrconcat (w32_rootdir (), DIRSEP_S "share" DIRSEP_S "locale", + NULL); return name; #else /*!HAVE_W32_SYSTEM*/ return LOCALEDIR; @@ -472,20 +468,13 @@ dirmngr_socket_name (void) const char * gnupg_module_name (int which) { - const char *s, *s2; - -#define X(a,b) do { \ - static char *name; \ - if (!name) \ - { \ - s = gnupg_ ## a (); \ - s2 = DIRSEP_S b EXEEXT_S; \ - name = xmalloc (strlen (s) + strlen (s2) + 1); \ - strcpy (stpcpy (name, s), s2); \ - } \ - return name; \ - } while (0) - +#define X(a,b) do { \ + static char *name; \ + if (!name) \ + name = xstrconcat (gnupg_ ## a (), DIRSEP_S b EXEEXT_S, NULL); \ + return name; \ + } while (0) + switch (which) { case GNUPG_MODULE_NAME_AGENT: diff --git a/g10/ChangeLog b/g10/ChangeLog index 70e471e12..ccbc1cbb5 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,7 +1,6 @@ 2010-09-06 Werner Koch - - * card-util.c (card_status): Remove stub creation fro GnuPG >= 2. + * card-util.c (card_status): Remove stub creation for GnuPG >= 2. (card_store_subkey): Temporary disable this code. * keyedit.c (show_key_with_all_names): Merge secret and public key @@ -10,12 +9,10 @@ * delkey.c (do_delete_key): Ditto. * export.c (subkey_in_list_p, exact_subkey_match_p): Ditto. (new_subkey_list_item): Ditto. - * keyid.c (keystr_from_sk, keystr_from_sk_with_sub) (keyid_from_sk, nbits_from_sk, datestr_from_sk) (expirestr_from_sk, colon_datestr_from_sk, fingerprint_from_sk) (serialno_and_fpr_from_sk, do_fingerprint_md_sk): Remove. - * import.c (print_import_ok): Remove arg SK. (import_secret_one): Adjust for seckey_info format. (transfer_secret_keys): Ditto. Use gpg_format_keydesc. @@ -24,11 +21,9 @@ (auto_create_card_key_stub): Remove - not anymore needed. (update_sec_keyblock_with_cardinfo): Remove. (import_secret_one): Use arg option instead of the global option. - * free-packet.c (copy_public_key): Adjust for seckey_info format. (copy_public_parts_to_secret_key, copy_secret_key) (cmp_secret_keys, cmp_public_secret_key): Remove. - * passphrase.c (gpg_format_keydesc): Add arg MODE and change all callers. * keyring.c (keyring_search): Remove special case for secret keys.