This will be free()d by mcon later, not PHP
Fixed PHP-996: Broken with cyrus-sals 2.1.23
Count the additional space before the dbname too
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
Do not overwrite the authdb, especially not when its $external buddy
Use the errorstring for that errorcode
Pass correct length to sasl_decode64() to not make it mad in old versions
Generously log things for debugging