Skip to content

Commit

Permalink
hotfix for mac compile
Browse files Browse the repository at this point in the history
  • Loading branch information
steipete committed Mar 23, 2011
1 parent cb417b8 commit 23d0cff
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Keychain/SFHFKeychainUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
// OTHER DEALINGS IN THE SOFTWARE.
//

#import <UIKit/UIKit.h>
#import "PSCompatibility.h"
#import "SFHFKeychainUtils.h"
#import <Security/Security.h>

Expand All @@ -47,8 +49,9 @@ + (NSString *) getPasswordForUsername: (NSString *) username andServiceName: (NS
*error = nil;
}

IF_IOS(

// Set up a query dictionary with the base query attributes: item type (generic), username, and service

NSArray *keys = [[[NSArray alloc] initWithObjects: (NSString *) kSecClass, kSecAttrAccount, kSecAttrService, nil] autorelease];
NSArray *objects = [[[NSArray alloc] initWithObjects: (NSString *) kSecClassGenericPassword, username, serviceName, nil] autorelease];

Expand Down Expand Up @@ -124,6 +127,9 @@ + (NSString *) getPasswordForUsername: (NSString *) username andServiceName: (NS
}

return [password autorelease];
)

IF_DESKTOP(return @"UNIMPLEMENTED";);
}

+ (BOOL) storeUsername: (NSString *) username andPassword: (NSString *) password forServiceName: (NSString *) serviceName updateExisting: (BOOL) updateExisting error: (NSError **) error
Expand Down Expand Up @@ -175,6 +181,7 @@ + (BOOL) storeUsername: (NSString *) username andPassword: (NSString *) password

OSStatus status = noErr;

IF_IOS(
if (existingPassword)
{
// We have an existing, properly entered item with a password.
Expand Down Expand Up @@ -224,6 +231,7 @@ + (BOOL) storeUsername: (NSString *) username andPassword: (NSString *) password

status = SecItemAdd((CFDictionaryRef) query, NULL);
}
)

if (error != nil && status != noErr)
{
Expand Down Expand Up @@ -252,6 +260,7 @@ + (BOOL) deleteItemForUsername: (NSString *) username andServiceName: (NSString
*error = nil;
}

IF_IOS(
NSArray *keys = [[[NSArray alloc] initWithObjects: (NSString *) kSecClass, kSecAttrAccount, kSecAttrService, kSecReturnAttributes, nil] autorelease];
NSArray *objects = [[[NSArray alloc] initWithObjects: (NSString *) kSecClassGenericPassword, username, serviceName, kCFBooleanTrue, nil] autorelease];

Expand All @@ -265,7 +274,7 @@ + (BOOL) deleteItemForUsername: (NSString *) username andServiceName: (NSString

return NO;
}

)
return YES;
}

Expand Down

0 comments on commit 23d0cff

Please sign in to comment.