if (compat20) packet_set_ssh2_format();
ssh_exchange_identification(){	char buf[256], remote_version[256];	/* must be same size! */	int remote_major, remote_minor, i, mismatch;	int connection_in = packet_get_connection_in();	int connection_out = packet_get_connection_out();	/* Read other side\'s version identification. */	for (i = 0; i < sizeof(buf) - 1; i++) {		int len = read(connection_in, &buf[i], 1);		if (len < 0)			fatal("ssh_exchange_identification: read: %.100s", strerror(errno));		if (len != 1)			fatal("ssh_exchange_identification: Connection closed by remote host");		if (buf[i] == '\r') {			buf[i] = '\n';			buf[i + 1] = 0;			continue;		/**XXX wait for \n */		}		if (buf[i] == '\n') {			buf[i + 1] = 0;			break;		}	}	buf[sizeof(buf) - 1] = 0;	server_version_string = xstrdup(buf);	/*	 * Check that the versions match.  In future this might accept	 * several versions and set appropriate flags to handle them.	 */	if (sscanf(server_version_string, "SSH-%d.%d-%[^\n]\n",	    &remote_major, &remote_minor, remote_version) != 3)		fatal("Bad remote protocol version identification: '%.100s'", buf);	debug("Remote protocol version %d.%d, remote software version %.100s",	      remote_major, remote_minor, remote_version);	compat_datafellows(remote_version);	mismatch = 0;	switch(remote_major) {	case 1:		if (remote_minor == 99 &&		    (options.protocol & SSH_PROTO_2) &&		    !(options.protocol & SSH_PROTO_1_PREFERRED)) {			enable_compat20();			break;		}		if (!(options.protocol & SSH_PROTO_1)) {			mismatch = 1;			break;		}		if (remote_minor < 3) {			fatal("Remote machine has too old SSH software version.");		} else if (remote_minor == 3) {			/* We speak 1.3, too. */			enable_compat13();			if (options.forward_agent) {				log("Agent forwarding disabled for protocol 1.3");				options.forward_agent = 0;			}		}		break;	case 2:		if (options.protocol & SSH_PROTO_2) {			enable_compat20();			break;		}		/* FALLTHROUGH */	default:		mismatch = 1;		break;	}	if (mismatch)		fatal("Protocol major versions differ: %d vs. %d",		    (options.protocol & SSH_PROTO_2) ? PROTOCOL_MAJOR_2 : PROTOCOL_MAJOR_1,		    remote_major);	/* Send our own protocol version identification. */	snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s\n",	    compat20 ? PROTOCOL_MAJOR_2 : PROTOCOL_MAJOR_1,	    compat20 ? PROTOCOL_MINOR_2 : PROTOCOL_MINOR_1,	    SSH_VERSION);	if (atomicio(write, connection_out, buf, strlen(buf)) != strlen(buf))		fatal("write: %.100s", strerror(errno));	client_version_string = xstrdup(buf);	chop(client_version_string);	chop(server_version_string);	debug("Local version string %.100s", client_version_string);}