message = dupprintf("Forwarded connection refused by" " server: %s [%.*s]", reasons[reason_code], reason_length, reason_string); logevent(message); sfree(message);
logeventf(ssh, "Forwarded connection refused by server: %s [%.*s]", reasons[reason_code], reason_length, reason_string);
static void ssh2_msg_channel_open_failure(Ssh ssh, struct Packet *pktin){    static const char *const reasons[] = {	"<unknown reason code>",	    "Administratively prohibited",	    "Connect failed",	    "Unknown channel type",	    "Resource shortage",    };    unsigned i = ssh_pkt_getuint32(pktin);    unsigned reason_code;    char *reason_string;    int reason_length;    char *message;    struct ssh_channel *c;    c = find234(ssh->channels, &i, ssh_channelfind);    if (!c)	return;			       /* nonexistent channel */    if (c->type != CHAN_SOCKDATA_DORMANT)	return;			       /* dunno why they're failing this */    reason_code = ssh_pkt_getuint32(pktin);    if (reason_code >= lenof(reasons))	reason_code = 0; /* ensure reasons[reason_code] in range */    ssh_pkt_getstring(pktin, &reason_string, &reason_length);    message = dupprintf("Forwarded connection refused by"			" server: %s [%.*s]", reasons[reason_code],			reason_length, reason_string);    logevent(message);    sfree(message);    pfd_close(c->u.pfd.s);    del234(ssh->channels, c);    sfree(c);}