mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
keyboxd: Fix searching for exact mail addresses.
* kbx/kbxserver.c (cmd_search): Use the openpgp hack for calling classify_user_id. * kbx/backend-sqlite.c (run_select_statement): Remove angle brackets in exact addrspec mode. * g10/call-keyboxd.c (keydb_search): Do not duplicate the left angle bracket. * sm/keydb.c (keydb_search): Ditto. -- Note that the openpgp hack flag of classify_user_id is actually a misnomer because we actually hack a round a problem in gpgsm. And it is only over there that we don't set it there. In keyboxd the flag should be set. And we need to remove the angle brackets of course because that is how we create the addrspec column values. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
d153e4936e
commit
f79e9540ca
@ -759,7 +759,8 @@ keydb_search (KEYDB_HANDLE hd, KEYDB_SEARCH_DESC *desc,
|
||||
break;
|
||||
|
||||
case KEYDB_SEARCH_MODE_MAIL:
|
||||
snprintf (line, sizeof line, "SEARCH %s -- <%s", more, desc->u.name);
|
||||
snprintf (line, sizeof line, "SEARCH %s -- <%s",
|
||||
more, desc->u.name+(desc->u.name[0] == '<') );
|
||||
break;
|
||||
|
||||
case KEYDB_SEARCH_MODE_MAILSUB:
|
||||
|
@ -839,6 +839,8 @@ run_select_statement (ctrl_t ctrl, be_sqlite_local_t ctx,
|
||||
unsigned int descidx;
|
||||
const char *extra = NULL;
|
||||
unsigned char kidbuf[8];
|
||||
const char *s;
|
||||
size_t n;
|
||||
|
||||
|
||||
descidx = ctx->descidx;
|
||||
@ -916,7 +918,20 @@ run_select_statement (ctrl_t ctrl, be_sqlite_local_t ctx,
|
||||
" WHERE p.ubid = u.ubid AND u.addrspec = ?1",
|
||||
extra, " ORDER BY p.ubid", &ctx->select_stmt);
|
||||
if (!err)
|
||||
err = run_sql_bind_text (ctx->select_stmt, 1, desc[descidx].u.name);
|
||||
{
|
||||
s = desc[descidx].u.name;
|
||||
if (s && *s == '<' && s[1])
|
||||
{ /* It is common that the indicator for exact addrspec
|
||||
* search has not been removed. We do this here. */
|
||||
s++;
|
||||
n = strlen (s);
|
||||
if (n > 1 && s[n-1] == '>')
|
||||
n--;
|
||||
}
|
||||
else
|
||||
n = s? strlen (s):0;
|
||||
err = run_sql_bind_ntext (ctx->select_stmt, 1, s, n);
|
||||
}
|
||||
break;
|
||||
|
||||
case KEYDB_SEARCH_MODE_MAILSUB:
|
||||
|
@ -336,7 +336,7 @@ cmd_search (assuan_context_t ctx, char *line)
|
||||
}
|
||||
else
|
||||
{
|
||||
err = classify_user_id (line, &ctrl->server_local->search_desc, 0);
|
||||
err = classify_user_id (line, &ctrl->server_local->search_desc, 1);
|
||||
if (err)
|
||||
goto leave;
|
||||
}
|
||||
|
@ -1617,7 +1617,8 @@ keydb_search (ctrl_t ctrl, KEYDB_HANDLE hd,
|
||||
break;
|
||||
|
||||
case KEYDB_SEARCH_MODE_MAIL:
|
||||
snprintf (line, sizeof line, "SEARCH --x509 <%s", desc[0].u.name);
|
||||
snprintf (line, sizeof line, "SEARCH --x509 <%s",
|
||||
desc[0].u.name + (desc[0].u.name[0] == '<'));
|
||||
break;
|
||||
|
||||
case KEYDB_SEARCH_MODE_MAILSUB:
|
||||
|
Loading…
x
Reference in New Issue
Block a user