Files
vHost/backend/internal/isolation/credential_sessions_linux_test.go

17 lines
681 B
Go

//go:build linux
package isolation
import "testing"
func TestFTPSessionIdentificationDoesNotSelectRuntimeProcesses(t *testing.T) {
for _, test := range []struct {
name, exe string
unreadable, want bool
}{{"pure-ftpd", "/www/server/pure-ftpd/sbin/pure-ftpd", false, true}, {"node", "/www/server/nodejs/node", false, false}, {"node", "", true, false}, {"pure-ftpd", "/usr/bin/node", false, false}, {"pure-ftpd", "", true, true}, {"pure-ftpd-other", "", true, false}} {
if got := managedFTPProcess([]byte("Name:\t"+test.name+"\nUid:\t1001\t1001\t1001\t1001\n"), test.exe, test.unreadable); got != test.want {
t.Errorf("FTP match %s: %t", test.name, got)
}
}
}