Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
K
koko
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
koko
Commits
b4ed7c7a
Unverified
Commit
b4ed7c7a
authored
Nov 06, 2019
by
Eric_Lee
Committed by
GitHub
Nov 06, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #144 from jumpserver/dev_bugfix
[Bugfix] fix telnet login connect bug
parents
4ca19af8
2843aeaa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
telnetconn.go
pkg/srvconn/telnetconn.go
+5
-5
No files found.
pkg/srvconn/telnetconn.go
View file @
b4ed7c7a
...
...
@@ -27,7 +27,7 @@ const (
SAG
=
3
ECHO
=
1
loginRegs
=
"(?i)login:?
\\
s*$|username:?
\\
s*$|name:?
\\
s*$|用户名:?
\\
s*$|账
\\
s*号:?
\\
s*$"
loginRegs
=
"(?i)login:?
\\
s*$|username:?
\\
s*$|name:?
\\
s*$|用户名:?
\\
s*$|账
\\
s*号:?
\\
s*$
|user:?
\\
s*$
"
passwordRegs
=
"(?i)Password:?
\\
s*$|ssword:?
\\
s*$|passwd:?
\\
s*$|密
\\
s*码:?
\\
s*$"
FailedRegs
=
"(?i)incorrect|failed|失败|错误"
DefaultSuccessRegs
=
"(?i)Last
\\
s*login|success|成功|#|>|
\\
$"
...
...
@@ -122,11 +122,11 @@ func (tc *ServerTelnetConnection) login(data []byte) AuthStatus {
return
AuthFailed
}
else
if
usernamePattern
.
Match
(
data
)
{
_
,
_
=
tc
.
conn
.
Write
([]
byte
(
tc
.
SystemUser
.
Username
+
"
\r\n
"
))
logger
.
Debug
(
"Username pattern match:
"
,
data
)
logger
.
Debug
f
(
"Username pattern match: %s
"
,
data
)
return
AuthPartial
}
else
if
passwordPattern
.
Match
(
data
)
{
_
,
_
=
tc
.
conn
.
Write
([]
byte
(
tc
.
SystemUser
.
Password
+
"
\r\n
"
))
logger
.
Debug
(
"Password pattern
"
,
data
)
logger
.
Debug
f
(
"Password pattern: %s
"
,
data
)
return
AuthPartial
}
else
if
successPattern
.
Match
(
data
)
{
return
AuthSuccess
...
...
@@ -169,7 +169,7 @@ func (tc *ServerTelnetConnection) Connect(h, w int, term string) (err error) {
return
}
if
tc
.
SystemUser
.
Password
==
""
{
if
tc
.
SystemUser
.
Password
==
""
{
info
:=
service
.
GetSystemUserAssetAuthInfo
(
tc
.
SystemUser
.
ID
,
asset
.
ID
)
tc
.
SystemUser
.
Password
=
info
.
Password
tc
.
SystemUser
.
PrivateKey
=
info
.
PrivateKey
...
...
@@ -193,7 +193,7 @@ func (tc *ServerTelnetConnection) Connect(h, w int, term string) (err error) {
case
AuthSuccess
:
return
nil
case
AuthFailed
:
return
errors
.
New
(
"
F
ailed login"
)
return
errors
.
New
(
"
f
ailed login"
)
default
:
continue
}
...
...
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