Commit 74109f5c authored by Stas Korobeynikov's avatar Stas Korobeynikov Committed by Pavel Vainerman

add/fix log

parent 923a89e2
......@@ -3676,11 +3676,13 @@ channel_request_remote_forwarding(struct Forward *fwd)
/* Wait for response from the remote side. */
type = packet_read();
logit("%d",type);
switch (type) {
case SSH_SMSG_SUCCESS:
success = 1;
break;
case SSH_SMSG_FAILURE:
logit("Warning: Server denied remote port forwarding.");
break;
default:
/* Unknown packet */
......
......@@ -424,6 +424,9 @@ client_x11_get_proto(const char *display, const char *xauth_path,
got_data = 1;
if (f)
pclose(f);
} else {
debug("Warning: untrusted X11 forwarding setup failed: "
"xauth key data not generated");
}
}
......@@ -451,7 +454,7 @@ client_x11_get_proto(const char *display, const char *xauth_path,
u_int8_t rnd[16];
u_int i;
logit("Warning: No xauth data; "
debug("Warning: No xauth data; "
"using fake authentication data for X11 forwarding.");
strlcpy(proto, SSH_X11_PROTO, sizeof proto);
arc4random_buf(rnd, sizeof(rnd));
......@@ -1146,6 +1149,10 @@ process_escapes(Channel *c, Buffer *bin, Buffer *bout, Buffer *berr,
if (len <= 0)
return (0);
#ifdef DEBUG
debug("NX> 280 Processing the escape chars in context: 1");
#endif
for (i = 0; i < (u_int)len; i++) {
/* Get one character at a time. */
ch = buf[i];
......@@ -1419,6 +1426,11 @@ client_process_input(fd_set *readset)
* character and have to process the characters one
* by one.
*/
#ifdef DEBUG
debug("NX> 280 Processing the escape chars in context: 2");
#endif
if (process_escapes(NULL, &stdin_buffer,
&stdout_buffer, &stderr_buffer, buf, len) == -1)
return;
......@@ -1548,6 +1560,10 @@ client_simple_escape_filter(Channel *c, char *buf, int len)
if (c->extended_usage != CHAN_EXTENDED_WRITE)
return 0;
#ifdef DEBUG
debug("NX> 280 Processing the escape chars in context: 3");
#endif
return process_escapes(c, &c->input, &c->output, &c->extended,
buf, len);
}
......
......@@ -148,11 +148,13 @@ set_nodelay(int fd)
return;
}
if (opt == 1) {
debug("NX> 286 SSH reports TCP_NODELAY already set on descriptor: %d", fd);
debug2("fd %d is TCP_NODELAY", fd);
return;
}
opt = 1;
debug2("fd %d setting TCP_NODELAY", fd);
debug("NX> 286 SSH is setting TCP_NODELAY on descriptor: %d", fd);
if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof opt) == -1)
error("setsockopt TCP_NODELAY: %.100s", strerror(errno));
}
......
......@@ -1452,6 +1452,11 @@ ssh_packet_read_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
timeoutp = &timeout;
}
/* Wait for some data to arrive. */
#ifdef TEST
debug("NX> 280 Calling the NX select in context: 7");
#endif
for (;;) {
if (state->packet_timeout_ms != -1) {
ms_to_timeval(&timeout, ms_remain);
......@@ -1479,7 +1484,7 @@ ssh_packet_read_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
#ifdef TEST
logit("NX> 280 Reading: %u bytes from fd: %d in context: 7",
sizeof(buf), connection_in);
sizeof(buf), state->connection_in);
#endif
len = read(state->connection_in, buf, sizeof(buf));
......@@ -2275,6 +2280,11 @@ ssh_packet_write_wait(struct ssh *ssh)
ms_remain = state->packet_timeout_ms;
timeoutp = &timeout;
}
#ifdef TEST
debug("NX> 280 Calling the NX select in context: 9");
#endif
for (;;) {
if (state->packet_timeout_ms != -1) {
ms_to_timeval(&timeout, ms_remain);
......@@ -2329,6 +2339,17 @@ ssh_packet_not_very_much_data_to_write(struct ssh *ssh)
void
ssh_packet_set_tos(struct ssh *ssh, int tos)
{
#if defined(IP_TOS) && !defined(IP_TOS_IS_BROKEN)
if (ssh_packet_connection_is_on_socket(ssh)) {
debug("NX> 286 Setting %s on fd: %d",
(tos == IPTOS_LOWDELAY ? "IPTOS_LOWDELAY" : "IPTOS_THROUGHPUT"),
ssh->state->connection_in);
}
#else
debug("NX> 286 WARNING! Not setting TOS on fd: %d with IP_TOS: %d IP_TOS_IS_BROKEN: %d",
ssh->state->connection_in, IP_TOS, IP_TOS_IS_BROKEN);
#endif
#ifndef IP_TOS_IS_BROKEN
if (!ssh_packet_connection_is_on_socket(ssh))
return;
......@@ -2360,6 +2381,12 @@ ssh_packet_set_tos(struct ssh *ssh, int tos)
void
ssh_packet_set_interactive(struct ssh *ssh, int interactive, int qos_interactive, int qos_bulk)
{
debug("NX> 286 Called packet_set_interactive() for fd: %d interactive is: %d",
ssh->state->connection_in, interactive);
debug("NX> 286 Forcing interactive to: %d for fd: %d",
interactive, ssh->state->connection_in);
struct session_state *state = ssh->state;
if (state->set_interactive_called)
......
......@@ -534,6 +534,10 @@ main(int ac, char **av)
struct ssh_digest_ctx *md;
u_char conn_hash[SSH_DIGEST_MAX_LENGTH];
if (NxModeEnabled) {
logit("NX> 203 NXSSH running with pid: %d", getpid());
}
ssh_malloc_init(); /* must be called before any mallocs */
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
sanitise_stdfd();
......
......@@ -495,6 +495,11 @@ ssh_connect_direct(const char *host, struct addrinfo *aitop,
debug("Connection established.");
#ifdef TEST
logit("NX> 280 SSH connection established with fd: %d",
sock);
#endif
/* Set SO_KEEPALIVE if requested. */
if (want_keepalive &&
setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (void *)&on,
......@@ -1177,7 +1182,7 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
if (options.check_host_ip && host_status != HOST_CHANGED &&
ip_status == HOST_CHANGED) {
snprintf(msg, sizeof(msg),
"Warning: the %s host key for '%.200s' "
"NX> 212 Warning: the %s host key for '%.200s' "
"differs from the key for the IP address '%.128s'"
"\nOffending key for IP in %s:%lu",
type, host, ip, ip_found->file, ip_found->line);
......@@ -1385,10 +1390,14 @@ ssh_login(Sensitive *sensitive, const char *orighost,
debug("Authenticating to %s:%d as '%s'", host, port, server_user);
if (compat20) {
ssh_kex2(host, hostaddr, port);
if (NxModeEnabled)
logit("NX> 202 Authenticating user: %.200s", server_user);
ssh_userauth2(local_user, server_user, host, sensitive);
} else {
#ifdef WITH_SSH1
ssh_kex(host, hostaddr);
if (NxModeEnabled)
logit("NX> 202 Authenticating user: %.200s", server_user);
ssh_userauth1(local_user, server_user, host, sensitive);
#else
fatal("ssh1 is not supported");
......
......@@ -1239,7 +1239,7 @@ load_identity_file(Identity *id)
return NULL;
}
snprintf(prompt, sizeof prompt,
"Enter passphrase for key '%.100s': ", id->filename);
"NX> 210 Enter passphrase for key '%.100s': ", id->filename);
for (i = 0; i <= options.number_of_password_prompts; i++) {
if (i == 0)
passphrase = "";
......@@ -1896,7 +1896,11 @@ authmethod_lookup(const char *name)
for (method = authmethods; method->name != NULL; method++)
if (strcmp(name, method->name) == 0)
return method;
debug2("Unrecognized authentication method name: %s", name ? name : "NULL");
if (NxAuthOnlyModeEnabled) {
debug2("Skipping authentication method name: %s", name ? name : "NULL");
} else {
debug2("Unrecognized authentication method name: %s", name ? name : "NULL");
}
return NULL;
}
......
......@@ -302,7 +302,7 @@ tty_make_modes(int fd, struct termios *tiop)
goto end;
}
if (tcgetattr(fd, &tio) == -1) {
logit("tcgetattr: %.100s", strerror(errno));
// logit("tcgetattr: %.100s", strerror(errno));
goto end;
}
} else
......@@ -371,7 +371,7 @@ tty_parse_modes(int fd, int *n_bytes_ptr)
* modes, they will initially have reasonable values.
*/
if (tcgetattr(fd, &tio) == -1) {
logit("tcgetattr: %.100s", strerror(errno));
// logit("tcgetattr: %.100s", strerror(errno));
failure = -1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment