1755{
1757 struct Body *b_enc = NULL;
1758 char body_charset[256] = { 0 };
1759 const char *from_charset = NULL;
1760 const char *send_charset = NULL;
1761 bool empty = false;
1762 bool err;
1763 char buf[256] = { 0 };
1764 pid_t pid;
1767
1769 goto cleanup;
1771 goto cleanup;
1772
1774 if (!fp_body)
1775 {
1777 goto cleanup;
1778 }
1779
1782 if (!fp_pgp_in)
1783 {
1786 goto cleanup;
1787 }
1788
1789
1790
1791
1792
1793
1796 from_charset = body_charset;
1797 else
1799
1801 {
1802 send_charset = "us-ascii";
1804 }
1805 else
1806 {
1807 int c;
1809
1811 send_charset = "us-ascii";
1812 else
1813 send_charset = "utf-8";
1814
1815
1818 fputc(c, fp_pgp_in);
1819
1821 }
1824
1828 if (!fp_pgp_out || !fp_pgp_err)
1829 {
1832 if (fp_pgp_out)
1833 {
1836 }
1838 goto cleanup;
1839 }
1840
1842 fileno(fp_pgp_err),
buf_string(pgpinfile), keylist, flags);
1843 if (pid == -1)
1844 {
1850 goto cleanup;
1851 }
1852
1856 fprintf(fp_pgp_in,
"%s\n", mod_data->
pgp_pass);
1858
1861 empty = true;
1862
1864
1865 fflush(fp_pgp_out);
1866 fflush(fp_pgp_err);
1867
1868 fseek(fp_pgp_out, 0, SEEK_SET);
1869 clearerr(fp_pgp_out);
1870 fseek(fp_pgp_err, 0, SEEK_SET);
1871 clearerr(fp_pgp_err);
1872
1873 if (!empty)
1874 empty = (fgetc(fp_pgp_out) == EOF);
1876
1877 err = false;
1878
1879 while (fgets(buf, sizeof(buf), fp_pgp_err))
1880 {
1881 err = true;
1882 fputs(buf, stdout);
1883 }
1884
1886
1887 if (err)
1889
1890 if (empty)
1891 {
1895 goto cleanup;
1896 }
1897
1899
1901
1904
1906 (flags &
SEC_ENCRYPT) ?
"pgp-encrypted" :
"pgp-signed");
1908
1910
1913
1916
1919
1920cleanup:
1923 return b_enc;
1924}
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.
const char * cc_charset(void)
Get the cached value of $charset.
int mutt_any_key_to_continue(const char *s)
Prompt the user to 'press any key' and wait.
struct Body * mutt_body_new(void)
Create a new Body.
char * mutt_body_get_charset(struct Body *b, char *buf, size_t buflen)
Get a body's character set.
int mutt_file_copy_stream(FILE *fp_in, FILE *fp_out)
Copy the contents of one file into another.
void mutt_file_unlink(const char *s)
Delete a file, carefully.
#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() -.
@ TYPE_TEXT
Type: 'text/*'.
@ DISP_NONE
No preferred disposition.
@ MODULE_ID_NCRYPT
ModuleNcrypt, Ncrypt
int mutt_ch_fgetconv(struct FgetConv *fc)
Convert a file's character set.
struct FgetConv * mutt_ch_fgetconv_open(FILE *fp, const char *from, const char *to, uint8_t flags)
Prepare a file for charset conversion.
void mutt_ch_fgetconv_close(struct FgetConv **ptr)
Close an fgetconv handle.
#define MUTT_ICONV_NONE
No flags are set.
#define mutt_ch_is_us_ascii(str)
int filter_wait(pid_t pid)
Wait for the exit of a process and return its status.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
char * mutt_str_dup(const char *str)
Copy a string, safely.
@ SEC_SIGN
Email is signed.
@ SEC_ENCRYPT
Email is encrypted.
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
void mutt_param_set(struct ParameterList *pl, const char *attribute, const char *value)
Set a Parameter.
bool pgp_use_gpg_agent(void)
Does the user want to use the gpg agent?
pid_t pgp_invoke_traditional(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, SecurityFlags flags)
Use PGP to create in inline-signed message.
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.
bool noconv
Don't do character set conversion.
bool unlink
If true, filename should be unlink()ed before free()ing this structure.
struct ParameterList parameter
Parameters of the content-type.
bool use_disp
Content-Disposition uses filename= ?
unsigned int disposition
content-disposition, ContentDisposition
char * subtype
content-type subtype
unsigned int encoding
content-transfer-encoding, ContentEncoding
unsigned int type
content-type primary type, ContentType
char * filename
When sending a message, this is the file to which this structure refers.
String manipulation buffer.
Cursor for converting a file's encoding.
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()