Don't release keyring entries just because a user requested them (Fixes #137)

This commit is contained in:
Jeremy Lakeman 2018-05-16 11:46:58 +09:30
parent c2103e3b86
commit d02bf3b7b9
2 changed files with 3 additions and 3 deletions

View File

@ -248,9 +248,7 @@ static int restful_keyring_get(httpd_request *r, const char *remainder)
keyring_identity *id = keyring_find_identity_sid(keyring, &r->sid1);
if (!id)
return http_request_keyring_response(r, 404, "Identity not found");
int ret = http_request_keyring_response_identity(r, 200, id);
keyring_free_identity(id);
return ret;
return http_request_keyring_response_identity(r, 200, id);
}
static int restful_keyring_remove(httpd_request *r, const char *remainder)

View File

@ -98,6 +98,8 @@ doc_keyringGet="REST API get single keyring identity as JSON"
test_keyringGet() {
rest_request GET "/restful/keyring/$SIDA1"
assertJq response.json 'contains({"identity": {"sid": "'$SIDA1'", "identity": "'$IDA1'", "did": "'"$DIDA1"'", "name": "'"$NAMEA1"'"}})'
rest_request GET "/restful/keyring/$SIDA1"
assertJq response.json 'contains({"identity": {"sid": "'$SIDA1'", "identity": "'$IDA1'", "did": "'"$DIDA1"'", "name": "'"$NAMEA1"'"}})'
}
doc_keyringAdd="REST API add keyring identity"