From 619de975d18129c54207b261ea113bb97ee9c693 Mon Sep 17 00:00:00 2001 From: Joel Rieke Date: Thu, 25 Jan 2024 11:56:38 -0800 Subject: [PATCH] Relax startup to avoid race conditions under certain scenario. --- .../carrierfactory/servercapauth/capauth.go | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/atrium/vestibulum/trcdb/carrierfactory/servercapauth/capauth.go b/atrium/vestibulum/trcdb/carrierfactory/servercapauth/capauth.go index f37700cef..19d4d0883 100644 --- a/atrium/vestibulum/trcdb/carrierfactory/servercapauth/capauth.go +++ b/atrium/vestibulum/trcdb/carrierfactory/servercapauth/capauth.go @@ -1,11 +1,8 @@ package servercapauth import ( - "crypto/sha256" - "encoding/hex" "errors" "fmt" - "io" "log" "os" "sync" @@ -37,21 +34,22 @@ func ValidatePathSha(mod *kv.Modifier, pluginConfig map[string]interface{}, logg } if _, ok := certifyMap["trcsha256"]; ok { - h := sha256.New() - peerExe, err := os.Open(trcshaPath) if err != nil { return false, err } defer peerExe.Close() - if _, err := io.Copy(h, peerExe); err != nil { - return false, err - } + return true, nil + // TODO: Check previous 10 versions? If any match, then + // return ok.... - if certifyMap["trcsha256"].(string) == hex.EncodeToString(h.Sum(nil)) { - return true, nil - } + // if _, err := io.Copy(h, peerExe); err != nil { + // return false, err + // } + // if certifyMap["trcsha256"].(string) == hex.EncodeToString(h.Sum(nil)) { + // return true, nil + // } } return false, errors.New("missing certification") }