Representation of a single alias to an email address. More...
#include "config.h"#include <pwd.h>#include <stdbool.h>#include <stddef.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <wchar.h>#include <wctype.h>#include "mutt/lib.h"#include "address/lib.h"#include "config/lib.h"#include "email/lib.h"#include "core/lib.h"#include "gui/lib.h"#include "mutt.h"#include "alias.h"#include "lib.h"#include "browser/lib.h"#include "editor/lib.h"#include "history/lib.h"#include "question/lib.h"#include "send/lib.h"#include "alternates.h"#include "globals.h"#include "maillist.h"#include "muttlib.h"#include "reverse.h"
Include dependency graph for alias.c:Go to the source code of this file.
Functions | |
| static void | write_safe_address (FILE *fp, const char *s) |
| Defang malicious email addresses. | |
| static void | expand_aliases_r (struct AddressList *al, struct ListHead *expn) |
| Expand aliases, recursively. | |
| static void | recode_buf (struct Buffer *buf) |
| Convert some text between two character sets. | |
| static int | check_alias_name (const char *s, struct Buffer *dest) |
| Sanity-check an alias name. | |
| static bool | string_is_address (const char *str, const char *user, const char *domain) |
| Does an email address match a user and domain? | |
| struct AddressList * | alias_lookup (const char *name) |
| Find an Alias. | |
| void | mutt_expand_aliases (struct AddressList *al) |
| Expand aliases in a List of Addresses. | |
| void | mutt_expand_aliases_env (struct Envelope *env) |
| Expand aliases in all the fields of an Envelope. | |
| struct AddressList * | mutt_get_address (struct Envelope *env, const char **prefix) |
| Get an Address from an Envelope. | |
| void | alias_create (struct AddressList *al, const struct ConfigSubset *sub) |
| Create a new Alias from an Address. | |
| bool | mutt_addr_is_user (const struct Address *addr) |
| Does the address belong to the user. | |
| struct Alias * | alias_new (void) |
| Create a new Alias. | |
| void | alias_free (struct Alias **ptr) |
| Free an Alias. | |
| void | aliaslist_clear (struct AliasList *al) |
| Empty a List of Aliases. | |
| void | alias_init (void) |
| Set up the Alias globals. | |
| void | alias_cleanup (void) |
| Clean up the Alias globals. | |
Variables | |
| struct AliasList | Aliases = TAILQ_HEAD_INITIALIZER(Aliases) |
| List of all the user's email aliases. | |
Representation of a single alias to an email address.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file alias.c.
|
static |
Defang malicious email addresses.
| fp | File to write to |
| s | Email address to defang |
if someone has an address like From: John /bin/rm -f ~ Doe john..nosp@m.doe@.nosp@m.examp.nosp@m.le.c.nosp@m.om and the user creates an alias for this, NeoMutt could wind up executing the backticks because it writes aliases like alias me John /bin/rm -f ~ Doe john..nosp@m.doe@.nosp@m.examp.nosp@m.le.c.nosp@m.om To avoid this problem, use a backslash () to quote any backticks. We also need to quote backslashes as well, since you could defeat the above by doing From: John `/bin/rm -f ~` Doe john..nosp@m.doe@.nosp@m.examp.nosp@m.le.c.nosp@m.om since that would get aliased as alias me John \/bin/rm -f ~\\ Doe john..nosp@m.doe@.nosp@m.examp.nosp@m.le.c.nosp@m.om which still gets evaluated because the double backslash is not a quote.
Additionally, we need to quote ' and " characters, otherwise neomutt will interpret them on the wrong parsing step.
$ wants to be quoted since it may indicate the start of an environment variable.
Definition at line 88 of file alias.c.
Here is the caller graph for this function:
|
static |
Expand aliases, recursively.
ListHead expn is used as temporary storage for already-expanded aliases.
Definition at line 106 of file alias.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Convert some text between two character sets.
| buf | Buffer to convert |
The 'from' charset is controlled by the 'charset' config variable. The 'to' charset is controlled by the 'config_charset' config variable.
Definition at line 192 of file alias.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Sanity-check an alias name.
| 0 | Success |
| -1 | Error |
Only characters which are non-special to both the RFC822 and the neomutt configuration parser are permitted.
Definition at line 216 of file alias.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Does an email address match a user and domain?
| str | Address string to test |
| user | User name |
| domain | Domain name |
| true | They match |
Definition at line 258 of file alias.c.
Here is the call graph for this function:
Here is the caller graph for this function:| struct AddressList * alias_lookup | ( | const char * | name | ) |
| void mutt_expand_aliases | ( | struct AddressList * | al | ) |
Expand aliases in a List of Addresses.
| al | AddressList |
Duplicate addresses are dropped
Definition at line 295 of file alias.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void mutt_expand_aliases_env | ( | struct Envelope * | env | ) |
Expand aliases in all the fields of an Envelope.
| env | Envelope to expand |
Definition at line 309 of file alias.c.
Here is the call graph for this function:
Here is the caller graph for this function:| struct AddressList * mutt_get_address | ( | struct Envelope * | env, |
| const char ** | prefix ) |
Get an Address from an Envelope.
| ptr | AddressList in the Envelope |
Definition at line 327 of file alias.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void alias_create | ( | struct AddressList * | al, |
| const struct ConfigSubset * | sub ) |
Create a new Alias from an Address.
| al | Address to use |
| sub | Config items |
Definition at line 367 of file alias.c.
Here is the call graph for this function:
Here is the caller graph for this function:| bool mutt_addr_is_user | ( | const struct Address * | addr | ) |
Does the address belong to the user.
| addr | Address to check |
| true | The given address belongs to the user |
Definition at line 596 of file alias.c.
Here is the call graph for this function:
Here is the caller graph for this function:| struct Alias * alias_new | ( | void | ) |
Create a new Alias.
| ptr | Newly allocated Alias |
Free the result with alias_free()
Definition at line 657 of file alias.c.
Here is the caller graph for this function:| void alias_free | ( | struct Alias ** | ptr | ) |
Free an Alias.
| [out] | ptr | Alias to free |
Definition at line 669 of file alias.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void aliaslist_clear | ( | struct AliasList * | al | ) |
Empty a List of Aliases.
| al | AliasList to empty |
Each Alias will be freed and the AliasList will be left empty.
Definition at line 694 of file alias.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void alias_init | ( | void | ) |
Set up the Alias globals.
Definition at line 711 of file alias.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void alias_cleanup | ( | void | ) |
Clean up the Alias globals.
Definition at line 719 of file alias.c.
Here is the call graph for this function:
Here is the caller graph for this function:| struct AliasList Aliases = TAILQ_HEAD_INITIALIZER(Aliases) |