mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-07 17:33:02 +01:00
indent: Re-indent get_pubkeys.
--
This commit is contained in:
parent
8ede3ae29a
commit
8602b980df
107
g10/getkey.c
107
g10/getkey.c
@ -413,34 +413,35 @@ pubkeys_free (pubkey_t keys)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Returns all keys that match the search specification SEARCH_TERMS.
|
/* Returns all keys that match the search specification SEARCH_TERMS.
|
||||||
|
*
|
||||||
This function also checks for and warns about duplicate entries in
|
* This function also checks for and warns about duplicate entries in
|
||||||
the keydb, which can occur if the user has configured multiple
|
* the keydb, which can occur if the user has configured multiple
|
||||||
keyrings or keyboxes or if a keyring or keybox was corrupted.
|
* keyrings or keyboxes or if a keyring or keybox was corrupted.
|
||||||
|
*
|
||||||
Note: SEARCH_TERMS will not be expanded (i.e., it may not be a
|
* Note: SEARCH_TERMS will not be expanded (i.e., it may not be a
|
||||||
group).
|
* group).
|
||||||
|
*
|
||||||
USE is the operation for which the key is required. It must be
|
* USE is the operation for which the key is required. It must be
|
||||||
either PUBKEY_USAGE_ENC, PUBKEY_USAGE_SIG, PUBKEY_USAGE_CERT or
|
* either PUBKEY_USAGE_ENC, PUBKEY_USAGE_SIG, PUBKEY_USAGE_CERT or
|
||||||
PUBKEY_USAGE_AUTH.
|
* PUBKEY_USAGE_AUTH.
|
||||||
|
*
|
||||||
XXX: Currently, only PUBKEY_USAGE_ENC and PUBKEY_USAGE_SIG are
|
* INCLUDE_UNUSABLE indicates whether disabled keys are allowed.
|
||||||
implemented.
|
* (Recipients specified with --encrypt-to and --hidden-encrypt-to may
|
||||||
|
* be disabled. It is possible to edit disabled keys.)
|
||||||
INCLUDE_UNUSABLE indicates whether disabled keys are allowed.
|
*
|
||||||
(Recipients specified with --encrypt-to and --hidden-encrypt-to may
|
* SOURCE is the context in which SEARCH_TERMS was specified, e.g.,
|
||||||
be disabled. It is possible to edit disabled keys.)
|
* "--encrypt-to", etc. If this function is called interactively,
|
||||||
|
* then this should be NULL.
|
||||||
SOURCE is the context in which SEARCH_TERMS was specified, e.g.,
|
*
|
||||||
"--encrypt-to", etc. If this function is called interactively,
|
* If WARN_POSSIBLY_AMBIGUOUS is set, then emits a warning if the user
|
||||||
then this should be NULL.
|
* does not specify a long key id or a fingerprint.
|
||||||
|
*
|
||||||
If WARN_POSSIBLY_AMBIGUOUS is set, then emits a warning if the user
|
* The results are placed in *KEYS. *KEYS must be NULL!
|
||||||
does not specify a long key id or a fingerprint.
|
*
|
||||||
|
* Fixme: Currently, only PUBKEY_USAGE_ENC and PUBKEY_USAGE_SIG are
|
||||||
The results are placed in *KEYS. *KEYS must be NULL! */
|
* implemented. */
|
||||||
gpg_error_t
|
gpg_error_t
|
||||||
get_pubkeys (ctrl_t ctrl,
|
get_pubkeys (ctrl_t ctrl,
|
||||||
char *search_terms, int use, int include_unusable, char *source,
|
char *search_terms, int use, int include_unusable, char *source,
|
||||||
@ -448,30 +449,23 @@ get_pubkeys (ctrl_t ctrl,
|
|||||||
pubkey_t *r_keys)
|
pubkey_t *r_keys)
|
||||||
{
|
{
|
||||||
/* We show a warning when a key appears multiple times in the DB.
|
/* We show a warning when a key appears multiple times in the DB.
|
||||||
This can happen for two reasons:
|
* This can happen for two reasons:
|
||||||
|
*
|
||||||
- The user has configured multiple keyrings or keyboxes.
|
* - The user has configured multiple keyrings or keyboxes.
|
||||||
|
*
|
||||||
- The keyring or keybox has been corrupted in some way, e.g., a
|
* - The keyring or keybox has been corrupted in some way, e.g., a
|
||||||
bug or a random process changing them.
|
* bug or a random process changing them.
|
||||||
|
*
|
||||||
For each duplicate, we only want to show the key once. Hence,
|
* For each duplicate, we only want to show the key once. Hence,
|
||||||
this list. */
|
* this list. */
|
||||||
static strlist_t key_dups;
|
static strlist_t key_dups;
|
||||||
|
|
||||||
/* USE transformed to a string. */
|
|
||||||
char *use_str;
|
|
||||||
|
|
||||||
gpg_error_t err;
|
gpg_error_t err;
|
||||||
|
char *use_str; /* USE transformed to a string. */
|
||||||
KEYDB_SEARCH_DESC desc;
|
KEYDB_SEARCH_DESC desc;
|
||||||
|
|
||||||
GETKEY_CTX ctx;
|
GETKEY_CTX ctx;
|
||||||
pubkey_t results = NULL;
|
pubkey_t results = NULL;
|
||||||
pubkey_t r;
|
pubkey_t r;
|
||||||
|
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
char fingerprint[2 * MAX_FINGERPRINT_LEN + 1];
|
char fingerprint[2 * MAX_FINGERPRINT_LEN + 1];
|
||||||
|
|
||||||
if (DBG_LOOKUP)
|
if (DBG_LOOKUP)
|
||||||
@ -533,17 +527,14 @@ get_pubkeys (ctrl_t ctrl,
|
|||||||
else
|
else
|
||||||
err = getkey_next (ctrl, ctx, pk, &kb);
|
err = getkey_next (ctrl, ctx, pk, &kb);
|
||||||
|
|
||||||
if (gpg_err_code (err) == GPG_ERR_NOT_FOUND)
|
if (gpg_err_code (err) == GPG_ERR_NOT_FOUND) /* No more results. */
|
||||||
/* No more results. */
|
|
||||||
{
|
{
|
||||||
xfree (pk);
|
xfree (pk);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (err)
|
else if (err) /* An error (other than "not found"). */
|
||||||
/* An error (other than "not found"). */
|
|
||||||
{
|
{
|
||||||
log_error (_("error looking up: %s\n"),
|
log_error (_("error looking up: %s\n"), gpg_strerror (err));
|
||||||
gpg_strerror (err));
|
|
||||||
xfree (pk);
|
xfree (pk);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -570,8 +561,7 @@ get_pubkeys (ctrl_t ctrl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! results && gpg_err_code (err) == GPG_ERR_NOT_FOUND)
|
if (! results && gpg_err_code (err) == GPG_ERR_NOT_FOUND)
|
||||||
/* No match. */
|
{ /* No match. */
|
||||||
{
|
|
||||||
if (DBG_LOOKUP)
|
if (DBG_LOOKUP)
|
||||||
log_debug ("%s: '%s' not found.\n", __func__, search_terms);
|
log_debug ("%s: '%s' not found.\n", __func__, search_terms);
|
||||||
|
|
||||||
@ -582,12 +572,12 @@ get_pubkeys (ctrl_t ctrl,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
else if (gpg_err_code (err) == GPG_ERR_NOT_FOUND)
|
else if (gpg_err_code (err) == GPG_ERR_NOT_FOUND)
|
||||||
/* No more matches. */
|
; /* No more matches. */
|
||||||
;
|
|
||||||
else if (err)
|
else if (err)
|
||||||
/* Some other error. An error message was already printed
|
{ /* Some other error. An error message was already printed out.
|
||||||
out. Free RESULTS and continue. */
|
* Free RESULTS and continue. */
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check for duplicates. */
|
/* Check for duplicates. */
|
||||||
if (DBG_LOOKUP)
|
if (DBG_LOOKUP)
|
||||||
@ -607,8 +597,7 @@ get_pubkeys (ctrl_t ctrl,
|
|||||||
{
|
{
|
||||||
if (cmp_public_keys (r->keyblock->pkt->pkt.public_key,
|
if (cmp_public_keys (r->keyblock->pkt->pkt.public_key,
|
||||||
r2->keyblock->pkt->pkt.public_key) != 0)
|
r2->keyblock->pkt->pkt.public_key) != 0)
|
||||||
/* Not a dup. */
|
{ /* Not a dup. */
|
||||||
{
|
|
||||||
prevp = &r2->next;
|
prevp = &r2->next;
|
||||||
next = r2->next;
|
next = r2->next;
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user