NeoMutt  2025-12-11-177-g48e272
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
address.c
Go to the documentation of this file.
1#include "config.h"
2#include <stdbool.h>
3#include <stdint.h>
4#include <stdio.h>
5#include <time.h>
6#include "mutt/lib.h"
7#include "config/lib.h"
8#include "email/lib.h"
9#include "core/lib.h"
10#include "mutt.h"
11
12bool StartupComplete = true;
13
14// clang-format off
15extern const struct Module ModuleMain;
16extern const struct Module ModuleAddress; extern const struct Module ModuleAlias; extern const struct Module ModuleAttach; extern const struct Module ModuleAutocrypt;
17extern const struct Module ModuleBcache; extern const struct Module ModuleBrowser; extern const struct Module ModuleColor; extern const struct Module ModuleCommands;
18extern const struct Module ModuleComplete; extern const struct Module ModuleCompmbox; extern const struct Module ModuleCompose; extern const struct Module ModuleCompress;
19extern const struct Module ModuleConfig; extern const struct Module ModuleConn; extern const struct Module ModuleConvert; extern const struct Module ModuleCore;
20extern const struct Module ModuleEditor; extern const struct Module ModuleEmail; extern const struct Module ModuleEnvelope; extern const struct Module ModuleExpando;
21extern const struct Module ModuleGui; extern const struct Module ModuleHcache; extern const struct Module ModuleHelpbar; extern const struct Module ModuleHistory;
22extern const struct Module ModuleHooks; extern const struct Module ModuleImap; extern const struct Module ModuleIndex; extern const struct Module ModuleKey;
23extern const struct Module ModuleLua; extern const struct Module ModuleMaildir; extern const struct Module ModuleMbox; extern const struct Module ModuleMenu;
24extern const struct Module ModuleMh; extern const struct Module ModuleMutt; extern const struct Module ModuleNcrypt; extern const struct Module ModuleNntp;
25extern const struct Module ModuleNotmuch; extern const struct Module ModulePager; extern const struct Module ModuleParse; extern const struct Module ModulePattern;
26extern const struct Module ModulePop; extern const struct Module ModulePostpone; extern const struct Module ModuleProgress; extern const struct Module ModuleQuestion;
27extern const struct Module ModuleSend; extern const struct Module ModuleSidebar; extern const struct Module ModuleStore;
28// clang-format on
29
33static const struct Module *Modules[] = {
34 // clang-format off
35 &ModuleMain, &ModuleGui, // These two have priority
44// clang-format on
45#ifdef USE_AUTOCRYPT
47#endif
48#ifdef USE_HCACHE_COMPRESSION
50#endif
51#ifdef USE_HCACHE
53#endif
54#ifdef USE_LUA
55 &ModuleLua,
56#endif
57#ifdef USE_NOTMUCH
59#endif
60#ifdef USE_HCACHE
62#endif
63 NULL,
64};
65
69static int log_disp_null(time_t stamp, const char *file, int line, const char *function,
70 enum LogLevel level, const char *format, ...)
71{
72 return 0;
73}
74
75int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
76{
78
80 char **tmp_env = MUTT_MEM_CALLOC(2, char *);
81 neomutt_init(NeoMutt, tmp_env, Modules);
82 FREE(&tmp_env);
83
84 char file[] = "/tmp/mutt-fuzz";
85 FILE *fp = fopen(file, "wb");
86 if (!fp)
87 return -1;
88
89 fwrite(data, 1, size, fp);
90 fclose(fp);
91 fp = fopen(file, "rb");
92 if (!fp)
93 return -1;
94
95 struct Email *e = email_new();
96 struct Envelope *env = mutt_rfc822_read_header(fp, e, 0, 0);
97 mutt_parse_part(fp, e->body);
98 email_free(&e);
99 mutt_env_free(&env);
100 fclose(fp);
103 return 0;
104}
const struct Module ModuleAddress
Module for the Address library.
Definition module.c:48
const struct Module ModuleAlias
Module for the Alias library.
Definition module.c:48
const struct Module ModuleAttach
Module for the Attach library.
Definition module.c:36
const struct Module ModuleAutocrypt
Module for the Autocrypt library.
Definition module.c:54
const struct Module ModuleBcache
Module for the Bcache library.
Definition module.c:36
const struct Module ModuleBrowser
Module for the Browser library.
Definition module.c:48
const struct Module ModuleColor
Module for the Color library.
Definition module.c:36
const struct Module ModuleCommands
Module for the Commands library.
Definition module.c:47
const struct Module ModuleComplete
Module for the Complete library.
Definition module.c:36
const struct Module ModuleCompmbox
Module for the Compmbox library.
Definition module.c:47
const struct Module ModuleCompose
Module for the Compose library.
Definition module.c:48
const struct Module ModuleCompress
Module for the Compress library.
Definition module.c:36
Convenience wrapper for the config headers.
const struct Module ModuleConfig
Module for the Config library.
Definition module.c:74
bool StartupComplete
When the config has been read.
Definition address.c:12
const struct Module ModuleConn
Module for the Conn library.
Definition module.c:77
const struct Module ModuleConvert
Module for the Convert library.
Definition module.c:36
Convenience wrapper for the core headers.
const struct Module ModuleCore
Module for the Core library.
Definition module.c:36
const struct Module ModuleEditor
Module for the Editor library.
Definition module.c:36
struct Email * email_new(void)
Create a new Email.
Definition email.c:77
void email_free(struct Email **ptr)
Free an Email.
Definition email.c:46
Structs that make up an email.
const struct Module ModuleEmail
Module for the Email library.
Definition module.c:48
void mutt_parse_part(FILE *fp, struct Body *b)
Parse a MIME part.
Definition parse.c:1822
struct Envelope * mutt_rfc822_read_header(FILE *fp, struct Email *e, bool user_hdrs, bool weed)
Parses an RFC822 header.
Definition parse.c:1205
const struct Module ModuleEnvelope
Module for the Envelope library.
Definition module.c:36
void mutt_env_free(struct Envelope **ptr)
Free an Envelope.
Definition envelope.c:125
const struct Module ModuleExpando
Module for the Expando library.
Definition module.c:48
const struct Module ModulePop
Module for the Pop library.
Definition module.c:48
const struct Module ModuleParse
Module for the Parse library.
Definition module.c:36
const struct Module ModuleMaildir
Module for the Maildir library.
Definition module.c:55
const struct Module ModulePostpone
Module for the Postpone library.
Definition module.c:36
const struct Module ModuleSidebar
Module for the Sidebar library.
Definition module.c:58
const struct Module ModuleMh
Module for the Mh library.
Definition module.c:48
const struct Module ModuleLua
Module for the Lua library.
Definition module.c:47
const struct Module ModulePager
Module for the Pager library.
Definition module.c:48
const struct Module ModuleGui
Module for the Gui library.
Definition module.c:36
const struct Module ModuleProgress
Module for the Progress library.
Definition module.c:48
const struct Module ModuleMenu
Module for the Menu library.
Definition module.c:48
static const struct Module * Modules[]
All the library Modules.
Definition address.c:33
const struct Module ModuleNcrypt
Module for the Ncrypt library.
Definition module.c:67
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
Definition address.c:75
const struct Module ModuleMutt
Module for the Mutt library.
Definition module.c:36
const struct Module ModuleHcache
Module for the Hcache library.
Definition module.c:69
const struct Module ModuleSend
Module for the Send library.
Definition module.c:48
const struct Module ModuleQuestion
Module for the Question library.
Definition module.c:36
const struct Module ModuleImap
Module for the Imap library.
Definition module.c:65
const struct Module ModuleMain
Module for the Main library.
Definition module.c:55
const struct Module ModuleStore
Module for the Store library.
Definition module.c:36
const struct Module ModuleMbox
Module for the Mbox library.
Definition module.c:48
const struct Module ModulePattern
Module for the Pattern library.
Definition module.c:48
const struct Module ModuleNntp
Module for the Nntp library.
Definition module.c:48
const struct Module ModuleHelpbar
Module for the Helpbar library.
Definition module.c:48
const struct Module ModuleHistory
Module for the History library.
Definition module.c:48
const struct Module ModuleNotmuch
Module for the Notmuch library.
Definition module.c:64
const struct Module ModuleKey
Module for the Key library.
Definition module.c:47
const struct Module ModuleIndex
Module for the Index library.
Definition module.c:48
const struct Module ModuleHooks
Module for the Hooks library.
Definition module.c:47
static int log_disp_null(time_t stamp, const char *file, int line, const char *function, enum LogLevel level, const char *format,...)
Discard log lines - Implements log_dispatcher_t -.
Definition address.c:69
int log_dispatcher_t MuttLogger
LogLevel
Names for the Logging Levels.
Definition logging2.h:40
#define FREE(x)
Definition memory.h:63
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:48
Convenience wrapper for the library headers.
Many unsorted constants and some structs.
void neomutt_cleanup(struct NeoMutt *n)
Clean up NeoMutt and Modules.
Definition neomutt.c:370
bool neomutt_init(struct NeoMutt *n, char **envp, const struct Module **modules)
Initialise NeoMutt.
Definition neomutt.c:315
struct NeoMutt * neomutt_new(void)
Create the main NeoMutt object.
Definition neomutt.c:303
void neomutt_free(struct NeoMutt **ptr)
Free a NeoMutt.
Definition neomutt.c:382
The envelope/body of an email.
Definition email.h:39
struct Body * body
List of MIME parts.
Definition email.h:69
The header of an Email.
Definition envelope.h:57
Container for Accounts, Notifications.
Definition neomutt.h:128