This is an archive of the discontinued Mercurial Phabricator instance.

wireprotoserver: handle SSH protocol version 2 upgrade requests
ClosedPublic

Authored by indygreg on Feb 12 2018, 7:46 PM.

Details

Summary

This commit teaches the SSH server to recognize the "upgrade"
request line that clients send when they wish to switch the
channel to version 2 of the SSH protocol.

Servers don't honor upgrade requests unless an experimental config
option is set.

Since the built-in server now supports upgrade requests, our test
server to test the handshake has been deleted. Existing tests
use the built-in server and their output doesn't change.

The upgrade is handled in our state machine. The end result is a bit
wonky, as the server transitions back to version 1 state immediately
after upgrading. But this will change as soon as version 2 has an
actual protocol that differs from version 1.

Tests demonstrating that the new server is a bit more strict about
the upgrade handshake have been added.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

indygreg created this revision.Feb 12 2018, 7:46 PM
lothiraldan accepted this revision.Feb 13 2018, 4:03 AM
lothiraldan added a subscriber: lothiraldan.

LGTM after a first glance

durin42 accepted this revision.Feb 14 2018, 8:49 PM
This revision is now accepted and ready to land.Feb 14 2018, 8:49 PM
This revision was automatically updated to reflect the committed changes.