mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
keyboxd: Add options --openpgp and --x509 to SEARCH.
* kbx/keyboxd.h (struct server_control_s): Replace the two request objects by just one. Add filter flags. * kbx/kbxserver.c (cmd_search): Add options --openpgp and --x509. (cmd_killkeyboxd): Do not return GPG_ERR_EOF. * kbx/frontend.c (kbxd_release_session_info): Adjust for the new request object. (kbxd_search, kbxd_store, kbxd_delete): Ditto. * kbx/backend-sqlite.c (struct be_sqlite_local_s): Add filter flags. (run_sql_prepare): Add optional arg 'extra'. Change callers. (run_sql_bind_ntext): New. (run_sql_bind_text): Just call run_sql_bind_ntext. (run_select_statement): Add ctrl arg. Implement the filter flags. * g10/call-keyboxd.c (keydb_search): Use the --openpgp option. -- As soon as we implement X.509 we need to have a way to return only openpgp or x.509 certificates. Gpg/gpgsm will then use the respective flag. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
3cf9bb4d73
commit
29977e21d1
5 changed files with 127 additions and 62 deletions
|
@ -687,36 +687,36 @@ keydb_search (KEYDB_HANDLE hd, KEYDB_SEARCH_DESC *desc,
|
|||
switch (desc->mode)
|
||||
{
|
||||
case KEYDB_SEARCH_MODE_EXACT:
|
||||
snprintf (line, sizeof line, "SEARCH =%s", desc[0].u.name);
|
||||
snprintf (line, sizeof line, "SEARCH --openpgp -- =%s", desc[0].u.name);
|
||||
break;
|
||||
|
||||
case KEYDB_SEARCH_MODE_SUBSTR:
|
||||
snprintf (line, sizeof line, "SEARCH *%s", desc[0].u.name);
|
||||
snprintf (line, sizeof line, "SEARCH --openpgp -- *%s", desc[0].u.name);
|
||||
break;
|
||||
|
||||
case KEYDB_SEARCH_MODE_MAIL:
|
||||
snprintf (line, sizeof line, "SEARCH <%s", desc[0].u.name);
|
||||
snprintf (line, sizeof line, "SEARCH --openpgp -- <%s", desc[0].u.name);
|
||||
break;
|
||||
|
||||
case KEYDB_SEARCH_MODE_MAILSUB:
|
||||
snprintf (line, sizeof line, "SEARCH @%s", desc[0].u.name);
|
||||
snprintf (line, sizeof line, "SEARCH --openpgp -- @%s", desc[0].u.name);
|
||||
break;
|
||||
|
||||
case KEYDB_SEARCH_MODE_MAILEND:
|
||||
snprintf (line, sizeof line, "SEARCH .%s", desc[0].u.name);
|
||||
snprintf (line, sizeof line, "SEARCH --openpgp -- .%s", desc[0].u.name);
|
||||
break;
|
||||
|
||||
case KEYDB_SEARCH_MODE_WORDS:
|
||||
snprintf (line, sizeof line, "SEARCH +%s", desc[0].u.name);
|
||||
snprintf (line, sizeof line, "SEARCH --openpgp -- +%s", desc[0].u.name);
|
||||
break;
|
||||
|
||||
case KEYDB_SEARCH_MODE_SHORT_KID:
|
||||
snprintf (line, sizeof line, "SEARCH 0x%08lX",
|
||||
snprintf (line, sizeof line, "SEARCH --openpgp -- 0x%08lX",
|
||||
(ulong)desc->u.kid[1]);
|
||||
break;
|
||||
|
||||
case KEYDB_SEARCH_MODE_LONG_KID:
|
||||
snprintf (line, sizeof line, "SEARCH 0x%08lX%08lX",
|
||||
snprintf (line, sizeof line, "SEARCH --openpgp -- 0x%08lX%08lX",
|
||||
(ulong)desc->u.kid[0], (ulong)desc->u.kid[1]);
|
||||
break;
|
||||
|
||||
|
@ -725,28 +725,28 @@ keydb_search (KEYDB_HANDLE hd, KEYDB_SEARCH_DESC *desc,
|
|||
unsigned char hexfpr[MAX_FINGERPRINT_LEN * 2 + 1];
|
||||
log_assert (desc[0].fprlen <= MAX_FINGERPRINT_LEN);
|
||||
bin2hex (desc[0].u.fpr, desc[0].fprlen, hexfpr);
|
||||
snprintf (line, sizeof line, "SEARCH 0x%s", hexfpr);
|
||||
snprintf (line, sizeof line, "SEARCH --openpgp -- 0x%s", hexfpr);
|
||||
}
|
||||
break;
|
||||
|
||||
case KEYDB_SEARCH_MODE_ISSUER:
|
||||
snprintf (line, sizeof line, "SEARCH #/%s", desc[0].u.name);
|
||||
snprintf (line, sizeof line, "SEARCH --openpgp -- #/%s", desc[0].u.name);
|
||||
break;
|
||||
|
||||
case KEYDB_SEARCH_MODE_ISSUER_SN:
|
||||
case KEYDB_SEARCH_MODE_SN:
|
||||
snprintf (line, sizeof line, "SEARCH #%s", desc[0].u.name);
|
||||
snprintf (line, sizeof line, "SEARCH --openpgp -- #%s", desc[0].u.name);
|
||||
break;
|
||||
|
||||
case KEYDB_SEARCH_MODE_SUBJECT:
|
||||
snprintf (line, sizeof line, "SEARCH /%s", desc[0].u.name);
|
||||
snprintf (line, sizeof line, "SEARCH --openpgp -- /%s", desc[0].u.name);
|
||||
break;
|
||||
|
||||
case KEYDB_SEARCH_MODE_KEYGRIP:
|
||||
{
|
||||
unsigned char hexgrip[KEYGRIP_LEN * 2 + 1];
|
||||
bin2hex (desc[0].u.grip, KEYGRIP_LEN, hexgrip);
|
||||
snprintf (line, sizeof line, "SEARCH &%s", hexgrip);
|
||||
snprintf (line, sizeof line, "SEARCH --openpgp -- &%s", hexgrip);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -754,12 +754,12 @@ keydb_search (KEYDB_HANDLE hd, KEYDB_SEARCH_DESC *desc,
|
|||
{
|
||||
unsigned char hexubid[UBID_LEN * 2 + 1];
|
||||
bin2hex (desc[0].u.ubid, UBID_LEN, hexubid);
|
||||
snprintf (line, sizeof line, "SEARCH ^%s", hexubid);
|
||||
snprintf (line, sizeof line, "SEARCH --openpgp -- ^%s", hexubid);
|
||||
}
|
||||
break;
|
||||
|
||||
case KEYDB_SEARCH_MODE_FIRST:
|
||||
snprintf (line, sizeof line, "SEARCH");
|
||||
snprintf (line, sizeof line, "SEARCH --openpgp");
|
||||
break;
|
||||
|
||||
case KEYDB_SEARCH_MODE_NEXT:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue