Skip to content
Snippets Groups Projects
Commit 90bd751a authored by Arie Peterson's avatar Arie Peterson
Browse files

Resolve discussions

parent 1625624c
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,10 @@ int callback_encryption_keys_get(const struct _u_request * request,
// Initialise encrypted container.
struct crypt_device * cd = NULL;
r = container_initialise(&cd, DATA_PARTITION_DEVICE, true);
// A negative return code indicates that something went wrong with the
// initialisation of the encrypted container, so we need to free it.
// A positive return code means we couldn't even attempt the initialisation,
// so there is nothing to clean up.
if (r < 0)
{
crypt_free(cd);
......@@ -30,7 +34,7 @@ int callback_encryption_keys_get(const struct _u_request * request,
bool in_use;
bool last_used;
int keyslot = 0;
for (keyslot = 0; keyslot <= 7; keyslot++)
for (keyslot = 0; keyslot <= crypt_keyslot_max(CRYPT_LUKS1); keyslot++)
{
// Create new json object containing info for this keyslot.
key = json_object();
......@@ -66,8 +70,7 @@ int callback_encryption_keys_get(const struct _u_request * request,
}
// Create json response.
json_t * json_body = NULL;
json_body = json_object();
json_t * json_body = json_object();
json_object_set_new(json_body, "encryption-keys", keys);
// Send response.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment