cmd/fsu: remove import of internal package
test / test (push) Successful in 24s Details

Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
This commit is contained in:
Ophestra Umiker 2024-11-04 12:32:14 +09:00
parent af15b1c048
commit 88abcbe0b2
Signed by: cat
SSH Key Fingerprint: SHA256:gQ67O0enBZ7UdZypgtspB2FDM1g3GVw8nX0XSdcFw8Q
3 changed files with 10 additions and 5 deletions

View File

@ -8,16 +8,17 @@ import (
"strconv" "strconv"
"strings" "strings"
"syscall" "syscall"
"git.ophivana.moe/security/fortify/internal"
) )
const ( const (
compPoison = "INVALIDINVALIDINVALIDINVALIDINVALID"
fsuConfFile = "/etc/fsurc" fsuConfFile = "/etc/fsurc"
envShim = "FORTIFY_SHIM" envShim = "FORTIFY_SHIM"
envAID = "FORTIFY_APP_ID" envAID = "FORTIFY_APP_ID"
) )
var Fmain = compPoison
func main() { func main() {
log.SetFlags(0) log.SetFlags(0)
log.SetPrefix("fsu: ") log.SetPrefix("fsu: ")
@ -33,7 +34,7 @@ func main() {
} }
var fmain string var fmain string
if p, ok := internal.Path(internal.Fmain); !ok { if p, ok := checkPath(Fmain); !ok {
log.Fatal("invalid fortify path, this copy of fsu is not compiled correctly") log.Fatal("invalid fortify path, this copy of fsu is not compiled correctly")
} else { } else {
fmain = p fmain = p
@ -137,3 +138,7 @@ func parseConfig(p string, puid int) (fid int, ok bool) {
return -1, false return -1, false
} }
} }
func checkPath(p string) (string, bool) {
return p, p != compPoison && p != "" && path.IsAbs(p)
}

View File

@ -3,7 +3,6 @@ package internal
import "path" import "path"
var ( var (
Fmain = compPoison
Fsu = compPoison Fsu = compPoison
Fshim = compPoison Fshim = compPoison
Finit = compPoison Finit = compPoison

View File

@ -28,10 +28,11 @@ buildGoModule rec {
[ [
"-s" "-s"
"-w" "-w"
"-X"
"main.Fmain=${placeholder "out"}/bin/.fortify-wrapped"
] ]
{ {
Version = "v${version}"; Version = "v${version}";
Fmain = "${placeholder "out"}/bin/.fortify-wrapped";
Fsu = "/run/wrappers/bin/fsu"; Fsu = "/run/wrappers/bin/fsu";
Fshim = "${placeholder "out"}/bin/.fshim"; Fshim = "${placeholder "out"}/bin/.fshim";
Finit = "${placeholder "out"}/bin/.finit"; Finit = "${placeholder "out"}/bin/.finit";