-
Notifications
You must be signed in to change notification settings - Fork 14
Description
We recently tried to switch our job handler to use "get active jobs", and saw a few apparent bugs in the SDK for that call.
The SDK expects a payload with xml root <Jobs>
while the server returns <Data>
. Based on the documentation, the same appears to be the case for "get cancelled jobs" and "get completed jobs", though we have not tested those.
Additionally, for this and other paginated calls, an invalid memory access is possible when the parser returns an error: (*response)->paging
is set, but due to the error (*response)
has not been allocated.
I understand this code is generated so the actual fixes will be elsewhere, but the following patch is what we built locally to resolve these issues for ds3_get_active_jobs_spectra_s3_request()
only.
diff --git a/src/ds3_requests.c b/src/ds3_requests.c
index 310fdae6..b3edebc2 100644
--- a/src/ds3_requests.c
+++ b/src/ds3_requests.c
@@ -10544,7 +10544,7 @@ static ds3_error* _parse_top_level_ds3_active_job_list_response(const ds3_client
ds3_error* error = NULL;
GPtrArray* active_jobs_array = g_ptr_array_new();
- error = _get_request_xml_nodes(xml_blob, &doc, &root, "Jobs");
+ error = _get_request_xml_nodes(xml_blob, &doc, &root, "Data");
if (error != NULL) {
return error;
}
@@ -15556,7 +15556,8 @@ ds3_error* ds3_get_active_jobs_spectra_s3_request(const ds3_client* client, cons
error = _parse_top_level_ds3_active_job_list_response(client, request, response, xml_blob);
- (*response)->paging = _parse_paging_headers(return_headers);
+ if (error == NULL)
+ (*response)->paging = _parse_paging_headers(return_headers);
ds3_string_multimap_free(return_headers);
return error;
Thanks,
Mike