server_input_channel_open(int type, int plen)
server_input_channel_open(int type, int plen, void *ctxt)
server_input_channel_open(int type, int plen){	Channel *c = NULL;	char *ctype;	int id;	unsigned int len;	int rchan;	int rmaxpack;	int rwindow;	ctype = packet_get_string(&len);	rchan = packet_get_int();	rwindow = packet_get_int();	rmaxpack = packet_get_int();	debug("server_input_channel_open: ctype %s rchan %d win %d max %d",	    ctype, rchan, rwindow, rmaxpack);	if (strcmp(ctype, "session") == 0) {		debug("open session");		packet_done();		/*		 * A server session has no fd to read or write		 * until a CHANNEL_REQUEST for a shell is made,		 * so we set the type to SSH_CHANNEL_LARVAL.		 * Additionally, a callback for handling all		 * CHANNEL_REQUEST messages is registered.		 */		id = channel_new(ctype, SSH_CHANNEL_LARVAL,		    -1, -1, -1, 0, CHAN_SES_PACKET_DEFAULT,		    0, xstrdup("server-session"));		if (session_open(id) == 1) {			channel_register_callback(id, SSH2_MSG_CHANNEL_REQUEST,			    session_input_channel_req, (void *)0);			channel_register_cleanup(id, session_close_by_channel);			c = channel_lookup(id);		} else {			debug("session open failed, free channel %d", id);			channel_free(id);		}	} else if (strcmp(ctype, "direct-tcpip") == 0) {		id = input_direct_tcpip();		if (id >= 0)			c = channel_lookup(id);	}	if (c != NULL) {		debug("confirm %s", ctype);		c->remote_id = rchan;		c->remote_window = rwindow;		c->remote_maxpacket = rmaxpack;		packet_start(SSH2_MSG_CHANNEL_OPEN_CONFIRMATION);		packet_put_int(c->remote_id);		packet_put_int(c->self);		packet_put_int(c->local_window);		packet_put_int(c->local_maxpacket);		packet_send();	} else {		debug("failure %s", ctype);		packet_start(SSH2_MSG_CHANNEL_OPEN_FAILURE);		packet_put_int(rchan);		packet_put_int(SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED);		packet_put_cstring("bla bla");		packet_put_cstring("");		packet_send();	}	xfree(ctype);}