1473{
1475 struct ListNode *crypt_hook = NULL;
1476 const char *keyid = NULL;
1477 char *keylist = NULL;
1478 size_t keylist_size = 0;
1479 size_t keylist_used = 0;
1483 char buf[1024] = { 0 };
1484 bool key_selected;
1486
1489
1491 {
1492 key_selected = false;
1493
1496 do
1497 {
1498 p = a;
1499 k_info = NULL;
1500
1501
1502
1503 if (crypt_hook)
1504 {
1505 keyid = crypt_hook->
data;
1507 if (!oppenc_mode && c_crypt_confirm_hook && isatty(STDIN_FILENO))
1508 {
1509 snprintf(buf,
sizeof(buf),
_(
"Use keyID = \"%s\" for %s?"), keyid,
1512 }
1514 {
1516 {
1518 keyid += 2;
1519 goto bypass_selection;
1520 }
1521
1522
1525 {
1528 }
1529 else if (!oppenc_mode)
1530 {
1532 }
1533 }
1535 {
1536 if (key_selected ||
STAILQ_NEXT(crypt_hook, entries))
1537 {
1539 continue;
1540 }
1541 }
1543 {
1547 return NULL;
1548 }
1549 }
1550
1551
1552 if (!k_info)
1553 {
1556 }
1557
1558
1559 if (!k_info && !oppenc_mode && isatty(STDIN_FILENO))
1560 {
1563 }
1564
1565 if (!k_info)
1566 {
1570 return NULL;
1571 }
1572
1574
1575 bypass_selection:
1576
1579 sprintf(keylist + keylist_used, "%s0x%s", keylist_used ? " " : "", keyid);
1581
1582 key_selected = true;
1583
1586
1587 if (crypt_hook)
1589
1590 } while (crypt_hook);
1591
1593 }
1594 return keylist;
1595}
void mutt_addrlist_qualify(struct AddressList *al, const char *host)
Expand local names in an Address list using a hostname.
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
int mutt_addrlist_parse(struct AddressList *al, const char *s)
Parse a list of email addresses.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
bool crypt_is_numerical_keyid(const char *s)
Is this a numerical keyid.
void pgp_class_invoke_getkeys(struct Address *addr)
Run a command to download a PGP key - Implements CryptModuleSpecs::pgp_invoke_getkeys() -.
void mutt_crypt_hook(struct ListHead *list, struct Address *addr)
Find crypto hooks for an Address.
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
#define FREE(x)
Free memory and set the pointer to NULL.
#define MUTT_MEM_REALLOC(pptr, n, type)
bool mutt_strn_equal(const char *a, const char *b, size_t num)
Check for equality of two strings (to a maximum), safely.
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
@ KEYFLAG_CANENCRYPT
Key is suitable for encryption.
char * pgp_fpr_or_lkeyid(struct PgpKeyInfo *k)
Get the fingerprint or long keyid.
struct PgpKeyInfo * pgp_ask_for_key(char *tag, const char *whatfor, KeyFlags abilities, enum PgpRing keyring)
Ask the user for a PGP key.
struct PgpKeyInfo * pgp_getkeybyaddr(struct Address *a, KeyFlags abilities, enum PgpRing keyring, bool oppenc_mode)
Find a PGP key by address.
struct PgpKeyInfo * pgp_getkeybystr(const char *cp, KeyFlags abilities, enum PgpRing keyring)
Find a PGP key by string.
@ PGP_PUBRING
Public keys.
void pgp_key_free(struct PgpKeyInfo **kpp)
Free a PGP key info.
QuadOption
Possible values for a quad-option.
@ MUTT_ABORT
User aborted the question (with Ctrl-G).
@ MUTT_NO
User answered 'No', or assume 'No'.
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
enum QuadOption query_yesorno_help(const char *prompt, enum QuadOption def, struct ConfigSubset *sub, const char *name)
Ask the user a Yes/No question offering help.
#define TAILQ_FOREACH(var, head, field)
#define STAILQ_HEAD_INITIALIZER(head)
#define STAILQ_FIRST(head)
#define TAILQ_FIRST(head)
#define TAILQ_HEAD_INITIALIZER(head)
#define STAILQ_NEXT(elm, field)
const char * mutt_fqdn(bool may_hide_host, const struct ConfigSubset *sub)
Get the Fully-Qualified Domain Name.
struct Buffer * mailbox
Mailbox and host address.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.
Information about a PGP key.