aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2005-03-31 07:05:35 +0000
committerWerner Koch <[email protected]>2005-03-31 07:05:35 +0000
commitfe01cbceb0376a4eb77b1310ac5480b1abe7a4aa (patch)
tree752d8c4936d038c959824d5201816d0abcd4c775
parent* keyserver.c (keyserver_spawn): Don't mess about with the $PATH. (diff)
downloadgnupg-fe01cbceb0376a4eb77b1310ac5480b1abe7a4aa.tar.gz
gnupg-fe01cbceb0376a4eb77b1310ac5480b1abe7a4aa.zip
* keydb.c (keydb_add_resource): Clarify meaning of flags. Add new
flag 4. Use log_info for errors registering the default secret key. * g10.c (main): Flag the default keyrings.
-rw-r--r--g10/ChangeLog6
-rw-r--r--g10/g10.c6
-rw-r--r--g10/keydb.c18
3 files changed, 24 insertions, 6 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index 62db6ad6d..d01bbc8f5 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,9 @@
+2005-03-31 Werner Koch <[email protected]>
+
+ * keydb.c (keydb_add_resource): Clarify meaning of flags. Add new
+ flag 4. Use log_info for errors registering the default secret key.
+ * g10.c (main): Flag the default keyrings.
+
2005-03-30 David Shaw <[email protected]>
* keyserver.c (keyserver_spawn): Don't mess about with the $PATH.
diff --git a/g10/g10.c b/g10/g10.c
index 93bda0523..12362172b 100644
--- a/g10/g10.c
+++ b/g10/g10.c
@@ -2924,7 +2924,7 @@ main( int argc, char **argv )
case the secrings are stored on a floppy.
We always need to add the keyrings if we are running under
- SELinux, thi is so that the rings are added to the list of
+ SELinux, this is so that the rings are added to the list of
secured files. */
if( ALWAYS_ADD_KEYRINGS
|| (cmd != aDeArmor && cmd != aEnArmor
@@ -2935,12 +2935,12 @@ main( int argc, char **argv )
&& cmd != aVerify && cmd != aSym))
{
if (!sec_nrings || default_keyring) /* add default secret rings */
- keydb_add_resource ("secring" EXTSEP_S "gpg", 0, 1);
+ keydb_add_resource ("secring" EXTSEP_S "gpg", 4, 1);
for (sl = sec_nrings; sl; sl = sl->next)
keydb_add_resource ( sl->d, 0, 1 );
}
if( !nrings || default_keyring ) /* add default ring */
- keydb_add_resource ("pubring" EXTSEP_S "gpg", 0, 0);
+ keydb_add_resource ("pubring" EXTSEP_S "gpg", 4, 0);
for(sl = nrings; sl; sl = sl->next )
keydb_add_resource ( sl->d, sl->flags, 0 );
}
diff --git a/g10/keydb.c b/g10/keydb.c
index c6dbe8094..8501143fd 100644
--- a/g10/keydb.c
+++ b/g10/keydb.c
@@ -1,5 +1,5 @@
/* keydb.c - key database dispatcher
- * Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -195,7 +195,8 @@ maybe_create_keyring (char *filename, int force)
* Note: this function may be called before secure memory is
* available.
* Flag 1 == force
- * Flag 2 == default
+ * Flag 2 == mark resource as primary
+ * Flag 4 == This is a default resources
*/
int
keydb_add_resource (const char *url, int flags, int secret)
@@ -305,7 +306,18 @@ keydb_add_resource (const char *url, int flags, int secret)
leave:
if (rc)
- log_error ("keyblock resource `%s': %s\n", filename, g10_errstr(rc));
+ {
+ /* Secret keyrings are not required in all cases. To avoid
+ having gpg return failure we use log_info here if the
+ rewsource is a secret one and marked as default
+ resource. */
+ if ((flags&4) && secret)
+ log_info (_("keyblock resource `%s': %s\n"),
+ filename, g10_errstr(rc));
+ else
+ log_error (_("keyblock resource `%s': %s\n"),
+ filename, g10_errstr(rc));
+ }
else if (secret)
any_secret = 1;
else