adium/adium

merge

2012-05-13, Frank Dowsett
a944b9e676d3
merge
--- a/Frameworks/AIUtilities Framework/Source/AIKeychain.m Sun May 13 00:35:06 2012 -0500
+++ b/Frameworks/AIUtilities Framework/Source/AIKeychain.m Sun May 13 16:11:03 2012 -0400
@@ -838,79 +838,63 @@
NSDictionary *result = nil;
// Search for keychain items whose server is our key
- SecKeychainSearchRef search = NULL;
-
- struct SecKeychainAttribute searchAttrs[] = {
- {
- .tag = kSecServerItemAttr,
- .length = (UInt32)[server length],
- .data = (void *)[server UTF8String],
- },
- {
- .tag = kSecProtocolItemAttr,
- .length = sizeof(SecProtocolType),
- .data = &protocol,
- }
- };
-
- struct SecKeychainAttributeList searchAttrList = {
- .count = 2,
- .attr = searchAttrs,
- };
-
- // If keychainRef is NULL, the users's default keychain search list will be used
- OSStatus err = SecKeychainSearchCreateFromAttributes(keychainRef, kSecInternetPasswordItemClass, &searchAttrList, &search);
+ SecKeychainItemRef item = NULL;
+ UInt32 passwordLength = 0U;
+ void *passwordBytes = NULL;
- if (err == noErr) {
- SecKeychainItemRef item = NULL;
-
- err = SecKeychainSearchCopyNext(search, &item);
+ // If keychainRef is NULL, the user's default keychain search list will be used
+ OSStatus err = SecKeychainFindInternetPassword(keychainRef,
+ (unsigned int)[server length],
+ [server UTF8String],
+ 0,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ protocol,
+ kSecAuthenticationTypeAny,
+ &passwordLength,
+ &passwordBytes,
+ &item);
+
+ if (err == errSecItemNotFound) {
+ // No matching server found
+ } else if (err == noErr) {
+ // Output storage.
+ struct SecKeychainAttributeList *attrList = NULL;
- if (err == errSecItemNotFound) {
- // No matching server found
- } else if (err == noErr) {
- // Output storage.
- struct SecKeychainAttributeList *attrList = NULL;
- UInt32 passwordLength = 0U;
- void *passwordBytes = NULL;
-
- // First, grab the username.
- UInt32 tags[] = { kSecAccountItemAttr };
- UInt32 formats[] = { CSSM_DB_ATTRIBUTE_FORMAT_STRING };
- struct SecKeychainAttributeInfo info = {
- .count = 1,
- .tag = tags,
- .format = formats,
- };
+ // First, grab the username.
+ UInt32 tags[] = { kSecAccountItemAttr };
+ UInt32 formats[] = { CSSM_DB_ATTRIBUTE_FORMAT_STRING };
+ struct SecKeychainAttributeInfo info = {
+ .count = 1,
+ .tag = tags,
+ .format = formats,
+ };
+
+ err = SecKeychainItemCopyAttributesAndData(item,
+ &info,
+ /* itemClass */ NULL,
+ &attrList,
+ &passwordLength,
+ &passwordBytes);
+ if (err == noErr) {
+ NSString *username = [NSString stringWithBytes:attrList->attr[0].data length:attrList->attr[0].length encoding:NSUTF8StringEncoding];
+ NSString *password = [NSString stringWithBytes:passwordBytes length:passwordLength encoding:NSUTF8StringEncoding];
+ result = [NSDictionary dictionaryWithObjectsAndKeys:
+ username, @"Username",
+ password, @"Password",
+ nil];
- err = SecKeychainItemCopyAttributesAndData(item,
- &info,
- /* itemClass */ NULL,
- &attrList,
- &passwordLength,
- &passwordBytes);
- if (err == noErr) {
- NSString *username = [NSString stringWithBytes:attrList->attr[0].data length:attrList->attr[0].length encoding:NSUTF8StringEncoding];
- NSString *password = [NSString stringWithBytes:passwordBytes length:passwordLength encoding:NSUTF8StringEncoding];
- result = [NSDictionary dictionaryWithObjectsAndKeys:
- username, @"Username",
- password, @"Password",
- nil];
-
- SecKeychainItemFreeAttributesAndData(attrList, passwordBytes);
- } else {
- NSLog(@"Error extracting infomation from keychain item");
- }
-
- if (item) {
- CFRelease(item);
- }
+ SecKeychainItemFreeAttributesAndData(attrList, passwordBytes);
} else {
- NSLog(@"%@: Error in SecKeychainSearchCopyNext(); err is %ld", self, (long)err);
+ NSLog(@"Error extracting infomation from keychain item");
}
- if (search) {
- CFRelease(search);
+ if (item) {
+ CFRelease(item);
}
} else {
NSLog(@"%@: Could not create search; err is %ld", self, (long)err);
--- a/Plugins/Bonjour/libezv/Private Classes/AWEzvContactManagerRendezvous.m Sun May 13 00:35:06 2012 -0500
+++ b/Plugins/Bonjour/libezv/Private Classes/AWEzvContactManagerRendezvous.m Sun May 13 16:11:03 2012 -0400
@@ -40,7 +40,7 @@
#import "AWEzvSupportRoutines.h"
#import <dns_sd.h>
-#import <openssl/sha.h>
+#import <CommonCrypto/CommonDigest.h>
/* One of the stupidest things I've ever met. Doing DNS lookups using the standard
* functions does not for mDNS records work unless you're in BIND 8 compatibility
@@ -331,7 +331,7 @@
- (void)setImageData:(NSData *)JPEGData
{
DNSServiceErrorType error;
- SHA_CTX ctx;
+ CC_SHA1_CTX ctx;
unsigned char digest[20];
if (avDNSReference == NULL) {
@@ -382,9 +382,9 @@
if (error == kDNSServiceErr_NoError) {
// Let's create the hash
- SHA1_Init(&ctx);
- SHA1_Update(&ctx, [JPEGData bytes], (unsigned long)[JPEGData length]);
- SHA1_Final(digest, &ctx);
+ CC_SHA1_Init(&ctx);
+ CC_SHA1_Update(&ctx, [JPEGData bytes], (CC_LONG)[JPEGData length]);
+ CC_SHA1_Final(digest, &ctx);
imagehash = [[NSData dataWithBytes:digest length:20] retain];
AILogWithSignature(@"Will update with hash %@; length is %u", imagehash, [JPEGData length]);
[self updatePHSH];