- switch (ssh->pktin.type) {
- /*
- * These packets we must handle instantly.
- */
- case SSH2_MSG_DISCONNECT:
- {
- /* log reason code in disconnect message */
- char *buf, *msg;
- int nowlen, reason, msglen;
-
- reason = ssh_pkt_getuint32(ssh);
- ssh_pkt_getstring(ssh, &msg, &msglen);
-
- if (reason > 0 && reason < lenof(ssh2_disconnect_reasons)) {
- buf = dupprintf("Received disconnect message (%s)",
- ssh2_disconnect_reasons[reason]);
- } else {
- buf = dupprintf("Received disconnect message (unknown"
- " type %d)", reason);
- }
- logevent(buf);
- sfree(buf);
- buf = dupprintf("Disconnection message text: %n%.*s",
- &nowlen, msglen, msg);
- logevent(buf);
- bombout(("Server sent disconnect message\ntype %d (%s):\n\"%s\"",
- reason,
- (reason > 0 && reason < lenof(ssh2_disconnect_reasons)) ?
- ssh2_disconnect_reasons[reason] : "unknown",
- buf+nowlen));
- sfree(buf);
- crStop(0);
- }
- break;
- case SSH2_MSG_IGNORE:
- goto next_packet;
- case SSH2_MSG_DEBUG:
- {
- /* log the debug message */
- char *buf, *msg;
- int msglen;
- int always_display;
-
- /* XXX maybe we should actually take notice of this */
- always_display = ssh2_pkt_getbool(ssh);
- ssh_pkt_getstring(ssh, &msg, &msglen);
-
- buf = dupprintf("Remote debug message: %.*s", msglen, msg);
- logevent(buf);
- sfree(buf);
- }
- goto next_packet;
-
- /*
- * These packets we need do nothing about here.
- */
- case SSH2_MSG_UNIMPLEMENTED:
- case SSH2_MSG_SERVICE_REQUEST:
- case SSH2_MSG_SERVICE_ACCEPT:
- case SSH2_MSG_KEXINIT:
- case SSH2_MSG_NEWKEYS:
- case SSH2_MSG_KEXDH_INIT:
- case SSH2_MSG_KEXDH_REPLY:
- /* case SSH2_MSG_KEX_DH_GEX_REQUEST: duplicate case value */
- /* case SSH2_MSG_KEX_DH_GEX_GROUP: duplicate case value */
- case SSH2_MSG_KEX_DH_GEX_INIT:
- case SSH2_MSG_KEX_DH_GEX_REPLY:
- case SSH2_MSG_USERAUTH_REQUEST:
- case SSH2_MSG_USERAUTH_FAILURE:
- case SSH2_MSG_USERAUTH_SUCCESS:
- case SSH2_MSG_USERAUTH_BANNER:
- case SSH2_MSG_USERAUTH_PK_OK:
- /* case SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ: duplicate case value */
- /* case SSH2_MSG_USERAUTH_INFO_REQUEST: duplicate case value */
- case SSH2_MSG_USERAUTH_INFO_RESPONSE:
- case SSH2_MSG_GLOBAL_REQUEST:
- case SSH2_MSG_REQUEST_SUCCESS:
- case SSH2_MSG_REQUEST_FAILURE:
- case SSH2_MSG_CHANNEL_OPEN:
- case SSH2_MSG_CHANNEL_OPEN_CONFIRMATION:
- case SSH2_MSG_CHANNEL_OPEN_FAILURE:
- case SSH2_MSG_CHANNEL_WINDOW_ADJUST:
- case SSH2_MSG_CHANNEL_DATA:
- case SSH2_MSG_CHANNEL_EXTENDED_DATA:
- case SSH2_MSG_CHANNEL_EOF:
- case SSH2_MSG_CHANNEL_CLOSE:
- case SSH2_MSG_CHANNEL_REQUEST:
- case SSH2_MSG_CHANNEL_SUCCESS:
- case SSH2_MSG_CHANNEL_FAILURE:
- break;
-
- /*
- * For anything else we send SSH2_MSG_UNIMPLEMENTED.
- */
- default:
- ssh2_pkt_init(ssh, SSH2_MSG_UNIMPLEMENTED);
- ssh2_pkt_adduint32(ssh, st->incoming_sequence - 1);
- ssh2_pkt_send(ssh);
- break;
- }
-
- crFinish(0);