NoMAD sometimes fails to sync password on PW change, usernames don't match
Had some trouble figuring out why passwords were not syncing when using the "Change Password" option from the NoMAD menu, even though we had LocalPasswordSync
enabled; we also have LocalPasswordSyncOnMatchOnly
set as well. Logs showed the message
User names do not match
After editing the code, we found that it was comparing the local username to the full username@KERBEROSREALM in NoMADUser.swift.
Sorry I couldn't figure out the proper way to do a pull request, but the diff fixing the issue for us (with Experimental branch) shows:
diff --git a/NoMAD/NoMADUser.swift b/NoMAD/NoMADUser.swift
index 9a78d49..b27d62e 100644
--- a/NoMAD/NoMADUser.swift
+++ b/NoMAD/NoMADUser.swift
@@ -575,7 +575,15 @@ func performPasswordChange(username: String, currentPassword: String, newPasswor
myLogger.logit(.debug, message: "Checking to see if user names match before syncing password.")
- if NSUserName() == username {
+ // ensure that user shortnames match, username currently can contain the KERBEROS realm
+ let userShortname: String
+ if username.range(of: "@") != nil {
+ let split = username.components(separatedBy: "@")
+ userShortname = split[0]
+ } else {
+ userShortname = username
+ }
+ if NSUserName() == userShortname {
// names match let's set the sync and preflight
myLogger.logit(.debug, message: "User names match, syncing password.")