NeoMutt  2025-12-11-980-ge38c27
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
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)
 Does the sender match the certificate?
 
int smime_class_verify_sender (struct Email *e, struct Message *msg)
 Does the sender match the certificate?
 

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 )

Does the sender match the certificate?

Definition at line 4177 of file crypt_gpgme.c.

4178{
4179 return verify_sender(e);
4180}
static bool verify_sender(struct Email *e)
Verify the sender of a message.
+ Here is the call graph for this function:

◆ smime_class_verify_sender()

int smime_class_verify_sender ( struct Email * e,
struct Message * msg )

Does the sender match the certificate?

Definition at line 1067 of file smime.c.

1068{
1069 const char *mbox = NULL;
1070 const char *certfile = NULL;
1071 int rc = 1;
1072
1073 struct Buffer *tempfname = buf_pool_get();
1074 buf_mktemp(tempfname);
1075 FILE *fp_out = mutt_file_fopen(buf_string(tempfname), "w");
1076 if (!fp_out)
1077 {
1078 mutt_perror("%s", buf_string(tempfname));
1079 goto cleanup;
1080 }
1081
1082 const bool encrypt = e->security & SEC_ENCRYPT;
1083 mutt_copy_message(fp_out, e, msg,
1085 encrypt ? (CH_MIME | CH_WEED | CH_NONEWLINE) : CH_NONE, 0);
1086
1087 fflush(fp_out);
1088 mutt_file_fclose(&fp_out);
1089
1090 if (!TAILQ_EMPTY(&e->env->from))
1091 {
1093 mbox = buf_string(TAILQ_FIRST(&e->env->from)->mailbox);
1094 }
1095 else if (!TAILQ_EMPTY(&e->env->sender))
1096 {
1098 mbox = buf_string(TAILQ_FIRST(&e->env->sender)->mailbox);
1099 }
1100
1101 if (mbox)
1102 {
1103 certfile = smime_extract_signer_certificate(buf_string(tempfname));
1104 if (certfile)
1105 {
1106 mutt_file_unlink(buf_string(tempfname));
1107 if (smime_handle_cert_email(certfile, mbox, false, NULL, NULL))
1108 {
1109 if (isendwin())
1111 }
1112 else
1113 {
1114 rc = 0;
1115 }
1116 mutt_file_unlink(certfile);
1117 FREE(&certfile);
1118 }
1119 else
1120 {
1121 mutt_any_key_to_continue(_("no certfile"));
1122 }
1123 }
1124 else
1125 {
1126 mutt_any_key_to_continue(_("no mbox"));
1127 }
1128
1129 mutt_file_unlink(buf_string(tempfname));
1130
1131cleanup:
1132 buf_pool_release(&tempfname);
1133 return rc;
1134}
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:96
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_email.c:920
@ MUTT_CM_DECODE_SMIME
Used for decoding S/MIME messages.
Definition copy_email.h:52
@ MUTT_CM_NONE
No flags are set.
Definition copy_email.h:41
#define MUTT_CM_DECODE_CRYPT
Combination flag for decoding any kind of cryptography (PGP or S/MIME)
Definition copy_email.h:58
@ CH_WEED
Weed the headers?
Definition copy_email.h:67
@ CH_MIME
Ignore MIME fields.
Definition copy_email.h:75
@ CH_NONE
No flags are set.
Definition copy_email.h:65
@ CH_NONEWLINE
Don't output terminating newline after the header.
Definition copy_email.h:74
int mutt_any_key_to_continue(const char *s)
Prompt the user to 'press any key' and wait.
Definition curs_lib.c:174
void mutt_file_unlink(const char *s)
Delete a file, carefully.
Definition file.c:156
#define mutt_file_fclose(FP)
Definition file.h:144
#define mutt_file_fopen(PATH, MODE)
Definition file.h:143
#define mutt_perror(...)
Definition logging2.h:95
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
#define _(a)
Definition message.h:28
@ SEC_ENCRYPT
Email is encrypted.
Definition lib.h:92
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition pool.c:91
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition pool.c:111
#define TAILQ_FIRST(head)
Definition queue.h:780
#define TAILQ_EMPTY(head)
Definition queue.h:778
static char * smime_extract_signer_certificate(const char *infile)
Extract the signer's certificate.
Definition smime.c:923
static int smime_handle_cert_email(const char *certificate, const char *mailbox, bool copy, char ***buffer, int *num)
Process an email containing certificates.
Definition smime.c:705
String manipulation buffer.
Definition buffer.h:36
struct Envelope * env
Envelope information.
Definition email.h:68
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
Definition email.h:43
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:33
+ Here is the call graph for this function: