1618{
1620 char buf[1024] = { 0 };
1621 FILE *fp_pgp_in = NULL;
1622 FILE *fp_tmp = NULL;
1623 struct Body *b_enc = NULL;
1624 bool err = false;
1625 bool empty = false;
1626 pid_t pid;
1629
1632 if (!fp_out)
1633 {
1635 goto cleanup;
1636 }
1637
1639 if (!fp_pgp_err)
1640 {
1644 goto cleanup;
1645 }
1646
1649 if (!fp_tmp)
1650 {
1655 goto cleanup;
1656 }
1657
1658 if (sign)
1660
1662 fputc('\n', fp_tmp);
1665
1667 fileno(fp_pgp_err),
buf_string(pgpinfile), keylist, sign);
1668 if (pid == -1)
1669 {
1673 goto cleanup;
1674 }
1675
1676 if (sign)
1677 {
1679 fputs(mod_data->
pgp_pass, fp_pgp_in);
1680 fputc('\n', fp_pgp_in);
1681 }
1683
1686 empty = true;
1687
1689
1690 fflush(fp_out);
1691 fseek(fp_out, 0, SEEK_SET);
1692 clearerr(fp_out);
1693 if (!empty)
1694 empty = (fgetc(fp_out) == EOF);
1696
1697 fflush(fp_pgp_err);
1698 fseek(fp_pgp_err, 0, SEEK_SET);
1699 clearerr(fp_pgp_err);
1700 while (fgets(buf, sizeof(buf) - 1, fp_pgp_err))
1701 {
1702 err = true;
1703 fputs(buf, stdout);
1704 }
1706
1707
1708 if (err)
1710
1711 if (empty)
1712 {
1713
1714 if (sign)
1717 goto cleanup;
1718 }
1719
1726
1729
1734
1744
1745cleanup:
1748 return b_enc;
1749}
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()