diff options
Diffstat (limited to 'src/mint/taler-mint-httpd.c')
-rw-r--r-- | src/mint/taler-mint-httpd.c | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/src/mint/taler-mint-httpd.c b/src/mint/taler-mint-httpd.c index 61d0bbdce..2c3b3d2e1 100644 --- a/src/mint/taler-mint-httpd.c +++ b/src/mint/taler-mint-httpd.c | |||
@@ -73,35 +73,29 @@ static uint16_t serve_port; | |||
73 | 73 | ||
74 | 74 | ||
75 | /** | 75 | /** |
76 | * Convert a string representing an EdDSA signature to an EdDSA | 76 | * Function called whenever MHD is done with a request. If the |
77 | * signature. | 77 | * request was a POST, we may have stored a `struct Buffer *` in the |
78 | * @a con_cls that might still need to be cleaned up. Call the | ||
79 | * respective function to free the memory. | ||
78 | * | 80 | * |
79 | * FIXME: this should be in GNUnet. | 81 | * @param cls client-defined closure |
80 | * FIXME: why? this code is dead, even here! | 82 | * @param connection connection handle |
81 | * | 83 | * @param con_cls value as set by the last call to |
82 | * @param enc encoded EdDSA signature | 84 | * the #MHD_AccessHandlerCallback |
83 | * @param enclen number of bytes in @a enc (without 0-terminator) | 85 | * @param toe reason for request termination |
84 | * @param pub where to store the EdDSA signature | 86 | * @see #MHD_OPTION_NOTIFY_COMPLETED |
85 | * @return #GNUNET_OK on success | 87 | * @ingroup request |
86 | */ | 88 | */ |
87 | int | 89 | static void |
88 | TALER_eddsa_signature_from_string (const char *enc, | 90 | handle_mhd_completion_callback (void *cls, |
89 | size_t enclen, | 91 | struct MHD_Connection *connection, |
90 | struct GNUNET_CRYPTO_EddsaSignature *sig) | 92 | void **con_cls, |
93 | enum MHD_RequestTerminationCode toe) | ||
91 | { | 94 | { |
92 | size_t keylen = (sizeof (struct GNUNET_CRYPTO_EddsaSignature)) * 8; | 95 | if (NULL == *con_cls) |
93 | 96 | return; | |
94 | if (keylen % 5 > 0) | 97 | TALER_MINT_parse_post_cleanup_callback (*con_cls); |
95 | keylen += 5 - keylen % 5; | 98 | *con_cls = NULL; |
96 | keylen /= 5; | ||
97 | if (enclen != keylen) | ||
98 | return GNUNET_SYSERR; | ||
99 | |||
100 | if (GNUNET_OK != GNUNET_STRINGS_string_to_data (enc, enclen, | ||
101 | sig, | ||
102 | sizeof (struct GNUNET_CRYPTO_EddsaSignature))) | ||
103 | return GNUNET_SYSERR; | ||
104 | return GNUNET_OK; | ||
105 | } | 99 | } |
106 | 100 | ||
107 | 101 | ||
@@ -225,7 +219,6 @@ handle_mhd_request (void *cls, | |||
225 | } | 219 | } |
226 | 220 | ||
227 | 221 | ||
228 | |||
229 | /** | 222 | /** |
230 | * Load configuration parameters for the mint | 223 | * Load configuration parameters for the mint |
231 | * server into the corresponding global variables. | 224 | * server into the corresponding global variables. |
@@ -359,6 +352,7 @@ main (int argc, char *const *argv) | |||
359 | serve_port, | 352 | serve_port, |
360 | NULL, NULL, | 353 | NULL, NULL, |
361 | &handle_mhd_request, NULL, | 354 | &handle_mhd_request, NULL, |
355 | MHD_OPTION_NOTIFY_COMPLETED, &handle_mhd_completion_callback, | ||
362 | MHD_OPTION_END); | 356 | MHD_OPTION_END); |
363 | 357 | ||
364 | if (NULL == mydaemon) | 358 | if (NULL == mydaemon) |