Skip to content

Commit

Permalink
hostserv/offer: User may sometimes not be logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
aji committed Feb 2, 2014
1 parent 2dac73e commit 31411f9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion modules/hostserv/offer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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"));
Expand Down

0 comments on commit 31411f9

Please sign in to comment.