Skip to content

Commit

Permalink
Implement LogValue for ClientCred
Browse files Browse the repository at this point in the history
  • Loading branch information
ravicious authored and github-actions committed Jul 30, 2024
1 parent 4c2c4ec commit 088c379
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 9 additions & 0 deletions lib/vnet/daemon/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package daemon

import (
"log/slog"
"time"

"github.com/gravitational/trace"
Expand Down Expand Up @@ -48,6 +49,14 @@ type ClientCred struct {
Euid int
}

func (c ClientCred) LogValue() slog.Value {
return slog.GroupValue(
slog.Bool("creds_valid", c.Valid),
slog.Int("egid", c.Egid),
slog.Int("euid", c.Euid),
)
}

func (c *Config) CheckAndSetDefaults() error {
switch {
case c.SocketPath == "":
Expand Down
3 changes: 1 addition & 2 deletions lib/vnet/daemon/service_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import "C"
import (
"context"
"errors"
"fmt"
"time"
"unsafe"

Expand Down Expand Up @@ -78,7 +77,7 @@ func Start(ctx context.Context, workFn func(context.Context, Config) error) erro
"ipv6_prefix", config.IPv6Prefix,
"dns_addr", config.DNSAddr,
"home_path", config.HomePath,
"cred", fmt.Sprintf("%#v", config.ClientCred),
"client_cred", config.ClientCred,
)

return trace.Wrap(workFn(ctx, config))
Expand Down

0 comments on commit 088c379

Please sign in to comment.