This adds sideband-aware code for the next step of the connection
handshake. If sideband connections are supported at both ends,
the server side sends an empty sideband packet with designator
SBD_PROCEED if the client was authenticated successfully. When the
client receives this packet, it enters the CL_RECEIVED_PROCEED state,
just as with non-sideband connections.
goto out;
case CL_SENT_CH_RESPONSE: /* read server response */
{
+ if (ct->use_sideband) {
+ struct sb_buffer sbb;
+ ret = recv_sb(ct, &s->rfds, &sbb);
+ if (ret <= 0)
+ goto out;
+ free(sbb.iov.iov_base);
+ if (sbb.band != SBD_PROCEED)
+ ret = -E_BAD_BAND;
+ else
+ ct->status = CL_RECEIVED_PROCEED;
+ goto out;
+ }
ret = client_recv_buffer(ct, &s->rfds, buf, sizeof(buf), &n);
if (ret < 0 || n == 0)
goto out;
/* init stream cipher keys with the second part of the random buffer */
cc->scc.recv = sc_new(rand_buf + CHALLENGE_SIZE, SESSION_KEY_LEN);
cc->scc.send = sc_new(rand_buf + CHALLENGE_SIZE + SESSION_KEY_LEN, SESSION_KEY_LEN);
- ret = sc_send_buffer(&cc->scc, PROCEED_MSG);
+ if (cc->use_sideband)
+ ret = send_sb(&cc->scc, NULL, 0, SBD_PROCEED, false);
+ else
+ ret = sc_send_buffer(&cc->scc, PROCEED_MSG);
if (ret < 0)
goto net_err;
ret = read_command(&cc->scc, &command);