From d53069c074f0a83d10fe4bc87c360d2838f7976e Mon Sep 17 00:00:00 2001 From: Devon Bautista Date: Fri, 8 Nov 2024 13:35:56 -0700 Subject: [PATCH] fix(coresmd): trim quotes on cert path to actually ignore if empty Passing '' or "" as an empty argument would see the cert path be literally quotes (e.g. "" or ''). This commit ensures those characters are trimmed from the output (shallowly) so the string appears as empty when checking if the cert path is set. --- coresmd/main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/coresmd/main.go b/coresmd/main.go index 96e6b21..b67ac32 100644 --- a/coresmd/main.go +++ b/coresmd/main.go @@ -5,6 +5,7 @@ import ( "fmt" "net" "net/url" + "strings" "time" "github.com/OpenCHAMI/coresmd/internal/debug" @@ -69,7 +70,8 @@ func setup4(args ...string) (handler.Handler4, error) { } // If nonempty, test that CA cert path exists (third argument) - caCertPath := args[2] + caCertPath := strings.Trim(args[2], `"'`) + log.Infof("cacertPath: %s", caCertPath) if caCertPath != "" { if err := smdClient.UseCACert(caCertPath); err != nil { return nil, fmt.Errorf("failed to set CA certificate: %w", err)