Update vendored library github.com/pkg/sftp

This commit is contained in:
Alexander Neumann committed 2018-03-30 12:37:16 +02:00
1 parent d9ba9279e0
commit 19035e977b
27 files changed
+494 -240

No files matched your search

+26 -16
View File
@@ -462,7 +462,7 @@ func (p sshFxpSetstatPacket) respond(svr *Server) error {
var uid uint32
var gid uint32
if uid, b, err = unmarshalUint32Safe(b); err != nil {
} else if gid, b, err = unmarshalUint32Safe(b); err != nil {
} else if gid, _, err = unmarshalUint32Safe(b); err != nil {
} else {
err = os.Chown(p.Path, int(uid), int(gid))
}
@@ -509,7 +509,7 @@ func (p sshFxpFsetstatPacket) respond(svr *Server) error {
var uid uint32
var gid uint32
if uid, b, err = unmarshalUint32Safe(b); err != nil {
} else if gid, b, err = unmarshalUint32Safe(b); err != nil {
} else if gid, _, err = unmarshalUint32Safe(b); err != nil {
} else {
err = f.Chown(int(uid), int(gid))
}
@@ -548,23 +548,33 @@ func statusFromError(p ider, err error) sshFxpStatusPacket {
Code: ssh_FX_OK,
},
}
if err != nil {
debug("statusFromError: error is %T %#v", err, err)
ret.StatusError.Code = ssh_FX_FAILURE
ret.StatusError.msg = err.Error()
if err == io.EOF {
ret.StatusError.Code = ssh_FX_EOF
} else if err == os.ErrNotExist {
ret.StatusError.Code = ssh_FX_NO_SUCH_FILE
} else if errno, ok := err.(syscall.Errno); ok {
if err == nil {
return ret
}
debug("statusFromError: error is %T %#v", err, err)
ret.StatusError.Code = ssh_FX_FAILURE
ret.StatusError.msg = err.Error()
switch e := err.(type) {
case syscall.Errno:
ret.StatusError.Code = translateErrno(e)
case *os.PathError:
debug("statusFromError,pathError: error is %T %#v", e.Err, e.Err)
if errno, ok := e.Err.(syscall.Errno); ok {
ret.StatusError.Code = translateErrno(errno)
} else if pathError, ok := err.(*os.PathError); ok {
debug("statusFromError: error is %T %#v", pathError.Err, pathError.Err)
if errno, ok := pathError.Err.(syscall.Errno); ok {
ret.StatusError.Code = translateErrno(errno)
}
}
case fxerr:
ret.StatusError.Code = uint32(e)
default:
switch e {
case io.EOF:
ret.StatusError.Code = ssh_FX_EOF
case os.ErrNotExist:
ret.StatusError.Code = ssh_FX_NO_SUCH_FILE
}
}
return ret
}