Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nxssh
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Алексей Аляев
nxssh
Commits
74109f5c
Commit
74109f5c
authored
Nov 08, 2016
by
Stas Korobeynikov
Committed by
Pavel Vainerman
Oct 03, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add/fix log
parent
923a89e2
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
71 additions
and
7 deletions
+71
-7
channels.c
channels.c
+2
-0
clientloop.c
clientloop.c
+17
-1
misc.c
misc.c
+2
-0
packet.c
packet.c
+28
-1
ssh.c
ssh.c
+4
-0
sshconnect.c
sshconnect.c
+10
-1
sshconnect2.c
sshconnect2.c
+6
-2
ttymodes.c
ttymodes.c
+2
-2
No files found.
channels.c
View file @
74109f5c
...
@@ -3676,11 +3676,13 @@ channel_request_remote_forwarding(struct Forward *fwd)
...
@@ -3676,11 +3676,13 @@ channel_request_remote_forwarding(struct Forward *fwd)
/* Wait for response from the remote side. */
/* Wait for response from the remote side. */
type
=
packet_read
();
type
=
packet_read
();
logit
(
"%d"
,
type
);
switch
(
type
)
{
switch
(
type
)
{
case
SSH_SMSG_SUCCESS
:
case
SSH_SMSG_SUCCESS
:
success
=
1
;
success
=
1
;
break
;
break
;
case
SSH_SMSG_FAILURE
:
case
SSH_SMSG_FAILURE
:
logit
(
"Warning: Server denied remote port forwarding."
);
break
;
break
;
default:
default:
/* Unknown packet */
/* Unknown packet */
...
...
clientloop.c
View file @
74109f5c
...
@@ -424,6 +424,9 @@ client_x11_get_proto(const char *display, const char *xauth_path,
...
@@ -424,6 +424,9 @@ client_x11_get_proto(const char *display, const char *xauth_path,
got_data
=
1
;
got_data
=
1
;
if
(
f
)
if
(
f
)
pclose
(
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,
...
@@ -451,7 +454,7 @@ client_x11_get_proto(const char *display, const char *xauth_path,
u_int8_t
rnd
[
16
];
u_int8_t
rnd
[
16
];
u_int
i
;
u_int
i
;
logit
(
"Warning: No xauth data; "
debug
(
"Warning: No xauth data; "
"using fake authentication data for X11 forwarding."
);
"using fake authentication data for X11 forwarding."
);
strlcpy
(
proto
,
SSH_X11_PROTO
,
sizeof
proto
);
strlcpy
(
proto
,
SSH_X11_PROTO
,
sizeof
proto
);
arc4random_buf
(
rnd
,
sizeof
(
rnd
));
arc4random_buf
(
rnd
,
sizeof
(
rnd
));
...
@@ -1146,6 +1149,10 @@ process_escapes(Channel *c, Buffer *bin, Buffer *bout, Buffer *berr,
...
@@ -1146,6 +1149,10 @@ process_escapes(Channel *c, Buffer *bin, Buffer *bout, Buffer *berr,
if
(
len
<=
0
)
if
(
len
<=
0
)
return
(
0
);
return
(
0
);
#ifdef DEBUG
debug
(
"NX> 280 Processing the escape chars in context: 1"
);
#endif
for
(
i
=
0
;
i
<
(
u_int
)
len
;
i
++
)
{
for
(
i
=
0
;
i
<
(
u_int
)
len
;
i
++
)
{
/* Get one character at a time. */
/* Get one character at a time. */
ch
=
buf
[
i
];
ch
=
buf
[
i
];
...
@@ -1419,6 +1426,11 @@ client_process_input(fd_set *readset)
...
@@ -1419,6 +1426,11 @@ client_process_input(fd_set *readset)
* character and have to process the characters one
* character and have to process the characters one
* by one.
* by one.
*/
*/
#ifdef DEBUG
debug
(
"NX> 280 Processing the escape chars in context: 2"
);
#endif
if
(
process_escapes
(
NULL
,
&
stdin_buffer
,
if
(
process_escapes
(
NULL
,
&
stdin_buffer
,
&
stdout_buffer
,
&
stderr_buffer
,
buf
,
len
)
==
-
1
)
&
stdout_buffer
,
&
stderr_buffer
,
buf
,
len
)
==
-
1
)
return
;
return
;
...
@@ -1548,6 +1560,10 @@ client_simple_escape_filter(Channel *c, char *buf, int len)
...
@@ -1548,6 +1560,10 @@ client_simple_escape_filter(Channel *c, char *buf, int len)
if
(
c
->
extended_usage
!=
CHAN_EXTENDED_WRITE
)
if
(
c
->
extended_usage
!=
CHAN_EXTENDED_WRITE
)
return
0
;
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
,
return
process_escapes
(
c
,
&
c
->
input
,
&
c
->
output
,
&
c
->
extended
,
buf
,
len
);
buf
,
len
);
}
}
...
...
misc.c
View file @
74109f5c
...
@@ -148,11 +148,13 @@ set_nodelay(int fd)
...
@@ -148,11 +148,13 @@ set_nodelay(int fd)
return
;
return
;
}
}
if
(
opt
==
1
)
{
if
(
opt
==
1
)
{
debug
(
"NX> 286 SSH reports TCP_NODELAY already set on descriptor: %d"
,
fd
);
debug2
(
"fd %d is TCP_NODELAY"
,
fd
);
debug2
(
"fd %d is TCP_NODELAY"
,
fd
);
return
;
return
;
}
}
opt
=
1
;
opt
=
1
;
debug2
(
"fd %d setting TCP_NODELAY"
,
fd
);
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
)
if
(
setsockopt
(
fd
,
IPPROTO_TCP
,
TCP_NODELAY
,
&
opt
,
sizeof
opt
)
==
-
1
)
error
(
"setsockopt TCP_NODELAY: %.100s"
,
strerror
(
errno
));
error
(
"setsockopt TCP_NODELAY: %.100s"
,
strerror
(
errno
));
}
}
...
...
packet.c
View file @
74109f5c
...
@@ -1452,6 +1452,11 @@ ssh_packet_read_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
...
@@ -1452,6 +1452,11 @@ ssh_packet_read_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
timeoutp
=
&
timeout
;
timeoutp
=
&
timeout
;
}
}
/* Wait for some data to arrive. */
/* Wait for some data to arrive. */
#ifdef TEST
debug
(
"NX> 280 Calling the NX select in context: 7"
);
#endif
for
(;;)
{
for
(;;)
{
if
(
state
->
packet_timeout_ms
!=
-
1
)
{
if
(
state
->
packet_timeout_ms
!=
-
1
)
{
ms_to_timeval
(
&
timeout
,
ms_remain
);
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)
...
@@ -1479,7 +1484,7 @@ ssh_packet_read_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
#ifdef TEST
#ifdef TEST
logit
(
"NX> 280 Reading: %u bytes from fd: %d in context: 7"
,
logit
(
"NX> 280 Reading: %u bytes from fd: %d in context: 7"
,
sizeof
(
buf
),
connection_in
);
sizeof
(
buf
),
state
->
connection_in
);
#endif
#endif
len
=
read
(
state
->
connection_in
,
buf
,
sizeof
(
buf
));
len
=
read
(
state
->
connection_in
,
buf
,
sizeof
(
buf
));
...
@@ -2275,6 +2280,11 @@ ssh_packet_write_wait(struct ssh *ssh)
...
@@ -2275,6 +2280,11 @@ ssh_packet_write_wait(struct ssh *ssh)
ms_remain
=
state
->
packet_timeout_ms
;
ms_remain
=
state
->
packet_timeout_ms
;
timeoutp
=
&
timeout
;
timeoutp
=
&
timeout
;
}
}
#ifdef TEST
debug
(
"NX> 280 Calling the NX select in context: 9"
);
#endif
for
(;;)
{
for
(;;)
{
if
(
state
->
packet_timeout_ms
!=
-
1
)
{
if
(
state
->
packet_timeout_ms
!=
-
1
)
{
ms_to_timeval
(
&
timeout
,
ms_remain
);
ms_to_timeval
(
&
timeout
,
ms_remain
);
...
@@ -2329,6 +2339,17 @@ ssh_packet_not_very_much_data_to_write(struct ssh *ssh)
...
@@ -2329,6 +2339,17 @@ ssh_packet_not_very_much_data_to_write(struct ssh *ssh)
void
void
ssh_packet_set_tos
(
struct
ssh
*
ssh
,
int
tos
)
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
#ifndef IP_TOS_IS_BROKEN
if
(
!
ssh_packet_connection_is_on_socket
(
ssh
))
if
(
!
ssh_packet_connection_is_on_socket
(
ssh
))
return
;
return
;
...
@@ -2360,6 +2381,12 @@ ssh_packet_set_tos(struct ssh *ssh, int tos)
...
@@ -2360,6 +2381,12 @@ ssh_packet_set_tos(struct ssh *ssh, int tos)
void
void
ssh_packet_set_interactive
(
struct
ssh
*
ssh
,
int
interactive
,
int
qos_interactive
,
int
qos_bulk
)
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
;
struct
session_state
*
state
=
ssh
->
state
;
if
(
state
->
set_interactive_called
)
if
(
state
->
set_interactive_called
)
...
...
ssh.c
View file @
74109f5c
...
@@ -534,6 +534,10 @@ main(int ac, char **av)
...
@@ -534,6 +534,10 @@ main(int ac, char **av)
struct
ssh_digest_ctx
*
md
;
struct
ssh_digest_ctx
*
md
;
u_char
conn_hash
[
SSH_DIGEST_MAX_LENGTH
];
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 */
ssh_malloc_init
();
/* must be called before any mallocs */
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
sanitise_stdfd
();
sanitise_stdfd
();
...
...
sshconnect.c
View file @
74109f5c
...
@@ -495,6 +495,11 @@ ssh_connect_direct(const char *host, struct addrinfo *aitop,
...
@@ -495,6 +495,11 @@ ssh_connect_direct(const char *host, struct addrinfo *aitop,
debug
(
"Connection established."
);
debug
(
"Connection established."
);
#ifdef TEST
logit
(
"NX> 280 SSH connection established with fd: %d"
,
sock
);
#endif
/* Set SO_KEEPALIVE if requested. */
/* Set SO_KEEPALIVE if requested. */
if
(
want_keepalive
&&
if
(
want_keepalive
&&
setsockopt
(
sock
,
SOL_SOCKET
,
SO_KEEPALIVE
,
(
void
*
)
&
on
,
setsockopt
(
sock
,
SOL_SOCKET
,
SO_KEEPALIVE
,
(
void
*
)
&
on
,
...
@@ -1177,7 +1182,7 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
...
@@ -1177,7 +1182,7 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
if
(
options
.
check_host_ip
&&
host_status
!=
HOST_CHANGED
&&
if
(
options
.
check_host_ip
&&
host_status
!=
HOST_CHANGED
&&
ip_status
==
HOST_CHANGED
)
{
ip_status
==
HOST_CHANGED
)
{
snprintf
(
msg
,
sizeof
(
msg
),
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'"
"differs from the key for the IP address '%.128s'"
"
\n
Offending key for IP in %s:%lu"
,
"
\n
Offending key for IP in %s:%lu"
,
type
,
host
,
ip
,
ip_found
->
file
,
ip_found
->
line
);
type
,
host
,
ip
,
ip_found
->
file
,
ip_found
->
line
);
...
@@ -1385,10 +1390,14 @@ ssh_login(Sensitive *sensitive, const char *orighost,
...
@@ -1385,10 +1390,14 @@ ssh_login(Sensitive *sensitive, const char *orighost,
debug
(
"Authenticating to %s:%d as '%s'"
,
host
,
port
,
server_user
);
debug
(
"Authenticating to %s:%d as '%s'"
,
host
,
port
,
server_user
);
if
(
compat20
)
{
if
(
compat20
)
{
ssh_kex2
(
host
,
hostaddr
,
port
);
ssh_kex2
(
host
,
hostaddr
,
port
);
if
(
NxModeEnabled
)
logit
(
"NX> 202 Authenticating user: %.200s"
,
server_user
);
ssh_userauth2
(
local_user
,
server_user
,
host
,
sensitive
);
ssh_userauth2
(
local_user
,
server_user
,
host
,
sensitive
);
}
else
{
}
else
{
#ifdef WITH_SSH1
#ifdef WITH_SSH1
ssh_kex
(
host
,
hostaddr
);
ssh_kex
(
host
,
hostaddr
);
if
(
NxModeEnabled
)
logit
(
"NX> 202 Authenticating user: %.200s"
,
server_user
);
ssh_userauth1
(
local_user
,
server_user
,
host
,
sensitive
);
ssh_userauth1
(
local_user
,
server_user
,
host
,
sensitive
);
#else
#else
fatal
(
"ssh1 is not supported"
);
fatal
(
"ssh1 is not supported"
);
...
...
sshconnect2.c
View file @
74109f5c
...
@@ -1239,7 +1239,7 @@ load_identity_file(Identity *id)
...
@@ -1239,7 +1239,7 @@ load_identity_file(Identity *id)
return
NULL
;
return
NULL
;
}
}
snprintf
(
prompt
,
sizeof
prompt
,
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
++
)
{
for
(
i
=
0
;
i
<=
options
.
number_of_password_prompts
;
i
++
)
{
if
(
i
==
0
)
if
(
i
==
0
)
passphrase
=
""
;
passphrase
=
""
;
...
@@ -1896,7 +1896,11 @@ authmethod_lookup(const char *name)
...
@@ -1896,7 +1896,11 @@ authmethod_lookup(const char *name)
for
(
method
=
authmethods
;
method
->
name
!=
NULL
;
method
++
)
for
(
method
=
authmethods
;
method
->
name
!=
NULL
;
method
++
)
if
(
strcmp
(
name
,
method
->
name
)
==
0
)
if
(
strcmp
(
name
,
method
->
name
)
==
0
)
return
method
;
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
;
return
NULL
;
}
}
...
...
ttymodes.c
View file @
74109f5c
...
@@ -302,7 +302,7 @@ tty_make_modes(int fd, struct termios *tiop)
...
@@ -302,7 +302,7 @@ tty_make_modes(int fd, struct termios *tiop)
goto
end
;
goto
end
;
}
}
if
(
tcgetattr
(
fd
,
&
tio
)
==
-
1
)
{
if
(
tcgetattr
(
fd
,
&
tio
)
==
-
1
)
{
logit
(
"tcgetattr: %.100s"
,
strerror
(
errno
));
//
logit("tcgetattr: %.100s", strerror(errno));
goto
end
;
goto
end
;
}
}
}
else
}
else
...
@@ -371,7 +371,7 @@ tty_parse_modes(int fd, int *n_bytes_ptr)
...
@@ -371,7 +371,7 @@ tty_parse_modes(int fd, int *n_bytes_ptr)
* modes, they will initially have reasonable values.
* modes, they will initially have reasonable values.
*/
*/
if
(
tcgetattr
(
fd
,
&
tio
)
==
-
1
)
{
if
(
tcgetattr
(
fd
,
&
tio
)
==
-
1
)
{
logit
(
"tcgetattr: %.100s"
,
strerror
(
errno
));
//
logit("tcgetattr: %.100s", strerror(errno));
failure
=
-
1
;
failure
=
-
1
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment