1486{
1488 struct ListNode *crypt_hook = NULL;
1489 const char *keyid = NULL;
1490 char *keylist = NULL;
1491 size_t keylist_size = 0;
1492 size_t keylist_used = 0;
1496 char buf[1024] = { 0 };
1497 bool key_selected;
1499
1502
1504 {
1505 key_selected = false;
1506
1509 do
1510 {
1511 p = a;
1512 k_info = NULL;
1513
1514
1515
1516 if (crypt_hook)
1517 {
1518 keyid = crypt_hook->
data;
1520 if (!oppenc_mode && c_crypt_confirm_hook && isatty(STDIN_FILENO))
1521 {
1522 snprintf(buf,
sizeof(buf),
_(
"Use keyID = \"%s\" for %s?"), keyid,
1525 }
1527 {
1529 {
1531 keyid += 2;
1532 goto bypass_selection;
1533 }
1534
1535
1538 {
1541 }
1542 else if (!oppenc_mode)
1543 {
1545 }
1546 }
1548 {
1549 if (key_selected ||
STAILQ_NEXT(crypt_hook, entries))
1550 {
1552 continue;
1553 }
1554 }
1556 {
1560 return NULL;
1561 }
1562 }
1563
1564
1565 if (!k_info)
1566 {
1569 }
1570
1571
1572 if (!k_info && !oppenc_mode && isatty(STDIN_FILENO))
1573 {
1576 }
1577
1578 if (!k_info)
1579 {
1583 return NULL;
1584 }
1585
1587
1588 bypass_selection:
1589
1592 sprintf(keylist + keylist_used, "%s0x%s", keylist_used ? " " : "", keyid);
1594
1595 key_selected = true;
1596
1599
1600 if (crypt_hook)
1602
1603 } while (crypt_hook);
1604
1606 }
1607 return keylist;
1608}
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.