diff options
-rw-r--r-- | src/identity/plugin_rest_identity.c | 26 | ||||
-rw-r--r-- | src/rest/plugin_rest_config.c | 13 | ||||
-rw-r--r-- | src/util/crypto_hkdf.c | 6 |
3 files changed, 33 insertions, 12 deletions
diff --git a/src/identity/plugin_rest_identity.c b/src/identity/plugin_rest_identity.c index dba1d478d..d7cd0e826 100644 --- a/src/identity/plugin_rest_identity.c +++ b/src/identity/plugin_rest_identity.c | |||
@@ -322,7 +322,9 @@ do_error (void *cls) | |||
322 | handle->response_code = MHD_HTTP_OK; | 322 | handle->response_code = MHD_HTTP_OK; |
323 | response = json_dumps (json_error, 0); | 323 | response = json_dumps (json_error, 0); |
324 | resp = GNUNET_REST_create_response (response); | 324 | resp = GNUNET_REST_create_response (response); |
325 | MHD_add_response_header (resp, "Content-Type", "application/json"); | 325 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, |
326 | "Content-Type", | ||
327 | "application/json")); | ||
326 | handle->proc (handle->proc_cls, resp, handle->response_code); | 328 | handle->proc (handle->proc_cls, resp, handle->response_code); |
327 | json_decref (json_error); | 329 | json_decref (json_error); |
328 | GNUNET_free (response); | 330 | GNUNET_free (response); |
@@ -412,7 +414,9 @@ ego_get_for_subsystem (void *cls, | |||
412 | result_str = json_dumps (json_root, 0); | 414 | result_str = json_dumps (json_root, 0); |
413 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); | 415 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); |
414 | resp = GNUNET_REST_create_response (result_str); | 416 | resp = GNUNET_REST_create_response (result_str); |
415 | MHD_add_response_header (resp, "Content-Type", "application/json"); | 417 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, |
418 | "Content-Type", | ||
419 | "application/json")); | ||
416 | json_decref (json_root); | 420 | json_decref (json_root); |
417 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); | 421 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); |
418 | GNUNET_free (result_str); | 422 | GNUNET_free (result_str); |
@@ -514,7 +518,9 @@ ego_get_all (struct GNUNET_REST_RequestHandle *con_handle, | |||
514 | result_str = json_dumps (json_root, 0); | 518 | result_str = json_dumps (json_root, 0); |
515 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); | 519 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); |
516 | resp = GNUNET_REST_create_response (result_str); | 520 | resp = GNUNET_REST_create_response (result_str); |
517 | MHD_add_response_header (resp, "Content-Type", "application/json"); | 521 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, |
522 | "Content-Type", | ||
523 | "application/json")); | ||
518 | json_decref (json_root); | 524 | json_decref (json_root); |
519 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); | 525 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); |
520 | GNUNET_free (result_str); | 526 | GNUNET_free (result_str); |
@@ -561,7 +567,9 @@ ego_get_response (struct RequestHandle *handle, struct EgoEntry *ego_entry) | |||
561 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); | 567 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); |
562 | resp = GNUNET_REST_create_response (result_str); | 568 | resp = GNUNET_REST_create_response (result_str); |
563 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); | 569 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); |
564 | MHD_add_response_header (resp, "Content-Type", "application/json"); | 570 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, |
571 | "Content-Type", | ||
572 | "application/json")); | ||
565 | json_decref (json_ego); | 573 | json_decref (json_ego); |
566 | GNUNET_free (result_str); | 574 | GNUNET_free (result_str); |
567 | GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); | 575 | GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); |
@@ -1195,7 +1203,9 @@ options_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
1195 | 1203 | ||
1196 | // For now, independent of path return all options | 1204 | // For now, independent of path return all options |
1197 | resp = GNUNET_REST_create_response (NULL); | 1205 | resp = GNUNET_REST_create_response (NULL); |
1198 | MHD_add_response_header (resp, "Access-Control-Allow-Methods", allow_methods); | 1206 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, |
1207 | "Access-Control-Allow-Methods", | ||
1208 | allow_methods)); | ||
1199 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); | 1209 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); |
1200 | GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); | 1210 | GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); |
1201 | return; | 1211 | return; |
@@ -1216,6 +1226,12 @@ list_ego (void *cls, | |||
1216 | state = ID_REST_STATE_POST_INIT; | 1226 | state = ID_REST_STATE_POST_INIT; |
1217 | return; | 1227 | return; |
1218 | } | 1228 | } |
1229 | if (NULL == ego) | ||
1230 | { | ||
1231 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
1232 | "Called with NULL ego\n"); | ||
1233 | return; | ||
1234 | } | ||
1219 | if (ID_REST_STATE_INIT == state) | 1235 | if (ID_REST_STATE_INIT == state) |
1220 | { | 1236 | { |
1221 | ego_entry = GNUNET_new (struct EgoEntry); | 1237 | ego_entry = GNUNET_new (struct EgoEntry); |
diff --git a/src/rest/plugin_rest_config.c b/src/rest/plugin_rest_config.c index 8269a4662..b0f18754c 100644 --- a/src/rest/plugin_rest_config.c +++ b/src/rest/plugin_rest_config.c | |||
@@ -91,7 +91,6 @@ static struct RequestHandle *requests_head; | |||
91 | static struct RequestHandle *requests_tail; | 91 | static struct RequestHandle *requests_tail; |
92 | 92 | ||
93 | 93 | ||
94 | |||
95 | /** | 94 | /** |
96 | * Cleanup request handle. | 95 | * Cleanup request handle. |
97 | * | 96 | * |
@@ -199,7 +198,9 @@ get_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
199 | } | 198 | } |
200 | response = json_dumps (result, 0); | 199 | response = json_dumps (result, 0); |
201 | resp = GNUNET_REST_create_response (response); | 200 | resp = GNUNET_REST_create_response (response); |
202 | MHD_add_response_header (resp, "Content-Type", "application/json"); | 201 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, |
202 | "Content-Type", | ||
203 | "application/json")); | ||
203 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); | 204 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); |
204 | cleanup_handle (handle); | 205 | cleanup_handle (handle); |
205 | GNUNET_free (response); | 206 | GNUNET_free (response); |
@@ -353,9 +354,9 @@ options_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
353 | struct RequestHandle *handle = cls; | 354 | struct RequestHandle *handle = cls; |
354 | 355 | ||
355 | resp = GNUNET_REST_create_response (NULL); | 356 | resp = GNUNET_REST_create_response (NULL); |
356 | MHD_add_response_header (resp, | 357 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, |
357 | "Access-Control-Allow-Methods", | 358 | "Access-Control-Allow-Methods", |
358 | MHD_HTTP_METHOD_GET); | 359 | MHD_HTTP_METHOD_GET)); |
359 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); | 360 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); |
360 | cleanup_handle (handle); | 361 | cleanup_handle (handle); |
361 | } | 362 | } |
@@ -425,7 +426,7 @@ libgnunet_plugin_rest_config_init (void *cls) | |||
425 | api->cls = &plugin; | 426 | api->cls = &plugin; |
426 | api->name = GNUNET_REST_API_NS_CONFIG; | 427 | api->name = GNUNET_REST_API_NS_CONFIG; |
427 | api->process_request = &rest_config_process_request; | 428 | api->process_request = &rest_config_process_request; |
428 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("CONFIG REST API initialized\n")); | 429 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _ ("CONFIG REST API initialized\n")); |
429 | return api; | 430 | return api; |
430 | } | 431 | } |
431 | 432 | ||
diff --git a/src/util/crypto_hkdf.c b/src/util/crypto_hkdf.c index 86a814b12..7270b87b6 100644 --- a/src/util/crypto_hkdf.c +++ b/src/util/crypto_hkdf.c | |||
@@ -77,7 +77,11 @@ static const void * | |||
77 | doHMAC (gcry_md_hd_t mac, const void *key, size_t key_len, const void *buf, | 77 | doHMAC (gcry_md_hd_t mac, const void *key, size_t key_len, const void *buf, |
78 | size_t buf_len) | 78 | size_t buf_len) |
79 | { | 79 | { |
80 | gcry_md_setkey (mac, key, key_len); | 80 | if (GPG_ERR_NO_ERROR != gcry_md_setkey (mac, key, key_len)) |
81 | { | ||
82 | GNUNET_break (0); | ||
83 | return NULL; | ||
84 | } | ||
81 | gcry_md_write (mac, buf, buf_len); | 85 | gcry_md_write (mac, buf, buf_len); |
82 | 86 | ||
83 | return (const void *) gcry_md_read (mac, 0); | 87 | return (const void *) gcry_md_read (mac, 0); |