From c190b9b14f94bcf84ed14bac04f1ddccb12c2a0c Mon Sep 17 00:00:00 2001
From: Nick Craig-Wood <nick@craig-wood.com>
Date: Fri, 22 Sep 2023 15:17:40 +0100
Subject: [PATCH] serve sftp: return not supported error for not supported
 commands

Before this change, if a hardlink command was issued, rclone would
just ignore it and not return an error.

This changes any unknown operations (including hardlink) to return an
unsupported error.
---
 cmd/serve/sftp/handler.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/cmd/serve/sftp/handler.go b/cmd/serve/sftp/handler.go
index aba3601a2..b937af80a 100644
--- a/cmd/serve/sftp/handler.go
+++ b/cmd/serve/sftp/handler.go
@@ -83,6 +83,10 @@ func (v vfsHandler) Filecmd(r *sftp.Request) error {
 		// link.symlink = r.Filepath
 		// v.files[r.Target] = link
 		return sftp.ErrSshFxOpUnsupported
+	case "Link":
+		return sftp.ErrSshFxOpUnsupported
+	default:
+		return sftp.ErrSshFxOpUnsupported
 	}
 	return nil
 }