Skip to content

Commit

Permalink
Merge pull request #85 from grahamgilbert/mbsetupuser
Browse files Browse the repository at this point in the history
Check for _mbsetupuser before checking for the pref
  • Loading branch information
grahamgilbert authored Aug 13, 2018
2 parents 61b7acc + 84dd313 commit dd1ab1a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Crypt/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>3.2.0</string>
<string>3.2.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>3.2.0</string>
<string>3.2.1</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2018 The Crypt Project. All rights reserved.</string>
<key>NSPrincipalClass</key>
Expand Down
20 changes: 15 additions & 5 deletions Crypt/Mechanisms/Check.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}

Expand Down

0 comments on commit dd1ab1a

Please sign in to comment.