Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add an option to disable email canon for LISTOWNMAIL comparisons #745

Merged
merged 4 commits into from Feb 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions dist/atheme.conf.example
Expand Up @@ -1574,6 +1574,16 @@ nickserv {
* disable listing command descriptions in `/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);
jesopo marked this conversation as resolved.
Show resolved Hide resolved
}

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)