mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
common,w32: Remove duplicated backslashes when setting the homedir.
* 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
This commit is contained in:
parent
2cb97713e9
commit
45f6357881
3
NEWS
3
NEWS
@ -3,6 +3,9 @@ Noteworthy changes in version 2.4.4 (unreleased)
|
|||||||
|
|
||||||
* gpgsm: Support ECDSA in de-vs compliance mode. [T6802]
|
* gpgsm: Support ECDSA in de-vs compliance mode. [T6802]
|
||||||
|
|
||||||
|
* dirmngr: Avoid starting a second instance on Windows via GPGME
|
||||||
|
based launching. [T6833]
|
||||||
|
|
||||||
* Fix garbled time output in non-English Windows. [T6741]
|
* Fix garbled time output in non-English Windows. [T6741]
|
||||||
|
|
||||||
Release-info: https://dev.gnupg.org/T6578
|
Release-info: https://dev.gnupg.org/T6578
|
||||||
|
@ -222,6 +222,10 @@ copy_dir_with_fixup (const char *newdir)
|
|||||||
{
|
{
|
||||||
char *result = NULL;
|
char *result = NULL;
|
||||||
char *p;
|
char *p;
|
||||||
|
#ifdef HAVE_W32_SYSTEM
|
||||||
|
char *p0;
|
||||||
|
const char *s;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!*newdir)
|
if (!*newdir)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -253,6 +257,29 @@ copy_dir_with_fixup (const char *newdir)
|
|||||||
*p-- = 0;
|
*p-- = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Hack to mitigate badly doubled backslashes. */
|
||||||
|
s = result? result : newdir;
|
||||||
|
if (s[0] == '\\' && s[1] == '\\' && s[2] != '\\')
|
||||||
|
{
|
||||||
|
/* UNC (\\Servername\file) or Long UNC (\\?\Servername\file)
|
||||||
|
* Does not seem to be double quoted. */
|
||||||
|
}
|
||||||
|
else if (strstr (s, "\\\\"))
|
||||||
|
{
|
||||||
|
/* Double quotes detected. Fold them into one because that is
|
||||||
|
* what what Windows does. This way we get a unique hash
|
||||||
|
* regardless of the number of doubled backslashes. */
|
||||||
|
if (!result)
|
||||||
|
result = xstrdup (newdir);
|
||||||
|
for (p0=p=result; *p; p++)
|
||||||
|
{
|
||||||
|
*p0++ = *p;
|
||||||
|
while (*p == '\\' && p[1] == '\\')
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
*p0 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
#else /*!HAVE_W32_SYSTEM*/
|
#else /*!HAVE_W32_SYSTEM*/
|
||||||
|
|
||||||
if (newdir[strlen (newdir)-1] == '/')
|
if (newdir[strlen (newdir)-1] == '/')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user