Camino only - Bug 372942: Don't pick up Safar's pseudo-negative keychain entries as accounts. r=josh sr=pink

git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@221560 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
stuart.morgan%alumni.case.edu
2007-03-08 18:33:24 +00:00
parent f6c040b373
commit 1879d879b2

View File

@@ -249,15 +249,24 @@ int KeychainPrefChangedCallback(const char* inPref, void* unused)
// Finally, check for a new style entry created by something other than Camino.
// Since we don't yet have any UI for multiple accounts, we use Safari's default
// if we can find it, otherwise we just arbitrarily pick the first one.
// if we can find it, otherwise we just arbitrarily pick the first one that
// looks plausible.
keychainEnumerator = [newKeychainItems objectEnumerator];
while ((item = [keychainEnumerator nextObject])) {
NSString* comment = [item comment];
if (comment && ([comment rangeOfString:@"default"].location != NSNotFound))
if (comment && ([comment rangeOfString:@"default"].location != NSNotFound)) {
// Safari doesn't bother to set kSecNegativeItemAttr on "Passwords not saved"
// items; that's just the way they roll. This fragile method is the best we can do.
if ([[item password] isEqualToString:@" "])
continue;
return item;
}
}
if ([newKeychainItems count] > 0) {
return [newKeychainItems objectAtIndex:0];
keychainEnumerator = [newKeychainItems objectEnumerator];
while ((item = [keychainEnumerator nextObject])) {
if ([[item password] isEqualToString:@" "])
continue;
return item;
}
return nil;