Update _hx509_collector_alloc prototype.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@20775 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -341,24 +341,26 @@ p12_init(hx509_context context,
|
|||||||
if (lock == NULL)
|
if (lock == NULL)
|
||||||
lock = _hx509_empty_lock;
|
lock = _hx509_empty_lock;
|
||||||
|
|
||||||
c = _hx509_collector_alloc(context, lock);
|
ret = _hx509_collector_alloc(context, lock, &c);
|
||||||
if (c == NULL)
|
if (ret)
|
||||||
return ENOMEM;
|
return ret;
|
||||||
|
|
||||||
p12 = calloc(1, sizeof(*p12));
|
p12 = calloc(1, sizeof(*p12));
|
||||||
if (p12 == NULL) {
|
if (p12 == NULL) {
|
||||||
ret = ENOMEM;
|
ret = ENOMEM;
|
||||||
|
hx509_set_error_string(context, 0, ret, "out of memory");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
p12->fn = strdup(residue);
|
p12->fn = strdup(residue);
|
||||||
if (p12->fn == NULL) {
|
if (p12->fn == NULL) {
|
||||||
ret = ENOMEM;
|
ret = ENOMEM;
|
||||||
|
hx509_set_error_string(context, 0, ret, "out of memory");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & HX509_CERTS_CREATE) {
|
if (flags & HX509_CERTS_CREATE) {
|
||||||
ret = hx509_certs_init(context, "MEMORY:ks-file-create",
|
ret = hx509_certs_init(context, "MEMORY:ks-file-create",
|
||||||
0, lock, &p12->certs);
|
0, lock, &p12->certs);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
*data = p12;
|
*data = p12;
|
||||||
@@ -366,13 +368,18 @@ p12_init(hx509_context context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = _hx509_map_file(residue, &buf, &len, NULL);
|
ret = _hx509_map_file(residue, &buf, &len, NULL);
|
||||||
if (ret)
|
if (ret) {
|
||||||
|
hx509_clear_error_string(context);
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
ret = decode_PKCS12_PFX(buf, len, &pfx, NULL);
|
ret = decode_PKCS12_PFX(buf, len, &pfx, NULL);
|
||||||
_hx509_unmap_file(buf, len);
|
_hx509_unmap_file(buf, len);
|
||||||
if (ret)
|
if (ret) {
|
||||||
|
hx509_set_error_string(context, 0, ret,
|
||||||
|
"Failed to decode the PFX in %s", residue);
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (der_heim_oid_cmp(&pfx.authSafe.contentType, oid_id_pkcs7_data()) != 0) {
|
if (der_heim_oid_cmp(&pfx.authSafe.contentType, oid_id_pkcs7_data()) != 0) {
|
||||||
free_PKCS12_PFX(&pfx);
|
free_PKCS12_PFX(&pfx);
|
||||||
@@ -451,15 +458,20 @@ addBag(hx509_context context,
|
|||||||
|
|
||||||
ptr = realloc(as->val, sizeof(as->val[0]) * (as->len + 1));
|
ptr = realloc(as->val, sizeof(as->val[0]) * (as->len + 1));
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
hx509_set_error_string(context, 0, ENOMEM, "malloc out of memory");
|
hx509_set_error_string(context, 0, ENOMEM, "out of memory");
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
as->val = ptr;
|
as->val = ptr;
|
||||||
|
|
||||||
ret = der_copy_oid(oid, &as->val[as->len].contentType);
|
ret = der_copy_oid(oid, &as->val[as->len].contentType);
|
||||||
|
if (ret) {
|
||||||
|
hx509_set_error_string(context, 0, ret, "out of memory");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
as->val[as->len].content = calloc(1, sizeof(*as->val[0].content));
|
as->val[as->len].content = calloc(1, sizeof(*as->val[0].content));
|
||||||
if (as->val[as->len].content == NULL) {
|
if (as->val[as->len].content == NULL) {
|
||||||
|
der_free_oid(&as->val[as->len].contentType);
|
||||||
hx509_set_error_string(context, 0, ENOMEM, "malloc out of memory");
|
hx509_set_error_string(context, 0, ENOMEM, "malloc out of memory");
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user