Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
97ecde70
Commit
97ecde70
authored
7 years ago
by
echicken
Browse files
Options
Downloads
Patches
Plain Diff
Keep this thing current with what's in GitHub. bleh
parent
b02604a5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/websocket-rlogin-service.js
+22
-18
22 additions, 18 deletions
exec/websocket-rlogin-service.js
with
22 additions
and
18 deletions
exec/websocket-rlogin-service.js
+
22
−
18
View file @
97ecde70
...
...
@@ -236,7 +236,7 @@ var RLoginClient = function(options) {
if
(
!
state
.
connected
)
throw
'
RLogin.send: not connected.
'
;
if
(
state
.
suspendInput
)
throw
'
RLogin.send: input has been suspended.
'
;
if
(
typeof
data
===
'
string
'
)
{
data
=
data
.
split
(
''
).
map
(
function
(
d
)
{
return
ascii
(
d
);
});
}
...
...
@@ -294,21 +294,21 @@ var RLoginClient = function(options) {
}
this
.
connect
=
function
()
{
if
(
typeof
options
.
port
!==
'
number
'
||
typeof
options
.
host
!=
'
string
'
)
{
throw
'
RLogin: invalid host or port argument.
'
;
}
if
(
typeof
options
.
clientUsername
!==
'
string
'
)
{
throw
'
RLogin: invalid clientUsername argument.
'
;
}
if
(
typeof
options
.
serverUsername
!==
'
string
'
)
{
throw
'
RLogin: invalid serverUsername argument.
'
;
}
if
(
typeof
options
.
terminalType
!==
'
string
'
)
{
throw
'
RLogin: invalid terminalType argument.
'
;
}
...
...
@@ -363,23 +363,27 @@ try {
wss
=
new
WebSocketProxy
(
client
);
if
(
typeof
wss
.
headers
[
'
Cookie
'
]
==
=
'
undefined
'
)
{
if
(
typeof
wss
.
headers
[
'
Cookie
'
]
==
'
undefined
'
)
{
err
(
'
No cookie from WebSocket client.
'
);
}
// Should probably search for the right cookie instead of assuming
var
cookie
=
wss
.
headers
[
'
Cookie
'
].
split
(
'
=
'
);
if
(
cookie
[
0
]
!==
'
synchronet
'
||
cookie
.
length
<
2
)
{
err
(
'
Invalid cookie from WebSocket client.
'
);
}
var
cookie
=
null
;
wss
.
headers
[
'
Cookie
'
].
split
(
'
;
'
).
some
(
function
(
e
)
{
if
(
e
.
search
(
/^
\s
*synchronet
\=
/
)
==
0
)
{
cookie
=
e
;
return
true
;
}
else
{
return
false
;
}
}
);
if
(
cookie
===
null
)
err
(
'
Invalid cookie from WebSocket client.
'
);
cookie
=
cookie
.
replace
(
/^
\s
*synchronet
\=
/
,
''
).
split
(
'
,
'
);
cookie
=
cookie
[
1
].
split
(
'
,
'
);
cookie
[
0
]
=
parseInt
(
cookie
[
0
]);
if
(
cookie
.
length
<
2
||
isNaN
(
cookie
[
0
])
||
cookie
[
0
]
<
1
||
cookie
[
0
]
>
system
.
lastuser
)
{
if
(
cookie
.
length
<
2
||
isNaN
(
cookie
[
0
])
||
cookie
[
0
]
<
1
||
cookie
[
0
]
>
system
.
lastuser
)
{
log
(
'
cookie
'
+
JSON
.
stringify
(
cookie
));
err
(
'
Invalid cookie from WebSocket client.
'
);
}
...
...
@@ -444,4 +448,4 @@ try {
}
finally
{
rlogin
.
disconnect
();
client
.
socket
.
close
();
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment