NeoMutt  2022-04-29-323-g5fcc6c
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 4001 of file crypt_gpgme.c.

4002{
4003 return verify_sender(e);
4004}
static bool verify_sender(struct Email *e)
Verify the sender of a message.
Definition: crypt_gpgme.c:3926
+ 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 1232 of file smime.c.

1233{
1234 char *mbox = NULL, *certfile = NULL;
1235 int rc = 1;
1236
1237 struct Buffer *tempfname = mutt_buffer_pool_get();
1238 mutt_buffer_mktemp(tempfname);
1239 FILE *fp_out = mutt_file_fopen(mutt_buffer_string(tempfname), "w");
1240 if (!fp_out)
1241 {
1242 mutt_perror(mutt_buffer_string(tempfname));
1243 goto cleanup;
1244 }
1245
1246 const bool encrypt = e->security & SEC_ENCRYPT;
1247 mutt_copy_message(fp_out, e, msg,
1249 encrypt ? (CH_MIME | CH_WEED | CH_NONEWLINE) : CH_NO_FLAGS, 0);
1250
1251 fflush(fp_out);
1252 mutt_file_fclose(&fp_out);
1253
1254 if (!TAILQ_EMPTY(&e->env->from))
1255 {
1257 mbox = TAILQ_FIRST(&e->env->from)->mailbox;
1258 }
1259 else if (!TAILQ_EMPTY(&e->env->sender))
1260 {
1262 mbox = TAILQ_FIRST(&e->env->sender)->mailbox;
1263 }
1264
1265 if (mbox)
1266 {
1268 if (certfile)
1269 {
1271 if (smime_handle_cert_email(certfile, mbox, false, NULL, NULL))
1272 {
1273 if (isendwin())
1275 }
1276 else
1277 rc = 0;
1278 mutt_file_unlink(certfile);
1279 FREE(&certfile);
1280 }
1281 else
1282 mutt_any_key_to_continue(_("no certfile"));
1283 }
1284 else
1285 mutt_any_key_to_continue(_("no mbox"));
1286
1288
1289cleanup:
1290 mutt_buffer_pool_release(&tempfname);
1291 return rc;
1292}
void mutt_expand_aliases(struct AddressList *al)
Expand aliases in a List of Addresses.
Definition: alias.c:298
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:77
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:864
#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:387
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:151
void mutt_file_unlink(const char *s)
Delete a file, carefully.
Definition: file.c:193
#define mutt_perror(...)
Definition: logging.h:88
#define FREE(x)
Definition: memory.h:43
#define _(a)
Definition: message.h:28
#define mutt_buffer_mktemp(buf)
Definition: muttlib.h:74
#define SEC_ENCRYPT
Email is encrypted.
Definition: lib.h:78
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
Definition: pool.c:112
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:101
#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:880
static char * smime_extract_signer_certificate(const char *infile)
Extract the signer's certificate.
Definition: smime.c:1090
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
+ Here is the call graph for this function: