aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2008-01-29 16:04:57 +0000
committerWerner Koch <[email protected]>2008-01-29 16:04:57 +0000
commit843d6c69eff22e7ba9675f4d16fd0ae96339f5bb (patch)
tree32945d5c888b9cb9667435949a4f195bf90587a0
parentTypo and grammer fixes by Justin Pryzby. (diff)
downloadgnupg-843d6c69eff22e7ba9675f4d16fd0ae96339f5bb.tar.gz
gnupg-843d6c69eff22e7ba9675f4d16fd0ae96339f5bb.zip
Fixed a W32 crash in gpg2 when creating a new keyring.
Typo fixes.
-rw-r--r--g10/ChangeLog5
-rw-r--r--g10/keydb.c19
-rw-r--r--kbx/keybox-blob.c2
-rw-r--r--sm/certlist.c2
4 files changed, 23 insertions, 5 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index af90bd715..1de64dcc5 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,8 @@
+2008-01-29 Werner Koch <[email protected]>
+
+ * keydb.c (maybe_create_keyring): Take care of a missing slash.
+ (maybe_create_keyring) [W32]: Also test for forward slash.
+
2008-01-26 Werner Koch <[email protected]>
* card-util.c (get_manufacturer): Add vendor 0004.
diff --git a/g10/keydb.c b/g10/keydb.c
index 69e24aefc..31e809875 100644
--- a/g10/keydb.c
+++ b/g10/keydb.c
@@ -1,5 +1,6 @@
/* keydb.c - key database dispatcher
- * Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2002, 2003, 2004, 2005,
+ * 2008 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -82,6 +83,7 @@ maybe_create_keyring (char *filename, int force)
int rc;
mode_t oldmask;
char *last_slash_in_filename;
+ int save_slash;
/* A quick test whether the filename already exists. */
if (!access (filename, F_OK))
@@ -98,6 +100,18 @@ maybe_create_keyring (char *filename, int force)
tricky auto-creation which is anyway only done for some home
directory name patterns. */
last_slash_in_filename = strrchr (filename, DIRSEP_C);
+#if HAVE_W32_SYSTEM
+ {
+ /* Windows may either have a slash or a backslash. Take care of it. */
+ char *p = strrchr (filename, '/');
+ if (!last_slash_in_filename || p > last_slash_in_filename)
+ last_slash_in_filename = p;
+ }
+#endif /*HAVE_W32_SYSTEM*/
+ if (!last_slash_in_filename)
+ return gpg_error (GPG_ERR_ENOENT); /* No slash at all - should
+ not happen though. */
+ save_slash = *last_slash_in_filename;
*last_slash_in_filename = 0;
if (access(filename, F_OK))
{
@@ -115,8 +129,7 @@ maybe_create_keyring (char *filename, int force)
goto leave;
}
}
- *last_slash_in_filename = DIRSEP_C;
-
+ *last_slash_in_filename = save_slash;
/* To avoid races with other instances of gpg trying to create or
update the keyring (it is removed during an update for a short
diff --git a/kbx/keybox-blob.c b/kbx/keybox-blob.c
index 6ad9aea2b..b0f227c48 100644
--- a/kbx/keybox-blob.c
+++ b/kbx/keybox-blob.c
@@ -103,7 +103,7 @@ X.509 specific are noted like [X.509: xxx]
b16 MD5 checksum (useful for KS syncronisation), we might also want to use
a mac here.
- b4 resevered
+ b4 reserved
*/
diff --git a/sm/certlist.c b/sm/certlist.c
index 4c92a1bb3..d4a351b6e 100644
--- a/sm/certlist.c
+++ b/sm/certlist.c
@@ -367,7 +367,7 @@ gpgsm_add_to_certlist (ctrl_t ctrl, const char *name, int secret,
/* We have to ignore ambigious names as long as
there only fault is a bad key usage. This is
required to support encryption and signing
- certifciates of the same subject.
+ certificates of the same subject.
Further we ignore them if they are due to an
identical certificate (which may happen if a