| 438 | | returnStatus = SecKeychainFindGenericPassword(keychain, strlen(serviceName), serviceName, strlen(accountName), accountName, &passwordLength, (void **)&kcPassword, nil); |
|---|
| | 441 | returnStatus = SecKeychainFindGenericPassword( |
|---|
| | 442 | keychain, strlen(serviceName), serviceName, |
|---|
| | 443 | strlen(accountName), accountName, &passwordLength, |
|---|
| | 444 | (void **)&kcPassword, nil); |
|---|
| 451 | | returnStatus = SecKeychainFindGenericPassword(nil, strlen(serviceName), serviceName, strlen(accountName), accountName, &passwordLength, (void **)&kcPassword, nil); |
|---|
| | 457 | returnStatus = SecKeychainFindGenericPassword( |
|---|
| | 458 | nil, strlen(serviceName), serviceName, strlen(accountName), |
|---|
| | 459 | accountName, &passwordLength, (void **)&kcPassword, nil); |
|---|
| 462 | | kcPassword[passwordLength] = '\0'; |
|---|
| 463 | | |
|---|
| 464 | | NSString *returnString = [NSString stringWithCString:kcPassword]; |
|---|
| 465 | | |
|---|
| 466 | | SecKeychainItemFreeContent(NULL, kcPassword); |
|---|
| | 470 | NSString *returnString; |
|---|
| | 471 | |
|---|
| | 472 | if ( kcPassword[passwordLength] != 0 ) { |
|---|
| | 473 | /* Don't trust memory allocated from system, copy it over |
|---|
| | 474 | First before making it a CString */ |
|---|
| | 475 | |
|---|
| | 476 | NSLog(@"Buggy password in keycahin workaround"); |
|---|
| | 477 | char * buffer = (char*)malloc((passwordLength+1)*sizeof(char)); |
|---|
| | 478 | strncpy(buffer, kcPassword, passwordLength); |
|---|
| | 479 | buffer[passwordLength] = '\0'; |
|---|
| | 480 | |
|---|
| | 481 | |
|---|
| | 482 | returnString = [NSString stringWithUTF8String:buffer]; |
|---|
| | 483 | |
|---|
| | 484 | SecKeychainItemFreeContent(NULL, kcPassword); |
|---|
| | 485 | free(buffer); |
|---|
| | 486 | } else { |
|---|
| | 487 | returnString = [NSString stringWithUTF8String:kcPassword]; |
|---|
| | 488 | |
|---|
| | 489 | SecKeychainItemFreeContent(NULL, kcPassword); |
|---|
| | 490 | } |
|---|
| 538 | | SecKeychainAddGenericPassword(nil, strlen(serviceName), serviceName, strlen(accountName), accountName, [passphrase length], (const void *)[passphrase UTF8String], nil); |
|---|
| | 563 | const char * utf8password = [passphrase UTF8String]; |
|---|
| | 564 | |
|---|
| | 565 | SecKeychainAddGenericPassword(nil, strlen(serviceName), |
|---|
| | 566 | serviceName, strlen(accountName), accountName, |
|---|
| | 567 | strlen(utf8password) + 1, |
|---|
| | 568 | (const void *)utf8password, nil); |
|---|