NeoMutt  2021-02-05-666-ge300cd
Teaching an old dog new tricks
SASL authentication support

SASL can stack a protection layer on top of an existing connection.

To handle this, we store a saslconn_t in conn->sockdata, and write wrappers which en/decode the read/write stream, then replace sockdata with an embedded copy of the old sockdata and call the underlying functions (which we've also preserved). I thought about trying to make a general stackable connection system, but it seemed like overkill - something is wrong if we have 15 filters on top of a socket. Anyway, anything else which wishes to stack can use the same method. The only disadvantage is we have to write wrappers for all the socket methods, even if we only stack over read and write. Thinking about it, the abstraction problem is that there is more in Connection than there needs to be. Ideally it would have only (void*)data and methods.

Function Description
mutt_sasl_cb_authname() callback to retrieve authname or user from ConnAccount
mutt_sasl_cb_log() callback to log SASL messages
mutt_sasl_cb_pass() SASL callback function to get password
mutt_sasl_client_new() Wrapper for sasl_client_new()
mutt_sasl_conn_close - close SASL connection() Implements Connection::close() -
mutt_sasl_conn_open - empty wrapper for underlying open function() Implements Connection::open() -
mutt_sasl_conn_poll - Check an SASL connection for data() Implements Connection::poll() -
mutt_sasl_conn_read - Read data from an SASL connection() Implements Connection::read() -
mutt_sasl_conn_write - Write to an SASL connection() Implements Connection::write() -
mutt_sasl_done() Invoke when processing is complete
mutt_sasl_get_callbacks() Get the SASL callback functions
mutt_sasl_interact() Perform an SASL interaction with the user
mutt_sasl_setup_conn() Set up an SASL connection
mutt_sasl_start() Initialise SASL library