1338{
1339 struct Body *t = NULL, *rv = NULL;
1340 char buf[1024] = { 0 };
1341 FILE *fp_pgp_in = NULL, *fp_pgp_out = NULL, *fp_pgp_err = NULL, *fp_signed = NULL;
1342 bool err = false;
1343 bool empty = true;
1344 pid_t pid;
1347
1349
1352 if (!fp_sig)
1353 {
1354 goto cleanup;
1355 }
1356
1359 if (!fp_signed)
1360 {
1364 goto cleanup;
1365 }
1366
1368 fputc('\n', fp_signed);
1371
1372 pid =
pgp_invoke_sign(&fp_pgp_in, &fp_pgp_out, &fp_pgp_err, -1, -1, -1,
1374 if (pid == -1)
1375 {
1380 goto cleanup;
1381 }
1382
1385 fputc('\n', fp_pgp_in);
1387
1388
1389
1390 while (fgets(buf, sizeof(buf) - 1, fp_pgp_out))
1391 {
1393 fputs("-----BEGIN PGP SIGNATURE-----\n", fp_sig);
1395 fputs("-----END PGP SIGNATURE-----\n", fp_sig);
1396 else
1397 fputs(buf, fp_sig);
1398 empty = false;
1399 }
1400
1401
1402 err = false;
1403 while (fgets(buf, sizeof(buf) - 1, fp_pgp_err))
1404 {
1405 err = true;
1406 fputs(buf, stdout);
1407 }
1408
1411 empty = true;
1412
1416
1418 {
1421 goto cleanup;
1422 }
1423
1424 if (err)
1426 if (empty)
1427 {
1429
1431 goto cleanup;
1432 }
1433
1440 rv = t;
1441
1445
1447
1458
1459cleanup:
1462 return rv;
1463}
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 *a)
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.
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() -.
@ TYPE_MULTIPART
Type: 'multipart/*'.
@ TYPE_APPLICATION
Type: 'application/*'.
@ DISP_INLINE
Content is inline.
@ DISP_NONE
No preferred disposition.
void mutt_generate_boundary(struct ParameterList *pl)
Create a unique boundary id for a MIME part.
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 mutt_param_set(struct ParameterList *pl, const char *attribute, const char *value)
Set a Parameter.
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_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 *a, 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.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.