66 "crypto/subtle"
77 "crypto/tls"
88 "crypto/x509"
9- "debug/elf"
10- "debug/macho"
11- "debug/pe"
129 "encoding/base64"
1310 "errors"
1411 "fmt"
@@ -18,14 +15,11 @@ import (
1815 "net"
1916 "os"
2017 "os/exec"
21- "os/user"
2218 "path/filepath"
23- "runtime"
2419 "strconv"
2520 "strings"
2621 "sync"
2722 "sync/atomic"
28- "syscall"
2923 "time"
3024
3125 "github.com/hashicorp/go-hclog"
@@ -497,54 +491,6 @@ var peTypes = map[uint16]string{
497491 0xaa64 : "arm64" ,
498492}
499493
500- // additionalNotesAboutCommand tries to get additional information about a command that might help diagnose
501- // why it won't run correctly. It runs as a best effort only.
502- func additionalNotesAboutCommand (path string ) string {
503- notes := ""
504- stat , err := os .Stat (path )
505- if err != nil {
506- return notes
507- }
508-
509- notes += "\n Additional notes about plugin:\n "
510- notes += fmt .Sprintf (" Path: %s\n " , path )
511- notes += fmt .Sprintf (" Mode: %s\n " , stat .Mode ())
512- statT , ok := stat .Sys ().(* syscall.Stat_t )
513- if ok {
514- currentUsername := "?"
515- if u , err := user .LookupId (strconv .FormatUint (uint64 (os .Getuid ()), 10 )); err == nil {
516- currentUsername = u .Username
517- }
518- currentGroup := "?"
519- if g , err := user .LookupGroupId (strconv .FormatUint (uint64 (os .Getgid ()), 10 )); err == nil {
520- currentGroup = g .Name
521- }
522- username := "?"
523- if u , err := user .LookupId (strconv .FormatUint (uint64 (statT .Uid ), 10 )); err == nil {
524- username = u .Username
525- }
526- group := "?"
527- if g , err := user .LookupGroupId (strconv .FormatUint (uint64 (statT .Gid ), 10 )); err == nil {
528- group = g .Name
529- }
530- notes += fmt .Sprintf (" Owner: %d [%s] (current: %d [%s])\n " , statT .Uid , username , os .Getuid (), currentUsername )
531- notes += fmt .Sprintf (" Group: %d [%s] (current: %d [%s])\n " , statT .Gid , group , os .Getgid (), currentGroup )
532- }
533-
534- if elfFile , err := elf .Open (path ); err == nil {
535- notes += fmt .Sprintf (" ELF architecture: %s (current architecture: %s)\n " , elfFile .Machine , runtime .GOARCH )
536- } else if machoFile , err := macho .Open (path ); err == nil {
537- notes += fmt .Sprintf (" MachO architecture: %s (current architecture: %s)\n " , machoFile .Cpu , runtime .GOARCH )
538- } else if peFile , err := pe .Open (path ); err == nil {
539- machine , ok := peTypes [peFile .Machine ]
540- if ! ok {
541- machine = "unknown"
542- }
543- notes += fmt .Sprintf (" PE architecture: %s (current architecture: %s)\n " , machine , runtime .GOARCH )
544- }
545- return notes
546- }
547-
548494// Start the underlying subprocess, communicating with it to negotiate
549495// a port for RPC connections, and returning the address to connect via RPC.
550496//
0 commit comments