1594{
1595 char buf[1024] = { 0 };
1596 FILE *fp_pgp_in = NULL, *fp_tmp = NULL;
1597 struct Body *t = NULL;
1598 int err = 0;
1599 bool empty = false;
1600 pid_t pid;
1603
1606 if (!fp_out)
1607 {
1609 goto cleanup;
1610 }
1611
1613 if (!fp_pgp_err)
1614 {
1618 goto cleanup;
1619 }
1620
1623 if (!fp_tmp)
1624 {
1629 goto cleanup;
1630 }
1631
1632 if (sign)
1634
1636 fputc('\n', fp_tmp);
1639
1641 fileno(fp_pgp_err),
buf_string(pgpinfile), keylist, sign);
1642 if (pid == -1)
1643 {
1647 goto cleanup;
1648 }
1649
1650 if (sign)
1651 {
1654 fputc('\n', fp_pgp_in);
1655 }
1657
1660 empty = true;
1661
1663
1664 fflush(fp_out);
1665 rewind(fp_out);
1666 if (!empty)
1667 empty = (fgetc(fp_out) == EOF);
1669
1670 fflush(fp_pgp_err);
1671 rewind(fp_pgp_err);
1672 while (fgets(buf, sizeof(buf) - 1, fp_pgp_err))
1673 {
1674 err = 1;
1675 fputs(buf, stdout);
1676 }
1678
1679
1680 if (err)
1682
1683 if (empty)
1684 {
1685
1686 if (sign)
1689 goto cleanup;
1690 }
1691
1698
1701
1706
1716
1717cleanup:
1720 return t;
1721}
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.
FILE * mutt_file_fopen(const char *path, const char *mode)
Call fopen() safely.
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
int filter_wait(pid_t pid)
Wait for the exit of a process and return its status.
void pgp_class_void_passphrase(void)
Implements CryptModuleSpecs::void_passphrase() -.
static char PgpPass[1024]
Cached PGP Passphrase.
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 *a, FILE *fp, struct ConfigSubset *sub)
Write a MIME part.
String manipulation buffer.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.
#define mutt_file_mkstemp()