1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

Start using C99 variadic macros.

In the past, I've had a lot of macros which you call with double
parentheses, along the lines of debug(("format string", params)), so
that the inner parens protect the commas and permit the macro to treat
the whole printf-style argument list as one macro argument.

That's all very well, but it's a bit inconvenient (it doesn't leave
you any way to implement such a macro by prepending another argument
to the list), and now this code base's rules allow C99isms, I can
switch all those macros to using a single pair of parens, using the
C99 ability to say '...' in the parameter list of the #define and get
at the corresponding suffix of the arguments as __VA_ARGS__.

So I'm doing it. I've made the following printf-style macros variadic:
bpp_logevent, ppl_logevent, ppl_printf and debug.

While I'm here, I've also fixed up a collection of conditioned-out
calls to debug() in the Windows front end which were clearly expecting
a macro with a different calling syntax, because they had an integer
parameter first. If I ever have a need to condition those back in,
they should actually work now.
This commit is contained in:
Simon Tatham 2018-12-08 20:32:31 +00:00
parent 383a16d5e5
commit e08641c912
26 changed files with 525 additions and 532 deletions

View File

@ -127,7 +127,7 @@ static void mainchan_open_confirmation(Channel *chan)
PacketProtocolLayer *ppl = mc->ppl; /* for ppl_logevent */ PacketProtocolLayer *ppl = mc->ppl; /* for ppl_logevent */
seat_update_specials_menu(mc->ppl->seat); seat_update_specials_menu(mc->ppl->seat);
ppl_logevent(("Opened main channel")); ppl_logevent("Opened main channel");
if (mc->is_simple) if (mc->is_simple)
sshfwd_hint_channel_is_simple(mc->sc); sshfwd_hint_channel_is_simple(mc->sc);
@ -146,8 +146,8 @@ static void mainchan_open_confirmation(Channel *chan)
if ((x11disp = x11_setup_display( if ((x11disp = x11_setup_display(
conf_get_str(mc->conf, CONF_x11_display), conf_get_str(mc->conf, CONF_x11_display),
mc->conf, &x11_setup_err)) == NULL) { mc->conf, &x11_setup_err)) == NULL) {
ppl_logevent(("X11 forwarding not enabled: unable to" ppl_logevent("X11 forwarding not enabled: unable to"
" initialise X display: %s", x11_setup_err)); " initialise X display: %s", x11_setup_err);
sfree(x11_setup_err); sfree(x11_setup_err);
} else { } else {
x11auth = ssh_add_x11_display( x11auth = ssh_add_x11_display(
@ -178,7 +178,7 @@ static void mainchan_open_confirmation(Channel *chan)
mc->n_req_env++; mc->n_req_env++;
} }
if (mc->n_req_env) if (mc->n_req_env)
ppl_logevent(("Sent %d environment variables", mc->n_req_env)); ppl_logevent("Sent %d environment variables", mc->n_req_env);
cmd = conf_get_str(mc->conf, CONF_remote_cmd); cmd = conf_get_str(mc->conf, CONF_remote_cmd);
if (conf_get_bool(mc->conf, CONF_ssh_subsys)) { if (conf_get_bool(mc->conf, CONF_ssh_subsys)) {
@ -222,10 +222,10 @@ static void mainchan_request_response(Channel *chan, bool success)
mc->req_x11 = false; mc->req_x11 = false;
if (success) { if (success) {
ppl_logevent(("X11 forwarding enabled")); ppl_logevent("X11 forwarding enabled");
ssh_enable_x_fwd(mc->cl); ssh_enable_x_fwd(mc->cl);
} else { } else {
ppl_logevent(("X11 forwarding refused")); ppl_logevent("X11 forwarding refused");
} }
return; return;
} }
@ -234,10 +234,10 @@ static void mainchan_request_response(Channel *chan, bool success)
mc->req_agent = false; mc->req_agent = false;
if (success) { if (success) {
ppl_logevent(("Agent forwarding enabled")); ppl_logevent("Agent forwarding enabled");
ssh_enable_agent_fwd(mc->cl); ssh_enable_agent_fwd(mc->cl);
} else { } else {
ppl_logevent(("Agent forwarding refused")); ppl_logevent("Agent forwarding refused");
} }
return; return;
} }
@ -246,11 +246,11 @@ static void mainchan_request_response(Channel *chan, bool success)
mc->req_pty = false; mc->req_pty = false;
if (success) { if (success) {
ppl_logevent(("Allocated pty")); ppl_logevent("Allocated pty");
mc->got_pty = true; mc->got_pty = true;
} else { } else {
ppl_logevent(("Server refused to allocate pty")); ppl_logevent("Server refused to allocate pty");
ppl_printf(("Server refused to allocate pty\r\n")); ppl_printf("Server refused to allocate pty\r\n");
ssh_set_ldisc_option(mc->cl, LD_ECHO, true); ssh_set_ldisc_option(mc->cl, LD_ECHO, true);
ssh_set_ldisc_option(mc->cl, LD_EDIT, true); ssh_set_ldisc_option(mc->cl, LD_EDIT, true);
} }
@ -260,22 +260,22 @@ static void mainchan_request_response(Channel *chan, bool success)
if (mc->n_env_replies < mc->n_req_env) { if (mc->n_env_replies < mc->n_req_env) {
int j = mc->n_env_replies++; int j = mc->n_env_replies++;
if (!success) { if (!success) {
ppl_logevent(("Server refused to set environment variable %s", ppl_logevent("Server refused to set environment variable %s",
conf_get_str_nthstrkey(mc->conf, conf_get_str_nthstrkey(mc->conf,
CONF_environmt, j))); CONF_environmt, j));
mc->n_env_fails++; mc->n_env_fails++;
} }
if (mc->n_env_replies == mc->n_req_env) { if (mc->n_env_replies == mc->n_req_env) {
if (mc->n_env_fails == 0) { if (mc->n_env_fails == 0) {
ppl_logevent(("All environment variables successfully set")); ppl_logevent("All environment variables successfully set");
} else if (mc->n_env_fails == mc->n_req_env) { } else if (mc->n_env_fails == mc->n_req_env) {
ppl_logevent(("All environment variables refused")); ppl_logevent("All environment variables refused");
ppl_printf(("Server refused to set environment " ppl_printf("Server refused to set environment "
"variables\r\n")); "variables\r\n");
} else { } else {
ppl_printf(("Server refused to set all environment " ppl_printf("Server refused to set all environment "
"variables\r\n")); "variables\r\n");
} }
} }
return; return;
@ -285,10 +285,10 @@ static void mainchan_request_response(Channel *chan, bool success)
mc->req_cmd_primary = false; mc->req_cmd_primary = false;
if (success) { if (success) {
ppl_logevent(("Started a shell/command")); ppl_logevent("Started a shell/command");
mainchan_ready(mc); mainchan_ready(mc);
} else if (*conf_get_str(mc->conf, CONF_remote_cmd2)) { } else if (*conf_get_str(mc->conf, CONF_remote_cmd2)) {
ppl_logevent(("Primary command failed; attempting fallback")); ppl_logevent("Primary command failed; attempting fallback");
mainchan_try_fallback_command(mc); mainchan_try_fallback_command(mc);
} else { } else {
/* /*
@ -305,7 +305,7 @@ static void mainchan_request_response(Channel *chan, bool success)
mc->req_cmd_fallback = false; mc->req_cmd_fallback = false;
if (success) { if (success) {
ppl_logevent(("Started a shell/command")); ppl_logevent("Started a shell/command");
ssh_got_fallback_cmd(mc->ppl->ssh); ssh_got_fallback_cmd(mc->ppl->ssh);
mainchan_ready(mc); mainchan_ready(mc);
} else { } else {
@ -385,7 +385,7 @@ static void mainchan_send_eof(Channel *chan)
* isn't a particularly meaningful concept. * isn't a particularly meaningful concept.
*/ */
sshfwd_write_eof(mc->sc); sshfwd_write_eof(mc->sc);
ppl_logevent(("Sent EOF message")); ppl_logevent("Sent EOF message");
mc->eof_sent = true; mc->eof_sent = true;
ssh_set_wants_user_input(mc->cl, false); /* stop reading from stdin */ ssh_set_wants_user_input(mc->cl, false); /* stop reading from stdin */
} }
@ -417,7 +417,7 @@ static bool mainchan_rcvd_exit_status(Channel *chan, int status)
PacketProtocolLayer *ppl = mc->ppl; /* for ppl_logevent */ PacketProtocolLayer *ppl = mc->ppl; /* for ppl_logevent */
ssh_got_exitcode(mc->ppl->ssh, status); ssh_got_exitcode(mc->ppl->ssh, status);
ppl_logevent(("Session sent command exit status %d", status)); ppl_logevent("Session sent command exit status %d", status);
return true; return true;
} }
@ -430,8 +430,8 @@ static void mainchan_log_exit_signal_common(
const char *core_msg = core_dumped ? " (core dumped)" : ""; const char *core_msg = core_dumped ? " (core dumped)" : "";
const char *msg_pre = (msg.len ? " (" : ""); const char *msg_pre = (msg.len ? " (" : "");
const char *msg_post = (msg.len ? ")" : ""); const char *msg_post = (msg.len ? ")" : "");
ppl_logevent(("Session exited on %s%s%s%.*s%s", ppl_logevent("Session exited on %s%s%s%.*s%s",
sigdesc, core_msg, msg_pre, PTRLEN_PRINTF(msg), msg_post)); sigdesc, core_msg, msg_pre, PTRLEN_PRINTF(msg), msg_post);
} }
static bool mainchan_rcvd_exit_signal( static bool mainchan_rcvd_exit_signal(
@ -544,7 +544,7 @@ void mainchan_special_cmd(mainchan *mc, SessionSpecialCode code, int arg)
} else if ((signame = ssh_signal_lookup(code)) != NULL) { } else if ((signame = ssh_signal_lookup(code)) != NULL) {
/* It's a signal. */ /* It's a signal. */
sshfwd_send_signal(mc->sc, false, signame); sshfwd_send_signal(mc->sc, false, signame);
ppl_logevent(("Sent signal SIG%s", signame)); ppl_logevent("Sent signal SIG%s", signame);
} }
} }

6
misc.h
View File

@ -174,7 +174,7 @@ char *buildinfo(const char *newline);
* *
* Output goes to debug.log * Output goes to debug.log
* *
* debug(()) (note the double brackets) is like printf(). * debug() is like printf().
* *
* dmemdump() and dmemdumpl() both do memory dumps. The difference * dmemdump() and dmemdumpl() both do memory dumps. The difference
* is that dmemdumpl() is more suited for when the memory address is * is that dmemdumpl() is more suited for when the memory address is
@ -185,11 +185,11 @@ char *buildinfo(const char *newline);
#ifdef DEBUG #ifdef DEBUG
void debug_printf(const char *fmt, ...); void debug_printf(const char *fmt, ...);
void debug_memdump(const void *buf, int len, bool L); void debug_memdump(const void *buf, int len, bool L);
#define debug(x) (debug_printf x) #define debug(...) (debug_printf(__VA_ARGS__))
#define dmemdump(buf,len) debug_memdump (buf, len, false); #define dmemdump(buf,len) debug_memdump (buf, len, false);
#define dmemdumpl(buf,len) debug_memdump (buf, len, true); #define dmemdumpl(buf,len) debug_memdump (buf, len, true);
#else #else
#define debug(x) #define debug(...)
#define dmemdump(buf,len) #define dmemdump(buf,len)
#define dmemdumpl(buf,len) #define dmemdumpl(buf,len)
#endif #endif

View File

@ -85,7 +85,7 @@ void ssh1_bpp_new_cipher(BinaryPacketProtocol *bpp,
assert(!s->crcda_ctx); assert(!s->crcda_ctx);
s->crcda_ctx = crcda_make_context(); s->crcda_ctx = crcda_make_context();
bpp_logevent(("Initialised %s encryption", cipher->text_name)); bpp_logevent("Initialised %s encryption", cipher->text_name);
} }
} }
@ -101,7 +101,7 @@ void ssh1_bpp_start_compression(BinaryPacketProtocol *bpp)
s->compctx = ssh_compressor_new(&ssh_zlib); s->compctx = ssh_compressor_new(&ssh_zlib);
s->decompctx = ssh_decompressor_new(&ssh_zlib); s->decompctx = ssh_decompressor_new(&ssh_zlib);
bpp_logevent(("Started zlib (RFC1950) compression")); bpp_logevent("Started zlib (RFC1950) compression");
} }
#define BPP_READ(ptr, len) do \ #define BPP_READ(ptr, len) do \

View File

