1622{
1624 char buf[1024] = { 0 };
1625 FILE *fp_pgp_in = NULL;
1626 FILE *fp_tmp = NULL;
1627 struct Body *b_enc = NULL;
1628 bool err = false;
1629 bool empty = false;
1630 pid_t pid;
1633
1636 if (!fp_out)
1637 {
1639 goto cleanup;
1640 }
1641
1643 if (!fp_pgp_err)
1644 {
1648 goto cleanup;
1649 }
1650
1653 if (!fp_tmp)
1654 {
1659 goto cleanup;
1660 }
1661
1662 if (sign)
1664
1666 fputc('\n', fp_tmp);
1669
1671 fileno(fp_pgp_err),
buf_string(pgpinfile), keylist, sign);
1672 if (pid == -1)
1673 {
1677 goto cleanup;
1678 }
1679
1680 if (sign)
1681 {
1683 fputs(mod_data->
pgp_pass, fp_pgp_in);
1684 fputc('\n', fp_pgp_in);
1685 }
1687
1690 empty = true;
1691
1693
1694 fflush(fp_out);
1695 fseek(fp_out, 0, SEEK_SET);
1696 clearerr(fp_out);
1697 if (!empty)
1698 empty = (fgetc(fp_out) == EOF);
1700
1701 fflush(fp_pgp_err);
1702 fseek(fp_pgp_err, 0, SEEK_SET);
1703 clearerr(fp_pgp_err);
1704 while (fgets(buf, sizeof(buf) - 1, fp_pgp_err))
1705 {
1706 err = true;
1707 fputs(buf, stdout);
1708 }
1710
1711
1712 if (err)
1714
1715 if (empty)
1716 {
1717
1718 if (sign)
1721 goto cleanup;
1722 }
1723
1730
1733
1738
1748
1749cleanup:
1752 return b_enc;
1753}
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
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.
int mutt_any_key_to_continue(const char *s)
Prompt the user to 'press any key' and wait.
#define mutt_file_fclose(FP)
#define mutt_file_fopen(PATH, MODE)
void pgp_class_void_passphrase(void)
Forget the cached passphrase - Implements CryptModuleSpecs::void_passphrase() -.
@ MODULE_ID_NCRYPT
ModuleNcrypt, Ncrypt
int filter_wait(pid_t pid)
Wait for the exit of a process and return its status.
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
bool pgp_use_gpg_agent(void)
Does the user want to use the gpg agent?
pid_t pgp_invoke_encrypt(FILE **fp_pgp_in, FILE **fp_pgp_out, FILE **fp_pgp_err, int fd_pgp_in, int fd_pgp_out, int fd_pgp_err, const char *fname, const char *uids, bool sign)
Use PGP to encrypt a file.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
int mutt_write_mime_body(struct Body *b, FILE *fp, struct ConfigSubset *sub)
Write a MIME part.
String manipulation buffer.
Ncrypt private Module data.
char pgp_pass[1024]
Cached PGP Passphrase.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.
#define mutt_file_mkstemp()