"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
smb: Add workstation field to smb backend
Kalin Stoyanov4928459f468b
diff --git a/backend/smb/connpool.go b/backend/smb/connpool.goindex 379866137..0aad733ce 100644--- a/backend/smb/connpool.go+++ b/backend/smb/connpool.go@@ -60,10 +60,11 @@ func (f *Fs) dial(ctx context.Context, network, addr string) (c *conn, err error}} else {d.Initiator = &smb2.NTLMInitiator{- User: f.opt.User,- Password: pass,- Domain: f.opt.Domain,- TargetSPN: f.opt.SPN,+ User: f.opt.User,+ Password: pass,+ Domain: f.opt.Domain,+ Workstation: f.opt.Workstation,+ TargetSPN: f.opt.SPN,}}diff --git a/backend/smb/smb.go b/backend/smb/smb.goindex b179bcabb..541a4fcd0 100644--- a/backend/smb/smb.go+++ b/backend/smb/smb.go@@ -79,6 +79,17 @@ authentication, and it often needs to be set for clusters. For example:Leave blank if not sure.`,Sensitive: true,+ }, {+ Name: "workstation",+ Help: `Workstation name sent in NTLM authentication.++The NetBIOS name sent as the client workstation in the NTLM AUTHENTICATE+message. Some servers (e.g. domain-joined Windows servers with per-account+workstation restrictions or NTLM allow-lists) require this to match a+specific name. Leave blank to send no workstation name (the default).+`,+ Advanced: true,+ Sensitive: true,}, {Name: "use_kerberos",Help: `Use Kerberos authentication.@@ -153,6 +164,7 @@ type Options struct {Pass string `config:"pass"`Domain string `config:"domain"`SPN string `config:"spn"`+ Workstation string `config:"workstation"`UseKerberos bool `config:"use_kerberos"`KerberosCCache string `config:"kerberos_ccache"`HideSpecial bool `config:"hide_special_share"`diff --git a/backend/smb/smb_internal_test.go b/backend/smb/smb_internal_test.goindex 00642ead7..f11e131d1 100644--- a/backend/smb/smb_internal_test.go+++ b/backend/smb/smb_internal_test.go@@ -12,6 +12,8 @@ import ("time""github.com/rclone/rclone/fs"+ "github.com/rclone/rclone/fs/config/configmap"+ "github.com/rclone/rclone/fs/config/configstruct""github.com/rclone/rclone/fs/object""github.com/rclone/rclone/fstest""github.com/stretchr/testify/assert"@@ -93,6 +95,33 @@ func TestUploadConnectionReuse(t *testing.T) {assert.Equal(t, 1, pooled, "upload should leave exactly one connection in the pool")}+// TestOptionsWorkstationConfig verifies the workstation config key is backwards compatible+func TestOptionsWorkstationConfig(t *testing.T) {+ tests := []struct {+ name string+ workstation string+ }{+ {"named workstation", "MYWORKSTATION"},+ {"empty workstation sends no name", ""},+ }++ for _, tt := range tests {+ t.Run(tt.name, func(t *testing.T) {+ m := configmap.Simple{+ "host": "example.com",+ "workstation": tt.workstation,+ }+ opt := new(Options)+ if err := configstruct.Set(m, opt); err != nil {+ t.Fatalf("configstruct.Set failed: %v", err)+ }+ if opt.Workstation != tt.workstation {+ t.Errorf("opt.Workstation = %q, want %q", opt.Workstation, tt.workstation)+ }+ })+ }+}+// TestIsPathDir tests the isPathDir function logicfunc TestIsPathDir(t *testing.T) {tests := []struct {