@ -126,7 +126,7 @@ bool ssh1_handle_direction_specific_packet(
s->ppl.bpp, SSH1_MSG_CHANNEL_OPEN_FAILURE); s->ppl.bpp, SSH1_MSG_CHANNEL_OPEN_FAILURE);
put_uint32(pktout, remid); put_uint32(pktout, remid);
pq_push(s->ppl.out_pq, pktout); pq_push(s->ppl.out_pq, pktout);
ppl_logevent(("Rejected X11 connect request")); ppl_logevent("Rejected X11 connect request");
} else { } else {
c = snew(struct ssh1_channel); c = snew(struct ssh1_channel);
c->connlayer = s; c->connlayer = s;
@ -142,7 +142,7 @@ bool ssh1_handle_direction_specific_packet(
put_uint32(pktout, c->remoteid); put_uint32(pktout, c->remoteid);
put_uint32(pktout, c->localid); put_uint32(pktout, c->localid);
pq_push(s->ppl.out_pq, pktout); pq_push(s->ppl.out_pq, pktout);
ppl_logevent(("Opened X11 forward channel")); ppl_logevent("Opened X11 forward channel");
} }
return true; return true;
@ -183,8 +183,8 @@ bool ssh1_handle_direction_specific_packet(
pfp = find234(s->rportfwds, &pf, NULL); pfp = find234(s->rportfwds, &pf, NULL);
if (!pfp) { if (!pfp) {
ppl_logevent(("Rejected remote port open request for %s:%d", ppl_logevent("Rejected remote port open request for %s:%d",
pf.dhost, port)); pf.dhost, port);
pktout = ssh_bpp_new_pktout( pktout = ssh_bpp_new_pktout(
s->ppl.bpp, SSH1_MSG_CHANNEL_OPEN_FAILURE); s->ppl.bpp, SSH1_MSG_CHANNEL_OPEN_FAILURE);
put_uint32(pktout, remid); put_uint32(pktout, remid);
@ -194,14 +194,14 @@ bool ssh1_handle_direction_specific_packet(
c = snew(struct ssh1_channel); c = snew(struct ssh1_channel);
c->connlayer = s; c->connlayer = s;
ppl_logevent(("Received remote port open request for %s:%d", ppl_logevent("Received remote port open request for %s:%d",
pf.dhost, port)); pf.dhost, port);
err = portfwdmgr_connect( err = portfwdmgr_connect(
s->portfwdmgr, &c->chan, pf.dhost, port, s->portfwdmgr, &c->chan, pf.dhost, port,
&c->sc, pfp->addressfamily); &c->sc, pfp->addressfamily);
if (err) { if (err) {
ppl_logevent(("Port open failed: %s", err)); ppl_logevent("Port open failed: %s", err);
sfree(err); sfree(err);
ssh1_channel_free(c); ssh1_channel_free(c);
pktout = ssh_bpp_new_pktout( pktout = ssh_bpp_new_pktout(
@ -217,7 +217,7 @@ bool ssh1_handle_direction_specific_packet(
put_uint32(pktout, c->remoteid); put_uint32(pktout, c->remoteid);
put_uint32(pktout, c->localid); put_uint32(pktout, c->localid);
pq_push(s->ppl.out_pq, pktout); pq_push(s->ppl.out_pq, pktout);
ppl_logevent(("Forwarded port opened successfully")); ppl_logevent("Forwarded port opened successfully");
} }
} }
@ -243,7 +243,7 @@ bool ssh1_handle_direction_specific_packet(
case SSH1_SMSG_EXIT_STATUS: case SSH1_SMSG_EXIT_STATUS:
{ {
int exitcode = get_uint32(pktin); int exitcode = get_uint32(pktin);
ppl_logevent(("Server sent command exit status %d", exitcode)); ppl_logevent("Server sent command exit status %d", exitcode);
ssh_got_exitcode(s->ppl.ssh, exitcode); ssh_got_exitcode(s->ppl.ssh, exitcode);
s->session_terminated = true; s->session_terminated = true;
@ -468,11 +468,11 @@ static void ssh1_rportfwd_response(struct ssh1_connection_state *s,
struct ssh_rportfwd *rpf = (struct ssh_rportfwd *)ctx; struct ssh_rportfwd *rpf = (struct ssh_rportfwd *)ctx;
if (success) { if (success) {
ppl_logevent(("Remote port forwarding from %s enabled", ppl_logevent("Remote port forwarding from %s enabled",
rpf->log_description)); rpf->log_description);
} else { } else {
ppl_logevent(("Remote port forwarding from %s refused", ppl_logevent("Remote port forwarding from %s refused",
rpf->log_description)); rpf->log_description);
struct ssh_rportfwd *realpf = del234(s->rportfwds, rpf); struct ssh_rportfwd *realpf = del234(s->rportfwds, rpf);
assert(realpf == rpf); assert(realpf == rpf);

View File

@ -72,7 +72,7 @@ bool ssh1_handle_direction_specific_packet(
if (s->finished_setup) if (s->finished_setup)
goto unexpected_setup_packet; goto unexpected_setup_packet;
ppl_logevent(("Client requested a shell")); ppl_logevent("Client requested a shell");
chan_run_shell(s->mainchan_chan); chan_run_shell(s->mainchan_chan);
s->finished_setup = true; s->finished_setup = true;
return true; return true;
@ -82,7 +82,7 @@ bool ssh1_handle_direction_specific_packet(
goto unexpected_setup_packet; goto unexpected_setup_packet;
cmd = get_string(pktin); cmd = get_string(pktin);
ppl_logevent(("Client sent command '%.*s'", PTRLEN_PRINTF(cmd))); ppl_logevent("Client sent command '%.*s'", PTRLEN_PRINTF(cmd));
chan_run_command(s->mainchan_chan, cmd); chan_run_command(s->mainchan_chan, cmd);
s->finished_setup = true; s->finished_setup = true;
return true; return true;
@ -119,12 +119,12 @@ bool ssh1_handle_direction_specific_packet(
BinarySource_UPCAST(pktin), 1); BinarySource_UPCAST(pktin), 1);
if (get_err(pktin)) { if (get_err(pktin)) {
ppl_logevent(("Unable to decode pty request packet")); ppl_logevent("Unable to decode pty request packet");
success = false; success = false;
} else if (!chan_allocate_pty( } else if (!chan_allocate_pty(
s->mainchan_chan, termtype, width, height, s->mainchan_chan, termtype, width, height,
pixwidth, pixheight, modes)) { pixwidth, pixheight, modes)) {
ppl_logevent(("Unable to allocate a pty")); ppl_logevent("Unable to allocate a pty");
success = false; success = false;
} else { } else {
success = true; success = true;
@ -144,8 +144,8 @@ bool ssh1_handle_direction_specific_packet(
host = get_string(pktin); host = get_string(pktin);
port = toint(get_uint32(pktin)); port = toint(get_uint32(pktin));
ppl_logevent(("Client requested port %d forward to %.*s:%d", ppl_logevent("Client requested port %d forward to %.*s:%d",
listenport, PTRLEN_PRINTF(host), port)); listenport, PTRLEN_PRINTF(host), port);
host_str = mkstr(host); host_str = mkstr(host);
success = portfwdmgr_listen( success = portfwdmgr_listen(
@ -207,8 +207,8 @@ bool ssh1_handle_direction_specific_packet(
host_str = mkstr(host); host_str = mkstr(host);
ppl_logevent(("Received request to connect to port %s:%d", ppl_logevent("Received request to connect to port %s:%d",
host_str, port)); host_str, port);
c = snew(struct ssh1_channel); c = snew(struct ssh1_channel);
c->connlayer = s; c->connlayer = s;
err = portfwdmgr_connect( err = portfwdmgr_connect(
@ -218,7 +218,7 @@ bool ssh1_handle_direction_specific_packet(
sfree(host_str); sfree(host_str);
if (err) { if (err) {
ppl_logevent(("Port open failed: %s", err)); ppl_logevent("Port open failed: %s", err);
sfree(err); sfree(err);
ssh1_channel_free(c); ssh1_channel_free(c);
pktout = ssh_bpp_new_pktout( pktout = ssh_bpp_new_pktout(
@ -234,7 +234,7 @@ bool ssh1_handle_direction_specific_packet(
put_uint32(pktout, c->remoteid); put_uint32(pktout, c->remoteid);
put_uint32(pktout, c->localid); put_uint32(pktout, c->localid);
pq_push(s->ppl.out_pq, pktout); pq_push(s->ppl.out_pq, pktout);
ppl_logevent(("Forwarded port opened successfully")); ppl_logevent("Forwarded port opened successfully");
} }
return true; return true;
@ -325,7 +325,7 @@ SshChannel *ssh1_serverside_x11_open(
c->halfopen = true; c->halfopen = true;
c->chan = chan; c->chan = chan;
ppl_logevent(("Forwarding X11 connection to client")); ppl_logevent("Forwarding X11 connection to client");
pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_SMSG_X11_OPEN); pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_SMSG_X11_OPEN);
put_uint32(pktout, c->localid); put_uint32(pktout, c->localid);
@ -347,7 +347,7 @@ SshChannel *ssh1_serverside_agent_open(ConnectionLayer *cl, Channel *chan)
c->halfopen = true; c->halfopen = true;
c->chan = chan; c->chan = chan;
ppl_logevent(("Forwarding agent connection to client")); ppl_logevent("Forwarding agent connection to client");
pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_SMSG_AGENT_OPEN); pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_SMSG_AGENT_OPEN);
put_uint32(pktout, c->localid); put_uint32(pktout, c->localid);

View File

@ -482,7 +482,7 @@ static void ssh1_channel_close_local(struct ssh1_channel *c,
const char *msg = chan_log_close_msg(c->chan); const char *msg = chan_log_close_msg(c->chan);
if (msg != NULL) if (msg != NULL)
ppl_logevent(("%s%s%s", msg, reason ? " " : "", reason ? reason : "")); ppl_logevent("%s%s%s", msg, reason ? " " : "", reason ? reason : "");
chan_free(c->chan); chan_free(c->chan);
c->chan = zombiechan_new(); c->chan = zombiechan_new();
@ -637,8 +637,8 @@ static SshChannel *ssh1_lportfwd_open(
c->halfopen = true; c->halfopen = true;
c->chan = chan; c->chan = chan;
ppl_logevent(("Opening connection to %s:%d for %s", ppl_logevent("Opening connection to %s:%d for %s",
hostname, port, description)); hostname, port, description);
pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_MSG_PORT_OPEN); pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_MSG_PORT_OPEN);
put_uint32(pktout, c->localid); put_uint32(pktout, c->localid);

View File

@ -258,7 +258,7 @@ static void ssh1_login_server_process_queue(PacketProtocolLayer *ppl)
} }
s->username = get_string(pktin); s->username = get_string(pktin);
s->username.ptr = s->username_str = mkstr(s->username); s->username.ptr = s->username_str = mkstr(s->username);
ppl_logevent(("Received username '%.*s'", PTRLEN_PRINTF(s->username))); ppl_logevent("Received username '%.*s'", PTRLEN_PRINTF(s->username));
s->auth_successful = auth_none(s->authpolicy, s->username); s->auth_successful = auth_none(s->authpolicy, s->username);
while (1) { while (1) {
@ -298,7 +298,7 @@ static void ssh1_login_server_process_queue(PacketProtocolLayer *ppl)
continue; continue;
if (s->authkey->bytes < 32) { if (s->authkey->bytes < 32) {
ppl_logevent(("Auth key far too small")); ppl_logevent("Auth key far too small");
continue; continue;
} }
@ -317,7 +317,7 @@ static void ssh1_login_server_process_queue(PacketProtocolLayer *ppl)
if (!rsa_ssh1_encrypt(rsabuf, 32, s->authkey)) { if (!rsa_ssh1_encrypt(rsabuf, 32, s->authkey)) {
sfree(rsabuf); sfree(rsabuf);
ppl_logevent(("Failed to encrypt auth challenge")); ppl_logevent("Failed to encrypt auth challenge");
continue; continue;
} }
@ -346,7 +346,7 @@ static void ssh1_login_server_process_queue(PacketProtocolLayer *ppl)
ptrlen expected = make_ptrlen( ptrlen expected = make_ptrlen(
s->auth_rsa_expected_response, 16); s->auth_rsa_expected_response, 16);
if (!ptrlen_eq_ptrlen(response, expected)) { if (!ptrlen_eq_ptrlen(response, expected)) {
ppl_logevent(("Wrong response to auth challenge")); ppl_logevent("Wrong response to auth challenge");
continue; continue;
} }
} }

View File

@ -157,7 +157,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
return; return;
} }
ppl_logevent(("Received public keys")); ppl_logevent("Received public keys");
{ {
ptrlen pl = get_data(pktin, 8); ptrlen pl = get_data(pktin, 8);
@ -174,8 +174,8 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
*/ */
if (!get_err(pktin)) { if (!get_err(pktin)) {
char *fingerprint = rsa_ssh1_fingerprint(&s->hostkey); char *fingerprint = rsa_ssh1_fingerprint(&s->hostkey);
ppl_logevent(("Host key fingerprint is:")); ppl_logevent("Host key fingerprint is:");
ppl_logevent((" %s", fingerprint)); ppl_logevent(" %s", fingerprint);
sfree(fingerprint); sfree(fingerprint);
} }
@ -276,7 +276,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
} }
} }
ppl_logevent(("Encrypted session key")); ppl_logevent("Encrypted session key");
{ {
bool cipher_chosen = false, warn = false; bool cipher_chosen = false, warn = false;
@ -290,7 +290,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
warn = true; warn = true;
} else if (next_cipher == CIPHER_AES) { } else if (next_cipher == CIPHER_AES) {
/* XXX Probably don't need to mention this. */ /* XXX Probably don't need to mention this. */
ppl_logevent(("AES not supported in SSH-1, skipping")); ppl_logevent("AES not supported in SSH-1, skipping");
} else { } else {
switch (next_cipher) { switch (next_cipher) {
case CIPHER_3DES: s->cipher_type = SSH_CIPHER_3DES; case CIPHER_3DES: s->cipher_type = SSH_CIPHER_3DES;
@ -330,13 +330,13 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
switch (s->cipher_type) { switch (s->cipher_type) {
case SSH_CIPHER_3DES: case SSH_CIPHER_3DES:
ppl_logevent(("Using 3DES encryption")); ppl_logevent("Using 3DES encryption");
break; break;
case SSH_CIPHER_DES: case SSH_CIPHER_DES:
ppl_logevent(("Using single-DES encryption")); ppl_logevent("Using single-DES encryption");
break; break;
case SSH_CIPHER_BLOWFISH: case SSH_CIPHER_BLOWFISH:
ppl_logevent(("Using Blowfish encryption")); ppl_logevent("Using Blowfish encryption");
break; break;
} }
@ -348,7 +348,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
put_uint32(pkt, s->local_protoflags); put_uint32(pkt, s->local_protoflags);
pq_push(s->ppl.out_pq, pkt); pq_push(s->ppl.out_pq, pkt);
ppl_logevent(("Trying to enable encryption...")); ppl_logevent("Trying to enable encryption...");
sfree(s->rsabuf); sfree(s->rsabuf);
s->rsabuf = NULL; s->rsabuf = NULL;
@ -390,7 +390,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
return; return;
} }
ppl_logevent(("Successfully started encryption")); ppl_logevent("Successfully started encryption");
if ((s->username = get_remote_username(s->conf)) == NULL) { if ((s->username = get_remote_username(s->conf)) == NULL) {
s->cur_prompt = new_prompts(); s->cur_prompt = new_prompts();
@ -428,9 +428,9 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
put_stringz(pkt, s->username); put_stringz(pkt, s->username);
pq_push(s->ppl.out_pq, pkt); pq_push(s->ppl.out_pq, pkt);
ppl_logevent(("Sent username \"%s\"", s->username)); ppl_logevent("Sent username \"%s\"", s->username);
if ((flags & FLAG_VERBOSE) || (flags & FLAG_INTERACTIVE)) if ((flags & FLAG_VERBOSE) || (flags & FLAG_INTERACTIVE))
ppl_printf(("Sent username \"%s\"\r\n", s->username)); ppl_printf("Sent username \"%s\"\r\n", s->username);
crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) != NULL); crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) != NULL);
@ -448,8 +448,8 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
s->keyfile = conf_get_filename(s->conf, CONF_keyfile); s->keyfile = conf_get_filename(s->conf, CONF_keyfile);
if (!filename_is_null(s->keyfile)) { if (!filename_is_null(s->keyfile)) {
int keytype; int keytype;
ppl_logevent(("Reading key file \"%.150s\"", ppl_logevent("Reading key file \"%.150s\"",
filename_to_str(s->keyfile))); filename_to_str(s->keyfile));
keytype = key_type(s->keyfile); keytype = key_type(s->keyfile);
if (keytype == SSH_KEYTYPE_SSH1 || if (keytype == SSH_KEYTYPE_SSH1 ||
keytype == SSH_KEYTYPE_SSH1_PUBLIC) { keytype == SSH_KEYTYPE_SSH1_PUBLIC) {
@ -460,22 +460,22 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
&s->publickey_comment, &error)) { &s->publickey_comment, &error)) {
s->privatekey_available = (keytype == SSH_KEYTYPE_SSH1); s->privatekey_available = (keytype == SSH_KEYTYPE_SSH1);
if (!s->privatekey_available) if (!s->privatekey_available)
ppl_logevent(("Key file contains public key only")); ppl_logevent("Key file contains public key only");
s->privatekey_encrypted = rsa_ssh1_encrypted(s->keyfile, NULL); s->privatekey_encrypted = rsa_ssh1_encrypted(s->keyfile, NULL);
} else { } else {
ppl_logevent(("Unable to load key (%s)", error)); ppl_logevent("Unable to load key (%s)", error);
ppl_printf(("Unable to load key file \"%s\" (%s)\r\n", ppl_printf("Unable to load key file \"%s\" (%s)\r\n",
filename_to_str(s->keyfile), error)); filename_to_str(s->keyfile), error);
strbuf_free(s->publickey_blob); strbuf_free(s->publickey_blob);
s->publickey_blob = NULL; s->publickey_blob = NULL;
} }
} else { } else {
ppl_logevent(("Unable to use this key file (%s)", ppl_logevent("Unable to use this key file (%s)",
key_type_to_str(keytype))); key_type_to_str(keytype));
ppl_printf(("Unable to use key file \"%s\" (%s)\r\n", ppl_printf("Unable to use key file \"%s\" (%s)\r\n",
filename_to_str(s->keyfile), filename_to_str(s->keyfile),
key_type_to_str(keytype))); key_type_to_str(keytype));
} }
} }
@ -493,7 +493,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
*/ */
s->authed = false; s->authed = false;
s->tried_agent = true; s->tried_agent = true;
ppl_logevent(("Pageant is running. Requesting keys.")); ppl_logevent("Pageant is running. Requesting keys.");
/* Request the keys held by the agent. */ /* Request the keys held by the agent. */
{ {
@ -510,11 +510,11 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
if (get_byte(s->asrc) == SSH1_AGENT_RSA_IDENTITIES_ANSWER) { if (get_byte(s->asrc) == SSH1_AGENT_RSA_IDENTITIES_ANSWER) {
s->nkeys = toint(get_uint32(s->asrc)); s->nkeys = toint(get_uint32(s->asrc));
if (s->nkeys < 0) { if (s->nkeys < 0) {
ppl_logevent(("Pageant reported negative key count %d", ppl_logevent("Pageant reported negative key count %d",
s->nkeys)); s->nkeys);
s->nkeys = 0; s->nkeys = 0;
} }
ppl_logevent(("Pageant has %d SSH-1 keys", s->nkeys)); ppl_logevent("Pageant has %d SSH-1 keys", s->nkeys);
for (s->keyi = 0; s->keyi < s->nkeys; s->keyi++) { for (s->keyi = 0; s->keyi < s->nkeys; s->keyi++) {
size_t start, end; size_t start, end;
start = s->asrc->pos; start = s->asrc->pos;
@ -523,7 +523,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
end = s->asrc->pos; end = s->asrc->pos;
s->comment = get_string(s->asrc); s->comment = get_string(s->asrc);
if (get_err(s->asrc)) { if (get_err(s->asrc)) {
ppl_logevent(("Pageant key list packet was truncated")); ppl_logevent("Pageant key list packet was truncated");
break; break;
} }
if (s->publickey_blob) { if (s->publickey_blob) {
@ -533,24 +533,24 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
if (keystr.len == s->publickey_blob->len && if (keystr.len == s->publickey_blob->len &&
!memcmp(keystr.ptr, s->publickey_blob->s, !memcmp(keystr.ptr, s->publickey_blob->s,
s->publickey_blob->len)) { s->publickey_blob->len)) {
ppl_logevent(("Pageant key #%d matches " ppl_logevent("Pageant key #%d matches "
"configured key file", s->keyi)); "configured key file", s->keyi);
s->tried_publickey = true; s->tried_publickey = true;
} else } else
/* Skip non-configured key */ /* Skip non-configured key */
continue; continue;
} }
ppl_logevent(("Trying Pageant key #%d", s->keyi)); ppl_logevent("Trying Pageant key #%d", s->keyi);
pkt = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_CMSG_AUTH_RSA); pkt = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_CMSG_AUTH_RSA);
put_mp_ssh1(pkt, s->key.modulus); put_mp_ssh1(pkt, s->key.modulus);
pq_push(s->ppl.out_pq, pkt); pq_push(s->ppl.out_pq, pkt);
crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) crMaybeWaitUntilV((pktin = ssh1_login_pop(s))
!= NULL); != NULL);
if (pktin->type != SSH1_SMSG_AUTH_RSA_CHALLENGE) { if (pktin->type != SSH1_SMSG_AUTH_RSA_CHALLENGE) {
ppl_logevent(("Key refused")); ppl_logevent("Key refused");
continue; continue;
} }
ppl_logevent(("Received RSA challenge")); ppl_logevent("Received RSA challenge");
s->challenge = get_mp_ssh1(pktin); s->challenge = get_mp_ssh1(pktin);
if (get_err(pktin)) { if (get_err(pktin)) {
freebn(s->challenge); freebn(s->challenge);
@ -579,7 +579,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
if (ret) { if (ret) {
if (s->agent_response.len >= 5+16 && if (s->agent_response.len >= 5+16 &&
ret[4] == SSH1_AGENT_RSA_RESPONSE) { ret[4] == SSH1_AGENT_RSA_RESPONSE) {
ppl_logevent(("Sending Pageant's response")); ppl_logevent("Sending Pageant's response");
pkt = ssh_bpp_new_pktout( pkt = ssh_bpp_new_pktout(
s->ppl.bpp, SSH1_CMSG_AUTH_RSA_RESPONSE); s->ppl.bpp, SSH1_CMSG_AUTH_RSA_RESPONSE);
put_data(pkt, ret + 5, 16); put_data(pkt, ret + 5, 16);
@ -589,25 +589,25 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
(pktin = ssh1_login_pop(s)) (pktin = ssh1_login_pop(s))
!= NULL); != NULL);
if (pktin->type == SSH1_SMSG_SUCCESS) { if (pktin->type == SSH1_SMSG_SUCCESS) {
ppl_logevent(("Pageant's response " ppl_logevent("Pageant's response "
"accepted")); "accepted");
if (flags & FLAG_VERBOSE) { if (flags & FLAG_VERBOSE) {
ppl_printf(("Authenticated using RSA " ppl_printf("Authenticated using RSA "
"key \"%.*s\" from " "key \"%.*s\" from "
"agent\r\n", PTRLEN_PRINTF( "agent\r\n", PTRLEN_PRINTF(
s->comment))); s->comment));
} }
s->authed = true; s->authed = true;
} else } else
ppl_logevent(("Pageant's response not " ppl_logevent("Pageant's response not "
"accepted")); "accepted");
} else { } else {
ppl_logevent(("Pageant failed to answer " ppl_logevent("Pageant failed to answer "
"challenge")); "challenge");
sfree((char *)ret); sfree((char *)ret);
} }
} else { } else {
ppl_logevent(("No reply received from Pageant")); ppl_logevent("No reply received from Pageant");
} }
} }
freebn(s->key.exponent); freebn(s->key.exponent);
@ -619,9 +619,9 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
sfree(s->agent_response_to_free); sfree(s->agent_response_to_free);
s->agent_response_to_free = NULL; s->agent_response_to_free = NULL;
if (s->publickey_blob && !s->tried_publickey) if (s->publickey_blob && !s->tried_publickey)
ppl_logevent(("Configured key file not in Pageant")); ppl_logevent("Configured key file not in Pageant");
} else { } else {
ppl_logevent(("Failed to get reply from Pageant")); ppl_logevent("Failed to get reply from Pageant");
} }
if (s->authed) if (s->authed)
break; break;
@ -634,9 +634,9 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
*/ */
bool got_passphrase; /* need not be kept over crReturn */ bool got_passphrase; /* need not be kept over crReturn */
if (flags & FLAG_VERBOSE) if (flags & FLAG_VERBOSE)
ppl_printf(("Trying public key authentication.\r\n")); ppl_printf("Trying public key authentication.\r\n");
ppl_logevent(("Trying public key \"%s\"", ppl_logevent("Trying public key \"%s\"",
filename_to_str(s->keyfile))); filename_to_str(s->keyfile));
s->tried_publickey = true; s->tried_publickey = true;
got_passphrase = false; got_passphrase = false;
while (!got_passphrase) { while (!got_passphrase) {
@ -648,7 +648,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
const char *error; const char *error;
if (!s->privatekey_encrypted) { if (!s->privatekey_encrypted) {
if (flags & FLAG_VERBOSE) if (flags & FLAG_VERBOSE)
ppl_printf(("No passphrase required.\r\n")); ppl_printf("No passphrase required.\r\n");
passphrase = NULL; passphrase = NULL;
} else { } else {
s->cur_prompt = new_prompts(s->ppl.seat); s->cur_prompt = new_prompts(s->ppl.seat);
@ -695,12 +695,12 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
/* Correct passphrase. */ /* Correct passphrase. */
got_passphrase = true; got_passphrase = true;
} else if (retd == 0) { } else if (retd == 0) {
ppl_printf(("Couldn't load private key from %s (%s).\r\n", ppl_printf("Couldn't load private key from %s (%s).\r\n",
filename_to_str(s->keyfile), error)); filename_to_str(s->keyfile), error);
got_passphrase = false; got_passphrase = false;
break; /* go and try something else */ break; /* go and try something else */
} else if (retd == -1) { } else if (retd == -1) {
ppl_printf(("Wrong passphrase.\r\n")); ppl_printf("Wrong passphrase.\r\n");
got_passphrase = false; got_passphrase = false;
/* and try again */ /* and try again */
} else { } else {
@ -721,7 +721,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) crMaybeWaitUntilV((pktin = ssh1_login_pop(s))
!= NULL); != NULL);
if (pktin->type == SSH1_SMSG_FAILURE) { if (pktin->type == SSH1_SMSG_FAILURE) {
ppl_printf(("Server refused our public key.\r\n")); ppl_printf("Server refused our public key.\r\n");
continue; /* go and try something else */ continue; /* go and try something else */
} }
if (pktin->type != SSH1_SMSG_AUTH_RSA_CHALLENGE) { if (pktin->type != SSH1_SMSG_AUTH_RSA_CHALLENGE) {
@ -772,8 +772,8 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
!= NULL); != NULL);
if (pktin->type == SSH1_SMSG_FAILURE) { if (pktin->type == SSH1_SMSG_FAILURE) {
if (flags & FLAG_VERBOSE) if (flags & FLAG_VERBOSE)
ppl_printf(("Failed to authenticate with" ppl_printf("Failed to authenticate with"
" our public key.\r\n")); " our public key.\r\n");
continue; /* go and try something else */ continue; /* go and try something else */
} else if (pktin->type != SSH1_SMSG_SUCCESS) { } else if (pktin->type != SSH1_SMSG_SUCCESS) {
ssh_proto_error(s->ppl.ssh, "Received unexpected packet" ssh_proto_error(s->ppl.ssh, "Received unexpected packet"
@ -797,14 +797,14 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
(s->supported_auths_mask & (1 << SSH1_AUTH_TIS)) && (s->supported_auths_mask & (1 << SSH1_AUTH_TIS)) &&
!s->tis_auth_refused) { !s->tis_auth_refused) {
s->pwpkt_type = SSH1_CMSG_AUTH_TIS_RESPONSE; s->pwpkt_type = SSH1_CMSG_AUTH_TIS_RESPONSE;
ppl_logevent(("Requested TIS authentication")); ppl_logevent("Requested TIS authentication");
pkt = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_CMSG_AUTH_TIS); pkt = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_CMSG_AUTH_TIS);
pq_push(s->ppl.out_pq, pkt); pq_push(s->ppl.out_pq, pkt);
crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) != NULL); crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) != NULL);
if (pktin->type == SSH1_SMSG_FAILURE) { if (pktin->type == SSH1_SMSG_FAILURE) {
ppl_logevent(("TIS authentication declined")); ppl_logevent("TIS authentication declined");
if (flags & FLAG_INTERACTIVE) if (flags & FLAG_INTERACTIVE)
ppl_printf(("TIS authentication refused.\r\n")); ppl_printf("TIS authentication refused.\r\n");
s->tis_auth_refused = true; s->tis_auth_refused = true;
continue; continue;
} else if (pktin->type == SSH1_SMSG_AUTH_TIS_CHALLENGE) { } else if (pktin->type == SSH1_SMSG_AUTH_TIS_CHALLENGE) {
@ -817,7 +817,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
"badly formed"); "badly formed");
return; return;
} }
ppl_logevent(("Received TIS challenge")); ppl_logevent("Received TIS challenge");
s->cur_prompt->to_server = true; s->cur_prompt->to_server = true;
s->cur_prompt->name = dupstr("SSH TIS authentication"); s->cur_prompt->name = dupstr("SSH TIS authentication");
/* Prompt heuristic comes from OpenSSH */ /* Prompt heuristic comes from OpenSSH */
@ -846,13 +846,13 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
(s->supported_auths_mask & (1 << SSH1_AUTH_CCARD)) && (s->supported_auths_mask & (1 << SSH1_AUTH_CCARD)) &&
!s->ccard_auth_refused) { !s->ccard_auth_refused) {
s->pwpkt_type = SSH1_CMSG_AUTH_CCARD_RESPONSE; s->pwpkt_type = SSH1_CMSG_AUTH_CCARD_RESPONSE;
ppl_logevent(("Requested CryptoCard authentication")); ppl_logevent("Requested CryptoCard authentication");
pkt = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_CMSG_AUTH_CCARD); pkt = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_CMSG_AUTH_CCARD);
pq_push(s->ppl.out_pq, pkt); pq_push(s->ppl.out_pq, pkt);
crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) != NULL); crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) != NULL);
if (pktin->type == SSH1_SMSG_FAILURE) { if (pktin->type == SSH1_SMSG_FAILURE) {
ppl_logevent(("CryptoCard authentication declined")); ppl_logevent("CryptoCard authentication declined");
ppl_printf(("CryptoCard authentication refused.\r\n")); ppl_printf("CryptoCard authentication refused.\r\n");
s->ccard_auth_refused = true; s->ccard_auth_refused = true;
continue; continue;
} else if (pktin->type == SSH1_SMSG_AUTH_CCARD_CHALLENGE) { } else if (pktin->type == SSH1_SMSG_AUTH_CCARD_CHALLENGE) {
@ -865,7 +865,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
"was badly formed"); "was badly formed");
return; return;
} }
ppl_logevent(("Received CryptoCard challenge")); ppl_logevent("Received CryptoCard challenge");
s->cur_prompt->to_server = true; s->cur_prompt->to_server = true;
s->cur_prompt->name = dupstr("SSH CryptoCard authentication"); s->cur_prompt->name = dupstr("SSH CryptoCard authentication");
s->cur_prompt->name_reqd = false; s->cur_prompt->name_reqd = false;
@ -1008,7 +1008,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
pq_push(s->ppl.out_pq, pkt); pq_push(s->ppl.out_pq, pkt);
} }
} }
ppl_logevent(("Sending password with camouflage packets")); ppl_logevent("Sending password with camouflage packets");
} }
else if (!(s->ppl.remote_bugs & BUG_NEEDS_SSH1_PLAIN_PASSWORD)) { else if (!(s->ppl.remote_bugs & BUG_NEEDS_SSH1_PLAIN_PASSWORD)) {
/* /*
@ -1018,7 +1018,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
*/ */
strbuf *padded_pw = strbuf_new(); strbuf *padded_pw = strbuf_new();
ppl_logevent(("Sending length-padded password")); ppl_logevent("Sending length-padded password");
pkt = ssh_bpp_new_pktout(s->ppl.bpp, s->pwpkt_type); pkt = ssh_bpp_new_pktout(s->ppl.bpp, s->pwpkt_type);
put_asciz(padded_pw, s->cur_prompt->prompts[0]->result); put_asciz(padded_pw, s->cur_prompt->prompts[0]->result);
do { do {
@ -1031,7 +1031,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
* The server is believed unable to cope with * The server is believed unable to cope with
* any of our password camouflage methods. * any of our password camouflage methods.
*/ */
ppl_logevent(("Sending unpadded password")); ppl_logevent("Sending unpadded password");
pkt = ssh_bpp_new_pktout(s->ppl.bpp, s->pwpkt_type); pkt = ssh_bpp_new_pktout(s->ppl.bpp, s->pwpkt_type);
put_stringz(pkt, s->cur_prompt->prompts[0]->result); put_stringz(pkt, s->cur_prompt->prompts[0]->result);
pq_push(s->ppl.out_pq, pkt); pq_push(s->ppl.out_pq, pkt);
@ -1041,14 +1041,14 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
put_stringz(pkt, s->cur_prompt->prompts[0]->result); put_stringz(pkt, s->cur_prompt->prompts[0]->result);
pq_push(s->ppl.out_pq, pkt); pq_push(s->ppl.out_pq, pkt);
} }
ppl_logevent(("Sent password")); ppl_logevent("Sent password");
free_prompts(s->cur_prompt); free_prompts(s->cur_prompt);
s->cur_prompt = NULL; s->cur_prompt = NULL;
crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) != NULL); crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) != NULL);
if (pktin->type == SSH1_SMSG_FAILURE) { if (pktin->type == SSH1_SMSG_FAILURE) {
if (flags & FLAG_VERBOSE) if (flags & FLAG_VERBOSE)
ppl_printf(("Access denied\r\n")); ppl_printf("Access denied\r\n");
ppl_logevent(("Authentication refused")); ppl_logevent("Authentication refused");
} else if (pktin->type != SSH1_SMSG_SUCCESS) { } else if (pktin->type != SSH1_SMSG_SUCCESS) {
ssh_proto_error(s->ppl.ssh, "Received unexpected packet" ssh_proto_error(s->ppl.ssh, "Received unexpected packet"
" in response to password authentication, type %d " " in response to password authentication, type %d "
@ -1057,10 +1057,10 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
} }
} }
ppl_logevent(("Authentication successful")); ppl_logevent("Authentication successful");
if (conf_get_bool(s->conf, CONF_compression)) { if (conf_get_bool(s->conf, CONF_compression)) {
ppl_logevent(("Requesting compression")); ppl_logevent("Requesting compression");
pkt = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_CMSG_REQUEST_COMPRESSION); pkt = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_CMSG_REQUEST_COMPRESSION);
put_uint32(pkt, 6); /* gzip compression level */ put_uint32(pkt, 6); /* gzip compression level */
pq_push(s->ppl.out_pq, pkt); pq_push(s->ppl.out_pq, pkt);
@ -1075,8 +1075,8 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
* cross in transit.) * cross in transit.)
*/ */
} else if (pktin->type == SSH1_SMSG_FAILURE) { } else if (pktin->type == SSH1_SMSG_FAILURE) {
ppl_logevent(("Server refused to enable compression")); ppl_logevent("Server refused to enable compression");
ppl_printf(("Server refused to compress\r\n")); ppl_printf("Server refused to compress\r\n");
} else { } else {
ssh_proto_error(s->ppl.ssh, "Received unexpected packet" ssh_proto_error(s->ppl.ssh, "Received unexpected packet"
" in response to compression request, type %d " " in response to compression request, type %d "

View File

@ -113,8 +113,8 @@ void ssh2_bpp_new_outgoing_crypto(
(ssh2_cipher_alg(s->out.cipher)->flags & SSH_CIPHER_IS_CBC) && (ssh2_cipher_alg(s->out.cipher)->flags & SSH_CIPHER_IS_CBC) &&
!(s->bpp.remote_bugs & BUG_CHOKES_ON_SSH2_IGNORE)); !(s->bpp.remote_bugs & BUG_CHOKES_ON_SSH2_IGNORE));
bpp_logevent(("Initialised %.200s outbound encryption", bpp_logevent("Initialised %.200s outbound encryption",
ssh2_cipher_alg(s->out.cipher)->text_name)); ssh2_cipher_alg(s->out.cipher)->text_name);
} else { } else {
s->out.cipher = NULL; s->out.cipher = NULL;
s->cbc_ignore_workaround = false; s->cbc_ignore_workaround = false;
@ -124,12 +124,12 @@ void ssh2_bpp_new_outgoing_crypto(
s->out.mac = ssh2_mac_new(mac, s->out.cipher); s->out.mac = ssh2_mac_new(mac, s->out.cipher);
mac->setkey(s->out.mac, mac_key); mac->setkey(s->out.mac, mac_key);
bpp_logevent(("Initialised %.200s outbound MAC algorithm%s%s", bpp_logevent("Initialised %.200s outbound MAC algorithm%s%s",
ssh2_mac_alg(s->out.mac)->text_name, ssh2_mac_alg(s->out.mac)->text_name,
etm_mode ? " (in ETM mode)" : "", etm_mode ? " (in ETM mode)" : "",
(s->out.cipher && (s->out.cipher &&
ssh2_cipher_alg(s->out.cipher)->required_mac ? ssh2_cipher_alg(s->out.cipher)->required_mac ?
" (required by cipher)" : ""))); " (required by cipher)" : ""));
} else { } else {
s->out.mac = NULL; s->out.mac = NULL;
} }
@ -138,8 +138,8 @@ void ssh2_bpp_new_outgoing_crypto(
s->out.pending_compression = compression; s->out.pending_compression = compression;
s->out_comp = NULL; s->out_comp = NULL;
bpp_logevent(("Will enable %s compression after user authentication", bpp_logevent("Will enable %s compression after user authentication",
s->out.pending_compression->text_name)); s->out.pending_compression->text_name);
} else { } else {
s->out.pending_compression = NULL; s->out.pending_compression = NULL;
@ -149,8 +149,8 @@ void ssh2_bpp_new_outgoing_crypto(
s->out_comp = ssh_compressor_new(compression); s->out_comp = ssh_compressor_new(compression);
if (s->out_comp) if (s->out_comp)
bpp_logevent(("Initialised %s compression", bpp_logevent("Initialised %s compression",
ssh_compressor_alg(s->out_comp)->text_name)); ssh_compressor_alg(s->out_comp)->text_name);
} }
} }
@ -176,8 +176,8 @@ void ssh2_bpp_new_incoming_crypto(
ssh2_cipher_setkey(s->in.cipher, ckey); ssh2_cipher_setkey(s->in.cipher, ckey);
ssh2_cipher_setiv(s->in.cipher, iv); ssh2_cipher_setiv(s->in.cipher, iv);
bpp_logevent(("Initialised %.200s inbound encryption", bpp_logevent("Initialised %.200s inbound encryption",
ssh2_cipher_alg(s->in.cipher)->text_name)); ssh2_cipher_alg(s->in.cipher)->text_name);
} else { } else {
s->in.cipher = NULL; s->in.cipher = NULL;
} }
@ -186,12 +186,12 @@ void ssh2_bpp_new_incoming_crypto(
s->in.mac = ssh2_mac_new(mac, s->in.cipher); s->in.mac = ssh2_mac_new(mac, s->in.cipher);
mac->setkey(s->in.mac, mac_key); mac->setkey(s->in.mac, mac_key);
bpp_logevent(("Initialised %.200s inbound MAC algorithm%s%s", bpp_logevent("Initialised %.200s inbound MAC algorithm%s%s",
ssh2_mac_alg(s->in.mac)->text_name, ssh2_mac_alg(s->in.mac)->text_name,
etm_mode ? " (in ETM mode)" : "", etm_mode ? " (in ETM mode)" : "",
(s->in.cipher && (s->in.cipher &&
ssh2_cipher_alg(s->in.cipher)->required_mac ? ssh2_cipher_alg(s->in.cipher)->required_mac ?
" (required by cipher)" : ""))); " (required by cipher)" : ""));
} else { } else {
s->in.mac = NULL; s->in.mac = NULL;
} }
@ -200,8 +200,8 @@ void ssh2_bpp_new_incoming_crypto(
s->in.pending_compression = compression; s->in.pending_compression = compression;
s->in_decomp = NULL; s->in_decomp = NULL;
bpp_logevent(("Will enable %s decompression after user authentication", bpp_logevent("Will enable %s decompression after user authentication",
s->in.pending_compression->text_name)); s->in.pending_compression->text_name);
} else { } else {
s->in.pending_compression = NULL; s->in.pending_compression = NULL;
@ -211,8 +211,8 @@ void ssh2_bpp_new_incoming_crypto(
s->in_decomp = ssh_decompressor_new(compression); s->in_decomp = ssh_decompressor_new(compression);
if (s->in_decomp) if (s->in_decomp)
bpp_logevent(("Initialised %s decompression", bpp_logevent("Initialised %s decompression",
ssh_decompressor_alg(s->in_decomp)->text_name)); ssh_decompressor_alg(s->in_decomp)->text_name);
} }
/* Clear the pending_newkeys flag, so that handle_input below will /* Clear the pending_newkeys flag, so that handle_input below will
@ -239,14 +239,14 @@ static void ssh2_bpp_enable_pending_compression(struct ssh2_bpp_state *s)
if (s->in.pending_compression) { if (s->in.pending_compression) {
s->in_decomp = ssh_decompressor_new(s->in.pending_compression); s->in_decomp = ssh_decompressor_new(s->in.pending_compression);
bpp_logevent(("Initialised delayed %s decompression", bpp_logevent("Initialised delayed %s decompression",
ssh_decompressor_alg(s->in_decomp)->text_name)); ssh_decompressor_alg(s->in_decomp)->text_name);
s->in.pending_compression = NULL; s->in.pending_compression = NULL;
} }
if (s->out.pending_compression) { if (s->out.pending_compression) {
s->out_comp = ssh_compressor_new(s->out.pending_compression); s->out_comp = ssh_compressor_new(s->out.pending_compression);
bpp_logevent(("Initialised delayed %s compression", bpp_logevent("Initialised delayed %s compression",
ssh_compressor_alg(s->out_comp)->text_name)); ssh_compressor_alg(s->out_comp)->text_name);
s->out.pending_compression = NULL; s->out.pending_compression = NULL;
} }
} }

View File

@ -20,8 +20,8 @@ static ChanopenResult chan_open_x11(
char *peeraddr_str; char *peeraddr_str;
Channel *ch; Channel *ch;
ppl_logevent(("Received X11 connect request from %.*s:%d", ppl_logevent("Received X11 connect request from %.*s:%d",
PTRLEN_PRINTF(peeraddr), peerport)); PTRLEN_PRINTF(peeraddr), peerport);
if (!s->X11_fwd_enabled && !s->connshare) { if (!s->X11_fwd_enabled && !s->connshare) {
CHANOPEN_RETURN_FAILURE( CHANOPEN_RETURN_FAILURE(
@ -33,7 +33,7 @@ static ChanopenResult chan_open_x11(
ch = x11_new_channel( ch = x11_new_channel(
s->x11authtree, sc, peeraddr_str, peerport, s->connshare != NULL); s->x11authtree, sc, peeraddr_str, peerport, s->connshare != NULL);
sfree(peeraddr_str); sfree(peeraddr_str);
ppl_logevent(("Opened X11 forward channel")); ppl_logevent("Opened X11 forward channel");
CHANOPEN_RETURN_SUCCESS(ch); CHANOPEN_RETURN_SUCCESS(ch);
} }
@ -46,9 +46,9 @@ static ChanopenResult chan_open_forwarded_tcpip(
Channel *ch; Channel *ch;
char *err; char *err;
ppl_logevent(("Received remote port %.*s:%d open request from %.*s:%d", ppl_logevent("Received remote port %.*s:%d open request from %.*s:%d",
PTRLEN_PRINTF(fwdaddr), fwdport, PTRLEN_PRINTF(fwdaddr), fwdport,
PTRLEN_PRINTF(peeraddr), peerport)); PTRLEN_PRINTF(peeraddr), peerport);
pf.shost = mkstr(fwdaddr); pf.shost = mkstr(fwdaddr);
pf.sport = fwdport; pf.sport = fwdport;
@ -72,17 +72,17 @@ static ChanopenResult chan_open_forwarded_tcpip(
err = portfwdmgr_connect( err = portfwdmgr_connect(
s->portfwdmgr, &ch, realpf->dhost, realpf->dport, s->portfwdmgr, &ch, realpf->dhost, realpf->dport,
sc, realpf->addressfamily); sc, realpf->addressfamily);
ppl_logevent(("Attempting to forward remote port to %s:%d", ppl_logevent("Attempting to forward remote port to %s:%d",
realpf->dhost, realpf->dport)); realpf->dhost, realpf->dport);
if (err != NULL) { if (err != NULL) {
ppl_logevent(("Port open failed: %s", err)); ppl_logevent("Port open failed: %s", err);
sfree(err); sfree(err);
CHANOPEN_RETURN_FAILURE( CHANOPEN_RETURN_FAILURE(
SSH2_OPEN_CONNECT_FAILED, SSH2_OPEN_CONNECT_FAILED,
("Port open failed")); ("Port open failed"));
} }
ppl_logevent(("Forwarded port opened successfully")); ppl_logevent("Forwarded port opened successfully");
CHANOPEN_RETURN_SUCCESS(ch); CHANOPEN_RETURN_SUCCESS(ch);
} }
@ -150,8 +150,8 @@ PktOut *ssh2_portfwd_chanopen(
* connect _to_. * connect _to_.
*/ */
ppl_logevent(("Opening connection to %s:%d for %s", ppl_logevent("Opening connection to %s:%d for %s",
hostname, port, description)); hostname, port, description);
pktout = ssh2_chanopen_init(c, "direct-tcpip"); pktout = ssh2_chanopen_init(c, "direct-tcpip");
{ {
@ -196,11 +196,11 @@ static void ssh2_rportfwd_globreq_response(struct ssh2_connection_state *s,
struct ssh_rportfwd *rpf = (struct ssh_rportfwd *)ctx; struct ssh_rportfwd *rpf = (struct ssh_rportfwd *)ctx;
if (pktin->type == SSH2_MSG_REQUEST_SUCCESS) { if (pktin->type == SSH2_MSG_REQUEST_SUCCESS) {
ppl_logevent(("Remote port forwarding from %s enabled", ppl_logevent("Remote port forwarding from %s enabled",
rpf->log_description)); rpf->log_description);
} else { } else {
ppl_logevent(("Remote port forwarding from %s refused", ppl_logevent("Remote port forwarding from %s refused",
rpf->log_description)); rpf->log_description);
struct ssh_rportfwd *realpf = del234(s->rportfwds, rpf); struct ssh_rportfwd *realpf = del234(s->rportfwds, rpf);
assert(realpf == rpf); assert(realpf == rpf);
@ -293,7 +293,7 @@ SshChannel *ssh2_session_open(ConnectionLayer *cl, Channel *chan)
c->halfopen = true; c->halfopen = true;
c->chan = chan; c->chan = chan;
ppl_logevent(("Opening main session channel")); ppl_logevent("Opening main session channel");
pktout = ssh2_chanopen_init(c, "session"); pktout = ssh2_chanopen_init(c, "session");
pq_push(s->ppl.out_pq, pktout); pq_push(s->ppl.out_pq, pktout);

View File

@ -26,7 +26,7 @@ static ChanopenResult chan_open_session(
{ {
PacketProtocolLayer *ppl = &s->ppl; /* for ppl_logevent */ PacketProtocolLayer *ppl = &s->ppl; /* for ppl_logevent */
ppl_logevent(("Opened session channel")); ppl_logevent("Opened session channel");
CHANOPEN_RETURN_SUCCESS(sesschan_new(sc, s->ppl.logctx, CHANOPEN_RETURN_SUCCESS(sesschan_new(sc, s->ppl.logctx,
s->sftpserver_vt)); s->sftpserver_vt));
} }
@ -41,21 +41,21 @@ static ChanopenResult chan_open_direct_tcpip(
dstaddr_str = mkstr(dstaddr); dstaddr_str = mkstr(dstaddr);
ppl_logevent(("Received request to connect to port %s:%d (from %.*s:%d)", ppl_logevent("Received request to connect to port %s:%d (from %.*s:%d)",
dstaddr_str, dstport, PTRLEN_PRINTF(peeraddr), peerport)); dstaddr_str, dstport, PTRLEN_PRINTF(peeraddr), peerport);
err = portfwdmgr_connect( err = portfwdmgr_connect(
s->portfwdmgr, &ch, dstaddr_str, dstport, sc, ADDRTYPE_UNSPEC); s->portfwdmgr, &ch, dstaddr_str, dstport, sc, ADDRTYPE_UNSPEC);
sfree(dstaddr_str); sfree(dstaddr_str);
if (err != NULL) { if (err != NULL) {
ppl_logevent(("Port open failed: %s", err)); ppl_logevent("Port open failed: %s", err);
sfree(err); sfree(err);
CHANOPEN_RETURN_FAILURE( CHANOPEN_RETURN_FAILURE(
SSH2_OPEN_CONNECT_FAILED, ("Connection failed")); SSH2_OPEN_CONNECT_FAILED, ("Connection failed"));
} }
ppl_logevent(("Port opened successfully")); ppl_logevent("Port opened successfully");
CHANOPEN_RETURN_SUCCESS(ch); CHANOPEN_RETURN_SUCCESS(ch);
} }
@ -121,11 +121,11 @@ PktOut *ssh2_portfwd_chanopen(
*/ */
if (pi && pi->log_text) if (pi && pi->log_text)
ppl_logevent(("Forwarding connection to listening port %s:%d from %s", ppl_logevent("Forwarding connection to listening port %s:%d from %s",
hostname, port, pi->log_text)); hostname, port, pi->log_text);
else else
ppl_logevent(("Forwarding connection to listening port %s:%d", ppl_logevent("Forwarding connection to listening port %s:%d",
hostname, port)); hostname, port);
pktout = ssh2_chanopen_init(c, "forwarded-tcpip"); pktout = ssh2_chanopen_init(c, "forwarded-tcpip");
put_stringz(pktout, hostname); put_stringz(pktout, hostname);
@ -169,7 +169,7 @@ SshChannel *ssh2_serverside_x11_open(
c->halfopen = true; c->halfopen = true;
c->chan = chan; c->chan = chan;
ppl_logevent(("Forwarding X11 channel to client")); ppl_logevent("Forwarding X11 channel to client");
pktout = ssh2_chanopen_init(c, "x11"); pktout = ssh2_chanopen_init(c, "x11");
put_stringz(pktout, (pi && pi->addr_text ? pi->addr_text : "0.0.0.0")); put_stringz(pktout, (pi && pi->addr_text ? pi->addr_text : "0.0.0.0"));
@ -192,7 +192,7 @@ SshChannel *ssh2_serverside_agent_open(ConnectionLayer *cl, Channel *chan)
c->halfopen = true; c->halfopen = true;
c->chan = chan; c->chan = chan;
ppl_logevent(("Forwarding SSH agent to client")); ppl_logevent("Forwarding SSH agent to client");
pktout = ssh2_chanopen_init(c, "auth-agent@openssh.com"); pktout = ssh2_chanopen_init(c, "auth-agent@openssh.com");
pq_push(s->ppl.out_pq, pktout); pq_push(s->ppl.out_pq, pktout);

View File

@ -407,8 +407,8 @@ static bool ssh2_connection_filter_queue(struct ssh2_connection_state *s)
put_stringz(pktout, chanopen_result.u.failure.wire_message); put_stringz(pktout, chanopen_result.u.failure.wire_message);
put_stringz(pktout, "en"); /* language tag */ put_stringz(pktout, "en"); /* language tag */
pq_push(s->ppl.out_pq, pktout); pq_push(s->ppl.out_pq, pktout);
ppl_logevent(("Rejected channel open: %s", ppl_logevent("Rejected channel open: %s",
chanopen_result.u.failure.wire_message)); chanopen_result.u.failure.wire_message);
sfree(chanopen_result.u.failure.wire_message); sfree(chanopen_result.u.failure.wire_message);
sfree(c); sfree(c);
} else { } else {
@ -685,8 +685,7 @@ static bool ssh2_connection_filter_queue(struct ssh2_connection_state *s)
bs_modes, encoded_modes.ptr, encoded_modes.len); bs_modes, encoded_modes.ptr, encoded_modes.len);
modes = read_ttymodes_from_packet(bs_modes, 2); modes = read_ttymodes_from_packet(bs_modes, 2);
if (get_err(bs_modes) || get_avail(bs_modes) > 0) { if (get_err(bs_modes) || get_avail(bs_modes) > 0) {
ppl_logevent(("Unable to decode terminal mode " ppl_logevent("Unable to decode terminal mode string");
"string"));
reply_success = false; reply_success = false;
} else { } else {
reply_success = chan_allocate_pty( reply_success = chan_allocate_pty(
@ -1151,7 +1150,7 @@ static void ssh2_channel_close_local(struct ssh2_channel *c,
msg = chan_log_close_msg(c->chan); msg = chan_log_close_msg(c->chan);
if (msg) if (msg)
ppl_logevent(("%s%s%s", msg, reason ? " " : "", reason ? reason : "")); ppl_logevent("%s%s%s", msg, reason ? " " : "", reason ? reason : "");
sfree(msg); sfree(msg);

View File

@ -43,7 +43,7 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
* requesting a group. * requesting a group.
*/ */
if (dh_is_gex(s->kex_alg)) { if (dh_is_gex(s->kex_alg)) {
ppl_logevent(("Doing Diffie-Hellman group exchange")); ppl_logevent("Doing Diffie-Hellman group exchange");
s->ppl.bpp->pls->kctx = SSH2_PKTCTX_DHGEX; s->ppl.bpp->pls->kctx = SSH2_PKTCTX_DHGEX;
/* /*
* Work out how big a DH group we will need to allow that * Work out how big a DH group we will need to allow that
@ -88,21 +88,21 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
s->kex_init_value = SSH2_MSG_KEX_DH_GEX_INIT; s->kex_init_value = SSH2_MSG_KEX_DH_GEX_INIT;
s->kex_reply_value = SSH2_MSG_KEX_DH_GEX_REPLY; s->kex_reply_value = SSH2_MSG_KEX_DH_GEX_REPLY;
ppl_logevent(("Doing Diffie-Hellman key exchange using %d-bit " ppl_logevent("Doing Diffie-Hellman key exchange using %d-bit "
"modulus and hash %s with a server-supplied group", "modulus and hash %s with a server-supplied group",
dh_modulus_bit_size(s->dh_ctx), dh_modulus_bit_size(s->dh_ctx),
s->kex_alg->hash->text_name)); s->kex_alg->hash->text_name);
} else { } else {
s->ppl.bpp->pls->kctx = SSH2_PKTCTX_DHGROUP; s->ppl.bpp->pls->kctx = SSH2_PKTCTX_DHGROUP;
s->dh_ctx = dh_setup_group(s->kex_alg); s->dh_ctx = dh_setup_group(s->kex_alg);
s->kex_init_value = SSH2_MSG_KEXDH_INIT; s->kex_init_value = SSH2_MSG_KEXDH_INIT;
s->kex_reply_value = SSH2_MSG_KEXDH_REPLY; s->kex_reply_value = SSH2_MSG_KEXDH_REPLY;
ppl_logevent(("Doing Diffie-Hellman key exchange using %d-bit " ppl_logevent("Doing Diffie-Hellman key exchange using %d-bit "
"modulus and hash %s with standard group \"%s\"", "modulus and hash %s with standard group \"%s\"",
dh_modulus_bit_size(s->dh_ctx), dh_modulus_bit_size(s->dh_ctx),
s->kex_alg->hash->text_name, s->kex_alg->hash->text_name,
s->kex_alg->groupname)); s->kex_alg->groupname);
} }
/* /*
@ -172,9 +172,9 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
} }
} else if (s->kex_alg->main_type == KEXTYPE_ECDH) { } else if (s->kex_alg->main_type == KEXTYPE_ECDH) {
ppl_logevent(("Doing ECDH key exchange with curve %s and hash %s", ppl_logevent("Doing ECDH key exchange with curve %s and hash %s",
ssh_ecdhkex_curve_textname(s->kex_alg), ssh_ecdhkex_curve_textname(s->kex_alg),
s->kex_alg->hash->text_name)); s->kex_alg->hash->text_name);
s->ppl.bpp->pls->kctx = SSH2_PKTCTX_ECDHKEX; s->ppl.bpp->pls->kctx = SSH2_PKTCTX_ECDHKEX;
s->ecdh_key = ssh_ecdhkex_newkey(s->kex_alg); s->ecdh_key = ssh_ecdhkex_newkey(s->kex_alg);
@ -268,8 +268,8 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
* much data. * much data.
*/ */
s->pbits = 512 << ((s->nbits - 1) / 64); s->pbits = 512 << ((s->nbits - 1) / 64);
ppl_logevent(("Doing GSSAPI (with Kerberos V5) Diffie-Hellman " ppl_logevent("Doing GSSAPI (with Kerberos V5) Diffie-Hellman "
"group exchange, with minimum %d bits", s->pbits)); "group exchange, with minimum %d bits", s->pbits);
pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH2_MSG_KEXGSS_GROUPREQ); pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH2_MSG_KEXGSS_GROUPREQ);
put_uint32(pktout, s->pbits); /* min */ put_uint32(pktout, s->pbits); /* min */
put_uint32(pktout, s->pbits); /* preferred */ put_uint32(pktout, s->pbits); /* preferred */
@ -297,18 +297,18 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
s->dh_ctx = dh_setup_gex(s->p, s->g); s->dh_ctx = dh_setup_gex(s->p, s->g);
} else { } else {
s->dh_ctx = dh_setup_group(s->kex_alg); s->dh_ctx = dh_setup_group(s->kex_alg);
ppl_logevent(("Using GSSAPI (with Kerberos V5) Diffie-Hellman with" ppl_logevent("Using GSSAPI (with Kerberos V5) Diffie-Hellman with"
" standard group \"%s\"", s->kex_alg->groupname)); " standard group \"%s\"", s->kex_alg->groupname);
} }
ppl_logevent(("Doing GSSAPI (with Kerberos V5) Diffie-Hellman key " ppl_logevent("Doing GSSAPI (with Kerberos V5) Diffie-Hellman key "
"exchange with hash %s", s->kex_alg->hash->text_name)); "exchange with hash %s", s->kex_alg->hash->text_name);
/* Now generate e for Diffie-Hellman. */ /* Now generate e for Diffie-Hellman. */
seat_set_busy_status(s->ppl.seat, BUSY_CPU); seat_set_busy_status(s->ppl.seat, BUSY_CPU);
s->e = dh_create_e(s->dh_ctx, s->nbits * 2); s->e = dh_create_e(s->dh_ctx, s->nbits * 2);
if (s->shgss->lib->gsslogmsg) if (s->shgss->lib->gsslogmsg)
ppl_logevent(("%s", s->shgss->lib->gsslogmsg)); ppl_logevent("%s", s->shgss->lib->gsslogmsg);
/* initial tokens are empty */ /* initial tokens are empty */
SSH_GSS_CLEAR_BUF(&s->gss_rcvtok); SSH_GSS_CLEAR_BUF(&s->gss_rcvtok);
@ -369,7 +369,7 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
put_mp_ssh2(pktout, s->e); put_mp_ssh2(pktout, s->e);
pq_push(s->ppl.out_pq, pktout); pq_push(s->ppl.out_pq, pktout);
s->shgss->lib->free_tok(s->shgss->lib, &s->gss_sndtok); s->shgss->lib->free_tok(s->shgss->lib, &s->gss_sndtok);
ppl_logevent(("GSSAPI key exchange initialised")); ppl_logevent("GSSAPI key exchange initialised");
} else if (s->gss_sndtok.length != 0) { } else if (s->gss_sndtok.length != 0) {
pktout = ssh_bpp_new_pktout( pktout = ssh_bpp_new_pktout(
s->ppl.bpp, SSH2_MSG_KEXGSS_CONTINUE); s->ppl.bpp, SSH2_MSG_KEXGSS_CONTINUE);
@ -435,8 +435,8 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
get_uint32(pktin); /* server's major status */ get_uint32(pktin); /* server's major status */
get_uint32(pktin); /* server's minor status */ get_uint32(pktin); /* server's minor status */
data = get_string(pktin); data = get_string(pktin);
ppl_logevent(("GSSAPI key exchange failed; " ppl_logevent("GSSAPI key exchange failed; "
"server's message: %.*s", PTRLEN_PRINTF(data))); "server's message: %.*s", PTRLEN_PRINTF(data));
/* Language tag, but we have no use for it */ /* Language tag, but we have no use for it */
get_string(pktin); get_string(pktin);
/* /*
@ -496,8 +496,8 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
ptrlen rsakeydata; ptrlen rsakeydata;
assert(s->kex_alg->main_type == KEXTYPE_RSA); assert(s->kex_alg->main_type == KEXTYPE_RSA);
ppl_logevent(("Doing RSA key exchange with hash %s", ppl_logevent("Doing RSA key exchange with hash %s",
s->kex_alg->hash->text_name)); s->kex_alg->hash->text_name);
s->ppl.bpp->pls->kctx = SSH2_PKTCTX_RSAKEX; s->ppl.bpp->pls->kctx = SSH2_PKTCTX_RSAKEX;
/* /*
* RSA key exchange. First expect a KEXRSA_PUBKEY packet * RSA key exchange. First expect a KEXRSA_PUBKEY packet
@ -643,7 +643,7 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
if (s->got_session_id) { if (s->got_session_id) {
s->shgss->lib->release_cred(s->shgss->lib, &s->shgss->ctx); s->shgss->lib->release_cred(s->shgss->lib, &s->shgss->ctx);
} }
ppl_logevent(("GSSAPI Key Exchange complete!")); ppl_logevent("GSSAPI Key Exchange complete!");
} }
#endif #endif
@ -682,8 +682,8 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
*/ */
if (s->hkey) { if (s->hkey) {
s->fingerprint = ssh2_fingerprint(s->hkey); s->fingerprint = ssh2_fingerprint(s->hkey);
ppl_logevent(("GSS kex provided fallback host key:")); ppl_logevent("GSS kex provided fallback host key:");
ppl_logevent(("%s", s->fingerprint)); ppl_logevent("%s", s->fingerprint);
sfree(s->fingerprint); sfree(s->fingerprint);
s->fingerprint = NULL; s->fingerprint = NULL;
ssh_transient_hostkey_cache_add(s->thc, s->hkey); ssh_transient_hostkey_cache_add(s->thc, s->hkey);
@ -724,7 +724,7 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
* consequence. * consequence.
*/ */
if (!s->warned_about_no_gss_transient_hostkey) { if (!s->warned_about_no_gss_transient_hostkey) {
ppl_logevent(("No fallback host key available")); ppl_logevent("No fallback host key available");
s->warned_about_no_gss_transient_hostkey = true; s->warned_about_no_gss_transient_hostkey = true;
} }
} }
@ -742,14 +742,14 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
s->fingerprint = ssh2_fingerprint(s->hkey); s->fingerprint = ssh2_fingerprint(s->hkey);
if (s->need_gss_transient_hostkey) { if (s->need_gss_transient_hostkey) {
ppl_logevent(("Post-GSS rekey provided fallback host key:")); ppl_logevent("Post-GSS rekey provided fallback host key:");
ppl_logevent(("%s", s->fingerprint)); ppl_logevent("%s", s->fingerprint);
ssh_transient_hostkey_cache_add(s->thc, s->hkey); ssh_transient_hostkey_cache_add(s->thc, s->hkey);
s->need_gss_transient_hostkey = false; s->need_gss_transient_hostkey = false;
} else if (!ssh_transient_hostkey_cache_verify(s->thc, s->hkey)) { } else if (!ssh_transient_hostkey_cache_verify(s->thc, s->hkey)) {
ppl_logevent(("Non-GSS rekey after initial GSS kex " ppl_logevent("Non-GSS rekey after initial GSS kex "
"used host key:")); "used host key:");
ppl_logevent(("%s", s->fingerprint)); ppl_logevent("%s", s->fingerprint);
ssh_sw_abort(s->ppl.ssh, "Server's host key did not match any " ssh_sw_abort(s->ppl.ssh, "Server's host key did not match any "
"used in previous GSS kex"); "used in previous GSS kex");
return; return;
@ -790,10 +790,10 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
} }
} }
if (list) { if (list) {
ppl_logevent(("Server also has %s host key%s, but we " ppl_logevent("Server also has %s host key%s, but we "
"don't know %s", list, "don't know %s", list,
nkeys > 1 ? "s" : "", nkeys > 1 ? "s" : "",
nkeys > 1 ? "any of them" : "it")); nkeys > 1 ? "any of them" : "it");
sfree(list); sfree(list);
} }
} }
@ -803,8 +803,8 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
* checked the signature of the exchange hash.) * checked the signature of the exchange hash.)
*/ */
s->fingerprint = ssh2_fingerprint(s->hkey); s->fingerprint = ssh2_fingerprint(s->hkey);
ppl_logevent(("Host key fingerprint is:")); ppl_logevent("Host key fingerprint is:");
ppl_logevent(("%s", s->fingerprint)); ppl_logevent("%s", s->fingerprint);
/* First check against manually configured host keys. */ /* First check against manually configured host keys. */
s->dlgret = verify_ssh_manual_host_key( s->dlgret = verify_ssh_manual_host_key(
s->conf, s->fingerprint, s->hkey); s->conf, s->fingerprint, s->hkey);
@ -840,8 +840,8 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
assert(ssh_key_alg(s->hkey) == s->cross_certifying); assert(ssh_key_alg(s->hkey) == s->cross_certifying);
s->fingerprint = ssh2_fingerprint(s->hkey); s->fingerprint = ssh2_fingerprint(s->hkey);
ppl_logevent(("Storing additional host key for this host:")); ppl_logevent("Storing additional host key for this host:");
ppl_logevent(("%s", s->fingerprint)); ppl_logevent("%s", s->fingerprint);
sfree(s->fingerprint); sfree(s->fingerprint);
s->fingerprint = NULL; s->fingerprint = NULL;
store_host_key(s->savedhost, s->savedport, store_host_key(s->savedhost, s->savedport,

View File

@ -66,7 +66,7 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
* waiting for the group request. * waiting for the group request.
*/ */
if (dh_is_gex(s->kex_alg)) { if (dh_is_gex(s->kex_alg)) {
ppl_logevent(("Doing Diffie-Hellman group exchange")); ppl_logevent("Doing Diffie-Hellman group exchange");
s->ppl.bpp->pls->kctx = SSH2_PKTCTX_DHGEX; s->ppl.bpp->pls->kctx = SSH2_PKTCTX_DHGEX;
crMaybeWaitUntilV((pktin = ssh2_transport_pop(s)) != NULL); crMaybeWaitUntilV((pktin = ssh2_transport_pop(s)) != NULL);
@ -111,12 +111,12 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
s->dh_ctx = dh_setup_group(s->kex_alg); s->dh_ctx = dh_setup_group(s->kex_alg);
s->kex_init_value = SSH2_MSG_KEXDH_INIT; s->kex_init_value = SSH2_MSG_KEXDH_INIT;
s->kex_reply_value = SSH2_MSG_KEXDH_REPLY; s->kex_reply_value = SSH2_MSG_KEXDH_REPLY;
ppl_logevent(("Using Diffie-Hellman with standard group \"%s\"", ppl_logevent("Using Diffie-Hellman with standard group \"%s\"",
s->kex_alg->groupname)); s->kex_alg->groupname);
} }
ppl_logevent(("Doing Diffie-Hellman key exchange with hash %s", ppl_logevent("Doing Diffie-Hellman key exchange with hash %s",
s->kex_alg->hash->text_name)); s->kex_alg->hash->text_name);
/* /*
* Generate e for Diffie-Hellman. * Generate e for Diffie-Hellman.
@ -179,9 +179,9 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
freebn(s->p); s->p = NULL; freebn(s->p); s->p = NULL;
} }
} else if (s->kex_alg->main_type == KEXTYPE_ECDH) { } else if (s->kex_alg->main_type == KEXTYPE_ECDH) {
ppl_logevent(("Doing ECDH key exchange with curve %s and hash %s", ppl_logevent("Doing ECDH key exchange with curve %s and hash %s",
ssh_ecdhkex_curve_textname(s->kex_alg), ssh_ecdhkex_curve_textname(s->kex_alg),
s->kex_alg->hash->text_name)); s->kex_alg->hash->text_name);
s->ppl.bpp->pls->kctx = SSH2_PKTCTX_ECDHKEX; s->ppl.bpp->pls->kctx = SSH2_PKTCTX_ECDHKEX;
s->ecdh_key = ssh_ecdhkex_newkey(s->kex_alg); s->ecdh_key = ssh_ecdhkex_newkey(s->kex_alg);
@ -230,8 +230,8 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
ssh_sw_abort(s->ppl.ssh, "GSS key exchange not supported in server"); ssh_sw_abort(s->ppl.ssh, "GSS key exchange not supported in server");
} else { } else {
assert(s->kex_alg->main_type == KEXTYPE_RSA); assert(s->kex_alg->main_type == KEXTYPE_RSA);
ppl_logevent(("Doing RSA key exchange with hash %s", ppl_logevent("Doing RSA key exchange with hash %s",
s->kex_alg->hash->text_name)); s->kex_alg->hash->text_name);
s->ppl.bpp->pls->kctx = SSH2_PKTCTX_RSAKEX; s->ppl.bpp->pls->kctx = SSH2_PKTCTX_RSAKEX;
{ {

View File

@ -344,7 +344,7 @@ bool ssh2_common_filter_queue(PacketProtocolLayer *ppl)
/* XXX maybe we should actually take notice of the return value */ /* XXX maybe we should actually take notice of the return value */
get_bool(pktin); get_bool(pktin);
msg = get_string(pktin); msg = get_string(pktin);
ppl_logevent(("Remote debug message: %.*s", PTRLEN_PRINTF(msg))); ppl_logevent("Remote debug message: %.*s", PTRLEN_PRINTF(msg));
pq_pop(ppl->in_pq); pq_pop(ppl->in_pq);
break; break;
@ -961,7 +961,7 @@ void ssh2transport_finalise_exhash(struct ssh2_transport_state *s)
s->exhash = NULL; s->exhash = NULL;
#if 0 #if 0
debug(("Exchange hash is:\n")); debug("Exchange hash is:\n");
dmemdump(s->exchange_hash, s->kex_alg->hash->hlen); dmemdump(s->exchange_hash, s->kex_alg->hash->hlen);
#endif #endif
} }
@ -1375,7 +1375,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
* deferred rekey reason. * deferred rekey reason.
*/ */
if (s->deferred_rekey_reason) { if (s->deferred_rekey_reason) {
ppl_logevent(("%s", s->deferred_rekey_reason)); ppl_logevent("%s", s->deferred_rekey_reason);
pktin = NULL; pktin = NULL;
s->deferred_rekey_reason = NULL; s->deferred_rekey_reason = NULL;
goto begin_key_exchange; goto begin_key_exchange;
@ -1462,7 +1462,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
return; return;
} }
pq_push_front(s->ppl.in_pq, pktin); pq_push_front(s->ppl.in_pq, pktin);
ppl_logevent(("Remote side initiated key re-exchange")); ppl_logevent("Remote side initiated key re-exchange");
s->rekey_class = RK_SERVER; s->rekey_class = RK_SERVER;
} }
@ -1507,8 +1507,8 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
* rekey, we process it anyway!) * rekey, we process it anyway!)
*/ */
if ((s->ppl.remote_bugs & BUG_SSH2_REKEY)) { if ((s->ppl.remote_bugs & BUG_SSH2_REKEY)) {
ppl_logevent(("Remote bug prevents key re-exchange (%s)", ppl_logevent("Remote bug prevents key re-exchange (%s)",
s->rekey_reason)); s->rekey_reason);
/* Reset the counters, so that at least this message doesn't /* Reset the counters, so that at least this message doesn't
* hit the event log _too_ often. */ * hit the event log _too_ often. */
s->stats->in.running = s->stats->out.running = true; s->stats->in.running = s->stats->out.running = true;
@ -1517,8 +1517,8 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
(void) ssh2_transport_timer_update(s, 0); (void) ssh2_transport_timer_update(s, 0);
s->rekey_class = RK_NONE; s->rekey_class = RK_NONE;
} else { } else {
ppl_logevent(("Initiating key re-exchange (%s)", ppl_logevent("Initiating key re-exchange (%s)",
s->rekey_reason)); s->rekey_reason);
} }
} }
} while (s->rekey_class == RK_NONE); } while (s->rekey_class == RK_NONE);
@ -1694,11 +1694,11 @@ static void ssh2_transport_gss_update(struct ssh2_transport_state *s,
s->shgss->lib, s->fullhostname, &s->shgss->srv_name); s->shgss->lib, s->fullhostname, &s->shgss->srv_name);
if (gss_stat != SSH_GSS_OK) { if (gss_stat != SSH_GSS_OK) {
if (gss_stat == SSH_GSS_BAD_HOST_NAME) if (gss_stat == SSH_GSS_BAD_HOST_NAME)
ppl_logevent(("GSSAPI import name failed - Bad service name;" ppl_logevent("GSSAPI import name failed - Bad service name;"
" won't use GSS key exchange")); " won't use GSS key exchange");
else else
ppl_logevent(("GSSAPI import name failed;" ppl_logevent("GSSAPI import name failed;"
" won't use GSS key exchange")); " won't use GSS key exchange");
return; return;
} }
} }
@ -1740,7 +1740,7 @@ static void ssh2_transport_gss_update(struct ssh2_transport_state *s,
* it shouldn't pop up all the time regardless. * it shouldn't pop up all the time regardless.
*/ */
if (definitely_rekeying) if (definitely_rekeying)
ppl_logevent(("No GSSAPI security context available")); ppl_logevent("No GSSAPI security context available");
return; return;
} }

View File

@ -225,8 +225,8 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
*/ */
if (!filename_is_null(s->keyfile)) { if (!filename_is_null(s->keyfile)) {
int keytype; int keytype;
ppl_logevent(("Reading key file \"%.150s\"", ppl_logevent("Reading key file \"%.150s\"",
filename_to_str(s->keyfile))); filename_to_str(s->keyfile));
keytype = key_type(s->keyfile); keytype = key_type(s->keyfile);
if (keytype == SSH_KEYTYPE_SSH2 || if (keytype == SSH_KEYTYPE_SSH2 ||
keytype == SSH_KEYTYPE_SSH2_PUBLIC_RFC4716 || keytype == SSH_KEYTYPE_SSH2_PUBLIC_RFC4716 ||
@ -239,22 +239,22 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
&s->publickey_comment, &error)) { &s->publickey_comment, &error)) {
s->privatekey_available = (keytype == SSH_KEYTYPE_SSH2); s->privatekey_available = (keytype == SSH_KEYTYPE_SSH2);
if (!s->privatekey_available) if (!s->privatekey_available)
ppl_logevent(("Key file contains public key only")); ppl_logevent("Key file contains public key only");
s->privatekey_encrypted = s->privatekey_encrypted =
ssh2_userkey_encrypted(s->keyfile, NULL); ssh2_userkey_encrypted(s->keyfile, NULL);
} else { } else {
ppl_logevent(("Unable to load key (%s)", error)); ppl_logevent("Unable to load key (%s)", error);
ppl_printf(("Unable to load key file \"%s\" (%s)\r\n", ppl_printf("Unable to load key file \"%s\" (%s)\r\n",
filename_to_str(s->keyfile), error)); filename_to_str(s->keyfile), error);
strbuf_free(s->publickey_blob); strbuf_free(s->publickey_blob);
s->publickey_blob = NULL; s->publickey_blob = NULL;
} }
} else { } else {
ppl_logevent(("Unable to use this key file (%s)", ppl_logevent("Unable to use this key file (%s)",
key_type_to_str(keytype))); key_type_to_str(keytype));
ppl_printf(("Unable to use key file \"%s\" (%s)\r\n", ppl_printf("Unable to use key file \"%s\" (%s)\r\n",
filename_to_str(s->keyfile), filename_to_str(s->keyfile),
key_type_to_str(keytype))); key_type_to_str(keytype));
s->publickey_blob = NULL; s->publickey_blob = NULL;
} }
} }
@ -266,7 +266,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->nkeys = 0; s->nkeys = 0;
s->pkblob_pos_in_agent = 0; s->pkblob_pos_in_agent = 0;
if (s->tryagent && agent_exists()) { if (s->tryagent && agent_exists()) {
ppl_logevent(("Pageant is running. Requesting keys.")); ppl_logevent("Pageant is running. Requesting keys.");
/* Request the keys held by the agent. */ /* Request the keys held by the agent. */
{ {
@ -290,12 +290,12 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
* and blob lengths make sense. * and blob lengths make sense.
*/ */
if (s->nkeys < 0) { if (s->nkeys < 0) {
ppl_logevent(("Pageant response contained a negative" ppl_logevent("Pageant response contained a negative"
" key count %d", s->nkeys)); " key count %d", s->nkeys);
s->nkeys = 0; s->nkeys = 0;
goto done_agent_query; goto done_agent_query;
} else { } else {
ppl_logevent(("Pageant has %d SSH-2 keys", s->nkeys)); ppl_logevent("Pageant has %d SSH-2 keys", s->nkeys);
/* See if configured key is in agent. */ /* See if configured key is in agent. */
for (keyi = 0; keyi < s->nkeys; keyi++) { for (keyi = 0; keyi < s->nkeys; keyi++) {
@ -303,7 +303,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
ptrlen blob = get_string(s->asrc); ptrlen blob = get_string(s->asrc);
get_string(s->asrc); /* skip comment */ get_string(s->asrc); /* skip comment */
if (get_err(s->asrc)) { if (get_err(s->asrc)) {
ppl_logevent(("Pageant response was truncated")); ppl_logevent("Pageant response was truncated");
s->nkeys = 0; s->nkeys = 0;
goto done_agent_query; goto done_agent_query;
} }
@ -312,20 +312,20 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
blob.len == s->publickey_blob->len && blob.len == s->publickey_blob->len &&
!memcmp(blob.ptr, s->publickey_blob->s, !memcmp(blob.ptr, s->publickey_blob->s,
s->publickey_blob->len)) { s->publickey_blob->len)) {
ppl_logevent(("Pageant key #%d matches " ppl_logevent("Pageant key #%d matches "
"configured key file", keyi)); "configured key file", keyi);
s->keyi = keyi; s->keyi = keyi;
s->pkblob_pos_in_agent = pos; s->pkblob_pos_in_agent = pos;
break; break;
} }
} }
if (s->publickey_blob && !s->pkblob_pos_in_agent) { if (s->publickey_blob && !s->pkblob_pos_in_agent) {
ppl_logevent(("Configured key file not in Pageant")); ppl_logevent("Configured key file not in Pageant");
s->nkeys = 0; s->nkeys = 0;
} }
} }
} else { } else {
ppl_logevent(("Failed to get reply from Pageant")); ppl_logevent("Failed to get reply from Pageant");
} }
done_agent_query:; done_agent_query:;
} }
@ -398,7 +398,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
free_prompts(s->cur_prompt); free_prompts(s->cur_prompt);
} else { } else {
if ((flags & FLAG_VERBOSE) || (flags & FLAG_INTERACTIVE)) if ((flags & FLAG_VERBOSE) || (flags & FLAG_INTERACTIVE))
ppl_printf(("Using username \"%s\".\r\n", s->username)); ppl_printf("Using username \"%s\".\r\n", s->username);
} }
s->got_username = true; s->got_username = true;
@ -475,7 +475,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
bufchain_clear(&s->banner); bufchain_clear(&s->banner);
} }
if (pktin && pktin->type == SSH2_MSG_USERAUTH_SUCCESS) { if (pktin && pktin->type == SSH2_MSG_USERAUTH_SUCCESS) {
ppl_logevent(("Access granted")); ppl_logevent("Access granted");
goto userauth_success; goto userauth_success;
} }
@ -528,32 +528,32 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
} else if (s->type == AUTH_TYPE_PUBLICKEY_OFFER_LOUD || } else if (s->type == AUTH_TYPE_PUBLICKEY_OFFER_LOUD ||
s->type == AUTH_TYPE_PUBLICKEY_OFFER_QUIET) { s->type == AUTH_TYPE_PUBLICKEY_OFFER_QUIET) {
if (s->type == AUTH_TYPE_PUBLICKEY_OFFER_LOUD) if (s->type == AUTH_TYPE_PUBLICKEY_OFFER_LOUD)
ppl_printf(("Server refused our key\r\n")); ppl_printf("Server refused our key\r\n");
ppl_logevent(("Server refused our key")); ppl_logevent("Server refused our key");
} else if (s->type == AUTH_TYPE_PUBLICKEY) { } else if (s->type == AUTH_TYPE_PUBLICKEY) {
/* This _shouldn't_ happen except by a /* This _shouldn't_ happen except by a
* protocol bug causing client and server to * protocol bug causing client and server to
* disagree on what is a correct signature. */ * disagree on what is a correct signature. */
ppl_printf(("Server refused public-key signature" ppl_printf("Server refused public-key signature"
" despite accepting key!\r\n")); " despite accepting key!\r\n");
ppl_logevent(("Server refused public-key signature" ppl_logevent("Server refused public-key signature"
" despite accepting key!")); " despite accepting key!");
} else if (s->type==AUTH_TYPE_KEYBOARD_INTERACTIVE_QUIET) { } else if (s->type==AUTH_TYPE_KEYBOARD_INTERACTIVE_QUIET) {
/* quiet, so no ppl_printf */ /* quiet, so no ppl_printf */
ppl_logevent(("Server refused keyboard-interactive " ppl_logevent("Server refused keyboard-interactive "
"authentication")); "authentication");
} else if (s->type==AUTH_TYPE_GSSAPI) { } else if (s->type==AUTH_TYPE_GSSAPI) {
/* always quiet, so no ppl_printf */ /* always quiet, so no ppl_printf */
/* also, the code down in the GSSAPI block has /* also, the code down in the GSSAPI block has
* already logged this in the Event Log */ * already logged this in the Event Log */
} else if (s->type == AUTH_TYPE_KEYBOARD_INTERACTIVE) { } else if (s->type == AUTH_TYPE_KEYBOARD_INTERACTIVE) {
ppl_logevent(("Keyboard-interactive authentication " ppl_logevent("Keyboard-interactive authentication "
"failed")); "failed");
ppl_printf(("Access denied\r\n")); ppl_printf("Access denied\r\n");
} else { } else {
assert(s->type == AUTH_TYPE_PASSWORD); assert(s->type == AUTH_TYPE_PASSWORD);
ppl_logevent(("Password authentication failed")); ppl_logevent("Password authentication failed");
ppl_printf(("Access denied\r\n")); ppl_printf("Access denied\r\n");
if (s->change_username) { if (s->change_username) {
/* XXX perhaps we should allow /* XXX perhaps we should allow
@ -562,8 +562,8 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
} }
} }
} else { } else {
ppl_printf(("Further authentication required\r\n")); ppl_printf("Further authentication required\r\n");
ppl_logevent(("Further authentication required")); ppl_logevent("Further authentication required");
} }
/* /*
@ -620,9 +620,9 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->ppl.bpp->pls->actx = SSH2_PKTCTX_GSSAPI; s->ppl.bpp->pls->actx = SSH2_PKTCTX_GSSAPI;
if (s->shgss->lib->gsslogmsg) if (s->shgss->lib->gsslogmsg)
ppl_logevent(("%s", s->shgss->lib->gsslogmsg)); ppl_logevent("%s", s->shgss->lib->gsslogmsg);
ppl_logevent(("Trying gssapi-keyex...")); ppl_logevent("Trying gssapi-keyex...");
s->pktout = ssh2_userauth_gss_packet(s, "gssapi-keyex"); s->pktout = ssh2_userauth_gss_packet(s, "gssapi-keyex");
pq_push(s->ppl.out_pq, s->pktout); pq_push(s->ppl.out_pq, s->pktout);
s->shgss->lib->release_cred(s->shgss->lib, &s->shgss->ctx); s->shgss->lib->release_cred(s->shgss->lib, &s->shgss->ctx);
@ -640,7 +640,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->ppl.bpp->pls->actx = SSH2_PKTCTX_PUBLICKEY; s->ppl.bpp->pls->actx = SSH2_PKTCTX_PUBLICKEY;
ppl_logevent(("Trying Pageant key #%d", s->keyi)); ppl_logevent("Trying Pageant key #%d", s->keyi);
/* Unpack key from agent response */ /* Unpack key from agent response */
s->pk = get_string(s->asrc); s->pk = get_string(s->asrc);
@ -675,9 +675,9 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
strbuf *agentreq, *sigdata; strbuf *agentreq, *sigdata;
if (flags & FLAG_VERBOSE) if (flags & FLAG_VERBOSE)
ppl_printf(("Authenticating with public key " ppl_printf("Authenticating with public key "
"\"%.*s\" from agent\r\n", "\"%.*s\" from agent\r\n",
PTRLEN_PRINTF(s->comment))); PTRLEN_PRINTF(s->comment));
/* /*
* Server is willing to accept the key. * Server is willing to accept the key.
@ -717,7 +717,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
get_uint32(src); /* skip length field */ get_uint32(src); /* skip length field */
if (get_byte(src) == SSH2_AGENT_SIGN_RESPONSE && if (get_byte(src) == SSH2_AGENT_SIGN_RESPONSE &&
(sigblob = get_string(src), !get_err(src))) { (sigblob = get_string(src), !get_err(src))) {
ppl_logevent(("Sending Pageant's response")); ppl_logevent("Sending Pageant's response");
ssh2_userauth_add_sigblob(s, s->pktout, ssh2_userauth_add_sigblob(s, s->pktout,
s->pk, sigblob); s->pk, sigblob);
pq_push(s->ppl.out_pq, s->pktout); pq_push(s->ppl.out_pq, s->pktout);
@ -768,7 +768,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
put_string(s->pktout, s->publickey_blob->s, put_string(s->pktout, s->publickey_blob->s,
s->publickey_blob->len); s->publickey_blob->len);
pq_push(s->ppl.out_pq, s->pktout); pq_push(s->ppl.out_pq, s->pktout);
ppl_logevent(("Offered public key")); ppl_logevent("Offered public key");
crMaybeWaitUntilV((pktin = ssh2_userauth_pop(s)) != NULL); crMaybeWaitUntilV((pktin = ssh2_userauth_pop(s)) != NULL);
if (pktin->type != SSH2_MSG_USERAUTH_PK_OK) { if (pktin->type != SSH2_MSG_USERAUTH_PK_OK) {
@ -777,15 +777,15 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->type = AUTH_TYPE_PUBLICKEY_OFFER_LOUD; s->type = AUTH_TYPE_PUBLICKEY_OFFER_LOUD;
continue; /* process this new message */ continue; /* process this new message */
} }
ppl_logevent(("Offer of public key accepted")); ppl_logevent("Offer of public key accepted");
/* /*
* Actually attempt a serious authentication using * Actually attempt a serious authentication using
* the key. * the key.
*/ */
if (flags & FLAG_VERBOSE) if (flags & FLAG_VERBOSE)
ppl_printf(("Authenticating with public key \"%s\"\r\n", ppl_printf("Authenticating with public key \"%s\"\r\n",
s->publickey_comment)); s->publickey_comment);
key = NULL; key = NULL;
while (!key) { while (!key) {
@ -846,12 +846,12 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
if (key == SSH2_WRONG_PASSPHRASE || key == NULL) { if (key == SSH2_WRONG_PASSPHRASE || key == NULL) {
if (passphrase && if (passphrase &&
(key == SSH2_WRONG_PASSPHRASE)) { (key == SSH2_WRONG_PASSPHRASE)) {
ppl_printf(("Wrong passphrase\r\n")); ppl_printf("Wrong passphrase\r\n");
key = NULL; key = NULL;
/* and loop again */ /* and loop again */
} else { } else {
ppl_printf(("Unable to load private key (%s)\r\n", ppl_printf("Unable to load private key (%s)\r\n",
error)); error);
key = NULL; key = NULL;
break; /* try something else */ break; /* try something else */
} }
@ -900,7 +900,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
strbuf_free(sigblob); strbuf_free(sigblob);
pq_push(s->ppl.out_pq, s->pktout); pq_push(s->ppl.out_pq, s->pktout);
ppl_logevent(("Sent public key signature")); ppl_logevent("Sent public key signature");
s->type = AUTH_TYPE_PUBLICKEY; s->type = AUTH_TYPE_PUBLICKEY;
ssh_key_free(key->key); ssh_key_free(key->key);
sfree(key->comment); sfree(key->comment);
@ -919,16 +919,16 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->ppl.bpp->pls->actx = SSH2_PKTCTX_GSSAPI; s->ppl.bpp->pls->actx = SSH2_PKTCTX_GSSAPI;
if (s->shgss->lib->gsslogmsg) if (s->shgss->lib->gsslogmsg)
ppl_logevent(("%s", s->shgss->lib->gsslogmsg)); ppl_logevent("%s", s->shgss->lib->gsslogmsg);
/* Sending USERAUTH_REQUEST with "gssapi-with-mic" method */ /* Sending USERAUTH_REQUEST with "gssapi-with-mic" method */
ppl_logevent(("Trying gssapi-with-mic...")); ppl_logevent("Trying gssapi-with-mic...");
s->pktout = ssh_bpp_new_pktout( s->pktout = ssh_bpp_new_pktout(
s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST); s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST);
put_stringz(s->pktout, s->username); put_stringz(s->pktout, s->username);
put_stringz(s->pktout, s->successor_layer->vt->name); put_stringz(s->pktout, s->successor_layer->vt->name);
put_stringz(s->pktout, "gssapi-with-mic"); put_stringz(s->pktout, "gssapi-with-mic");
ppl_logevent(("Attempting GSSAPI authentication")); ppl_logevent("Attempting GSSAPI authentication");
/* add mechanism info */ /* add mechanism info */
s->shgss->lib->indicate_mech(s->shgss->lib, &s->gss_buf); s->shgss->lib->indicate_mech(s->shgss->lib, &s->gss_buf);
@ -947,7 +947,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
pq_push(s->ppl.out_pq, s->pktout); pq_push(s->ppl.out_pq, s->pktout);
crMaybeWaitUntilV((pktin = ssh2_userauth_pop(s)) != NULL); crMaybeWaitUntilV((pktin = ssh2_userauth_pop(s)) != NULL);
if (pktin->type != SSH2_MSG_USERAUTH_GSSAPI_RESPONSE) { if (pktin->type != SSH2_MSG_USERAUTH_GSSAPI_RESPONSE) {
ppl_logevent(("GSSAPI authentication request refused")); ppl_logevent("GSSAPI authentication request refused");
pq_push_front(s->ppl.in_pq, pktin); pq_push_front(s->ppl.in_pq, pktin);
continue; continue;
} }
@ -962,8 +962,8 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
((char *)s->gss_rcvtok.value)[1] != s->gss_buf.length || ((char *)s->gss_rcvtok.value)[1] != s->gss_buf.length ||
memcmp((char *)s->gss_rcvtok.value + 2, memcmp((char *)s->gss_rcvtok.value + 2,
s->gss_buf.value,s->gss_buf.length) ) { s->gss_buf.value,s->gss_buf.length) ) {
ppl_logevent(("GSSAPI authentication - wrong response " ppl_logevent("GSSAPI authentication - wrong response "
"from server")); "from server");
continue; continue;
} }
@ -973,10 +973,10 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->shgss->lib, s->fullhostname, &s->shgss->srv_name); s->shgss->lib, s->fullhostname, &s->shgss->srv_name);
if (s->gss_stat != SSH_GSS_OK) { if (s->gss_stat != SSH_GSS_OK) {
if (s->gss_stat == SSH_GSS_BAD_HOST_NAME) if (s->gss_stat == SSH_GSS_BAD_HOST_NAME)
ppl_logevent(("GSSAPI import name failed -" ppl_logevent("GSSAPI import name failed -"
" Bad service name")); " Bad service name");
else else
ppl_logevent(("GSSAPI import name failed")); ppl_logevent("GSSAPI import name failed");
continue; continue;
} }
} }
@ -985,8 +985,8 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->gss_stat = s->shgss->lib->acquire_cred( s->gss_stat = s->shgss->lib->acquire_cred(
s->shgss->lib, &s->shgss->ctx, NULL); s->shgss->lib, &s->shgss->ctx, NULL);
if (s->gss_stat != SSH_GSS_OK) { if (s->gss_stat != SSH_GSS_OK) {
ppl_logevent(("GSSAPI authentication failed to get " ppl_logevent("GSSAPI authentication failed to get "
"credentials")); "credentials");
/* The failure was on our side, so the server /* The failure was on our side, so the server
* won't be sending a response packet indicating * won't be sending a response packet indicating
* failure. Avoid waiting for it next time round * failure. Avoid waiting for it next time round
@ -1017,19 +1017,19 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
if (s->gss_stat!=SSH_GSS_S_COMPLETE && if (s->gss_stat!=SSH_GSS_S_COMPLETE &&
s->gss_stat!=SSH_GSS_S_CONTINUE_NEEDED) { s->gss_stat!=SSH_GSS_S_CONTINUE_NEEDED) {
ppl_logevent(("GSSAPI authentication initialisation " ppl_logevent("GSSAPI authentication initialisation "
"failed")); "failed");
if (s->shgss->lib->display_status(s->shgss->lib, if (s->shgss->lib->display_status(s->shgss->lib,
s->shgss->ctx, &s->gss_buf) == SSH_GSS_OK) { s->shgss->ctx, &s->gss_buf) == SSH_GSS_OK) {
ppl_logevent(("%s", (char *)s->gss_buf.value)); ppl_logevent("%s", (char *)s->gss_buf.value);
sfree(s->gss_buf.value); sfree(s->gss_buf.value);
} }
pq_push_front(s->ppl.in_pq, pktin); pq_push_front(s->ppl.in_pq, pktin);
break; break;
} }
ppl_logevent(("GSSAPI authentication initialised")); ppl_logevent("GSSAPI authentication initialised");
/* /*
* Client and server now exchange tokens until GSSAPI * Client and server now exchange tokens until GSSAPI
@ -1076,14 +1076,14 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
} }
if (pktin->type == SSH2_MSG_USERAUTH_FAILURE) { if (pktin->type == SSH2_MSG_USERAUTH_FAILURE) {
ppl_logevent(("GSSAPI authentication failed")); ppl_logevent("GSSAPI authentication failed");
s->gss_stat = SSH_GSS_FAILURE; s->gss_stat = SSH_GSS_FAILURE;
pq_push_front(s->ppl.in_pq, pktin); pq_push_front(s->ppl.in_pq, pktin);
break; break;
} else if (pktin->type != } else if (pktin->type !=
SSH2_MSG_USERAUTH_GSSAPI_TOKEN) { SSH2_MSG_USERAUTH_GSSAPI_TOKEN) {
ppl_logevent(("GSSAPI authentication -" ppl_logevent("GSSAPI authentication -"
" bad server response")); " bad server response");
s->gss_stat = SSH_GSS_FAILURE; s->gss_stat = SSH_GSS_FAILURE;
break; break;
} }
@ -1097,7 +1097,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->shgss->lib->release_cred(s->shgss->lib, &s->shgss->ctx); s->shgss->lib->release_cred(s->shgss->lib, &s->shgss->ctx);
continue; continue;
} }
ppl_logevent(("GSSAPI authentication loop finished OK")); ppl_logevent("GSSAPI authentication loop finished OK");
/* Now send the MIC */ /* Now send the MIC */
@ -1127,7 +1127,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
put_stringz(s->pktout, ""); /* submethods */ put_stringz(s->pktout, ""); /* submethods */
pq_push(s->ppl.out_pq, s->pktout); pq_push(s->ppl.out_pq, s->pktout);
ppl_logevent(("Attempting keyboard-interactive authentication")); ppl_logevent("Attempting keyboard-interactive authentication");
crMaybeWaitUntilV((pktin = ssh2_userauth_pop(s)) != NULL); crMaybeWaitUntilV((pktin = ssh2_userauth_pop(s)) != NULL);
if (pktin->type != SSH2_MSG_USERAUTH_INFO_REQUEST) { if (pktin->type != SSH2_MSG_USERAUTH_INFO_REQUEST) {
@ -1342,7 +1342,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
put_stringz(s->pktout, s->password); put_stringz(s->pktout, s->password);
s->pktout->minlen = 256; s->pktout->minlen = 256;
pq_push(s->ppl.out_pq, s->pktout); pq_push(s->ppl.out_pq, s->pktout);
ppl_logevent(("Sent password")); ppl_logevent("Sent password");
s->type = AUTH_TYPE_PASSWORD; s->type = AUTH_TYPE_PASSWORD;
/* /*
@ -1369,8 +1369,8 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
msg = "Server requested password change"; msg = "Server requested password change";
else else
msg = "Server rejected new password"; msg = "Server rejected new password";
ppl_logevent(("%s", msg)); ppl_logevent("%s", msg);
ppl_printf(("%s\r\n", msg)); ppl_printf("%s\r\n", msg);
} }
prompt = get_string(pktin); prompt = get_string(pktin);
@ -1460,7 +1460,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
== 0); == 0);
if (!got_new) if (!got_new)
/* They don't. Silly user. */ /* They don't. Silly user. */
ppl_printf(("Passwords do not match\r\n")); ppl_printf("Passwords do not match\r\n");
} }
@ -1480,7 +1480,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
free_prompts(s->cur_prompt); free_prompts(s->cur_prompt);
s->pktout->minlen = 256; s->pktout->minlen = 256;
pq_push(s->ppl.out_pq, s->pktout); pq_push(s->ppl.out_pq, s->pktout);
ppl_logevent(("Sent new password")); ppl_logevent("Sent new password");
/* /*
* Now see what the server has to say about it. * Now see what the server has to say about it.
@ -1635,8 +1635,8 @@ static void ssh2_userauth_add_sigblob(
mod_mp.ptr = (const char *)mod_mp.ptr + 1; mod_mp.ptr = (const char *)mod_mp.ptr + 1;
} }
/* debug(("modulus length is %d\n", len)); */ /* debug("modulus length is %d\n", len); */
/* debug(("signature length is %d\n", siglen)); */ /* debug("signature length is %d\n", siglen); */
if (mod_mp.len != sig_mp.len) { if (mod_mp.len != sig_mp.len) {
strbuf *substr = strbuf_new(); strbuf *substr = strbuf_new();

View File

@ -1938,20 +1938,19 @@ void diagbn(char *prefix, Bignum md)
int i, nibbles, morenibbles; int i, nibbles, morenibbles;
static const char hex[] = "0123456789ABCDEF"; static const char hex[] = "0123456789ABCDEF";
debug(("%s0x", prefix ? prefix : "")); debug("%s0x", prefix ? prefix : "");
nibbles = (3 + bignum_bitcount(md)) / 4; nibbles = (3 + bignum_bitcount(md)) / 4;
if (nibbles < 1) if (nibbles < 1)
nibbles = 1; nibbles = 1;
morenibbles = 4 * md[0] - nibbles; morenibbles = 4 * md[0] - nibbles;
for (i = 0; i < morenibbles; i++) for (i = 0; i < morenibbles; i++)
debug(("-")); debug("-");
for (i = nibbles; i--;) for (i = nibbles; i--;)
debug(("%c", debug("%c", hex[(bignum_byte(md, i / 2) >> (4 * (i % 2))) & 0xF]);
hex[(bignum_byte(md, i / 2) >> (4 * (i % 2))) & 0xF]));
if (prefix) if (prefix)
debug(("\n")); debug("\n");
} }
#endif #endif

View File

@ -71,11 +71,9 @@ void ssh2_bpp_queue_disconnect(BinaryPacketProtocol *bpp,
bool ssh2_bpp_check_unimplemented(BinaryPacketProtocol *bpp, PktIn *pktin); bool ssh2_bpp_check_unimplemented(BinaryPacketProtocol *bpp, PktIn *pktin);
/* Convenience macro for BPPs to send formatted strings to the Event /* Convenience macro for BPPs to send formatted strings to the Event
* Log. Assumes a function parameter called 'bpp' is in scope, and * Log. Assumes a function parameter called 'bpp' is in scope. */
* takes a double pair of parens because it passes a whole argument #define bpp_logevent(...) ( \
* list to dupprintf. */ logevent_and_free((bpp)->logctx, dupprintf(__VA_ARGS__)))
#define bpp_logevent(params) ( \
logevent_and_free((bpp)->logctx, dupprintf params))
/* /*
* Structure that tracks how much data is sent and received, for * Structure that tracks how much data is sent and received, for

View File

@ -986,7 +986,7 @@ bool ssh1_common_filter_queue(PacketProtocolLayer *ppl)
case SSH1_MSG_DEBUG: case SSH1_MSG_DEBUG:
msg = get_string(pktin); msg = get_string(pktin);
ppl_logevent(("Remote debug message: %.*s", PTRLEN_PRINTF(msg))); ppl_logevent("Remote debug message: %.*s", PTRLEN_PRINTF(msg));
pq_pop(ppl->in_pq); pq_pop(ppl->in_pq);
break; break;

View File

@ -118,16 +118,14 @@ void ssh2_userauth_set_transport_layer(PacketProtocolLayer *userauth,
/* Convenience macro for protocol layers to send formatted strings to /* Convenience macro for protocol layers to send formatted strings to
* the Event Log. Assumes a function parameter called 'ppl' is in * the Event Log. Assumes a function parameter called 'ppl' is in
* scope, and takes a double pair of parens because it passes a whole * scope. */
* argument list to dupprintf. */ #define ppl_logevent(...) ( \
#define ppl_logevent(params) ( \ logevent_and_free((ppl)->logctx, dupprintf(__VA_ARGS__)))
logevent_and_free((ppl)->logctx, dupprintf params))
/* Convenience macro for protocol layers to send formatted strings to /* Convenience macro for protocol layers to send formatted strings to
* the terminal. Also expects 'ppl' to be in scope and takes double * the terminal. Also expects 'ppl' to be in scope. */
* parens. */ #define ppl_printf(...) \
#define ppl_printf(params) \ ssh_ppl_user_output_string_and_free(ppl, dupprintf(__VA_ARGS__))
ssh_ppl_user_output_string_and_free(ppl, dupprintf params)
void ssh_ppl_user_output_string_and_free(PacketProtocolLayer *ppl, char *text); void ssh_ppl_user_output_string_and_free(PacketProtocolLayer *ppl, char *text);
/* Methods for userauth to communicate back to the transport layer */ /* Methods for userauth to communicate back to the transport layer */

View File

@ -201,7 +201,7 @@ static void ssh_verstring_send(struct ssh_verstring_state *s)
bufchain_add(s->bpp.out_raw, "\015", 1); bufchain_add(s->bpp.out_raw, "\015", 1);
bufchain_add(s->bpp.out_raw, "\012", 1); bufchain_add(s->bpp.out_raw, "\012", 1);
bpp_logevent(("We claim version: %s", s->our_vstring)); bpp_logevent("We claim version: %s", s->our_vstring);
} }
#define BPP_WAITFOR(minlen) do \ #define BPP_WAITFOR(minlen) do \
@ -312,7 +312,7 @@ void ssh_verstring_handle_input(BinaryPacketProtocol *bpp)
s->vslen--; s->vslen--;
s->vstring[s->vslen] = '\0'; s->vstring[s->vslen] = '\0';
bpp_logevent(("Remote version: %s", s->vstring)); bpp_logevent("Remote version: %s", s->vstring);
/* /*
* Pick out the protocol version and software version. The former * Pick out the protocol version and software version. The former
@ -378,7 +378,7 @@ void ssh_verstring_handle_input(BinaryPacketProtocol *bpp)
crStopV; crStopV;
} }
bpp_logevent(("Using SSH protocol version %d", s->major_protoversion)); bpp_logevent("Using SSH protocol version %d", s->major_protoversion);
if (!s->send_early) { if (!s->send_early) {
/* /*
@ -450,7 +450,7 @@ static void ssh_detect_bugs(struct ssh_verstring_state *s)
* sniffing. * sniffing.
*/ */
s->remote_bugs |= BUG_CHOKES_ON_SSH1_IGNORE; s->remote_bugs |= BUG_CHOKES_ON_SSH1_IGNORE;
bpp_logevent(("We believe remote version has SSH-1 ignore bug")); bpp_logevent("We believe remote version has SSH-1 ignore bug");
} }
if (conf_get_int(s->conf, CONF_sshbug_plainpw1) == FORCE_ON || if (conf_get_int(s->conf, CONF_sshbug_plainpw1) == FORCE_ON ||
@ -462,8 +462,8 @@ static void ssh_detect_bugs(struct ssh_verstring_state *s)
* the password. * the password.
*/ */
s->remote_bugs |= BUG_NEEDS_SSH1_PLAIN_PASSWORD; s->remote_bugs |= BUG_NEEDS_SSH1_PLAIN_PASSWORD;
bpp_logevent(("We believe remote version needs a " bpp_logevent("We believe remote version needs a "
"plain SSH-1 password")); "plain SSH-1 password");
} }
if (conf_get_int(s->conf, CONF_sshbug_rsa1) == FORCE_ON || if (conf_get_int(s->conf, CONF_sshbug_rsa1) == FORCE_ON ||
@ -475,8 +475,8 @@ static void ssh_detect_bugs(struct ssh_verstring_state *s)
* an AUTH_RSA message. * an AUTH_RSA message.
*/ */
s->remote_bugs |= BUG_CHOKES_ON_RSA; s->remote_bugs |= BUG_CHOKES_ON_RSA;
bpp_logevent(("We believe remote version can't handle SSH-1 " bpp_logevent("We believe remote version can't handle SSH-1 "
"RSA authentication")); "RSA authentication");
} }
if (conf_get_int(s->conf, CONF_sshbug_hmac2) == FORCE_ON || if (conf_get_int(s->conf, CONF_sshbug_hmac2) == FORCE_ON ||
@ -489,7 +489,7 @@ static void ssh_detect_bugs(struct ssh_verstring_state *s)
* These versions have the HMAC bug. * These versions have the HMAC bug.
*/ */
s->remote_bugs |= BUG_SSH2_HMAC; s->remote_bugs |= BUG_SSH2_HMAC;
bpp_logevent(("We believe remote version has SSH-2 HMAC bug")); bpp_logevent("We believe remote version has SSH-2 HMAC bug");
} }
if (conf_get_int(s->conf, CONF_sshbug_derivekey2) == FORCE_ON || if (conf_get_int(s->conf, CONF_sshbug_derivekey2) == FORCE_ON ||
@ -502,8 +502,8 @@ static void ssh_detect_bugs(struct ssh_verstring_state *s)
* generate the keys). * generate the keys).
*/ */
s->remote_bugs |= BUG_SSH2_DERIVEKEY; s->remote_bugs |= BUG_SSH2_DERIVEKEY;
bpp_logevent(("We believe remote version has SSH-2 " bpp_logevent("We believe remote version has SSH-2 "
"key-derivation bug")); "key-derivation bug");
} }
if (conf_get_int(s->conf, CONF_sshbug_rsapad2) == FORCE_ON || if (conf_get_int(s->conf, CONF_sshbug_rsapad2) == FORCE_ON ||
@ -516,7 +516,7 @@ static void ssh_detect_bugs(struct ssh_verstring_state *s)
* These versions have the SSH-2 RSA padding bug. * These versions have the SSH-2 RSA padding bug.
*/ */
s->remote_bugs |= BUG_SSH2_RSA_PADDING; s->remote_bugs |= BUG_SSH2_RSA_PADDING;
bpp_logevent(("We believe remote version has SSH-2 RSA padding bug")); bpp_logevent("We believe remote version has SSH-2 RSA padding bug");
} }
if (conf_get_int(s->conf, CONF_sshbug_pksessid2) == FORCE_ON || if (conf_get_int(s->conf, CONF_sshbug_pksessid2) == FORCE_ON ||
@ -527,8 +527,8 @@ static void ssh_detect_bugs(struct ssh_verstring_state *s)
* public-key authentication. * public-key authentication.
*/ */
s->remote_bugs |= BUG_SSH2_PK_SESSIONID; s->remote_bugs |= BUG_SSH2_PK_SESSIONID;
bpp_logevent(("We believe remote version has SSH-2 " bpp_logevent("We believe remote version has SSH-2 "
"public-key-session-ID bug")); "public-key-session-ID bug");
} }
if (conf_get_int(s->conf, CONF_sshbug_rekey2) == FORCE_ON || if (conf_get_int(s->conf, CONF_sshbug_rekey2) == FORCE_ON ||
@ -544,7 +544,7 @@ static void ssh_detect_bugs(struct ssh_verstring_state *s)
* These versions have the SSH-2 rekey bug. * These versions have the SSH-2 rekey bug.
*/ */
s->remote_bugs |= BUG_SSH2_REKEY; s->remote_bugs |= BUG_SSH2_REKEY;
bpp_logevent(("We believe remote version has SSH-2 rekey bug")); bpp_logevent("We believe remote version has SSH-2 rekey bug");
} }
if (conf_get_int(s->conf, CONF_sshbug_maxpkt2) == FORCE_ON || if (conf_get_int(s->conf, CONF_sshbug_maxpkt2) == FORCE_ON ||
@ -555,8 +555,8 @@ static void ssh_detect_bugs(struct ssh_verstring_state *s)
* This version ignores our makpkt and needs to be throttled. * This version ignores our makpkt and needs to be throttled.
*/ */
s->remote_bugs |= BUG_SSH2_MAXPKT; s->remote_bugs |= BUG_SSH2_MAXPKT;
bpp_logevent(("We believe remote version ignores SSH-2 " bpp_logevent("We believe remote version ignores SSH-2 "
"maximum packet size")); "maximum packet size");
} }
if (conf_get_int(s->conf, CONF_sshbug_ignore2) == FORCE_ON) { if (conf_get_int(s->conf, CONF_sshbug_ignore2) == FORCE_ON) {
@ -565,7 +565,7 @@ static void ssh_detect_bugs(struct ssh_verstring_state *s)
* none detected automatically. * none detected automatically.
*/ */
s->remote_bugs |= BUG_CHOKES_ON_SSH2_IGNORE; s->remote_bugs |= BUG_CHOKES_ON_SSH2_IGNORE;
bpp_logevent(("We believe remote version has SSH-2 ignore bug")); bpp_logevent("We believe remote version has SSH-2 ignore bug");
} }
if (conf_get_int(s->conf, CONF_sshbug_oldgex2) == FORCE_ON || if (conf_get_int(s->conf, CONF_sshbug_oldgex2) == FORCE_ON ||
@ -577,7 +577,7 @@ static void ssh_detect_bugs(struct ssh_verstring_state *s)
* we use the newer version. * we use the newer version.
*/ */
s->remote_bugs |= BUG_SSH2_OLDGEX; s->remote_bugs |= BUG_SSH2_OLDGEX;
bpp_logevent(("We believe remote version has outdated SSH-2 GEX")); bpp_logevent("We believe remote version has outdated SSH-2 GEX");
} }
if (conf_get_int(s->conf, CONF_sshbug_winadj) == FORCE_ON) { if (conf_get_int(s->conf, CONF_sshbug_winadj) == FORCE_ON) {
@ -586,7 +586,7 @@ static void ssh_detect_bugs(struct ssh_verstring_state *s)
* reason or another. Currently, none detected automatically. * reason or another. Currently, none detected automatically.
*/ */
s->remote_bugs |= BUG_CHOKES_ON_WINADJ; s->remote_bugs |= BUG_CHOKES_ON_WINADJ;
bpp_logevent(("We believe remote version has winadj bug")); bpp_logevent("We believe remote version has winadj bug");
} }
if (conf_get_int(s->conf, CONF_sshbug_chanreq) == FORCE_ON || if (conf_get_int(s->conf, CONF_sshbug_chanreq) == FORCE_ON ||
@ -603,8 +603,8 @@ static void ssh_detect_bugs(struct ssh_verstring_state *s)
* https://secure.ucc.asn.au/hg/dropbear/rev/cd02449b709c * https://secure.ucc.asn.au/hg/dropbear/rev/cd02449b709c
*/ */
s->remote_bugs |= BUG_SENDS_LATE_REQUEST_REPLY; s->remote_bugs |= BUG_SENDS_LATE_REQUEST_REPLY;
bpp_logevent(("We believe remote version has SSH-2 " bpp_logevent("We believe remote version has SSH-2 "
"channel request bug")); "channel request bug");
} }
} }

