Skip to content

Commit

Permalink
Merge PR #745 (make LISTOWNMAIL canonicalization optional)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilbelkyr committed Feb 24, 2021
2 parents f27ba39 + 8400711 commit dbaaa45
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
10 changes: 10 additions & 0 deletions dist/atheme.conf.example
Expand Up @@ -1739,6 +1739,16 @@ nickserv {
* `/msg NickServ HELP'.
*/
#shorthelp = "";

/*
* (*)listownmail_canon
*
* Whether to canonicalize emails when doing LISTOWNMAIL. Depending on what
* custom canonicalizers you have loaded, LISTOWNMAIL can expose user:email
* mappings via LISTOWNMAIL when it might not be safe to do so (e.g. if you
* unconditionally strip +subaddress from emails.)
*/
listownmail_canon;
};

/* ChanServ configuration.
Expand Down
7 changes: 6 additions & 1 deletion modules/nickserv/listownmail.c
Expand Up @@ -9,6 +9,8 @@

#include <atheme.h>

static bool listownmail_canon = false;

static void
ns_cmd_listownmail(struct sourceinfo *si, int parc, char *parv[])
{
Expand Down Expand Up @@ -41,7 +43,8 @@ ns_cmd_listownmail(struct sourceinfo *si, int parc, char *parv[])

continue_if_fail(mu != NULL);

if (!strcasecmp(si->smu->email_canonical, mu->email_canonical))
if ((listownmail_canon && !strcasecmp(si->smu->email_canonical, mu->email_canonical))
|| (!listownmail_canon && !strcasecmp(si->smu->email, mu->email)))
{
// in the future we could add a LIMIT parameter
if (matches == 0)
Expand Down Expand Up @@ -72,12 +75,14 @@ mod_init(struct module *const restrict m)
MODULE_TRY_REQUEST_DEPENDENCY(m, "nickserv/main")

service_named_bind_command("nickserv", &ns_listownmail);
add_bool_conf_item("LISTOWNMAIL_CANON", &nicksvs.me->conf_table, 0, &listownmail_canon, true);
}

static void
mod_deinit(const enum module_unload_intent ATHEME_VATTR_UNUSED intent)
{
service_named_unbind_command("nickserv", &ns_listownmail);
del_conf_item("LISTOWNMAIL_CANON", &nicksvs.me->conf_table);
}

SIMPLE_DECLARE_MODULE_V1("nickserv/listownmail", MODULE_UNLOAD_CAPABILITY_OK)

0 comments on commit dbaaa45

Please sign in to comment.