diff options
author | Özgür Kesim <oec-taler@kesim.org> | 2022-06-27 18:06:44 +0200 |
---|---|---|
committer | Özgür Kesim <oec-taler@kesim.org> | 2022-06-27 18:06:44 +0200 |
commit | 206c7ec705567b3520ab170fd61cd8114adeed89 (patch) | |
tree | fbc4adf34f0dd382b8721506ea46f899804d2e41 /src | |
parent | cddfaf007f4ac22e224f3df5f0151a0d620fb131 (diff) | |
download | exchange-206c7ec705567b3520ab170fd61cd8114adeed89.tar.xz |
-fixes in extension event handler
Diffstat (limited to 'src')
-rw-r--r-- | src/exchange/taler-exchange-httpd_extensions.c | 11 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_management_extensions.c | 10 |
2 files changed, 10 insertions, 11 deletions
diff --git a/src/exchange/taler-exchange-httpd_extensions.c b/src/exchange/taler-exchange-httpd_extensions.c index c9d470521..5a6137383 100644 --- a/src/exchange/taler-exchange-httpd_extensions.c +++ b/src/exchange/taler-exchange-httpd_extensions.c @@ -38,8 +38,8 @@ static struct GNUNET_DB_EventHandler *extensions_eh; * the extensions data in the database. * * @param cls NULL - * @param extra unused - * @param extra_size number of bytes in @a extra unused + * @param extra type of the extension + * @param extra_size number of bytes in @a extra */ static void extension_update_event_cb (void *cls, @@ -47,13 +47,14 @@ extension_update_event_cb (void *cls, size_t extra_size) { (void) cls; + uint32_t nbo_type; enum TALER_Extension_Type type; const struct TALER_Extension *extension; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Received extensions update event\n"); - if (sizeof(enum TALER_Extension_Type) != extra_size) + if (sizeof(nbo_type) != extra_size) { GNUNET_break (0); GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -61,8 +62,10 @@ extension_update_event_cb (void *cls, return; } - type = *(enum TALER_Extension_Type *) extra; + GNUNET_assert (NULL != extra); + nbo_type = *(uint32_t *) extra; + type = (enum TALER_Extension_Type) ntohl (nbo_type); /* Get the corresponding extension */ extension = TALER_extensions_get_by_type (type); diff --git a/src/exchange/taler-exchange-httpd_management_extensions.c b/src/exchange/taler-exchange-httpd_management_extensions.c index ce151e2e5..83a1dfc97 100644 --- a/src/exchange/taler-exchange-httpd_management_extensions.c +++ b/src/exchange/taler-exchange-httpd_management_extensions.c @@ -121,20 +121,16 @@ set_extensions (void *cls, /* Success, trigger event */ { - enum TALER_Extension_Type *type = &sec->extensions[i].type; + uint32_t nbo_type = htonl (sec->extensions[i].type); struct GNUNET_DB_EventHeaderP ev = { .size = htons (sizeof (ev)), .type = htons (TALER_DBEVENT_EXCHANGE_EXTENSIONS_UPDATED) }; - // FIXME-Oec: bug: convert type to NBO first! - // FIXME-Oec: bug: sizeof enum is ill-defined... - // FIXME-Oec: bug: don't see /keys listening to the event - // FIXME-Oec: why is TEH_keys_update_states (); not enough? TEH_plugin->event_notify (TEH_plugin->cls, &ev, - type, - sizeof(*type)); + &nbo_type, + sizeof(nbo_type)); } } |