3.3 Steps

A step (sasl-step object) is an abstraction of authentication “step” which holds the response value and the next entry point for the authentication process (the latter is not accessible).

Function: sasl-step-data step

Return the data which step holds, a string.

Function: sasl-step-set-data step data

Store data string to step.

To get the initial response, you should call the function sasl-next-step with the second argument nil.

(setq name (sasl-mechanism-name mechanism))

At this point we could send the command which starts a SASL authentication protocol exchange. For example,

(process-send-string
 process
 (if (sasl-step-data step)              ;initial response
     (format "AUTH %s %s\r\n" name (base64-encode-string (sasl-step-data step) t))
   (format "AUTH %s\r\n" name)))

To go on with the authentication process, all you have to do is call sasl-next-step consecutively.

Function: sasl-next-step client step

Perform the authentication step. At the first time step should be set to nil.