From c6c6b4cdfe2f9847af9a49485d8c257e284476a7 Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Fri, 21 Dec 2012 17:10:55 +0100 Subject: Abandon token idea but check referer instead. --- content/fetchers/about.c | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/content/fetchers/about.c b/content/fetchers/about.c index 4993414eb..4e67d388c 100644 --- a/content/fetchers/about.c +++ b/content/fetchers/about.c @@ -56,6 +56,12 @@ #include "utils/testament.h" #include "image/image_cache.h" +#define NS_WITH_INTERACTIVE_ABOUT_CONFIG 1 + +#ifdef NS_WITH_INTERACTIVE_ABOUT_CONFIG +# include +#endif + struct fetch_about_context; typedef bool (*fetch_about_handler)(struct fetch_about_context *); @@ -112,8 +118,6 @@ static bool fetch_about_send_header(struct fetch_about_context *ctx, } - - static bool fetch_about_blank_handler(struct fetch_about_context *ctx) { fetch_msg msg; @@ -313,33 +317,22 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx) url_func_result status; struct fetch_multipart_data *post_item; bool do_save = false; - bool valid_token = false; - char token[9] = {"12345678"}; /* save settings: */ post_item = ctx->post_multipart; while (post_item != NULL) { - - if (strcmp(post_item->name, "token") == 0 - && strcmp(post_item->value, token) == 0) { - valid_token = true; - if (do_save == true) { - break; - } - } - if (strcmp(post_item->name, "action") == 0 && strcmp(post_item->value, "Set") == 0) { - do_save = true; - if (valid_token == true) { - break; + if (strcmp(fetch_get_referer_to_send(ctx->fetchh), + "about:config")) { + do_save = true; } + break; } post_item = post_item->next; } - if (do_save && valid_token) { - int opt = 0; + if (do_save) { post_item = ctx->post_multipart; while (post_item != NULL) { nsoption_set_key(post_item->name, post_item->value); @@ -357,7 +350,6 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx) msg.type = FETCH_DATA; msg.data.header_or_data.buf = (const uint8_t *) buffer; -#define NS_WITH_INTERACTIVE_ABOUT_CONFIG 1 slen = snprintf(buffer, sizeof buffer, "\n\n" "NetSurf Browser Config\n" @@ -408,13 +400,11 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx) "\n"); slen += snprintf(buffer + slen, sizeof buffer - slen, "
" - "\n" " \n" "\n" "

\n" "\n" - "\n\n\n", - token); + "\n\n\n"); #else slen += snprintf(buffer + slen, sizeof buffer - slen, "\n\n\n"); -- cgit v1.2.3