Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LEFEBVREJP email
rsm
Commits
da03c8eb
Commit
da03c8eb
authored
Jan 17, 2020
by
LEFEBVREJP email
Browse files
Fixing double free of session.
parent
052b45f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
rsmcore/sessionworker.cc
View file @
da03c8eb
...
...
@@ -35,6 +35,7 @@ class SessionWorkerImpl
if
(
session
!=
nullptr
)
{
ssh_free
(
session
);
ssh_finalize
();
}
}
};
...
...
@@ -107,8 +108,6 @@ void SessionWorker::disconnect()
{
radix_tagged_line
(
"Disconnecting session."
);
ssh_disconnect
(
p
->
session
);
ssh_free
(
p
->
session
);
ssh_finalize
();
}
}
...
...
@@ -264,6 +263,7 @@ void SessionWorker::requestExec(QString command)
{
assert_ssh_session
(
p
->
session
,
"request_exec() -- Session is not allocated."
);
radix_tagged_line
(
"requestExec("
<<
command
.
toStdString
()
<<
")"
);
char
buffer
[
256
];
// clear any previous buffer
p
->
output_buffer
.
clear
();
...
...
@@ -294,10 +294,10 @@ void SessionWorker::requestExec(QString command)
{
p
->
output_buffer
.
append
(
buffer
,
nbytes
);
emit
execOutputReady
();
radix
(
nbytes
);
nbytes
=
ssh_channel_read
(
channel
,
buffer
,
sizeof
(
buffer
),
0
);
}
radix_tagged_line
();
radix_tagged_line
(
"nbytes="
<<
nbytes
);
radix_tagged_line
(
"Finished reading response
\n
"
<<
p
->
output_buffer
.
data
());
if
(
nbytes
==
0
)
{
...
...
rsmcore/tests/tstSession.cc
View file @
da03c8eb
...
...
@@ -5,13 +5,14 @@
using
namespace
rsm
;
TEST
(
RSM
,
Session
)
{
SessionWorker
session
(
"
warroom4
"
);
session
.
setLogVerbosity
(
SessionWorker
::
Verbosity
::
Functi
on
s
);
SessionWorker
session
(
"
nfecc
"
);
session
.
setLogVerbosity
(
SessionWorker
::
Verbosity
::
N
on
e
);
session
.
setPort
(
22
);
session
.
setUser
(
"jap"
);
session
.
connect
();
// 1) hand-shake with host
session
.
verifyKnownHost
();
// 2) verify host is known/acceptable
session
.
authenticate
();
// 3) process authentication
session
.
requestExec
(
"ls -la"
);
session
.
requestExec
(
"ls modulefiles"
);
session
.
disconnect
();
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment