1490{
1492 struct ListNode *crypt_hook = NULL;
1493 const char *keyid = NULL;
1494 char *keylist = NULL;
1495 size_t keylist_size = 0;
1496 size_t keylist_used = 0;
1500 char buf[1024] = { 0 };
1501 bool key_selected;
1503
1506
1508 {
1509 key_selected = false;
1510
1513 do
1514 {
1515 p = a;
1516 k_info = NULL;
1517
1518
1519
1520 if (crypt_hook)
1521 {
1522 keyid = crypt_hook->
data;
1524 if (!oppenc_mode && c_crypt_confirm_hook && isatty(STDIN_FILENO))
1525 {
1526 snprintf(buf,
sizeof(buf),
_(
"Use keyID = \"%s\" for %s?"), keyid,
1529 }
1531 {
1533 {
1535 keyid += 2;
1536 goto bypass_selection;
1537 }
1538
1539
1542 {
1545 }
1546 else if (!oppenc_mode)
1547 {
1549 }
1550 }
1552 {
1553 if (key_selected ||
STAILQ_NEXT(crypt_hook, entries))
1554 {
1556 continue;
1557 }
1558 }
1560 {
1564 return NULL;
1565 }
1566 }
1567
1568
1569 if (!k_info)
1570 {
1573 }
1574
1575
1576 if (!k_info && !oppenc_mode && isatty(STDIN_FILENO))
1577 {
1580 }
1581
1582 if (!k_info)
1583 {
1587 return NULL;
1588 }
1589
1591
1592 bypass_selection:
1593
1596 sprintf(keylist + keylist_used, "%s0x%s", keylist_used ? " " : "", keyid);
1598
1599 key_selected = true;
1600
1603
1604 if (crypt_hook)
1606
1607 } while (crypt_hook);
1608
1610 }
1611 return keylist;
1612}
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, T)
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.