From 2a02936ed64f959b36c69a0a54d76e9339516d88 Mon Sep 17 00:00:00 2001 From: Roberto Dip Date: Tue, 15 Aug 2023 19:11:44 -0300 Subject: [PATCH] account for mixed case domains (#13342) Unreleased tweak, do a case insensitive comparison of domains. --- orbit/pkg/profiles/profiles_darwin.go | 2 +- orbit/pkg/profiles/profiles_darwin_test.go | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/orbit/pkg/profiles/profiles_darwin.go b/orbit/pkg/profiles/profiles_darwin.go index 22490e4638..25c31fa92d 100644 --- a/orbit/pkg/profiles/profiles_darwin.go +++ b/orbit/pkg/profiles/profiles_darwin.go @@ -171,7 +171,7 @@ func CheckAssignedEnrollmentProfile(expectedURL string) error { return fmt.Errorf("parsing profiles output: unable to parse configuration web url: %w", err) } - if assigned.Hostname() != expected.Hostname() { + if !strings.EqualFold(assigned.Hostname(), expected.Hostname()) { return fmt.Errorf(`matching configuration web url: expected '%s' but found '%s'`, expected.Hostname(), assigned.Hostname()) } diff --git a/orbit/pkg/profiles/profiles_darwin_test.go b/orbit/pkg/profiles/profiles_darwin_test.go index 5d6668d162..34e047ed9e 100644 --- a/orbit/pkg/profiles/profiles_darwin_test.go +++ b/orbit/pkg/profiles/profiles_darwin_test.go @@ -102,7 +102,7 @@ MDM server / https://test.example.com `), nil, true, - "", + "//test.example.com", false, }, { @@ -200,6 +200,22 @@ func TestCheckAssignedEnrollmentProfile(t *testing.T) { ConfigurationURL = "https://test.example.com/mdm/apple/enroll?token=1234"; ConfigurationWebURL = "https://valid.com?token=1234"; ... +} + `), + nil, + false, + nil, + }, + { + "mixed case match", + ptr.String(`Device Enrollment configuration: +{ + AllowPairing = 1; + AutoAdvanceSetup = 0; + AwaitDeviceConfigured = 0; + ConfigurationURL = "https://test.ExaMplE.com/mdm/apple/enroll?token=1234"; + ConfigurationWebURL = "https://vaLiD.com?tOken=1234"; + ... } `), nil,