Add assert to catch modules returning invalid return codes
Rewrite krb5 module in attempt to make it threadsafe