diff --git a/src/include/d_options.rec b/src/include/d_options.rec index ec6f4f81..d9990f0f 100644 --- a/src/include/d_options.rec +++ b/src/include/d_options.rec @@ -73,6 +73,11 @@ Description1: the size of the socket address pointed by @a sa. Argument2: const struct sockaddr *sa Description2: the address to bind to; can be IPv4 (AF_INET), IPv6 (AF_INET6) or even a UNIX domain socket (AF_UNIX) CustomSetter: /* custom setter */ ++ #if FIXME_EG ++ struct sockaddr_storage bind_sa; ++ if (option->val.bind_sa.v_sa_len > sizeof (bind_sa)) return FREAKOUT; ++ memcpy (&settings->bind_sa, option->val.bind_sa.v_sa, option->val.bind_sa.v_sa_len); ++ #endif + if (0 != option->val.bind_sa.v_sa_len) + { + if (NULL != settings->bind_sa.v_sa) @@ -203,7 +208,7 @@ Name: PER_IP_LIMIT Value: 162 Comment: Limit on the number of (concurrent) network connections made to the server from the same IP address. + Can be used to prevent one IP from taking over all of the allowed connections. If the same IP tries to establish more than the specified number of connections, they will be immediately rejected. -Argument1: unsigned int per_ip_limit +Argument1: unsigned int limit Description1: FIXME Name: accept_policy @@ -380,6 +385,11 @@ Description2: the buffer with strong random data, the content will be copied by CustomSetter: /* custom setter */ + if (0 != option->val.random_entropy.v_buf_size) + { ++ #if FIXME_EG ++ MHD_entropy_hash_ (&settings->random_entropy, ++ option->val.random_entropy.v_buf, ++ option->val.random_entropy.v_buf_size); ++ #endif + if (NULL != settings->random_entropy.v_buf) + free (settings->random_entropy.v_buf); + settings->random_entropy.v_buf diff --git a/src/include/microhttpd2.h b/src/include/microhttpd2.h index 0ec1fc2e..0c4e141a 100644 --- a/src/include/microhttpd2.h +++ b/src/include/microhttpd2.h @@ -3332,12 +3332,12 @@ MHD_D_OPTION_GLOBAL_CONNECTION_LIMIT ( /** * Limit on the number of (concurrent) network connections made to the server from the same IP address. * Can be used to prevent one IP from taking over all of the allowed connections. If the same IP tries to establish more than the specified number of connections, they will be immediately rejected. - * @param per_ip_limit FIXME + * @param limit FIXME * @return structure with the requested setting */ struct MHD_DaemonOptionAndValue MHD_D_OPTION_PER_IP_LIMIT ( - unsigned int per_ip_limit + unsigned int limit ); /** diff --git a/src/include/microhttpd2_generated_daemon_options.h b/src/include/microhttpd2_generated_daemon_options.h index 02c9eec0..0b4f03dc 100644 --- a/src/include/microhttpd2_generated_daemon_options.h +++ b/src/include/microhttpd2_generated_daemon_options.h @@ -1102,15 +1102,15 @@ Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are used. /** * Limit on the number of (concurrent) network connections made to the server from the same IP address. * Can be used to prevent one IP from taking over all of the allowed connections. If the same IP tries to establish more than the specified number of connections, they will be immediately rejected. - * @param per_ip_limit FIXME + * @param limit FIXME * @return structure with the requested setting */ -# define MHD_D_OPTION_PER_IP_LIMIT(per_ip_limit) \ +# define MHD_D_OPTION_PER_IP_LIMIT(limit) \ MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ { \ .opt = MHD_D_O_PER_IP_LIMIT, \ - .val.per_ip_limit = (per_ip_limit) \ + .val.per_ip_limit = (limit) \ } \ MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** @@ -1852,18 +1852,18 @@ MHD_D_OPTION_GLOBAL_CONNECTION_LIMIT ( /** * Limit on the number of (concurrent) network connections made to the server from the same IP address. * Can be used to prevent one IP from taking over all of the allowed connections. If the same IP tries to establish more than the specified number of connections, they will be immediately rejected. - * @param per_ip_limit FIXME + * @param limit FIXME * @return structure with the requested setting */ static MHD_INLINE struct MHD_daemonOptionAndValue MHD_D_OPTION_PER_IP_LIMIT ( - unsigned int per_ip_limit + unsigned int limit ) { struct MHD_DaemonOptionAndValue opt_val; opt_val.opt = MHD_D_O_PER_IP_LIMIT; - opt_val.val.per_ip_limit = per_ip_limit; + opt_val.val.per_ip_limit = limit; return opt_val; } diff --git a/src/mhd2/daemon_set_options.c b/src/mhd2/daemon_set_options.c index ec313aab..9df4dd49 100644 --- a/src/mhd2/daemon_set_options.c +++ b/src/mhd2/daemon_set_options.c @@ -21,16 +21,17 @@ MHD_daemon_set_options ( const struct MHD_DaemonOptionAndValue *options, size_t options_max_num) { - struct DaemonOptions *const settings = daemon->settings; + struct DaemonOptions *const settings = daemon->psettings; size_t i; - if (daemon->frozen) + if (NULL == settings) return MHD_SC_TOO_LATE; - for (i=0;iopt) { + const struct MHD_daemonOptionAndValue *const option = options + i; + switch (option->opt) + { case MHD_D_O_END: return MHD_SC_OK; case MHD_D_O_WORK_MODE: @@ -193,6 +194,7 @@ MHD_daemon_set_options ( settings->dauth_def_max_nc = option->val.dauth_def_max_nc; continue; case MHD_D_O_SENTINEL: + default: /* for -WFIXME_EG */ break; } return MHD_SC_OPTION_UNKNOWN; diff --git a/src/mhd2/response_set_options.c b/src/mhd2/response_set_options.c index 4e2f0d0f..ee49f9cc 100644 --- a/src/mhd2/response_set_options.c +++ b/src/mhd2/response_set_options.c @@ -21,16 +21,17 @@ MHD_response_set_options ( const struct MHD_ResponseOptionAndValue *options, size_t options_max_num) { - struct ResponseOptions *const settings = response->settings; + struct ResponseOptions *const settings = response->psettings; size_t i; - if (response->frozen) + if (NULL == settings) return MHD_SC_TOO_LATE; - for (i=0;iopt) { + const struct MHD_responseOptionAndValue *const option = options + i; + switch (option->opt) + { case MHD_R_O_END: return MHD_SC_OK; case MHD_R_O_REUSABLE: @@ -59,6 +60,7 @@ MHD_response_set_options ( settings->termination_callback.v_term_cb_cls = option->val.termination_callback.v_term_cb_cls; continue; case MHD_R_O_SENTINEL: + default: /* for -WFIXME_EG */ break; } return MHD_SC_OPTION_UNKNOWN;