View File

@ -1065,12 +1065,12 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
} }
} }
debug(("key_event: type=%s keyval=%s state=%s " debug("key_event: type=%s keyval=%s state=%s "
"hardware_keycode=%d is_modifier=%s string=[%s]\n", "hardware_keycode=%d is_modifier=%s string=[%s]\n",
type_string, keyval_string, state_string, type_string, keyval_string, state_string,
(int)event->hardware_keycode, (int)event->hardware_keycode,
event->is_modifier ? "true" : "false", event->is_modifier ? "true" : "false",
string_string)); string_string);
sfree(type_string); sfree(type_string);
sfree(state_string); sfree(state_string);
@ -1096,8 +1096,8 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
event->keyval == GDK_KEY_Alt_R) && event->keyval == GDK_KEY_Alt_R) &&
inst->alt_keycode >= 0 && inst->alt_digits > 1) { inst->alt_keycode >= 0 && inst->alt_digits > 1) {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - modifier release terminates Alt+numberpad input, " debug(" - modifier release terminates Alt+numberpad input, "
"keycode = %d\n", inst->alt_keycode)); "keycode = %d\n", inst->alt_keycode);
#endif #endif
/* /*
* FIXME: we might usefully try to do something clever here * FIXME: we might usefully try to do something clever here
@ -1110,16 +1110,16 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
} }
#if GTK_CHECK_VERSION(2,0,0) #if GTK_CHECK_VERSION(2,0,0)
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - key release, passing to IM\n")); debug(" - key release, passing to IM\n");
#endif #endif
if (gtk_im_context_filter_keypress(inst->imc, event)) { if (gtk_im_context_filter_keypress(inst->imc, event)) {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - key release accepted by IM\n")); debug(" - key release accepted by IM\n");
#endif #endif
return true; return true;
} else { } else {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - key release not accepted by IM\n")); debug(" - key release not accepted by IM\n");
#endif #endif
} }
#endif #endif
@ -1136,8 +1136,8 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
event->keyval == GDK_KEY_Alt_L || event->keyval == GDK_KEY_Alt_L ||
event->keyval == GDK_KEY_Alt_R)) { event->keyval == GDK_KEY_Alt_R)) {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - modifier press potentially begins Alt+numberpad " debug(" - modifier press potentially begins Alt+numberpad "
"input\n")); "input\n");
#endif #endif
inst->alt_keycode = -1; inst->alt_keycode = -1;
inst->alt_digits = 0; inst->alt_digits = 0;
@ -1176,8 +1176,8 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
inst->alt_keycode = inst->alt_keycode * 10 + digit; inst->alt_keycode = inst->alt_keycode * 10 + digit;
inst->alt_digits++; inst->alt_digits++;
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Alt+numberpad digit %d added to keycode %d" debug(" - Alt+numberpad digit %d added to keycode %d"
" gives %d\n", digit, old_keycode, inst->alt_keycode)); " gives %d\n", digit, old_keycode, inst->alt_keycode);
#endif #endif
/* Having used this digit, we now do nothing more with it. */ /* Having used this digit, we now do nothing more with it. */
goto done; goto done;
@ -1187,7 +1187,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
if (event->keyval == GDK_KEY_greater && if (event->keyval == GDK_KEY_greater &&
(event->state & GDK_CONTROL_MASK)) { (event->state & GDK_CONTROL_MASK)) {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Ctrl->: increase font size\n")); debug(" - Ctrl->: increase font size\n");
#endif #endif
change_font_size(inst, +1); change_font_size(inst, +1);
return true; return true;
@ -1195,7 +1195,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
if (event->keyval == GDK_KEY_less && if (event->keyval == GDK_KEY_less &&
(event->state & GDK_CONTROL_MASK)) { (event->state & GDK_CONTROL_MASK)) {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Ctrl-<: increase font size\n")); debug(" - Ctrl-<: increase font size\n");
#endif #endif
change_font_size(inst, -1); change_font_size(inst, -1);
return true; return true;
@ -1209,7 +1209,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
((event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) == ((event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) ==
(GDK_CONTROL_MASK | GDK_SHIFT_MASK))) { (GDK_CONTROL_MASK | GDK_SHIFT_MASK))) {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Ctrl-Shift-PgUp scroll\n")); debug(" - Ctrl-Shift-PgUp scroll\n");
#endif #endif
term_scroll(inst->term, 1, 0); term_scroll(inst->term, 1, 0);
return true; return true;
@ -1217,7 +1217,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
if (event->keyval == GDK_KEY_Page_Up && if (event->keyval == GDK_KEY_Page_Up &&
(event->state & GDK_SHIFT_MASK)) { (event->state & GDK_SHIFT_MASK)) {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Shift-PgUp scroll\n")); debug(" - Shift-PgUp scroll\n");
#endif #endif
term_scroll(inst->term, 0, -inst->height/2); term_scroll(inst->term, 0, -inst->height/2);
return true; return true;
@ -1225,7 +1225,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
if (event->keyval == GDK_KEY_Page_Up && if (event->keyval == GDK_KEY_Page_Up &&
(event->state & GDK_CONTROL_MASK)) { (event->state & GDK_CONTROL_MASK)) {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Ctrl-PgUp scroll\n")); debug(" - Ctrl-PgUp scroll\n");
#endif #endif
term_scroll(inst->term, 0, -1); term_scroll(inst->term, 0, -1);
return true; return true;
@ -1234,7 +1234,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
((event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) == ((event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) ==
(GDK_CONTROL_MASK | GDK_SHIFT_MASK))) { (GDK_CONTROL_MASK | GDK_SHIFT_MASK))) {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Ctrl-shift-PgDn scroll\n")); debug(" - Ctrl-shift-PgDn scroll\n");
#endif #endif
term_scroll(inst->term, -1, 0); term_scroll(inst->term, -1, 0);
return true; return true;
@ -1242,7 +1242,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
if (event->keyval == GDK_KEY_Page_Down && if (event->keyval == GDK_KEY_Page_Down &&
(event->state & GDK_SHIFT_MASK)) { (event->state & GDK_SHIFT_MASK)) {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Shift-PgDn scroll\n")); debug(" - Shift-PgDn scroll\n");
#endif #endif
term_scroll(inst->term, 0, +inst->height/2); term_scroll(inst->term, 0, +inst->height/2);
return true; return true;
@ -1250,7 +1250,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
if (event->keyval == GDK_KEY_Page_Down && if (event->keyval == GDK_KEY_Page_Down &&
(event->state & GDK_CONTROL_MASK)) { (event->state & GDK_CONTROL_MASK)) {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Ctrl-PgDn scroll\n")); debug(" - Ctrl-PgDn scroll\n");
#endif #endif
term_scroll(inst->term, 0, +1); term_scroll(inst->term, 0, +1);
return true; return true;
@ -1266,25 +1266,25 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
switch (cfgval) { switch (cfgval) {
case CLIPUI_IMPLICIT: case CLIPUI_IMPLICIT:
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Shift-Insert: paste from PRIMARY\n")); debug(" - Shift-Insert: paste from PRIMARY\n");
#endif #endif
term_request_paste(inst->term, CLIP_PRIMARY); term_request_paste(inst->term, CLIP_PRIMARY);
return true; return true;
case CLIPUI_EXPLICIT: case CLIPUI_EXPLICIT:
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Shift-Insert: paste from CLIPBOARD\n")); debug(" - Shift-Insert: paste from CLIPBOARD\n");
#endif #endif
term_request_paste(inst->term, CLIP_CLIPBOARD); term_request_paste(inst->term, CLIP_CLIPBOARD);
return true; return true;
case CLIPUI_CUSTOM: case CLIPUI_CUSTOM:
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Shift-Insert: paste from custom clipboard\n")); debug(" - Shift-Insert: paste from custom clipboard\n");
#endif #endif
term_request_paste(inst->term, inst->clipboard_ctrlshiftins); term_request_paste(inst->term, inst->clipboard_ctrlshiftins);
return true; return true;
default: default:
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Shift-Insert: no paste action\n")); debug(" - Shift-Insert: no paste action\n");
#endif #endif
break; break;
} }
@ -1298,26 +1298,26 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
case CLIPUI_IMPLICIT: case CLIPUI_IMPLICIT:
/* do nothing; re-copy to PRIMARY is not needed */ /* do nothing; re-copy to PRIMARY is not needed */
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Ctrl-Insert: non-copy to PRIMARY\n")); debug(" - Ctrl-Insert: non-copy to PRIMARY\n");
#endif #endif
return true; return true;
case CLIPUI_EXPLICIT: case CLIPUI_EXPLICIT:
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Ctrl-Insert: copy to CLIPBOARD\n")); debug(" - Ctrl-Insert: copy to CLIPBOARD\n");
#endif #endif
term_request_copy(inst->term, term_request_copy(inst->term,
clips_clipboard, lenof(clips_clipboard)); clips_clipboard, lenof(clips_clipboard));
return true; return true;
case CLIPUI_CUSTOM: case CLIPUI_CUSTOM:
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Ctrl-Insert: copy to custom clipboard\n")); debug(" - Ctrl-Insert: copy to custom clipboard\n");
#endif #endif
term_request_copy(inst->term, term_request_copy(inst->term,
&inst->clipboard_ctrlshiftins, 1); &inst->clipboard_ctrlshiftins, 1);
return true; return true;
default: default:
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Ctrl-Insert: no copy action\n")); debug(" - Ctrl-Insert: no copy action\n");
#endif #endif
break; break;
} }
@ -1338,25 +1338,25 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
case CLIPUI_IMPLICIT: case CLIPUI_IMPLICIT:
if (paste) { if (paste) {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Ctrl-Shift-V: paste from PRIMARY\n")); debug(" - Ctrl-Shift-V: paste from PRIMARY\n");
#endif #endif
term_request_paste(inst->term, CLIP_PRIMARY); term_request_paste(inst->term, CLIP_PRIMARY);
} else { } else {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Ctrl-Shift-C: non-copy to PRIMARY\n")); debug(" - Ctrl-Shift-C: non-copy to PRIMARY\n");
#endif #endif
} }
return true; return true;
case CLIPUI_EXPLICIT: case CLIPUI_EXPLICIT:
if (paste) { if (paste) {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Ctrl-Shift-V: paste from CLIPBOARD\n")); debug(" - Ctrl-Shift-V: paste from CLIPBOARD\n");
#endif #endif
term_request_paste(inst->term, CLIP_CLIPBOARD); term_request_paste(inst->term, CLIP_CLIPBOARD);
} else { } else {
static const int clips[] = { CLIP_CLIPBOARD }; static const int clips[] = { CLIP_CLIPBOARD };
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Ctrl-Shift-C: copy to CLIPBOARD\n")); debug(" - Ctrl-Shift-C: copy to CLIPBOARD\n");
#endif #endif
term_request_copy(inst->term, clips, lenof(clips)); term_request_copy(inst->term, clips, lenof(clips));
} }
@ -1364,13 +1364,13 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
case CLIPUI_CUSTOM: case CLIPUI_CUSTOM:
if (paste) { if (paste) {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Ctrl-Shift-V: paste from custom clipboard\n")); debug(" - Ctrl-Shift-V: paste from custom clipboard\n");
#endif #endif
term_request_paste(inst->term, term_request_paste(inst->term,
inst->clipboard_ctrlshiftcv); inst->clipboard_ctrlshiftcv);
} else { } else {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Ctrl-Shift-C: copy to custom clipboard\n")); debug(" - Ctrl-Shift-C: copy to custom clipboard\n");
#endif #endif
term_request_copy(inst->term, term_request_copy(inst->term,
&inst->clipboard_ctrlshiftcv, 1); &inst->clipboard_ctrlshiftcv, 1);
@ -1458,8 +1458,8 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
* something not what we wanted). * something not what we wanted).
*/ */
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Meta modifier requiring manual intervention, " debug(" - Meta modifier requiring manual intervention, "
"suppressing IM filtering\n")); "suppressing IM filtering\n");
#endif #endif
try_filter = false; try_filter = false;
} }
@ -1467,16 +1467,16 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
if (try_filter) { if (try_filter) {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - general key press, passing to IM\n")); debug(" - general key press, passing to IM\n");
#endif #endif
if (gtk_im_context_filter_keypress(inst->imc, event)) { if (gtk_im_context_filter_keypress(inst->imc, event)) {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - key press accepted by IM\n")); debug(" - key press accepted by IM\n");
#endif #endif
return true; return true;
} else { } else {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - key press not accepted by IM\n")); debug(" - key press not accepted by IM\n");
#endif #endif
} }
} }
@ -1517,8 +1517,8 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
(unsigned)widedata[i]); (unsigned)widedata[i]);
sfree(old); sfree(old);
} }
debug((" - string translated into Unicode = [%s]\n", debug(" - string translated into Unicode = [%s]\n",
string_string)); string_string);
sfree(string_string); sfree(string_string);
} }
#endif #endif
@ -1539,8 +1539,8 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
(unsigned)output[i+1] & 0xFF); (unsigned)output[i+1] & 0xFF);
sfree(old); sfree(old);
} }
debug((" - string translated into UTF-8 = [%s]\n", debug(" - string translated into UTF-8 = [%s]\n",
string_string)); string_string);
sfree(string_string); sfree(string_string);
} }
#endif #endif
@ -1554,8 +1554,8 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
ucsoutput[0] = '\033'; ucsoutput[0] = '\033';
ucsoutput[1] = ucsval; ucsoutput[1] = ucsval;
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - keysym_to_unicode gave %04x\n", debug(" - keysym_to_unicode gave %04x\n",
(unsigned)ucsoutput[1])); (unsigned)ucsoutput[1]);
#endif #endif
use_ucsoutput = true; use_ucsoutput = true;
end = 2; end = 2;
@ -1591,9 +1591,9 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
{ {
char *keyval_name = dup_keyval_name(new_keyval); char *keyval_name = dup_keyval_name(new_keyval);
debug((" - retranslation for manual Meta: " debug(" - retranslation for manual Meta: "
"new keyval = %s, Unicode = %04x\n", "new keyval = %s, Unicode = %04x\n",
keyval_name, (unsigned)ucsoutput[1])); keyval_name, (unsigned)ucsoutput[1]);
sfree(keyval_name); sfree(keyval_name);
} }
#endif #endif
@ -1609,7 +1609,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
if (!output[1] && event->keyval == '`' && if (!output[1] && event->keyval == '`' &&
(event->state & GDK_CONTROL_MASK)) { (event->state & GDK_CONTROL_MASK)) {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Ctrl-` special case, translating as 1c\n")); debug(" - Ctrl-` special case, translating as 1c\n");
#endif #endif
output[1] = '\x1C'; output[1] = '\x1C';
use_ucsoutput = false; use_ucsoutput = false;
@ -1648,10 +1648,10 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
if (orig == output[1]) if (orig == output[1])
debug((" - manual Ctrl key handling did nothing\n")); debug(" - manual Ctrl key handling did nothing\n");
else else
debug((" - manual Ctrl key handling: %02x -> %02x\n", debug(" - manual Ctrl key handling: %02x -> %02x\n",
(unsigned)orig, (unsigned)output[1])); (unsigned)orig, (unsigned)output[1]);
#endif #endif
} }
@ -1659,7 +1659,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
if (event->keyval == GDK_KEY_Break && if (event->keyval == GDK_KEY_Break &&
(event->state & GDK_CONTROL_MASK)) { (event->state & GDK_CONTROL_MASK)) {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Ctrl-Break special case, sending SS_BRK\n")); debug(" - Ctrl-Break special case, sending SS_BRK\n");
#endif #endif
if (inst->backend) if (inst->backend)
backend_special(inst->backend, SS_BRK, 0); backend_special(inst->backend, SS_BRK, 0);
@ -1670,7 +1670,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
* special to ldisc. */ * special to ldisc. */
if (event->keyval == GDK_KEY_Return) { if (event->keyval == GDK_KEY_Return) {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Return special case, translating as 0d + special\n")); debug(" - Return special case, translating as 0d + special\n");
#endif #endif
output[1] = '\015'; output[1] = '\015';
use_ucsoutput = false; use_ucsoutput = false;
@ -1685,7 +1685,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
(event->state & (GDK_SHIFT_MASK | (event->state & (GDK_SHIFT_MASK |
GDK_CONTROL_MASK)) == GDK_CONTROL_MASK) { GDK_CONTROL_MASK)) == GDK_CONTROL_MASK) {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Ctrl-{space,2,@} special case, translating as 00\n")); debug(" - Ctrl-{space,2,@} special case, translating as 00\n");
#endif #endif
output[1] = '\0'; output[1] = '\0';
use_ucsoutput = false; use_ucsoutput = false;
@ -1697,7 +1697,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) == (event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) ==
(GDK_SHIFT_MASK | GDK_CONTROL_MASK)) { (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Ctrl-Shift-space special case, translating as 00a0\n")); debug(" - Ctrl-Shift-space special case, translating as 00a0\n");
#endif #endif
output[1] = '\240'; output[1] = '\240';
output_charset = CS_ISO8859_1; output_charset = CS_ISO8859_1;
@ -1711,8 +1711,8 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
output[1] = conf_get_bool(inst->conf, CONF_bksp_is_delete) ? output[1] = conf_get_bool(inst->conf, CONF_bksp_is_delete) ?
'\x7F' : '\x08'; '\x7F' : '\x08';
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Backspace, translating as %02x\n", debug(" - Backspace, translating as %02x\n",
(unsigned)output[1])); (unsigned)output[1]);
#endif #endif
use_ucsoutput = false; use_ucsoutput = false;
end = 2; end = 2;
@ -1724,8 +1724,8 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
output[1] = conf_get_bool(inst->conf, CONF_bksp_is_delete) ? output[1] = conf_get_bool(inst->conf, CONF_bksp_is_delete) ?
'\x08' : '\x7F'; '\x08' : '\x7F';
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Shift-Backspace, translating as %02x\n", debug(" - Shift-Backspace, translating as %02x\n",
(unsigned)output[1])); (unsigned)output[1]);
#endif #endif
use_ucsoutput = false; use_ucsoutput = false;
end = 2; end = 2;
@ -1737,7 +1737,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
(event->keyval == GDK_KEY_Tab && (event->keyval == GDK_KEY_Tab &&
(event->state & GDK_SHIFT_MASK))) { (event->state & GDK_SHIFT_MASK))) {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Shift-Tab, translating as ESC [ Z\n")); debug(" - Shift-Tab, translating as ESC [ Z\n");
#endif #endif
end = 1 + sprintf(output+1, "\033[Z"); end = 1 + sprintf(output+1, "\033[Z");
use_ucsoutput = false; use_ucsoutput = false;
@ -1747,7 +1747,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
* doesn't translate Tab for us. */ * doesn't translate Tab for us. */
if (event->keyval == GDK_KEY_Tab && end <= 1) { if (event->keyval == GDK_KEY_Tab && end <= 1) {
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Tab, translating as 09\n")); debug(" - Tab, translating as 09\n");
#endif #endif
output[1] = '\t'; output[1] = '\t';
end = 2; end = 2;
@ -1759,7 +1759,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
event->state & GDK_SHIFT_MASK, event->state & GDK_SHIFT_MASK,
event->state & GDK_CONTROL_MASK); event->state & GDK_CONTROL_MASK);
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - numeric keypad key")); debug(" - numeric keypad key");
#endif #endif
use_ucsoutput = false; use_ucsoutput = false;
goto done; goto done;
@ -1792,7 +1792,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
event->state & GDK_SHIFT_MASK, event->state & GDK_SHIFT_MASK,
event->state & GDK_CONTROL_MASK); event->state & GDK_CONTROL_MASK);
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - function key F%d", fkey_number)); debug(" - function key F%d", fkey_number);
#endif #endif
use_ucsoutput = false; use_ucsoutput = false;
goto done; goto done;
@ -1817,7 +1817,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
end = 1 + format_small_keypad_key(output+1, inst->term, sk_key); end = 1 + format_small_keypad_key(output+1, inst->term, sk_key);
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - small keypad key")); debug(" - small keypad key");
#endif #endif
use_ucsoutput = false; use_ucsoutput = false;
goto done; goto done;
@ -1837,7 +1837,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
end = 1 + format_arrow_key(output+1, inst->term, xkey, end = 1 + format_arrow_key(output+1, inst->term, xkey,
event->state & GDK_CONTROL_MASK); event->state & GDK_CONTROL_MASK);
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - arrow key")); debug(" - arrow key");
#endif #endif
use_ucsoutput = false; use_ucsoutput = false;
goto done; goto done;
@ -1849,7 +1849,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
event->state & GDK_SHIFT_MASK, event->state & GDK_SHIFT_MASK,
event->state & GDK_CONTROL_MASK); event->state & GDK_CONTROL_MASK);
#ifdef KEY_EVENT_DIAGNOSTICS #ifdef KEY_EVENT_DIAGNOSTICS
debug((" - numeric keypad key")); debug(" - numeric keypad key");
#endif #endif
use_ucsoutput = false; use_ucsoutput = false;
goto done; goto done;
@ -1873,8 +1873,8 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
(unsigned)output[i] & 0xFF); (unsigned)output[i] & 0xFF);
sfree(old); sfree(old);
} }
debug((" - final output, special, generic encoding = [%s]\n", debug(" - final output, special, generic encoding = [%s]\n",
charset_to_localenc(output_charset), string_string)); charset_to_localenc(output_charset), string_string);
sfree(string_string); sfree(string_string);
#endif #endif
/* /*
@ -1898,8 +1898,8 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
(unsigned)output[i] & 0xFF); (unsigned)output[i] & 0xFF);
sfree(old); sfree(old);
} }
debug((" - final output in %s = [%s]\n", debug(" - final output in %s = [%s]\n",
charset_to_localenc(output_charset), string_string)); charset_to_localenc(output_charset), string_string);
sfree(string_string); sfree(string_string);
#endif #endif
generated_something = true; generated_something = true;
@ -1918,8 +1918,8 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
(unsigned)ucsoutput[i]); (unsigned)ucsoutput[i]);
sfree(old); sfree(old);
} }
debug((" - final output in Unicode = [%s]\n", debug(" - final output in Unicode = [%s]\n",
string_string)); string_string);
sfree(string_string); sfree(string_string);
#endif #endif
@ -1947,8 +1947,8 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
(unsigned)output[i] & 0xFF); (unsigned)output[i] & 0xFF);
sfree(old); sfree(old);
} }
debug((" - final output in direct-to-font encoding = [%s]\n", debug(" - final output in direct-to-font encoding = [%s]\n",
string_string)); string_string);
sfree(string_string); sfree(string_string);
#endif #endif
generated_something = true; generated_something = true;
@ -1981,7 +1981,7 @@ void input_method_commit_event(GtkIMContext *imc, gchar *str, gpointer data)
(unsigned)str[i] & 0xFF); (unsigned)str[i] & 0xFF);
sfree(old); sfree(old);
} }
debug((" - IM commit event in UTF-8 = [%s]\n", string_string)); debug(" - IM commit event in UTF-8 = [%s]\n", string_string);
sfree(string_string); sfree(string_string);
#endif #endif

View File

@ -237,7 +237,7 @@ SockAddr *sk_namelookup(const char *host, char **canonicalname, int address_fami
* we don't use gethostbyname as a fallback!) * we don't use gethostbyname as a fallback!)
*/ */
if (ret->superfamily == UNRESOLVED) { if (ret->superfamily == UNRESOLVED) {
/*debug(("Resolving \"%s\" with gethostbyname() (IPv4 only)...\n", host)); */ /*debug("Resolving \"%s\" with gethostbyname() (IPv4 only)...\n", host); */
if ( (h = gethostbyname(host)) ) if ( (h = gethostbyname(host)) )
ret->superfamily = IP; ret->superfamily = IP;
} }

