void step(const std::string& data) { if (status != STEPPING) { AuthenticationErrorMessage message; message.set_error("Unexpected authentication 'step' received"); send(pid, message); status = ERROR; promise.fail(message.error()); return; } LOG(INFO) << "Received SASL authentication step"; const char* output = NULL; unsigned length = 0; int result = sasl_server_step( connection, data.length() == 0 ? NULL : data.data(), data.length(), &output, &length); handle(result, output, length); }
void start(const string& mechanism, const string& data) { if (status != STARTING) { AuthenticationErrorMessage message; message.set_error("Unexpected authentication 'start' received"); send(pid, message); status = ERROR; promise.fail(message.error()); return; } LOG(INFO) << "Received SASL authentication start with " << mechanism.c_str() << " mechanism"; // Start the server. const char* output = NULL; unsigned length = 0; int result = sasl_server_start( connection, mechanism.c_str(), data.length() == 0 ? NULL : data.data(), data.length(), &output, &length); handle(result, output, length); }