out_payload isn't set on failure, but error_message is!
Return consistent error codes, and check for them
Avoid broken casting. error_message is always set on failure
Improve SASL OK check to verify the other end actually finished too