View File

@ -1548,8 +1548,8 @@ static void init_fonts(int pick_width, int pick_height)
} }
#ifdef RDB_DEBUG_PATCH #ifdef RDB_DEBUG_PATCH
debug(23, "Primary font H=%d, AW=%d, MW=%d", debug("Primary font H=%d, AW=%d, MW=%d\n",
tm.tmHeight, tm.tmAveCharWidth, tm.tmMaxCharWidth); tm.tmHeight, tm.tmAveCharWidth, tm.tmMaxCharWidth);
#endif #endif
{ {
@ -1796,7 +1796,7 @@ static void reset_window(int reinit) {
RECT cr, wr; RECT cr, wr;
#ifdef RDB_DEBUG_PATCH #ifdef RDB_DEBUG_PATCH
debug((27, "reset_window()")); debug("reset_window()\n");
#endif #endif
/* Current window sizes ... */ /* Current window sizes ... */
@ -1815,7 +1815,7 @@ static void reset_window(int reinit) {
/* Are we being forced to reload the fonts ? */ /* Are we being forced to reload the fonts ? */
if (reinit>1) { if (reinit>1) {
#ifdef RDB_DEBUG_PATCH #ifdef RDB_DEBUG_PATCH
debug((27, "reset_window() -- Forced deinit")); debug("reset_window() -- Forced deinit\n");
#endif #endif
deinit_fonts(); deinit_fonts();
init_fonts(0,0); init_fonts(0,0);
@ -1833,7 +1833,7 @@ static void reset_window(int reinit) {
offset_height = (win_height-font_height*term->rows)/2; offset_height = (win_height-font_height*term->rows)/2;
InvalidateRect(hwnd, NULL, true); InvalidateRect(hwnd, NULL, true);
#ifdef RDB_DEBUG_PATCH #ifdef RDB_DEBUG_PATCH
debug((27, "reset_window() -> Reposition terminal")); debug("reset_window() -> Reposition terminal\n");
#endif #endif
} }
@ -1854,8 +1854,8 @@ static void reset_window(int reinit) {
offset_height = (win_height-font_height*term->rows)/2; offset_height = (win_height-font_height*term->rows)/2;
InvalidateRect(hwnd, NULL, true); InvalidateRect(hwnd, NULL, true);
#ifdef RDB_DEBUG_PATCH #ifdef RDB_DEBUG_PATCH
debug((25, "reset_window() -> Z font resize to (%d, %d)", debug("reset_window() -> Z font resize to (%d, %d)\n",
font_width, font_height)); font_width, font_height);
#endif #endif
} }
} else { } else {
@ -1870,7 +1870,7 @@ static void reset_window(int reinit) {
offset_height = (win_height-font_height*term->rows)/2; offset_height = (win_height-font_height*term->rows)/2;
InvalidateRect(hwnd, NULL, true); InvalidateRect(hwnd, NULL, true);
#ifdef RDB_DEBUG_PATCH #ifdef RDB_DEBUG_PATCH
debug((27, "reset_window() -> Zoomed term_size")); debug("reset_window() -> Zoomed term_size\n");
#endif #endif
} }
} }
@ -1882,7 +1882,7 @@ static void reset_window(int reinit) {
*/ */
if (reinit>0) { if (reinit>0) {
#ifdef RDB_DEBUG_PATCH #ifdef RDB_DEBUG_PATCH
debug((27, "reset_window() -> Forced re-init")); debug("reset_window() -> Forced re-init\n");
#endif #endif
offset_width = offset_height = window_border; offset_width = offset_height = window_border;
@ -1950,8 +1950,8 @@ static void reset_window(int reinit) {
term_size(term, height, width, term_size(term, height, width,
conf_get_int(conf, CONF_savelines)); conf_get_int(conf, CONF_savelines));
#ifdef RDB_DEBUG_PATCH #ifdef RDB_DEBUG_PATCH
debug((27, "reset_window() -> term resize to (%d,%d)", debug("reset_window() -> term resize to (%d,%d)\n",
height, width)); height, width);
#endif #endif
} }
} }
@ -1963,9 +1963,9 @@ static void reset_window(int reinit) {
InvalidateRect(hwnd, NULL, true); InvalidateRect(hwnd, NULL, true);
#ifdef RDB_DEBUG_PATCH #ifdef RDB_DEBUG_PATCH
debug((27, "reset_window() -> window resize to (%d,%d)", debug("reset_window() -> window resize to (%d,%d)\n",
font_width*term->cols + extra_width, font_width*term->cols + extra_width,
font_height*term->rows + extra_height)); font_height*term->rows + extra_height);
#endif #endif
} }
return; return;
@ -1987,8 +1987,8 @@ static void reset_window(int reinit) {
InvalidateRect(hwnd, NULL, true); InvalidateRect(hwnd, NULL, true);
#ifdef RDB_DEBUG_PATCH #ifdef RDB_DEBUG_PATCH
debug((25, "reset_window() -> font resize to (%d,%d)", debug("reset_window() -> font resize to (%d,%d)\n",
font_width, font_height)); font_width, font_height);
#endif #endif
} }
} }
@ -2862,7 +2862,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
break; break;
case WM_ENTERSIZEMOVE: case WM_ENTERSIZEMOVE:
#ifdef RDB_DEBUG_PATCH #ifdef RDB_DEBUG_PATCH
debug((27, "WM_ENTERSIZEMOVE")); debug("WM_ENTERSIZEMOVE\n");
#endif #endif
EnableSizeTip(true); EnableSizeTip(true);
resizing = true; resizing = true;
@ -2872,7 +2872,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
EnableSizeTip(false); EnableSizeTip(false);
resizing = false; resizing = false;
#ifdef RDB_DEBUG_PATCH #ifdef RDB_DEBUG_PATCH
debug((27, "WM_EXITSIZEMOVE")); debug("WM_EXITSIZEMOVE\n");
#endif #endif
if (need_backend_resize) { if (need_backend_resize) {
term_size(term, conf_get_int(conf, CONF_height), term_size(term, conf_get_int(conf, CONF_height),
@ -2983,13 +2983,13 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
case WM_SIZE: case WM_SIZE:
resize_action = conf_get_int(conf, CONF_resize_action); resize_action = conf_get_int(conf, CONF_resize_action);
#ifdef RDB_DEBUG_PATCH #ifdef RDB_DEBUG_PATCH
debug((27, "WM_SIZE %s (%d,%d)", debug("WM_SIZE %s (%d,%d)\n",
(wParam == SIZE_MINIMIZED) ? "SIZE_MINIMIZED": (wParam == SIZE_MINIMIZED) ? "SIZE_MINIMIZED":
(wParam == SIZE_MAXIMIZED) ? "SIZE_MAXIMIZED": (wParam == SIZE_MAXIMIZED) ? "SIZE_MAXIMIZED":
(wParam == SIZE_RESTORED && resizing) ? "to": (wParam == SIZE_RESTORED && resizing) ? "to":
(wParam == SIZE_RESTORED) ? "SIZE_RESTORED": (wParam == SIZE_RESTORED) ? "SIZE_RESTORED":
"...", "...",
LOWORD(lParam), HIWORD(lParam))); LOWORD(lParam), HIWORD(lParam));
#endif #endif
if (wParam == SIZE_MINIMIZED) if (wParam == SIZE_MINIMIZED)
SetWindowText(hwnd, SetWindowText(hwnd,
@ -4098,53 +4098,53 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
first = 0; first = 0;
if ((HIWORD(lParam) & (KF_UP | KF_REPEAT)) == KF_REPEAT) { if ((HIWORD(lParam) & (KF_UP | KF_REPEAT)) == KF_REPEAT) {
debug(("+")); debug("+");
} else if ((HIWORD(lParam) & KF_UP) } else if ((HIWORD(lParam) & KF_UP)
&& scan == (HIWORD(lParam) & 0xFF)) { && scan == (HIWORD(lParam) & 0xFF)) {
debug((". U")); debug(". U");
} else { } else {
debug((".\n")); debug(".\n");
if (wParam >= VK_F1 && wParam <= VK_F20) if (wParam >= VK_F1 && wParam <= VK_F20)
debug(("K_F%d", wParam + 1 - VK_F1)); debug("K_F%d", wParam + 1 - VK_F1);
else else
switch (wParam) { switch (wParam) {
case VK_SHIFT: case VK_SHIFT:
debug(("SHIFT")); debug("SHIFT");
break; break;
case VK_CONTROL: case VK_CONTROL:
debug(("CTRL")); debug("CTRL");
break; break;
case VK_MENU: case VK_MENU:
debug(("ALT")); debug("ALT");
break; break;
default: default:
debug(("VK_%02x", wParam)); debug("VK_%02x", wParam);
} }
if (message == WM_SYSKEYDOWN || message == WM_SYSKEYUP) if (message == WM_SYSKEYDOWN || message == WM_SYSKEYUP)
debug(("*")); debug("*");
debug((", S%02x", scan = (HIWORD(lParam) & 0xFF))); debug(", S%02x", scan = (HIWORD(lParam) & 0xFF));
ch = MapVirtualKeyEx(wParam, 2, kbd_layout); ch = MapVirtualKeyEx(wParam, 2, kbd_layout);
if (ch >= ' ' && ch <= '~') if (ch >= ' ' && ch <= '~')
debug((", '%c'", ch)); debug(", '%c'", ch);
else if (ch) else if (ch)
debug((", $%02x", ch)); debug(", $%02x", ch);
if (keys_unicode[0]) if (keys_unicode[0])
debug((", KB0=%04x", keys_unicode[0])); debug(", KB0=%04x", keys_unicode[0]);
if (keys_unicode[1]) if (keys_unicode[1])
debug((", KB1=%04x", keys_unicode[1])); debug(", KB1=%04x", keys_unicode[1]);
if (keys_unicode[2]) if (keys_unicode[2])
debug((", KB2=%04x", keys_unicode[2])); debug(", KB2=%04x", keys_unicode[2]);
if ((keystate[VK_SHIFT] & 0x80) != 0) if ((keystate[VK_SHIFT] & 0x80) != 0)
debug((", S")); debug(", S");
if ((keystate[VK_CONTROL] & 0x80) != 0) if ((keystate[VK_CONTROL] & 0x80) != 0)
debug((", C")); debug(", C");
if ((HIWORD(lParam) & KF_EXTENDED)) if ((HIWORD(lParam) & KF_EXTENDED))
debug((", E")); debug(", E");
if ((HIWORD(lParam) & KF_UP)) if ((HIWORD(lParam) & KF_UP))
debug((", U")); debug(", U");
} }
if ((HIWORD(lParam) & (KF_UP | KF_REPEAT)) == KF_REPEAT); if ((HIWORD(lParam) & (KF_UP | KF_REPEAT)) == KF_REPEAT);
@ -4155,7 +4155,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
for (ch = 0; ch < 256; ch++) for (ch = 0; ch < 256; ch++)
if (oldstate[ch] != keystate[ch]) if (oldstate[ch] != keystate[ch])
debug((", M%02x=%02x", ch, keystate[ch])); debug(", M%02x=%02x", ch, keystate[ch]);
memcpy(oldstate, keystate, sizeof(oldstate)); memcpy(oldstate, keystate, sizeof(oldstate));
} }
@ -4588,19 +4588,19 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
if (r == 1 && !key_down) { if (r == 1 && !key_down) {
if (alt_sum) { if (alt_sum) {
if (in_utf(term) || ucsdata.dbcs_screenfont) if (in_utf(term) || ucsdata.dbcs_screenfont)
debug((", (U+%04x)", alt_sum)); debug(", (U+%04x)", alt_sum);
else else
debug((", LCH(%d)", alt_sum)); debug(", LCH(%d)", alt_sum);
} else { } else {
debug((", ACH(%d)", keys_unicode[0])); debug(", ACH(%d)", keys_unicode[0]);
} }
} else if (r > 0) { } else if (r > 0) {
int r1; int r1;
debug((", ASC(")); debug(", ASC(");
for (r1 = 0; r1 < r; r1++) { for (r1 = 0; r1 < r; r1++) {
debug(("%s%d", r1 ? "," : "", keys_unicode[r1])); debug("%s%d", r1 ? "," : "", keys_unicode[r1]);
} }
debug((")")); debug(")");
} }
#endif #endif
if (r > 0) { if (r > 0) {

View File

@ -794,7 +794,7 @@ static char *answer_filemapping_message(const char *mapname)
reply.buf = NULL; reply.buf = NULL;
#ifdef DEBUG_IPC #ifdef DEBUG_IPC
debug(("mapname = \"%s\"\n", mapname)); debug("mapname = \"%s\"\n", mapname);
#endif #endif
maphandle = OpenFileMapping(FILE_MAP_ALL_ACCESS, false, mapname); maphandle = OpenFileMapping(FILE_MAP_ALL_ACCESS, false, mapname);
@ -805,7 +805,7 @@ static char *answer_filemapping_message(const char *mapname)
} }
#ifdef DEBUG_IPC #ifdef DEBUG_IPC
debug(("maphandle = %p\n", maphandle)); debug("maphandle = %p\n", maphandle);
#endif #endif
#ifndef NO_SECURITY #ifndef NO_SECURITY
@ -837,8 +837,8 @@ static char *answer_filemapping_message(const char *mapname)
ConvertSidToStringSid(mapsid, &theirs); ConvertSidToStringSid(mapsid, &theirs);
ConvertSidToStringSid(expectedsid, &ours); ConvertSidToStringSid(expectedsid, &ours);
ConvertSidToStringSid(expectedsid_bc, &ours2); ConvertSidToStringSid(expectedsid_bc, &ours2);
debug(("got sids:\n oursnew=%s\n oursold=%s\n" debug("got sids:\n oursnew=%s\n oursold=%s\n"
" theirs=%s\n", ours, ours2, theirs)); " theirs=%s\n", ours, ours2, theirs);
LocalFree(ours); LocalFree(ours);
LocalFree(ours2); LocalFree(ours2);
LocalFree(theirs); LocalFree(theirs);
@ -854,7 +854,7 @@ static char *answer_filemapping_message(const char *mapname)
#endif /* NO_SECURITY */ #endif /* NO_SECURITY */
{ {
#ifdef DEBUG_IPC #ifdef DEBUG_IPC
debug(("security APIs not present\n")); debug("security APIs not present\n");
#endif #endif
} }
@ -866,7 +866,7 @@ static char *answer_filemapping_message(const char *mapname)
} }
#ifdef DEBUG_IPC #ifdef DEBUG_IPC
debug(("mapped address = %p\n", mapaddr)); debug("mapped address = %p\n", mapaddr);
#endif #endif
{ {
@ -887,7 +887,7 @@ static char *answer_filemapping_message(const char *mapname)
mapsize = mbi.RegionSize; mapsize = mbi.RegionSize;
} }
#ifdef DEBUG_IPC #ifdef DEBUG_IPC
debug(("region size = %zd\n", mapsize)); debug("region size = %zd\n", mapsize);
#endif #endif
if (mapsize < 5) { if (mapsize < 5) {
err = dupstr("mapping smaller than smallest possible request"); err = dupstr("mapping smaller than smallest possible request");
@ -897,8 +897,8 @@ static char *answer_filemapping_message(const char *mapname)
msglen = GET_32BIT((unsigned char *)mapaddr); msglen = GET_32BIT((unsigned char *)mapaddr);
#ifdef DEBUG_IPC #ifdef DEBUG_IPC
debug(("msg length=%08x, msg type=%02x\n", debug("msg length=%08x, msg type=%02x\n",
msglen, (unsigned)((unsigned char *) mapaddr)[4])); msglen, (unsigned)((unsigned char *) mapaddr)[4]);
#endif #endif
reply.buf = (char *)mapaddr + 4; reply.buf = (char *)mapaddr + 4;
@ -1095,7 +1095,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
err = answer_filemapping_message(mapname); err = answer_filemapping_message(mapname);
if (err) { if (err) {
#ifdef DEBUG_IPC #ifdef DEBUG_IPC
debug(("IPC failed: %s\n", err)); debug("IPC failed: %s\n", err);
#endif #endif
sfree(err); sfree(err);
return 0; return 0;

View File

@ -504,15 +504,14 @@ void init_ucs(Conf *conf, struct unicode_data *ucsdata)
} }
#if 0 #if 0
debug( debug("Line cp%d, Font cp%d%s\n", ucsdata->line_codepage,
("Line cp%d, Font cp%d%s\n", ucsdata->line_codepage, ucsdata->font_codepage, ucsdata->dbcs_screenfont ? " DBCS" : "");
ucsdata->font_codepage, ucsdata->dbcs_screenfont ? " DBCS" : ""));
for (i = 0; i < 256; i += 16) { for (i = 0; i < 256; i += 16) {
for (j = 0; j < 16; j++) { for (j = 0; j < 16; j++) {
debug(("%04x%s", ucsdata->unitab_line[i + j], j == 15 ? "" : ",")); debug("%04x%s", ucsdata->unitab_line[i + j], j == 15 ? "" : ",");
} }
debug(("\n")); debug("\n");
} }
#endif #endif