1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-05-14 08:13:25 +02:00

keyboxd: Searching UpperCaseAddress.

* kbx/backend-sqlite.c (run_select_statement): Convert with
ascii_strlwr when the mode is KEYDB_SEARCH_MODE_MAIL.

--

GnuPG-bug-id: 7576
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2025-03-26 14:26:54 +09:00 committed by Werner Koch
parent 052055fea5
commit 0812ab2996
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -956,18 +956,36 @@ run_select_statement (ctrl_t ctrl, be_sqlite_local_t ctx,
extra, " ORDER BY p.ubid", &ctx->select_stmt); extra, " ORDER BY p.ubid", &ctx->select_stmt);
if (!err) if (!err)
{ {
s = desc[descidx].u.name; if (desc[descidx].mode == KEYDB_SEARCH_MODE_MAIL)
if (s && *s == '<' && s[1]) {
{ /* It is common that the indicator for exact addrspec char *mail = xtrystrdup (desc[descidx].u.name);
* search has not been removed. We do this here. */
s++; if (!mail)
n = strlen (s); err = gpg_error_from_syserror ();
if (n > 1 && s[n-1] == '>') else
n--; {
ascii_strlwr (mail);
s = mail;
if (*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 = strlen (s);
err = run_sql_bind_ntext (ctx->select_stmt, 1, s, n);
xfree (mail);
}
} }
else else
n = s? strlen (s):0; {
err = run_sql_bind_ntext (ctx->select_stmt, 1, s, n); s = desc[descidx].u.name;
n = s? strlen (s):0;
err = run_sql_bind_ntext (ctx->select_stmt, 1, s, n);
}
} }
break; break;