From 7aea574678bcfc09abc934f7884ab72a06fb2740 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sun, 28 Nov 2021 19:25:32 +0000 Subject: [PATCH 1/2] handle hook_user_login_check_t->mu being null --- src/sasl_blacklist.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/sasl_blacklist.c b/src/sasl_blacklist.c index cdb1f3a30..2fb6fbbad 100644 --- a/src/sasl_blacklist.c +++ b/src/sasl_blacklist.c @@ -174,9 +174,13 @@ blacklist_can_login(hook_user_login_check_t *const restrict c) if (! is_permitted_mechanism(ssi->sess->mechptr->name)) { - (void) slog(LG_VERBOSE, "%s %s:%s denied login to \2%s\2 ('%s' not allowed)", - log_target, entity(c->mu)->name, ssi->sess->uid, entity(c->mu)->name, - ssi->sess->mechptr->name); + if (c->mu != NULL) + slog(LG_VERBOSE, "%s %s:%s denied login to \2%s\2 ('%s' not allowed)", + log_target, entity(c->mu)->name, ssi->sess->uid, entity(c->mu)->name, + ssi->sess->mechptr->name); + else + slog(LG_VERBOSE, "%s %s: denied login ('%s' not allowed)", + log_target, ssi->sess->uid, ssi->sess->mechptr->name); c->allowed = false; } From 7323aaa2c568d114eb0d4da3cec6a2c6707d5707 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sun, 28 Nov 2021 19:39:41 +0000 Subject: [PATCH 2/2] missed c->mu reference --- src/sasl_blacklist.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/sasl_blacklist.c b/src/sasl_blacklist.c index 2fb6fbbad..0c7a8a89f 100644 --- a/src/sasl_blacklist.c +++ b/src/sasl_blacklist.c @@ -188,8 +188,11 @@ blacklist_can_login(hook_user_login_check_t *const restrict c) } else if (is_restricted_user(c->si->su)) { - (void) log_user(c->si->su, "denied login to \2%s\2 (restricted address)", - entity(c->mu)->name); + if (c->mu != NULL) + log_user(c->si->su, "denied login to \2%s\2 (restricted address)", + entity(c->mu)->name); + else + log_user(c->si->su, "denied login (restricted address)"); c->allowed = false; }