sasl_session_destroy(struct sasl_session *const restrict p)
{
	mowgli_node_t *n;

	MOWGLI_ITER_FOREACH(n, sasl_sessions.head)
	{
		if (n == &p->node && n->data == p)
		{
			(void) mowgli_node_delete(n, &sasl_sessions);
			break;
		}
	}

	if (p->mechptr && p->mechptr->mech_finish)
		(void) p->mechptr->mech_finish(p);

	if (p->si)
		(void) atheme_object_unref(p->si);

	struct user *const u = user_find(p->uid);
	if (u)
		// If the user is still on the network, allow them to use NickServ IDENTIFY/LOGIN again
		u->flags &= ~UF_DOING_SASL;

	(void) sfree(p->certfp);
	(void) sfree(p->host);
	(void) sfree(p->buf);
	(void) sfree(p->ip);
	(void) sfree(p);
}
sasl_session_destroy(struct sasl_session *const restrict p)
{
	mowgli_node_t *n;

	MOWGLI_ITER_FOREACH(n, sasl_sessions.head)
	{
		if (n == &p->node && n->data == p)
		{
			(void) mowgli_node_delete(n, &sasl_sessions);
			break;
		}
	}

	if (p->mechptr && p->mechptr->mech_finish)
		(void) p->mechptr->mech_finish(p);

	if (p->si)
		(void) atheme_object_unref(p->si);

	struct user *const u = user_find(p->uid);
	if (u)
		 
		u->flags &= ~UF_DOING_SASL;

	(void) sfree(p->certfp);
	(void) sfree(p->host);
	(void) sfree(p->buf);
	(void) sfree(p->ip);
	(void) sfree(p);
}