Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Client
- int fd = connect(...);
- char buffer[100];
- read(fd, buffer, sizeof(buffer));
- int major, minor;
- char impl[100];
- if (sscanf(buffer, "SSH-%d.%d-%99s", &major, &minor, impl) != 3 ||
- !(major == MY_MAJOR_VERSION && minor == MY_MINOR_VERSION))
- {
- write(fd, "Protocol mismatch.\n", 20);
- close(fd);
- abortTheShip();
- }
- // negotiate encryption settings
- // Server
- int fd = accept(...);
- char buffer[100];
- read(fd, buffer, sizeof(buffer));
- int major, minor;
- char impl[100];
- if (sscanf(buffer, "SSH-%d.%d-%99s", &major, &minor, impl) != 3 ||
- !(major == MY_MAJOR_VERSION && minor == MY_MINOR_VERSION))
- {
- write(fd, "Protocol mismatch.\n", 20);
- close(fd);
- abortTheShip();
- }
- // negotiate encryption settings
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement