[client] Resolve the merge conflicts left in the tree

262ce8c3b landed with the conflict markers still in it, so client/server and
the iOS SDK did not compile. Four regions, resolved as follows.

client/server/mdm.go — main moved the MDM conflict-check machinery into the
mdm package (mdm.ResolveConflicts, mdm.ConflictBool, mdm.ConflictURL, ...).
This branch had edited the local copies, which are now dead: dropped, along
with the profilemanager import that only the local conflictURL needed.

client/server/server.go, Login gate — this branch's value-aware gate stays
(the point of the PR: refuse a real divergence, let a restatement through),
so main's presence-based `loginRequestHasConfigOverrides` block goes; that
helper no longer exists here anyway. Main's other change in the same lines
is real and kept: the MDM policy now comes from the daemon-owned
s.mdmLoader.Load() instead of the package-level loadMDMPolicy, which main
removed. The stale call right below the conflict was the reason the file
would not have compiled even with the markers gone.

client/server/server.go, getConfig — both sides add something and both are
needed. The identity is provisioned and persisted first, then the MDM
overlay is applied, so what reaches disk stays the profile's own config: the
overlay is runtime-only and re-derived on every load.

client/ios/NetBirdSDK/client.go — main reworked SetConfigFromJSON to store
the JSON and re-parse it on each load, which is the shape kept; the parse is
now only a validity check, and this branch's reason for it (a document with
no peer identity is refused, not just an unparseable one) moves into that
comment.

client/server/update_settings_gate_test.go — follows the sentinel constant
to its new home, mdm.PreSharedKeyRedactedSentinel.
This commit is contained in:
riccardom
2026-09-08 14:03:15 +02:00
parent 262ce8c3b2
commit 97b9a18ef6
4 changed files with 15 additions and 149 deletions
+6 -10
View File
@@ -130,17 +130,13 @@ func NewClient(cfgFile, stateFile, cacheDir, logFilePath, deviceName string, osV
// SetConfigFromJSON stores the JSON config that later loads resolve instead of the config file (tvOS).
func (c *Client) SetConfigFromJSON(jsonStr string) error {
<<<<<<< HEAD
cfg, err := profilemanager.ConfigFromJSON(jsonStr)
if err != nil {
// Not only a parse error any more: a document with no peer identity is
// refused, because Run() would otherwise connect as a peer whose key
// this SDK has no way to hand back to the caller's store.
log.Errorf("SetConfigFromJSON: failed to load config JSON: %v", err)
=======
// Parsed only to reject a bad document early; the JSON itself is what is
// stored, and every load re-parses it. Not only a parse error any more: a
// document with no peer identity is refused too, because Run() would
// otherwise connect as a peer whose key this SDK has no way to hand back
// to the caller's store.
if _, err := profilemanager.ConfigFromJSON(jsonStr); err != nil {
log.Errorf("SetConfigFromJSON: failed to parse config JSON: %v", err)
>>>>>>> origin/main
log.Errorf("SetConfigFromJSON: failed to load config JSON: %v", err)
return err
}
c.preloadedConfigJSON.Store(&jsonStr)