[git] GnuPG - branch, STABLE-BRANCH-2-0, updated. gnupg-2.0.19-65-gf395a3e
by Werner Koch
cvs at cvs.gnupg.org
Thu Jan 3 20:29:05 CET 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".
The branch, STABLE-BRANCH-2-0 has been updated
via f395a3e7ef78e93084a572cf39c1bb2d85ce5f45 (commit)
via c291ebaf6f083de9d0a4baf5e384f27601e0253c (commit)
from f484d8b28bccce7652362fa7940e53af04a412c8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit f395a3e7ef78e93084a572cf39c1bb2d85ce5f45
Author: Werner Koch <wk at gnupg.org>
Date: Thu Jan 3 20:19:23 2013 +0100
gpg: Detect Keybox files and print a diagnostic.
* g10/keydb.c (KEYDB_RESOURCE_TYPE_KEYBOX): New.
(keydb_add_resource): Handle scheme "gnupg-kbx:". Detect Keybox
magic. Print wanrning note for Keybox.
(keydb_new, keydb_release, keydb_get_resource_name)
(lock_all, unlock_all, keydb_get_keyblock)
(keydb_update_keyblock, keydb_insert_keyblock, keydb_delete_keyblock)
(keydb_locate_writable, keydb_rebuild_caches, keydb_search_reset)
(keydb_search2): Ignore Keybox type in switches.
* g10/gpg.h (G10ERR_UNSUPPORTED): Map to correct gpg-error value.
--
GnuPG 2.1 will support Keybox files in GPG and thus users might see
weird error messages if they accidentally use a keybox file with 2.0.
Better print a note here.
diff --git a/g10/gpg.h b/g10/gpg.h
index c39d215..7049656 100644
--- a/g10/gpg.h
+++ b/g10/gpg.h
@@ -114,7 +114,7 @@ struct server_control_s
#define G10ERR_TRUSTDB GPG_ERR_TRUSTDB
#define G10ERR_UNEXPECTED GPG_ERR_UNEXPECTED
#define G10ERR_UNKNOWN_PACKET GPG_ERR_UNKNOWN_PACKET
-#define G10ERR_UNSUPPORTED GPG_ERR_UNSUPPORTED
+#define G10ERR_UNSUPPORTED GPG_ERR_NOT_SUPPORTED
#define G10ERR_UNU_PUBKEY GPG_ERR_UNUSABLE_PUBKEY
#define G10ERR_UNU_SECKEY GPG_ERR_UNUSABLE_SECKEY
#define G10ERR_WRONG_SECKEY GPG_ERR_WRONG_SECKEY
diff --git a/g10/keydb.c b/g10/keydb.c
index 9e8b8c4..450ada7 100644
--- a/g10/keydb.c
+++ b/g10/keydb.c
@@ -1,6 +1,6 @@
/* keydb.c - key database dispatcher
* Copyright (C) 2001, 2002, 2003, 2004, 2005,
- * 2008, 2009 Free Software Foundation, Inc.
+ * 2008, 2009, 2012 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -41,7 +41,8 @@ static int active_handles;
typedef enum {
KEYDB_RESOURCE_TYPE_NONE = 0,
- KEYDB_RESOURCE_TYPE_KEYRING
+ KEYDB_RESOURCE_TYPE_KEYRING,
+ KEYDB_RESOURCE_TYPE_KEYBOX
} KeydbResourceType;
#define MAX_KEYDB_RESOURCES 40
@@ -236,6 +237,11 @@ keydb_add_resource (const char *url, int flags, int secret)
rt = KEYDB_RESOURCE_TYPE_KEYRING;
resname += 11;
}
+ else if (strlen (resname) > 10 && !strncmp (resname, "gnupg-kbx:", 10) )
+ {
+ rt = KEYDB_RESOURCE_TYPE_KEYBOX;
+ resname += 10;
+ }
#if !defined(HAVE_DRIVE_LETTERS) && !defined(__riscos__)
else if (strchr (resname, ':')) {
log_error ("invalid key resource URL `%s'\n", url );
@@ -267,6 +273,11 @@ keydb_add_resource (const char *url, int flags, int secret)
if (fread( &magic, 4, 1, fp) == 1 ) {
if (magic == 0x13579ace || magic == 0xce9a5713)
; /* GDBM magic - no more support */
+ else if (fread (&magic, 4, 1, fp) == 1
+ && !memcmp (&magic, "\x01", 1)
+ && fread (&magic, 4, 1, fp) == 1
+ && !memcmp (&magic, "KBXf", 4))
+ rt = KEYDB_RESOURCE_TYPE_KEYBOX;
else
rt = KEYDB_RESOURCE_TYPE_KEYRING;
}
@@ -314,6 +325,10 @@ keydb_add_resource (const char *url, int flags, int secret)
}
break;
+ case KEYDB_RESOURCE_TYPE_KEYBOX:
+ rc = G10ERR_UNSUPPORTED;
+ goto leave;
+
default:
log_error ("resource type of `%s' not supported\n", url);
rc = G10ERR_GENERAL;
@@ -335,6 +350,9 @@ keydb_add_resource (const char *url, int flags, int secret)
else
log_error (_("keyblock resource `%s': %s\n"),
filename, g10_errstr(rc));
+ if (rt == KEYDB_RESOURCE_TYPE_KEYBOX)
+ log_error ("Note: This version of GPG does not support"
+ " the Keybox format\n");
}
else if (secret)
any_secret = 1;
@@ -364,6 +382,7 @@ keydb_new (int secret)
switch (all_resources[i].type)
{
case KEYDB_RESOURCE_TYPE_NONE: /* ignore */
+ case KEYDB_RESOURCE_TYPE_KEYBOX: /* ignore */
break;
case KEYDB_RESOURCE_TYPE_KEYRING:
hd->active[j].type = all_resources[i].type;
@@ -398,6 +417,7 @@ keydb_release (KEYDB_HANDLE hd)
for (i=0; i < hd->used; i++) {
switch (hd->active[i].type) {
case KEYDB_RESOURCE_TYPE_NONE:
+ case KEYDB_RESOURCE_TYPE_KEYBOX:
break;
case KEYDB_RESOURCE_TYPE_KEYRING:
keyring_release (hd->active[i].u.kr);
@@ -435,6 +455,7 @@ keydb_get_resource_name (KEYDB_HANDLE hd)
switch (hd->active[idx].type) {
case KEYDB_RESOURCE_TYPE_NONE:
+ case KEYDB_RESOURCE_TYPE_KEYBOX:
s = NULL;
break;
case KEYDB_RESOURCE_TYPE_KEYRING:
@@ -455,6 +476,7 @@ lock_all (KEYDB_HANDLE hd)
for (i=0; !rc && i < hd->used; i++) {
switch (hd->active[i].type) {
case KEYDB_RESOURCE_TYPE_NONE:
+ case KEYDB_RESOURCE_TYPE_KEYBOX:
break;
case KEYDB_RESOURCE_TYPE_KEYRING:
rc = keyring_lock (hd->active[i].u.kr, 1);
@@ -467,6 +489,7 @@ lock_all (KEYDB_HANDLE hd)
for (i--; i >= 0; i--) {
switch (hd->active[i].type) {
case KEYDB_RESOURCE_TYPE_NONE:
+ case KEYDB_RESOURCE_TYPE_KEYBOX:
break;
case KEYDB_RESOURCE_TYPE_KEYRING:
keyring_lock (hd->active[i].u.kr, 0);
@@ -491,6 +514,7 @@ unlock_all (KEYDB_HANDLE hd)
for (i=hd->used-1; i >= 0; i--) {
switch (hd->active[i].type) {
case KEYDB_RESOURCE_TYPE_NONE:
+ case KEYDB_RESOURCE_TYPE_KEYBOX:
break;
case KEYDB_RESOURCE_TYPE_KEYRING:
keyring_lock (hd->active[i].u.kr, 0);
@@ -520,6 +544,7 @@ keydb_get_keyblock (KEYDB_HANDLE hd, KBNODE *ret_kb)
switch (hd->active[hd->found].type) {
case KEYDB_RESOURCE_TYPE_NONE:
+ case KEYDB_RESOURCE_TYPE_KEYBOX:
rc = G10ERR_GENERAL; /* oops */
break;
case KEYDB_RESOURCE_TYPE_KEYRING:
@@ -553,6 +578,7 @@ keydb_update_keyblock (KEYDB_HANDLE hd, KBNODE kb)
switch (hd->active[hd->found].type) {
case KEYDB_RESOURCE_TYPE_NONE:
+ case KEYDB_RESOURCE_TYPE_KEYBOX:
rc = G10ERR_GENERAL; /* oops */
break;
case KEYDB_RESOURCE_TYPE_KEYRING:
@@ -593,6 +619,7 @@ keydb_insert_keyblock (KEYDB_HANDLE hd, KBNODE kb)
switch (hd->active[idx].type) {
case KEYDB_RESOURCE_TYPE_NONE:
+ case KEYDB_RESOURCE_TYPE_KEYBOX:
rc = G10ERR_GENERAL; /* oops */
break;
case KEYDB_RESOURCE_TYPE_KEYRING:
@@ -628,6 +655,7 @@ keydb_delete_keyblock (KEYDB_HANDLE hd)
switch (hd->active[hd->found].type) {
case KEYDB_RESOURCE_TYPE_NONE:
+ case KEYDB_RESOURCE_TYPE_KEYBOX:
rc = G10ERR_GENERAL; /* oops */
break;
case KEYDB_RESOURCE_TYPE_KEYRING:
@@ -683,6 +711,7 @@ keydb_locate_writable (KEYDB_HANDLE hd, const char *reserved)
switch (hd->active[hd->current].type)
{
case KEYDB_RESOURCE_TYPE_NONE:
+ case KEYDB_RESOURCE_TYPE_KEYBOX:
BUG();
break;
case KEYDB_RESOURCE_TYPE_KEYRING:
@@ -712,6 +741,7 @@ keydb_rebuild_caches (int noisy)
switch (all_resources[i].type)
{
case KEYDB_RESOURCE_TYPE_NONE: /* ignore */
+ case KEYDB_RESOURCE_TYPE_KEYBOX: /* ignore */
break;
case KEYDB_RESOURCE_TYPE_KEYRING:
rc = keyring_rebuild_cache (all_resources[i].token,noisy);
@@ -742,6 +772,7 @@ keydb_search_reset (KEYDB_HANDLE hd)
for (i=0; !rc && i < hd->used; i++) {
switch (hd->active[i].type) {
case KEYDB_RESOURCE_TYPE_NONE:
+ case KEYDB_RESOURCE_TYPE_KEYBOX:
break;
case KEYDB_RESOURCE_TYPE_KEYRING:
rc = keyring_search_reset (hd->active[i].u.kr);
@@ -768,6 +799,7 @@ keydb_search2 (KEYDB_HANDLE hd, KEYDB_SEARCH_DESC *desc,
while (rc == -1 && hd->current >= 0 && hd->current < hd->used) {
switch (hd->active[hd->current].type) {
case KEYDB_RESOURCE_TYPE_NONE:
+ case KEYDB_RESOURCE_TYPE_KEYBOX:
BUG(); /* we should never see it here */
break;
case KEYDB_RESOURCE_TYPE_KEYRING:
commit c291ebaf6f083de9d0a4baf5e384f27601e0253c
Author: Werner Koch <wk at gnupg.org>
Date: Thu Jan 3 20:11:54 2013 +0100
Remove trailing white space from some files.
--
diff --git a/g10/gpg.h b/g10/gpg.h
index e152b27..c39d215 100644
--- a/g10/gpg.h
+++ b/g10/gpg.h
@@ -17,7 +17,7 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GNUPG_G10_GPG_H
-#define GNUPG_G10_GPG_H
+#define GNUPG_G10_GPG_H
/* Note, that this file should be the first one after the system
header files. This is required to set the error source to the
@@ -41,8 +41,8 @@
#define MAX_FINGERPRINT_LEN 20
-/*
- Forward declarations.
+/*
+ Forward declarations.
*/
/* Object used to keep state locally to server.c . */
@@ -67,7 +67,7 @@ struct server_control_s
-/*
+/*
Compatibility stuff to be faded out over time.
*/
@@ -78,45 +78,45 @@ struct server_control_s
/* Mapping of the old error codes to the gpg-error ones. Fixme: This
is just a temporary solution: We need to do all these gpg_error()
calls in the code. */
-#define G10ERR_BAD_KEY GPG_ERR_BAD_KEY
-#define G10ERR_BAD_PASS GPG_ERR_BAD_PASS
-#define G10ERR_BAD_PUBKEY GPG_ERR_BAD_PUBKEY
+#define G10ERR_BAD_KEY GPG_ERR_BAD_KEY
+#define G10ERR_BAD_PASS GPG_ERR_BAD_PASS
+#define G10ERR_BAD_PUBKEY GPG_ERR_BAD_PUBKEY
#define G10ERR_BAD_SIGN GPG_ERR_BAD_SIGNATURE
-#define G10ERR_BAD_URI GPG_ERR_BAD_URI
-#define G10ERR_CHECKSUM GPG_ERR_CHECKSUM
-#define G10ERR_CIPHER_ALGO GPG_ERR_CIPHER_ALGO
-#define G10ERR_CLOSE_FILE GPG_ERR_CLOSE_FILE
-#define G10ERR_COMPR_ALGO GPG_ERR_COMPR_ALGO
-#define G10ERR_CREATE_FILE GPG_ERR_CREATE_FILE
-#define G10ERR_DIGEST_ALGO GPG_ERR_DIGEST_ALGO
+#define G10ERR_BAD_URI GPG_ERR_BAD_URI
+#define G10ERR_CHECKSUM GPG_ERR_CHECKSUM
+#define G10ERR_CIPHER_ALGO GPG_ERR_CIPHER_ALGO
+#define G10ERR_CLOSE_FILE GPG_ERR_CLOSE_FILE
+#define G10ERR_COMPR_ALGO GPG_ERR_COMPR_ALGO
+#define G10ERR_CREATE_FILE GPG_ERR_CREATE_FILE
+#define G10ERR_DIGEST_ALGO GPG_ERR_DIGEST_ALGO
#define G10ERR_FILE_EXISTS GPG_ERR_EEXIST
-#define G10ERR_GENERAL GPG_ERR_GENERAL
-#define G10ERR_INV_ARG GPG_ERR_INV_ARG
-#define G10ERR_INV_KEYRING GPG_ERR_INV_KEYRING
-#define G10ERR_INV_USER_ID GPG_ERR_INV_USER_ID
-#define G10ERR_INVALID_ARMOR GPG_ERR_INV_ARMOR
-#define G10ERR_INVALID_PACKET GPG_ERR_INV_PACKET
-#define G10ERR_KEYRING_OPEN GPG_ERR_KEYRING_OPEN
-#define G10ERR_KEYSERVER GPG_ERR_KEYSERVER
-#define G10ERR_NO_DATA GPG_ERR_NO_DATA
-#define G10ERR_NO_PUBKEY GPG_ERR_NO_PUBKEY
-#define G10ERR_NO_SECKEY GPG_ERR_NO_SECKEY
-#define G10ERR_NO_USER_ID GPG_ERR_NO_USER_ID
-#define G10ERR_NOT_PROCESSED GPG_ERR_NOT_PROCESSED
-#define G10ERR_OPEN_FILE GPG_ERR_OPEN_FILE
-#define G10ERR_PASSPHRASE GPG_ERR_PASSPHRASE
-#define G10ERR_PUBKEY_ALGO GPG_ERR_PUBKEY_ALGO
-#define G10ERR_READ_FILE GPG_ERR_READ_FILE
-#define G10ERR_RENAME_FILE GPG_ERR_RENAME_FILE
-#define G10ERR_RESOURCE_LIMIT GPG_ERR_RESOURCE_LIMIT
-#define G10ERR_SIG_CLASS GPG_ERR_SIG_CLASS
-#define G10ERR_TIME_CONFLICT GPG_ERR_TIME_CONFLICT
-#define G10ERR_TRUSTDB GPG_ERR_TRUSTDB
-#define G10ERR_UNEXPECTED GPG_ERR_UNEXPECTED
-#define G10ERR_UNKNOWN_PACKET GPG_ERR_UNKNOWN_PACKET
-#define G10ERR_UNSUPPORTED GPG_ERR_UNSUPPORTED
-#define G10ERR_UNU_PUBKEY GPG_ERR_UNUSABLE_PUBKEY
-#define G10ERR_UNU_SECKEY GPG_ERR_UNUSABLE_SECKEY
-#define G10ERR_WRONG_SECKEY GPG_ERR_WRONG_SECKEY
+#define G10ERR_GENERAL GPG_ERR_GENERAL
+#define G10ERR_INV_ARG GPG_ERR_INV_ARG
+#define G10ERR_INV_KEYRING GPG_ERR_INV_KEYRING
+#define G10ERR_INV_USER_ID GPG_ERR_INV_USER_ID
+#define G10ERR_INVALID_ARMOR GPG_ERR_INV_ARMOR
+#define G10ERR_INVALID_PACKET GPG_ERR_INV_PACKET
+#define G10ERR_KEYRING_OPEN GPG_ERR_KEYRING_OPEN
+#define G10ERR_KEYSERVER GPG_ERR_KEYSERVER
+#define G10ERR_NO_DATA GPG_ERR_NO_DATA
+#define G10ERR_NO_PUBKEY GPG_ERR_NO_PUBKEY
+#define G10ERR_NO_SECKEY GPG_ERR_NO_SECKEY
+#define G10ERR_NO_USER_ID GPG_ERR_NO_USER_ID
+#define G10ERR_NOT_PROCESSED GPG_ERR_NOT_PROCESSED
+#define G10ERR_OPEN_FILE GPG_ERR_OPEN_FILE
+#define G10ERR_PASSPHRASE GPG_ERR_PASSPHRASE
+#define G10ERR_PUBKEY_ALGO GPG_ERR_PUBKEY_ALGO
+#define G10ERR_READ_FILE GPG_ERR_READ_FILE
+#define G10ERR_RENAME_FILE GPG_ERR_RENAME_FILE
+#define G10ERR_RESOURCE_LIMIT GPG_ERR_RESOURCE_LIMIT
+#define G10ERR_SIG_CLASS GPG_ERR_SIG_CLASS
+#define G10ERR_TIME_CONFLICT GPG_ERR_TIME_CONFLICT
+#define G10ERR_TRUSTDB GPG_ERR_TRUSTDB
+#define G10ERR_UNEXPECTED GPG_ERR_UNEXPECTED
+#define G10ERR_UNKNOWN_PACKET GPG_ERR_UNKNOWN_PACKET
+#define G10ERR_UNSUPPORTED GPG_ERR_UNSUPPORTED
+#define G10ERR_UNU_PUBKEY GPG_ERR_UNUSABLE_PUBKEY
+#define G10ERR_UNU_SECKEY GPG_ERR_UNUSABLE_SECKEY
+#define G10ERR_WRONG_SECKEY GPG_ERR_WRONG_SECKEY
#endif /*GNUPG_G10_GPG_H*/
diff --git a/g10/keydb.c b/g10/keydb.c
index 398be19..9e8b8c4 100644
--- a/g10/keydb.c
+++ b/g10/keydb.c
@@ -1,5 +1,5 @@
/* keydb.c - key database dispatcher
- * Copyright (C) 2001, 2002, 2003, 2004, 2005,
+ * Copyright (C) 2001, 2002, 2003, 2004, 2005,
* 2008, 2009 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
@@ -34,7 +34,7 @@
#include "main.h" /*try_make_homedir ()*/
#include "packet.h"
#include "keyring.h"
-#include "keydb.h"
+#include "keydb.h"
#include "i18n.h"
static int active_handles;
@@ -91,7 +91,7 @@ maybe_create_keyring (char *filename, int force)
/* If we don't want to create a new file at all, there is no need to
go any further - bail out right here. */
- if (!force)
+ if (!force)
return gpg_error (GPG_ERR_ENOENT);
/* First of all we try to create the home directory. Note, that we
@@ -114,9 +114,9 @@ maybe_create_keyring (char *filename, int force)
save_slash = *last_slash_in_filename;
*last_slash_in_filename = 0;
if (access(filename, F_OK))
- {
+ {
static int tried;
-
+
if (!tried)
{
tried = 1;
@@ -144,8 +144,8 @@ maybe_create_keyring (char *filename, int force)
if (opt.verbose)
log_info ("can't allocate lock for `%s'\n", filename );
- if (!force)
- return gpg_error (GPG_ERR_ENOENT);
+ if (!force)
+ return gpg_error (GPG_ERR_ENOENT);
else
return gpg_error (GPG_ERR_GENERAL);
}
@@ -175,7 +175,7 @@ maybe_create_keyring (char *filename, int force)
else
iobuf = iobuf_create (filename);
umask (oldmask);
- if (!iobuf)
+ if (!iobuf)
{
rc = gpg_error_from_syserror ();
log_error ( _("error creating keyring `%s': %s\n"),
@@ -293,7 +293,7 @@ keydb_add_resource (const char *url, int flags, int secret)
{
if (used_resources >= MAX_KEYDB_RESOURCES)
rc = G10ERR_RESOURCE_LIMIT;
- else
+ else
{
if(flags&2)
primary_keyring=token;
@@ -352,10 +352,10 @@ keydb_new (int secret)
{
KEYDB_HANDLE hd;
int i, j;
-
+
hd = xmalloc_clear (sizeof *hd);
hd->found = -1;
-
+
assert (used_resources <= MAX_KEYDB_RESOURCES);
for (i=j=0; i < used_resources; i++)
{
@@ -379,12 +379,12 @@ keydb_new (int secret)
}
}
hd->used = j;
-
+
active_handles++;
return hd;
}
-void
+void
keydb_release (KEYDB_HANDLE hd)
{
int i;
@@ -423,19 +423,19 @@ keydb_get_resource_name (KEYDB_HANDLE hd)
int idx;
const char *s = NULL;
- if (!hd)
+ if (!hd)
return NULL;
- if ( hd->found >= 0 && hd->found < hd->used)
+ if ( hd->found >= 0 && hd->found < hd->used)
idx = hd->found;
- else if ( hd->current >= 0 && hd->current < hd->used)
+ else if ( hd->current >= 0 && hd->current < hd->used)
idx = hd->current;
else
idx = 0;
switch (hd->active[idx].type) {
case KEYDB_RESOURCE_TYPE_NONE:
- s = NULL;
+ s = NULL;
break;
case KEYDB_RESOURCE_TYPE_KEYRING:
s = keyring_get_resource_name (hd->active[idx].u.kr);
@@ -447,7 +447,7 @@ keydb_get_resource_name (KEYDB_HANDLE hd)
-static int
+static int
lock_all (KEYDB_HANDLE hd)
{
int i, rc = 0;
@@ -504,7 +504,7 @@ unlock_all (KEYDB_HANDLE hd)
/*
* Return the last found keyring. Caller must free it.
* The returned keyblock has the kbode flag bit 0 set for the node with
- * the public key used to locate the keyblock or flag bit 1 set for
+ * the public key used to locate the keyblock or flag bit 1 set for
* the user ID node.
*/
int
@@ -515,7 +515,7 @@ keydb_get_keyblock (KEYDB_HANDLE hd, KBNODE *ret_kb)
if (!hd)
return G10ERR_INV_ARG;
- if ( hd->found < 0 || hd->found >= hd->used)
+ if ( hd->found < 0 || hd->found >= hd->used)
return -1; /* nothing found */
switch (hd->active[hd->found].type) {
@@ -530,7 +530,7 @@ keydb_get_keyblock (KEYDB_HANDLE hd, KBNODE *ret_kb)
return rc;
}
-/*
+/*
* update the current keyblock with KB
*/
int
@@ -541,7 +541,7 @@ keydb_update_keyblock (KEYDB_HANDLE hd, KBNODE kb)
if (!hd)
return G10ERR_INV_ARG;
- if ( hd->found < 0 || hd->found >= hd->used)
+ if ( hd->found < 0 || hd->found >= hd->used)
return -1; /* nothing found */
if( opt.dry_run )
@@ -565,8 +565,8 @@ keydb_update_keyblock (KEYDB_HANDLE hd, KBNODE kb)
}
-/*
- * Insert a new KB into one of the resources.
+/*
+ * Insert a new KB into one of the resources.
*/
int
keydb_insert_keyblock (KEYDB_HANDLE hd, KBNODE kb)
@@ -574,15 +574,15 @@ keydb_insert_keyblock (KEYDB_HANDLE hd, KBNODE kb)
int rc = -1;
int idx;
- if (!hd)
+ if (!hd)
return G10ERR_INV_ARG;
if( opt.dry_run )
return 0;
- if ( hd->found >= 0 && hd->found < hd->used)
+ if ( hd->found >= 0 && hd->found < hd->used)
idx = hd->found;
- else if ( hd->current >= 0 && hd->current < hd->used)
+ else if ( hd->current >= 0 && hd->current < hd->used)
idx = hd->current;
else
return G10ERR_GENERAL;
@@ -605,7 +605,7 @@ keydb_insert_keyblock (KEYDB_HANDLE hd, KBNODE kb)
}
-/*
+/*
* The current keyblock will be deleted.
*/
int
@@ -616,7 +616,7 @@ keydb_delete_keyblock (KEYDB_HANDLE hd)
if (!hd)
return G10ERR_INV_ARG;
- if ( hd->found < 0 || hd->found >= hd->used)
+ if ( hd->found < 0 || hd->found >= hd->used)
return -1; /* nothing found */
if( opt.dry_run )
@@ -643,7 +643,7 @@ keydb_delete_keyblock (KEYDB_HANDLE hd)
/*
* Locate the default writable key resource, so that the next
* operation (which is only relevant for inserts) will be done on this
- * resource.
+ * resource.
*/
int
keydb_locate_writable (KEYDB_HANDLE hd, const char *reserved)
@@ -654,7 +654,7 @@ keydb_locate_writable (KEYDB_HANDLE hd, const char *reserved)
if (!hd)
return G10ERR_INV_ARG;
-
+
rc = keydb_search_reset (hd); /* this does reset hd->current */
if (rc)
return rc;
@@ -678,9 +678,9 @@ keydb_locate_writable (KEYDB_HANDLE hd, const char *reserved)
return rc;
}
- for ( ; hd->current >= 0 && hd->current < hd->used; hd->current++)
+ for ( ; hd->current >= 0 && hd->current < hd->used; hd->current++)
{
- switch (hd->active[hd->current].type)
+ switch (hd->active[hd->current].type)
{
case KEYDB_RESOURCE_TYPE_NONE:
BUG();
@@ -691,7 +691,7 @@ keydb_locate_writable (KEYDB_HANDLE hd, const char *reserved)
break;
}
}
-
+
return -1;
}
@@ -702,7 +702,7 @@ void
keydb_rebuild_caches (int noisy)
{
int i, rc;
-
+
for (i=0; i < used_resources; i++)
{
if (all_resources[i].secret)
@@ -725,10 +725,10 @@ keydb_rebuild_caches (int noisy)
-/*
+/*
* Start the next search on this handle right at the beginning
*/
-int
+int
keydb_search_reset (KEYDB_HANDLE hd)
{
int i, rc = 0;
@@ -736,7 +736,7 @@ keydb_search_reset (KEYDB_HANDLE hd)
if (!hd)
return G10ERR_INV_ARG;
- hd->current = 0;
+ hd->current = 0;
hd->found = -1;
/* and reset all resources */
for (i=0; !rc && i < hd->used; i++) {
@@ -748,15 +748,15 @@ keydb_search_reset (KEYDB_HANDLE hd)
break;
}
}
- return rc;
+ return rc;
}
-/*
+/*
* Search through all keydb resources, starting at the current position,
* for a keyblock which contains one of the keys described in the DESC array.
*/
-int
+int
keydb_search2 (KEYDB_HANDLE hd, KEYDB_SEARCH_DESC *desc,
size_t ndesc, size_t *descindex)
{
@@ -776,12 +776,12 @@ keydb_search2 (KEYDB_HANDLE hd, KEYDB_SEARCH_DESC *desc,
break;
}
if (rc == -1) /* EOF -> switch to next resource */
- hd->current++;
+ hd->current++;
else if (!rc)
hd->found = hd->current;
}
- return rc;
+ return rc;
}
int
-----------------------------------------------------------------------
Summary of changes:
g10/gpg.h | 84 ++++++++++++++++++++--------------------
g10/keydb.c | 122 +++++++++++++++++++++++++++++++++++++----------------------
2 files changed, 119 insertions(+), 87 deletions(-)
hooks/post-receive
--
The GNU Privacy Guard
http://git.gnupg.org
More information about the Gnupg-commits
mailing list