From ccc33ccd658845f140f408b4431af70c9a1a6b8d Mon Sep 17 00:00:00 2001 From: riccardom Date: Thu, 11 Jun 2026 12:55:37 +0200 Subject: [PATCH] Removes unused vars --- client/server/mdm.go | 9 +++------ client/server/server.go | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/client/server/mdm.go b/client/server/mdm.go index e4b71596c..6939d35b5 100644 --- a/client/server/mdm.go +++ b/client/server/mdm.go @@ -32,7 +32,7 @@ var loadMDMPolicy = mdm.LoadPolicy // // The callback runs in the ticker's own goroutine. Ticker has already // logged the per-key diff before invoking this hook. -func (s *Server) onMDMPolicyChange(_, curr *mdm.Policy) error { +func (s *Server) onMDMPolicyChange(_, _ *mdm.Policy) error { log.Warn("MDM policy changed; restarting engine to apply new configuration") // Hold s.mutex for the entire restart sequence (cancel + quiescence @@ -77,7 +77,6 @@ func (s *Server) onMDMPolicyChange(_, curr *mdm.Policy) error { // restartEngineForMDMLocked with source="mdm". Emit an MDM-specific // user-visible toast so the operator knows their IT policy was // applied (UserMessage != "" triggers the GUI notifier). - _ = curr s.statusRecorder.PublishEvent( proto.SystemEvent_INFO, proto.SystemEvent_SYSTEM, @@ -405,13 +404,11 @@ func loginRequestMDMConflicts(msg *proto.LoginRequest, policy *mdm.Policy) []str // fields tries to change an MDM-enforced value to something else, and // nil otherwise. The whole request is rejected on any conflict; non- // conflicting fields in the same request are not applied either (no -// partial apply). The `policy` parameter is accepted for call-site -// symmetry with the *Conflicts helpers and is currently unused. -func rejectMDMManagedFieldConflicts(policy *mdm.Policy, conflicts []string) error { +// partial apply). +func rejectMDMManagedFieldConflicts(conflicts []string) error { if len(conflicts) == 0 { return nil } - _ = policy log.Warnf("MDM rejected request: tried to modify %d managed key(s): %v", len(conflicts), conflicts) st := gstatus.New( diff --git a/client/server/server.go b/client/server/server.go index 720be753d..821439c68 100644 --- a/client/server/server.go +++ b/client/server/server.go @@ -371,7 +371,7 @@ func (s *Server) SetConfig(callerCtx context.Context, msg *proto.SetConfigReques // Violation detail listing the offending key names. Non-conflicting // fields in the same request are not applied either. policy := loadMDMPolicy() - if err := rejectMDMManagedFieldConflicts(policy, mdmManagedFieldConflicts(msg, policy)); err != nil { + if err := rejectMDMManagedFieldConflicts(mdmManagedFieldConflicts(msg, policy)); err != nil { return nil, err } @@ -497,7 +497,7 @@ func (s *Server) Login(callerCtx context.Context, msg *proto.LoginRequest) (*pro return nil, gstatus.Errorf(codes.Unavailable, errUpdateSettingsDisabled) } policy := loadMDMPolicy() - if err := rejectMDMManagedFieldConflicts(policy, loginRequestMDMConflicts(msg, policy)); err != nil { + if err := rejectMDMManagedFieldConflicts(loginRequestMDMConflicts(msg, policy)); err != nil { return nil, err } }