Merge pull request #303 from drakkan/extensions

define supported extensions in one place and use for both server and …
This commit is contained in:
John Eikenberry 2019-08-29 14:10:45 -07:00 committed by GitHub
commit 43a60a90f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View File

@ -151,7 +151,7 @@ func (rs *RequestServer) packetWorker(
var rpkt responsePacket
switch pkt := pkt.requestPacket.(type) {
case *sshFxInitPacket:
rpkt = sshFxVersionPacket{Version: sftpProtocolVersion}
rpkt = sshFxVersionPacket{Version: sftpProtocolVersion, Extensions: sftpExtensions}
case *sshFxpClosePacket:
handle := pkt.getHandle()
rpkt = statusFromError(pkt, rs.closeRequest(handle))

View File

@ -157,11 +157,8 @@ func handlePacket(s *Server, p orderedRequest) error {
switch p := p.requestPacket.(type) {
case *sshFxInitPacket:
rpkt = sshFxVersionPacket{
Version: sftpProtocolVersion,
Extensions: []sshExtensionPair{
{"hardlink@openssh.com", "1"},
{"posix-rename@openssh.com", "1"},
},
Version: sftpProtocolVersion,
Extensions: sftpExtensions,
}
case *sshFxpStatPacket:
// stat the requested file

View File

@ -85,6 +85,11 @@ const (
ssh_FXF_EXCL = 0x00000020
)
var sftpExtensions = []sshExtensionPair{
{"hardlink@openssh.com", "1"},
{"posix-rename@openssh.com", "1"},
}
type fxp uint8
func (f fxp) String() string {