Jabberd2 lockup after authorisation

I recently spent forever debugging an issue where the server would lock up right after the client sent authentication details. What made it worse was that XMPP clients seem to have very poor error messages, so its near impossible figuring out what went wrong. That and Wireshark becomes much harder when using encrypted sessions. Finally though I managed to track it down and this page is mainly as a reminder to myself.

The problem is due to the fact I configured my server to not allow account registrations. I setup the following line in c2s.xml:

<id require-starttls='true'
        pemfile='/etc/jabberd/server.pem'
        password-change='true'
        instructions='Registrations not allowed...'
    >danielhall.me</id>

Followed by this in sm.xml:

<!--  
<auto-create/>
-->

Then I inserted all my users into the authreg table manually using queries like:

INSERT INTO authreg VALUES ('username', 'danielhall.me', 'sup@Hs3cr3tPassw0rd');

The problem here is that you’ve manually created the authorisation for the account, and not created the session. The best way to deal with this is to remove the comments around the auto-create tag in sm.xml. This isn’t a problem as users not in the authreg table will not even be able to reach the session manager
before their authorisation is rejected.