1605{
1607 char buf[1024] = { 0 };
1608 FILE *fp_pgp_in = NULL;
1609 FILE *fp_tmp = NULL;
1610 struct Body *b_enc = NULL;
1611 bool err = false;
1612 bool empty = false;
1613 pid_t pid;
1616
1619 if (!fp_out)
1620 {
1622 goto cleanup;
1623 }
1624
1626 if (!fp_pgp_err)
1627 {
1631 goto cleanup;
1632 }
1633
1636 if (!fp_tmp)
1637 {
1642 goto cleanup;
1643 }
1644
1645 if (sign)
1647
1649 fputc('\n', fp_tmp);
1652
1654 fileno(fp_pgp_err),
buf_string(pgpinfile), keylist, sign);
1655 if (pid == -1)
1656 {
1660 goto cleanup;
1661 }
1662
1663 if (sign)
1664 {
1666 fputs(mod_data->
pgp_pass, fp_pgp_in);
1667 fputc('\n', fp_pgp_in);
1668 }
1670
1673 empty = true;
1674
1676
1677 fflush(fp_out);
1678 rewind(fp_out);
1679 if (!empty)
1680 empty = (fgetc(fp_out) == EOF);
1682
1683 fflush(fp_pgp_err);
1684 rewind(fp_pgp_err);
1685 while (fgets(buf, sizeof(buf) - 1, fp_pgp_err))
1686 {
1687 err = true;
1688 fputs(buf, stdout);
1689 }
1691
1692
1693 if (err)
1695
1696 if (empty)
1697 {
1698
1699 if (sign)
1702 goto cleanup;
1703 }
1704
1711
1714
1719
1729
1730cleanup:
1733 return b_enc;
1734}
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()