NeoMutt  2023-05-17-33-gce4425
Teaching an old dog new tricks
DOXYGEN
smime_verify_sender()

Does the sender match the certificate? More...

+ Collaboration diagram for smime_verify_sender():

Functions

int smime_gpgme_verify_sender (struct Email *e, struct Message *msg)
 Implements CryptModuleSpecs::smime_verify_sender() -. More...
 
int smime_class_verify_sender (struct Email *e, struct Message *msg)
 Implements CryptModuleSpecs::smime_verify_sender() -. More...
 

Detailed Description

Does the sender match the certificate?

Parameters
eEmail
msgMessage
Return values
0Success
1Failure

Function Documentation

◆ smime_gpgme_verify_sender()

int smime_gpgme_verify_sender ( struct Email e,
struct Message msg 
)

Implements CryptModuleSpecs::smime_verify_sender() -.

Definition at line 4034 of file crypt_gpgme.c.

4035{
4036 return verify_sender(e);
4037}
static bool verify_sender(struct Email *e)
Verify the sender of a message.
Definition: crypt_gpgme.c:3955
+ Here is the call graph for this function:

◆ smime_class_verify_sender()

int smime_class_verify_sender ( struct Email e,
struct Message msg 
)

Implements CryptModuleSpecs::smime_verify_sender() -.

Definition at line 1257 of file smime.c.

1258{
1259 char *mbox = NULL, *certfile = NULL;
1260 int rc = 1;
1261
1262 struct Buffer *tempfname = buf_pool_get();
1263 buf_mktemp(tempfname);
1264 FILE *fp_out = mutt_file_fopen(buf_string(tempfname), "w");
1265 if (!fp_out)
1266 {
1267 mutt_perror(buf_string(tempfname));
1268 goto cleanup;
1269 }
1270
1271 const bool encrypt = e->security & SEC_ENCRYPT;
1272 mutt_copy_message(fp_out, e, msg,
1274 encrypt ? (CH_MIME | CH_WEED | CH_NONEWLINE) : CH_NO_FLAGS, 0);
1275
1276 fflush(fp_out);
1277 mutt_file_fclose(&fp_out);
1278
1279 if (!TAILQ_EMPTY(&e->env->from))
1280 {
1282 mbox = TAILQ_FIRST(&e->env->from)->mailbox;
1283 }
1284 else if (!TAILQ_EMPTY(&e->env->sender))
1285 {
1287 mbox = TAILQ_FIRST(&e->env->sender)->mailbox;
1288 }
1289
1290 if (mbox)
1291 {
1292 certfile = smime_extract_signer_certificate(buf_string(tempfname));
1293 if (certfile)
1294 {
1295 mutt_file_unlink(buf_string(tempfname));
1296 if (smime_handle_cert_email(certfile, mbox, false, NULL, NULL))
1297 {
1298 if (isendwin())
1300 }
1301 else
1302 {
1303 rc = 0;
1304 }
1305 mutt_file_unlink(certfile);
1306 FREE(&certfile);
1307 }
1308 else
1309 {
1310 mutt_any_key_to_continue(_("no certfile"));
1311 }
1312 }
1313 else
1314 {
1315 mutt_any_key_to_continue(_("no mbox"));
1316 }
1317
1318 mutt_file_unlink(buf_string(tempfname));
1319
1320cleanup:
1321 buf_pool_release(&tempfname);
1322 return rc;
1323}
void mutt_expand_aliases(struct AddressList *al)
Expand aliases in a List of Addresses.
Definition: alias.c:297
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:78
int mutt_copy_message(FILE *fp_out, struct Email *e, struct Message *msg, CopyMessageFlags cmflags, CopyHeaderFlags chflags, int wraplen)
Copy a message from a Mailbox.
Definition: copy.c:884
#define CH_NONEWLINE
Don't output terminating newline after the header.
Definition: copy.h:60
#define CH_WEED
Weed the headers?
Definition: copy.h:53
#define MUTT_CM_DECODE_SMIME
Used for decoding S/MIME messages.
Definition: copy.h:46
#define CH_MIME
Ignore MIME fields.
Definition: copy.h:61
#define MUTT_CM_NO_FLAGS
No flags are set.
Definition: copy.h:35
#define MUTT_CM_DECODE_CRYPT
Definition: copy.h:48
#define CH_NO_FLAGS
No flags are set.
Definition: copy.h:51
int mutt_any_key_to_continue(const char *s)
Prompt the user to 'press any key' and wait.
Definition: curs_lib.c:388
FILE * mutt_file_fopen(const char *path, const char *mode)
Call fopen() safely.
Definition: file.c:634
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
Definition: file.c:150
void mutt_file_unlink(const char *s)
Delete a file, carefully.
Definition: file.c:194
#define mutt_perror(...)
Definition: logging2.h:88
#define FREE(x)
Definition: memory.h:43
#define _(a)
Definition: message.h:28
#define SEC_ENCRYPT
Email is encrypted.
Definition: lib.h:78
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:106
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition: pool.c:119
#define TAILQ_FIRST(head)
Definition: queue.h:723
#define TAILQ_EMPTY(head)
Definition: queue.h:721
static int smime_handle_cert_email(char *certificate, char *mailbox, bool copy, char ***buffer, int *num)
Process an email containing certificates.
Definition: smime.c:900
static char * smime_extract_signer_certificate(const char *infile)
Extract the signer's certificate.
Definition: smime.c:1116
String manipulation buffer.
Definition: buffer.h:34
struct Envelope * env
Envelope information.
Definition: email.h:66
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
Definition: email.h:41
struct AddressList sender
Email's sender.
Definition: envelope.h:63
struct AddressList from
Email's 'From' list.
Definition: envelope.h:59
#define buf_mktemp(buf)
Definition: tmp.h:37
+ Here is the call graph for this function: