mirror of https://github.com/pkg/sftp.git
parent
f881033388
commit
ea8e50a388
|
@ -210,13 +210,12 @@ type sshFxpOpenPacket struct {
|
||||||
Path string
|
Path string
|
||||||
Pflags uint32
|
Pflags uint32
|
||||||
Flags uint32 // ignored
|
Flags uint32 // ignored
|
||||||
Size uint64 // ignored
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p sshFxpOpenPacket) MarshalBinary() ([]byte, error) {
|
func (p sshFxpOpenPacket) MarshalBinary() ([]byte, error) {
|
||||||
l := 1 + 4 +
|
l := 1 + 4 +
|
||||||
4 + len(p.Path) +
|
4 + len(p.Path) +
|
||||||
4 + 4 + 8
|
4 + 4
|
||||||
|
|
||||||
b := make([]byte, 0, l)
|
b := make([]byte, 0, l)
|
||||||
b = append(b, ssh_FXP_OPEN)
|
b = append(b, ssh_FXP_OPEN)
|
||||||
|
@ -224,7 +223,6 @@ func (p sshFxpOpenPacket) MarshalBinary() ([]byte, error) {
|
||||||
b = marshalString(b, p.Path)
|
b = marshalString(b, p.Path)
|
||||||
b = marshalUint32(b, p.Pflags)
|
b = marshalUint32(b, p.Pflags)
|
||||||
b = marshalUint32(b, p.Flags)
|
b = marshalUint32(b, p.Flags)
|
||||||
b = marshalUint64(b, p.Size)
|
|
||||||
return b, nil
|
return b, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ var sendPacketTests = []struct {
|
||||||
Id: 1,
|
Id: 1,
|
||||||
Path: "/foo",
|
Path: "/foo",
|
||||||
Pflags: flags(os.O_RDONLY),
|
Pflags: flags(os.O_RDONLY),
|
||||||
}, []byte{0x0, 0x0, 0x0, 0x1d, 0x3, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x4, 0x2f, 0x66, 0x6f, 0x6f, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}},
|
}, []byte{0x0, 0x0, 0x0, 0x15, 0x3, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x4, 0x2f, 0x66, 0x6f, 0x6f, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0,}},
|
||||||
|
|
||||||
{sshFxpWritePacket{
|
{sshFxpWritePacket{
|
||||||
Id: 124,
|
Id: 124,
|
||||||
|
|
Loading…
Reference in New Issue