File tree Expand file tree Collapse file tree 3 files changed +7
-21
lines changed Expand file tree Collapse file tree 3 files changed +7
-21
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ func (p sshFxpStatusPacket) id() uint32 { return p.ID }
75
75
func (p sshFxpStatResponse ) id () uint32 { return p .ID }
76
76
func (p sshFxpNamePacket ) id () uint32 { return p .ID }
77
77
func (p sshFxpHandlePacket ) id () uint32 { return p .ID }
78
+ func (p StatVFS ) id () uint32 { return p .ID }
78
79
func (p sshFxVersionPacket ) id () uint32 { return 0 }
79
80
80
81
// take raw incoming packet data and build packet objects
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ package sftp
2
2
3
3
import (
4
4
"context"
5
- "encoding"
6
5
"io"
7
6
"os"
8
7
"path"
@@ -209,10 +208,7 @@ func (rs *RequestServer) packetWorker(
209
208
return errors .Errorf ("unexpected packet type %T" , pkt )
210
209
}
211
210
212
- err := rs .sendPacket (rpkt )
213
- if err != nil {
214
- return err
215
- }
211
+ rs .sendPacket (rpkt )
216
212
}
217
213
return nil
218
214
}
@@ -246,11 +242,6 @@ func cleanPath(p string) string {
246
242
}
247
243
248
244
// Wrap underlying connection methods to use packetManager
249
- func (rs * RequestServer ) sendPacket (m encoding.BinaryMarshaler ) error {
250
- if pkt , ok := m .(responsePacket ); ok {
251
- rs .pktMgr .readyPacket (pkt )
252
- } else {
253
- return errors .Errorf ("unexpected packet type %T" , m )
254
- }
255
- return nil
245
+ func (rs * RequestServer ) sendPacket (pkt responsePacket ) {
246
+ rs .pktMgr .readyPacket (pkt )
256
247
}
Original file line number Diff line number Diff line change @@ -140,9 +140,7 @@ func (svr *Server) sftpServerWorker(pktChan chan requestPacket) error {
140
140
// If server is operating read-only and a write operation is requested,
141
141
// return permission denied
142
142
if ! readonly && svr .readOnly {
143
- if err := svr .sendError (pkt , syscall .EPERM ); err != nil {
144
- return errors .Wrap (err , "failed to send read only packet response" )
145
- }
143
+ svr .sendError (pkt , syscall .EPERM )
146
144
continue
147
145
}
148
146
@@ -339,12 +337,8 @@ func (svr *Server) Serve() error {
339
337
}
340
338
341
339
// Wrap underlying connection methods to use packetManager
342
- func (svr * Server ) sendPacket (m encoding.BinaryMarshaler ) error {
343
- if pkt , ok := m .(responsePacket ); ok {
344
- svr .pktMgr .readyPacket (pkt )
345
- } else {
346
- return errors .Errorf ("unexpected packet type %T" , m )
347
- }
340
+ func (svr * Server ) sendPacket (pkt responsePacket ) error {
341
+ svr .pktMgr .readyPacket (pkt )
348
342
return nil
349
343
}
350
344
You can’t perform that action at this time.
0 commit comments