[svn] GnuPG - r4880 - in trunk: . kbx sm
svn author wk
cvs at cvs.gnupg.org
Thu Nov 20 17:26:40 CET 2008
Author: wk
Date: 2008-11-20 17:26:40 +0100 (Thu, 20 Nov 2008)
New Revision: 4880
Modified:
trunk/NEWS
trunk/kbx/ChangeLog
trunk/kbx/keybox-file.c
trunk/kbx/keybox-update.c
trunk/sm/ChangeLog
Log:
Fixed a temporary file name collision between gpg and gpgsm under Windows.
Modified: trunk/kbx/ChangeLog
===================================================================
--- trunk/kbx/ChangeLog 2008-11-20 13:08:26 UTC (rev 4879)
+++ trunk/kbx/ChangeLog 2008-11-20 16:26:40 UTC (rev 4880)
@@ -1,3 +1,8 @@
+2008-11-20 Werner Koch <wk at g10code.com>
+
+ * keybox-update.c (create_tmp_file) [USE_ONLY_8DOT3]: Use other
+ suffixes to avoid conflicts with gpg uses filenames.
+
2008-11-11 Werner Koch <wk at g10code.com>
* Makefile.am (kbxutil_LDADD): Change order of libs.
Modified: trunk/sm/ChangeLog
===================================================================
--- trunk/sm/ChangeLog 2008-11-20 13:08:26 UTC (rev 4879)
+++ trunk/sm/ChangeLog 2008-11-20 16:26:40 UTC (rev 4880)
@@ -1,7 +1,7 @@
2008-11-18 Werner Koch <wk at g10code.com>
* gpgsm.c (make_libversion): New.
- (my_strusage): Use new fucntion.
+ (my_strusage): Use new function.
(build_lib_list): Remove.
2008-11-13 Werner Koch <wk at g10code.com>
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2008-11-20 13:08:26 UTC (rev 4879)
+++ trunk/NEWS 2008-11-20 16:26:40 UTC (rev 4880)
@@ -38,6 +38,9 @@
* [w32] The gnupg2.nls directory is not anymore used. The standard
locale directory is now used.
+ * [w32] Fixed a race condition bteween gpg and gpgsm in the use of
+ temporary file names.
+
* The gpg-preset-passphrase mechanism works again.
* Admin PINs are cached again (bug in 2.0.9).
Modified: trunk/kbx/keybox-file.c
===================================================================
--- trunk/kbx/keybox-file.c 2008-11-20 13:08:26 UTC (rev 4879)
+++ trunk/kbx/keybox-file.c 2008-11-20 16:26:40 UTC (rev 4880)
@@ -1,4 +1,4 @@
-/* keybox-file.c - file oeprations
+/* keybox-file.c - File operations
* Copyright (C) 2001, 2003 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
Modified: trunk/kbx/keybox-update.c
===================================================================
--- trunk/kbx/keybox-update.c 2008-11-20 13:08:26 UTC (rev 4879)
+++ trunk/kbx/keybox-update.c 2008-11-20 16:26:40 UTC (rev 4880)
@@ -75,7 +75,9 @@
/* Here is another Windoze bug?:
* you cant rename("pubring.kbx.tmp", "pubring.kbx");
* but rename("pubring.kbx.tmp", "pubring.aaa");
- * works. So we replace .kbx by .bak or .tmp
+ * works. So we replace ".kbx" by ".kb_" or ".k__". Note that we
+ * can't use ".bak" and ".tmp", because these suffixes are used by
+ * gpg and would lead to a sharing violation or data corruption.
*/
if (strlen (template) > 4
&& !strcmp (template+strlen(template)-4, EXTSEP_S "kbx") )
@@ -84,7 +86,7 @@
if (!bakfname)
return gpg_error_from_syserror ();
strcpy (bakfname, template);
- strcpy (bakfname+strlen(template)-4, EXTSEP_S "bak");
+ strcpy (bakfname+strlen(template)-4, EXTSEP_S "kb_");
tmpfname = xtrymalloc (strlen (template) + 1);
if (!tmpfname)
@@ -94,14 +96,15 @@
return tmperr;
}
strcpy (tmpfname,template);
- strcpy (tmpfname + strlen (template)-4, EXTSEP_S "tmp");
+ strcpy (tmpfname + strlen (template)-4, EXTSEP_S "k__");
}
else
- { /* File does not end with kbx; hmmm. */
+ { /* File does not end with kbx, thus we hope we are working on a
+ modern file system and appending a suffix works. */
bakfname = xtrymalloc ( strlen (template) + 5);
if (!bakfname)
return gpg_error_from_syserror ();
- strcpy (stpcpy (bakfname, template), EXTSEP_S "bak");
+ strcpy (stpcpy (bakfname, template), EXTSEP_S "kb_");
tmpfname = xtrymalloc ( strlen (template) + 5);
if (!tmpfname)
@@ -110,7 +113,7 @@
xfree (bakfname);
return tmperr;
}
- strcpy (stpcpy (tmpfname, template), EXTSEP_S "tmp");
+ strcpy (stpcpy (tmpfname, template), EXTSEP_S "k__");
}
# else /* Posix file names */
bakfname = xtrymalloc (strlen (template) + 2);
More information about the Gnupg-commits
mailing list