Introduce subtypes.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21097 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -264,7 +264,6 @@ keychain_init(hx509_context context,
|
|||||||
const char *residue, hx509_lock lock)
|
const char *residue, hx509_lock lock)
|
||||||
{
|
{
|
||||||
struct ks_keychain *ctx;
|
struct ks_keychain *ctx;
|
||||||
OSStatus ret;
|
|
||||||
|
|
||||||
ctx = calloc(1, sizeof(*ctx));
|
ctx = calloc(1, sizeof(*ctx));
|
||||||
if (ctx == NULL) {
|
if (ctx == NULL) {
|
||||||
@@ -273,15 +272,22 @@ keychain_init(hx509_context context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (residue) {
|
if (residue) {
|
||||||
if (strcasecmp(residue, "system-anchors") == 0)
|
if (strcasecmp(residue, "system-anchors") == 0) {
|
||||||
ctx->anchors = 1;
|
ctx->anchors = 1;
|
||||||
|
} else if (strncasecmp(residue, "FILE:", 5) == 0) {
|
||||||
|
OSStatus ret;
|
||||||
|
|
||||||
ret = SecKeychainOpen(residue, &ctx->keychain);
|
ret = SecKeychainOpen(residue + 5, &ctx->keychain);
|
||||||
if (ret != noErr) {
|
if (ret != noErr) {
|
||||||
hx509_set_error_string(context, 0, ENOENT,
|
hx509_set_error_string(context, 0, ENOENT,
|
||||||
"Failed to open %s", residue);
|
"Failed to open %s", residue);
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
hx509_set_error_string(context, 0, ENOENT,
|
||||||
|
"Unknown subtype %s", residue);
|
||||||
|
return ENOENT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*data = ctx;
|
*data = ctx;
|
||||||
@@ -402,9 +408,9 @@ keychain_iter(hx509_context context,
|
|||||||
{
|
{
|
||||||
SecKeychainAttributeList *attrs = NULL;
|
SecKeychainAttributeList *attrs = NULL;
|
||||||
SecKeychainAttributeInfo attrInfo;
|
SecKeychainAttributeInfo attrInfo;
|
||||||
uint32 attrFormat = 0;
|
uint32 attrFormat[1] = { 0 };
|
||||||
SecKeychainItemRef itemRef;
|
SecKeychainItemRef itemRef;
|
||||||
SecItemAttr item;
|
SecItemAttr item[1];
|
||||||
struct iter *iter = cursor;
|
struct iter *iter = cursor;
|
||||||
OSStatus ret;
|
OSStatus ret;
|
||||||
UInt32 len;
|
UInt32 len;
|
||||||
@@ -425,11 +431,11 @@ keychain_iter(hx509_context context,
|
|||||||
* Pick out certificate and matching "keyid"
|
* Pick out certificate and matching "keyid"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
item = kSecPublicKeyHashItemAttr;
|
item[0] = kSecPublicKeyHashItemAttr;
|
||||||
|
|
||||||
attrInfo.count = 1;
|
attrInfo.count = 1;
|
||||||
attrInfo.tag = &item;
|
attrInfo.tag = item;
|
||||||
attrInfo.format = &attrFormat;
|
attrInfo.format = attrFormat;
|
||||||
|
|
||||||
ret = SecKeychainItemCopyAttributesAndData(itemRef, &attrInfo, NULL,
|
ret = SecKeychainItemCopyAttributesAndData(itemRef, &attrInfo, NULL,
|
||||||
&attrs, &len, &ptr);
|
&attrs, &len, &ptr);
|
||||||
|
Reference in New Issue
Block a user