Skip to content

Commit

Permalink
fix(coresmd): trim quotes on cert path to actually ignore if empty
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
synackd committed Nov 8, 2024
1 parent dd0dd07 commit d53069c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion coresmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"net"
"net/url"
"strings"
"time"

"github.com/OpenCHAMI/coresmd/internal/debug"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d53069c

Please sign in to comment.