From 84dd3138b028cba9a833164650bd665e22d4ce6d Mon Sep 17 00:00:00 2001 From: Graham Gilbert Date: Mon, 13 Aug 2018 12:36:49 -0700 Subject: [PATCH] Check for _mbsetupuser before checking for the pref --- Crypt/Info.plist | 4 ++-- Crypt/Mechanisms/Check.swift | 20 +++++++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Crypt/Info.plist b/Crypt/Info.plist index b39f49d..b4b80b4 100644 --- a/Crypt/Info.plist +++ b/Crypt/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 3.2.0 + 3.2.1 CFBundleSignature ???? CFBundleVersion - 3.2.0 + 3.2.1 NSHumanReadableCopyright Copyright © 2018 The Crypt Project. All rights reserved. NSPrincipalClass diff --git a/Crypt/Mechanisms/Check.swift b/Crypt/Mechanisms/Check.swift index 7ec765e..2ab622c 100644 --- a/Crypt/Mechanisms/Check.swift +++ b/Crypt/Mechanisms/Check.swift @@ -212,7 +212,21 @@ class Check: CryptMechanism { fileprivate func getSkipUsers() -> Bool { os_log("Checking for any SkipUsers...", log: Check.log, type: .default) guard let username = self.username - else { return false } + else { + os_log("Cannot get username", log: Check.log, type: .error) + return false + } + os_log("Username is %{public}@...", log: Check.log, type: .error, String(describing: username)) + + if username as String == "_mbsetupuser" { + os_log("User is _mbsetupuser... Need to Skip...", log: Check.log, type: .error) + return true + } + + if username as String == "root" { + os_log("User is root... Need to Skip...", log: Check.log, type: .error) + return true + } guard let prefValue = CFPreferencesCopyAppValue("SkipUsers" as CFString, bundleid as CFString) as? [String] else { return false } for s in prefValue { @@ -221,10 +235,6 @@ class Check: CryptMechanism { return true } } - if username as String == "_mbsetupuser" { - os_log("User is _mbsetupuser... Need to Skip...", log: Check.log, type: .error) - return true - } return false }