Bläddra i källkod

Disable SMB server on Windows

Toby Chui 1 vecka sedan
förälder
incheckning
f1f797acc4
2 ändrade filer med 8 tillägg och 0 borttagningar
  1. 1 0
      .gitignore
  2. 7 0
      src/smbserver.go

+ 1 - 0
.gitignore

@@ -63,3 +63,4 @@ src/system/git/
 src/system/mail/
 src/system/cluster/
 src/system/cluster.db
+src/system/smb/secret.key

+ 7 - 0
src/smbserver.go

@@ -5,6 +5,7 @@ import (
 	"net/http"
 	"os"
 	"path/filepath"
+	"runtime"
 	"strings"
 	"time"
 	"unicode"
@@ -47,6 +48,12 @@ func netbiosName(host string) string {
 // SMBServerInit sets up the manager, its endpoints and its list entry. It runs
 // after the Samba wrapper, which it has to share port 445 with.
 func SMBServerInit(router, adminRouter *prout.RouterDef) {
+	//Windows keeps port 445 for its own file sharing, and only Windows 11 24H2
+	//and newer clients can reach another port, so on a Windows host the
+	//server, its settings and its endpoints are left out altogether
+	if runtime.GOOS == "windows" {
+		return
+	}
 	hostname, err := os.Hostname()
 	if err != nil {
 		hostname = *host_name