Does this resolve issues with fullFilePath

This commit is contained in:
Melon 2025-02-01 00:59:28 +00:00
parent 432c907303
commit a23155a827
Signed by: melon
GPG Key ID: 6C9D970C50D26A25

View File

@ -221,7 +221,11 @@ func setupFakeSSH(wg *sync.WaitGroup, call func(addrPort netip.AddrPort, pubKey
panic(err) panic(err)
} }
var fullFilePath string var fullFilePath *string
{
a := ""
fullFilePath = &a
}
// Sessions have out-of-band requests such as "shell", // Sessions have out-of-band requests such as "shell",
// "pty-req" and "env". Here we handle only the // "pty-req" and "env". Here we handle only the
@ -245,7 +249,7 @@ func setupFakeSSH(wg *sync.WaitGroup, call func(addrPort netip.AddrPort, pubKey
} }
filePath := cmd[len(scpStartStr) : len(cmd)-1] filePath := cmd[len(scpStartStr) : len(cmd)-1]
fmt.Println("Writing file:", filePath) fmt.Println("Writing file:", filePath)
fullFilePath = filePath *fullFilePath = filePath
} }
} }
wg.Done() wg.Done()
@ -284,8 +288,8 @@ func setupFakeSSH(wg *sync.WaitGroup, call func(addrPort netip.AddrPort, pubKey
fileSize := must(strconv.Atoi(fileSizeStr[:len(fileSizeStr)-1])) fileSize := must(strconv.Atoi(fileSizeStr[:len(fileSizeStr)-1]))
fileName := strings.TrimSpace(string(must(io.ReadAll(r)))) fileName := strings.TrimSpace(string(must(io.ReadAll(r))))
if fileName != filepath.Base(fullFilePath) { if fileName != filepath.Base(*fullFilePath) {
panic(fmt.Errorf("invalid file name (expected \"%s\" from full path \"%s\" but got \"%s\")", filepath.Base(fullFilePath), fullFilePath, fileName)) panic(fmt.Errorf("invalid file name (expected \"%s\" from full path \"%s\" but got \"%s\")", filepath.Base(*fullFilePath), *fullFilePath, fileName))
} }
if fileName != "420.cert.pem" && fileName != "420.key.pem" { if fileName != "420.cert.pem" && fileName != "420.key.pem" {