1337{
1339 struct Body *b_enc = NULL;
1340 struct Body *rv = NULL;
1341 char buf[1024] = { 0 };
1342 FILE *fp_pgp_in = NULL;
1343 FILE *fp_pgp_out = NULL;
1344 FILE *fp_pgp_err = NULL;
1345 FILE *fp_signed = NULL;
1346 bool err = false;
1347 bool empty = true;
1348 pid_t pid;
1351
1353
1356 if (!fp_sig)
1357 {
1358 goto cleanup;
1359 }
1360
1363 if (!fp_signed)
1364 {
1368 goto cleanup;
1369 }
1370
1372 fputc('\n', fp_signed);
1375
1376 pid =
pgp_invoke_sign(&fp_pgp_in, &fp_pgp_out, &fp_pgp_err, -1, -1, -1,
1378 if (pid == -1)
1379 {
1384 goto cleanup;
1385 }
1386
1388 fputs(mod_data->
pgp_pass, fp_pgp_in);
1389 fputc('\n', fp_pgp_in);
1391
1392
1393
1394 while (fgets(buf, sizeof(buf) - 1, fp_pgp_out))
1395 {
1397 fputs("-----BEGIN PGP SIGNATURE-----\n", fp_sig);
1399 fputs("-----END PGP SIGNATURE-----\n", fp_sig);
1400 else
1401 fputs(buf, fp_sig);
1402 empty = false;
1403 }
1404
1405
1406 err = false;
1407 while (fgets(buf, sizeof(buf) - 1, fp_pgp_err))
1408 {
1409 err = true;
1410 fputs(buf, stdout);
1411 }
1412
1415 empty = true;
1416
1420
1422 {
1425 goto cleanup;
1426 }
1427
1428 if (err)
1430 if (empty)
1431 {
1433
1435 goto cleanup;
1436 }
1437
1444 rv = b_enc;
1445
1449
1451
1462
1463cleanup:
1466 return rv;
1467}
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.
void crypt_convert_to_7bit(struct Body *b)
Convert an email to 7bit encoding.
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.
#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_MULTIPART
Type: 'multipart/*'.
@ TYPE_APPLICATION
Type: 'application/*'.
@ DISP_INLINE
Content is inline.
@ DISP_NONE
No preferred disposition.
@ MODULE_ID_NCRYPT
ModuleNcrypt, Ncrypt
void mutt_generate_boundary(struct ParameterList *pl)
Create a unique boundary id for a MIME part.
int filter_wait(pid_t pid)
Wait for the exit of a process and return its status.
char * mutt_str_dup(const char *str)
Copy a string, safely.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
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_sign(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)
Use PGP to sign a file.
const char * pgp_micalg(const char *fname)
Find the hash algorithm of 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.
struct Body * parts
parts of a multipart or message/rfc822
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
struct Body * next
next attachment in the list
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.
Ncrypt private Module data.
char pgp_pass[1024]
Cached PGP Passphrase.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.