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
1f8b3300
Commit
1f8b3300
authored
8 years ago
by
Stas Korobeynikov
Committed by
Pavel Vainerman
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add hostkeyadd use options
parent
9553287a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
sshconnect.c
sshconnect.c
+28
-0
No files found.
sshconnect.c
View file @
1f8b3300
...
@@ -1227,6 +1227,10 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
...
@@ -1227,6 +1227,10 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
switch
(
host_status
)
{
switch
(
host_status
)
{
case
HOST_OK
:
case
HOST_OK
:
/* The host is known and the key matches. */
/* The host is known and the key matches. */
if
(
options
.
hostkeyadd
==
1
)
{
exit
(
0
);
}
debug
(
"Host '%.200s' is known and matches the %s host %s."
,
debug
(
"Host '%.200s' is known and matches the %s host %s."
,
host
,
type
,
want_cert
?
"certificate"
:
"key"
);
host
,
type
,
want_cert
?
"certificate"
:
"key"
);
debug
(
"Found %s in %s:%lu"
,
want_cert
?
"CA key"
:
"key"
,
debug
(
"Found %s in %s:%lu"
,
want_cert
?
"CA key"
:
"key"
,
...
@@ -1275,6 +1279,9 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
...
@@ -1275,6 +1279,9 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
if
(
readonly
||
want_cert
)
if
(
readonly
||
want_cert
)
goto
fail
;
goto
fail
;
/* The host is new. */
/* The host is new. */
if
(
options
.
hostkeyadd
==
1
)
{
error
(
":Host %.200s is added to know hosts"
,
host
);
}
if
(
options
.
strict_host_key_checking
==
1
)
{
if
(
options
.
strict_host_key_checking
==
1
)
{
/*
/*
* User has requested strict host key checking. We
* User has requested strict host key checking. We
...
@@ -1358,6 +1365,8 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
...
@@ -1358,6 +1365,8 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
else
else
logit
(
"Warning: Permanently added '%.200s' (%s) to the "
logit
(
"Warning: Permanently added '%.200s' (%s) to the "
"list of known hosts."
,
hostp
,
type
);
"list of known hosts."
,
hostp
,
type
);
if
(
options
.
hostkeyadd
==
1
)
exit
(
0
);
break
;
break
;
case
HOST_REVOKED
:
case
HOST_REVOKED
:
error
(
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
);
error
(
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
);
...
@@ -1379,6 +1388,21 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
...
@@ -1379,6 +1388,21 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
goto
continue_unsafe
;
goto
continue_unsafe
;
case
HOST_CHANGED
:
case
HOST_CHANGED
:
if
(
options
.
hostkeyadd
==
1
)
{
if
(
options
.
check_host_ip
&&
ip_status
==
HOST_NEW
)
{
snprintf
(
hostline
,
sizeof
(
hostline
),
"%s,%s"
,
host
,
ip
);
hostp
=
hostline
;
}
else
hostp
=
host
;
if
(
!
add_host_to_hostfile
(
user_hostfiles
[
0
],
hostp
,
host_key
,
options
.
hash_known_hosts
))
logit
(
"Failed to add the host to the list of known "
"hosts (%.500s)."
,
user_hostfiles
[
0
]);
else
logit
(
"Warning: Permanently added '%.200s' (%s) to the "
"list of known hosts."
,
hostp
,
type
);
exit
(
0
);
}
if
(
want_cert
)
{
if
(
want_cert
)
{
/*
/*
* This is only a debug() since it is valid to have
* This is only a debug() since it is valid to have
...
@@ -1708,12 +1732,16 @@ ssh_login(Sensitive *sensitive, const char *orighost,
...
@@ -1708,12 +1732,16 @@ 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
(
options
.
onlycheck
==
1
)
exit
(
0
);
if
(
NxModeEnabled
)
if
(
NxModeEnabled
)
logit
(
"NX> 202 Authenticating user: %.200s"
,
server_user
);
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
(
options
.
onlycheck
==
1
)
exit
(
0
);
if
(
NxModeEnabled
)
if
(
NxModeEnabled
)
logit
(
"NX> 202 Authenticating user: %.200s"
,
server_user
);
logit
(
"NX> 202 Authenticating user: %.200s"
,
server_user
);
ssh_userauth1
(
local_user
,
server_user
,
host
,
sensitive
);
ssh_userauth1
(
local_user
,
server_user
,
host
,
sensitive
);
...
...
This diff is collapsed.
Click to expand it.
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