From 31411f9c64ce7c06712d38dec11403b5c02f8bd4 Mon Sep 17 00:00:00 2001 From: Alex Iadicicco Date: Sat, 1 Feb 2014 21:12:16 -0700 Subject: [PATCH] hostserv/offer: User may sometimes not be logged in --- modules/hostserv/offer.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/hostserv/offer.c b/modules/hostserv/offer.c index bd4260ec47..bb5ae14c79 100644 --- a/modules/hostserv/offer.c +++ b/modules/hostserv/offer.c @@ -209,10 +209,12 @@ static bool myuser_is_in_group(myuser_t *mu, myentity_t *mt) mygroup_t *mg; mowgli_node_t *n; - return_val_if_fail(mu != NULL, false); return_val_if_fail(mt != NULL, false); return_val_if_fail((mg = group(mt)) != NULL, false); + if (!mu) /* NULL users can't be in groups! :o */ + return false; + MOWGLI_ITER_FOREACH(n, mg->acs.head) { groupacs_t *ga = n->data; @@ -238,6 +240,12 @@ static void hs_cmd_take(sourceinfo_t *si, int parc, char *parv[]) return; } + if (si->smu == NULL) + { + command_fail(si, fault_nochange, _("You can't take vhosts when not logged in")); + return; + } + if (metadata_find(si->smu, "private:restrict:setter")) { command_fail(si, fault_noprivs, _("You have been restricted from taking vhosts by network staff"));