Browse Source

fix: add nil guard for group param in propagating store log calls

Prevent potential nil dereference when logging group.Name in
CreateGroup and UpdateGroup of PropagatingCredentialStore.
pull/8560/head
Chris Lu 1 day ago
parent
commit
36d11f3cb3
  1. 8
      weed/credential/propagating_store.go

8
weed/credential/propagating_store.go

@ -391,7 +391,9 @@ func (s *PropagatingCredentialStore) DeleteServiceAccount(ctx context.Context, i
// via the filer subscription mechanism (watching /etc/iam/groups/ directory). // via the filer subscription mechanism (watching /etc/iam/groups/ directory).
func (s *PropagatingCredentialStore) CreateGroup(ctx context.Context, group *iam_pb.Group) error { func (s *PropagatingCredentialStore) CreateGroup(ctx context.Context, group *iam_pb.Group) error {
glog.V(4).Infof("IAM: PropagatingCredentialStore.CreateGroup %s", group.Name)
if group != nil {
glog.V(4).Infof("IAM: PropagatingCredentialStore.CreateGroup %s", group.Name)
}
return s.CredentialStore.CreateGroup(ctx, group) return s.CredentialStore.CreateGroup(ctx, group)
} }
@ -409,6 +411,8 @@ func (s *PropagatingCredentialStore) ListGroups(ctx context.Context) ([]string,
} }
func (s *PropagatingCredentialStore) UpdateGroup(ctx context.Context, group *iam_pb.Group) error { func (s *PropagatingCredentialStore) UpdateGroup(ctx context.Context, group *iam_pb.Group) error {
glog.V(4).Infof("IAM: PropagatingCredentialStore.UpdateGroup %s", group.Name)
if group != nil {
glog.V(4).Infof("IAM: PropagatingCredentialStore.UpdateGroup %s", group.Name)
}
return s.CredentialStore.UpdateGroup(ctx, group) return s.CredentialStore.UpdateGroup(ctx, group)
} }
Loading…
Cancel
Save