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
952f26c1
Commit
952f26c1
authored
Nov 08, 2019
by
Eric
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[bugfix] fix bugs
parent
b4ed7c7a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
sftp.go
pkg/handler/sftp.go
+3
-3
wrappersession.go
pkg/handler/wrappersession.go
+5
-0
No files found.
pkg/handler/sftp.go
View file @
952f26c1
...
...
@@ -34,7 +34,7 @@ func SftpHandler(sess ssh.Session) {
logger
.
Infof
(
"SFTP request %s: Handler start"
,
reqID
)
req
:=
sftp
.
NewRequestServer
(
sess
,
handlers
)
if
err
:=
req
.
Serve
();
err
==
io
.
EOF
{
logger
.
Debug
(
"SFTP request %s: Exited session."
,
reqID
)
logger
.
Debug
f
(
"SFTP request %s: Exited session."
,
reqID
)
}
else
if
err
!=
nil
{
logger
.
Errorf
(
"SFTP request %s: Server completed with error %s"
,
reqID
,
err
)
}
...
...
@@ -82,7 +82,7 @@ func (fs *sftpHandler) Filecmd(r *sftp.Request) (err error) {
case
"Setstat"
:
return
case
"Rename"
:
logger
.
Debug
(
"%s=>%s"
,
r
.
Filepath
,
r
.
Target
)
logger
.
Debug
f
(
"%s=>%s"
,
r
.
Filepath
,
r
.
Target
)
return
fs
.
Rename
(
r
.
Filepath
,
r
.
Target
)
case
"Rmdir"
:
err
=
fs
.
RemoveDirectory
(
r
.
Filepath
)
...
...
@@ -91,7 +91,7 @@ func (fs *sftpHandler) Filecmd(r *sftp.Request) (err error) {
case
"Mkdir"
:
err
=
fs
.
MkdirAll
(
r
.
Filepath
)
case
"Symlink"
:
logger
.
Debug
(
"%s=>%s"
,
r
.
Filepath
,
r
.
Target
)
logger
.
Debug
f
(
"%s=>%s"
,
r
.
Filepath
,
r
.
Target
)
err
=
fs
.
Symlink
(
r
.
Filepath
,
r
.
Target
)
default
:
return
...
...
pkg/handler/wrappersession.go
View file @
952f26c1
...
...
@@ -61,6 +61,11 @@ func (w *WrapperSession) Read(p []byte) (int, error) {
}
func
(
w
*
WrapperSession
)
Close
()
error
{
select
{
case
<-
w
.
closed
:
return
nil
default
:
}
err
:=
w
.
inWriter
.
Close
()
w
.
initReadPip
()
return
err
...
...
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