NeoMutt  2023-11-03-107-g582dc1
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? - Implements CryptModuleSpecs::smime_verify_sender() -.
 
int smime_class_verify_sender (struct Email *e, struct Message *msg)
 Does the sender match the certificate? - Implements CryptModuleSpecs::smime_verify_sender() -.
 

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? - Implements CryptModuleSpecs::smime_verify_sender() -.

Definition at line 4028 of file crypt_gpgme.c.

4029{
4030 return verify_sender(e);
4031}
static bool verify_sender(struct Email *e)
Verify the sender of a message.
Definition: crypt_gpgme.c:3949
+ 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? - Implements CryptModuleSpecs::smime_verify_sender() -.

Definition at line 1245 of file smime.c.

1246{
1247 const char *mbox = NULL, *certfile = NULL;
1248 int rc = 1;
1249
1250 struct Buffer *tempfname = buf_pool_get();
1251 buf_mktemp(tempfname);
1252 FILE *fp_out = mutt_file_fopen(buf_string(tempfname), "w");
1253 if (!fp_out)
1254 {
1255 mutt_perror("%s", buf_string(tempfname));
1256 goto cleanup;
1257 }
1258
1259 const bool encrypt = e->security & SEC_ENCRYPT;
1260 mutt_copy_message(fp_out, e, msg,
1262 encrypt ? (CH_MIME | CH_WEED | CH_NONEWLINE) : CH_NO_FLAGS, 0);
1263
1264 fflush(fp_out);
1265 mutt_file_fclose(&fp_out);
1266
1267 if (!TAILQ_EMPTY(&e->env->from))
1268 {
1270 mbox = buf_string(TAILQ_FIRST(&e->env->from)->mailbox);
1271 }
1272 else if (!TAILQ_EMPTY(&e->env->sender))
1273 {
1275 mbox = buf_string(TAILQ_FIRST(&e->env->sender)->mailbox);
1276 }
1277
1278 if (mbox)
1279 {
1280 certfile = smime_extract_signer_certificate(buf_string(tempfname));
1281 if (certfile)
1282 {
1283 mutt_file_unlink(buf_string(tempfname));
1284 if (smime_handle_cert_email(certfile, mbox, false, NULL, NULL))
1285 {
1286 if (isendwin())
1288 }
1289 else
1290 {
1291 rc = 0;
1292 }
1293 mutt_file_unlink(certfile);
1294 FREE(&certfile);
1295 }
1296 else
1297 {
1298 mutt_any_key_to_continue(_("no certfile"));
1299 }
1300 }
1301 else
1302 {
1303 mutt_any_key_to_continue(_("no mbox"));
1304 }
1305
1306 mutt_file_unlink(buf_string(tempfname));
1307
1308cleanup:
1309 buf_pool_release(&tempfname);
1310 return rc;
1311}
void mutt_expand_aliases(struct AddressList *al)
Expand aliases in a List of Addresses.
Definition: alias.c:298
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:93
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:184
FILE * mutt_file_fopen(const char *path, const char *mode)
Call fopen() safely.
Definition: file.c:636
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
Definition: file.c:152
void mutt_file_unlink(const char *s)
Delete a file, carefully.
Definition: file.c:196
#define mutt_perror(...)
Definition: logging2.h:93
#define FREE(x)
Definition: memory.h:45
#define _(a)
Definition: message.h:28
#define SEC_ENCRYPT
Email is encrypted.
Definition: lib.h:79
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:81
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition: pool.c:94
#define TAILQ_FIRST(head)
Definition: queue.h:723
#define TAILQ_EMPTY(head)
Definition: queue.h:721
static char * smime_extract_signer_certificate(const char *infile)
Extract the signer's certificate.
Definition: smime.c:1103
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:887
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:33
+ Here is the call graph for this function: