diff options
Diffstat (limited to 'frontends/monkey')
-rw-r--r-- | frontends/monkey/Makefile | 2 | ||||
-rw-r--r-- | frontends/monkey/cert.c | 149 | ||||
-rw-r--r-- | frontends/monkey/cert.h | 31 | ||||
-rw-r--r-- | frontends/monkey/main.c | 7 | ||||
-rw-r--r-- | frontends/monkey/output.c | 1 | ||||
-rw-r--r-- | frontends/monkey/output.h | 1 |
6 files changed, 1 insertions, 190 deletions
diff --git a/frontends/monkey/Makefile b/frontends/monkey/Makefile index 85bc9b5ae..d2dae3e16 100644 --- a/frontends/monkey/Makefile +++ b/frontends/monkey/Makefile @@ -51,7 +51,7 @@ endif # S_MONKEY are sources purely for the MONKEY build S_FRONTEND := main.c output.c filetype.c schedule.c bitmap.c plot.c browser.c \ - download.c 401login.c cert.c layout.c dispatch.c fetch.c + download.c 401login.c layout.c dispatch.c fetch.c # This is the final source build list diff --git a/frontends/monkey/cert.c b/frontends/monkey/cert.c deleted file mode 100644 index 3ec2fbee0..000000000 --- a/frontends/monkey/cert.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright 2011 Daniel Silverstone <dsilvers@digital-scurf.org> - * - * This file is part of NetSurf, http://www.netsurf-browser.org/ - * - * NetSurf is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * NetSurf is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> - -#include "utils/ring.h" -#include "utils/nsurl.h" -#include "content/urldb.h" - -#include "monkey/output.h" -#include "monkey/cert.h" - -struct monkey_cert { - struct monkey_cert *r_next, *r_prev; - uint32_t num; - nserror (*cb)(bool,void*); - void *cbpw; - nsurl *url; -}; - -static struct monkey_cert *cert_ring = NULL; -static uint32_t cert_ctr = 0; - -nserror -gui_cert_verify(nsurl *url, - const struct cert_chain *chain, - nserror (*cb)(bool proceed, void *pw), - void *cbpw) -{ - struct monkey_cert *mcrt_ctx; - - mcrt_ctx = calloc(sizeof(*mcrt_ctx), 1); - if (mcrt_ctx == NULL) { - return NSERROR_NOMEM; - } - - mcrt_ctx->cb = cb; - mcrt_ctx->cbpw = cbpw; - mcrt_ctx->num = cert_ctr++; - mcrt_ctx->url = nsurl_ref(url); - - RING_INSERT(cert_ring, mcrt_ctx); - - moutf(MOUT_SSLCERT, "VERIFY CWIN %u URL %s", - mcrt_ctx->num, nsurl_access(url)); - - return NSERROR_OK; -} - - -static struct monkey_cert * -monkey_find_sslcert_by_num(uint32_t sslcert_num) -{ - struct monkey_cert *ret = NULL; - - RING_ITERATE_START(struct monkey_cert, cert_ring, c_ring) { - if (c_ring->num == sslcert_num) { - ret = c_ring; - RING_ITERATE_STOP(cert_ring, c_ring); - } - } RING_ITERATE_END(cert_ring, c_ring); - - return ret; -} - -static void free_sslcert_context(struct monkey_cert *mcrt_ctx) { - moutf(MOUT_SSLCERT, "DESTROY CWIN %u", mcrt_ctx->num); - RING_REMOVE(cert_ring, mcrt_ctx); - if (mcrt_ctx->url) { - nsurl_unref(mcrt_ctx->url); - } - free(mcrt_ctx); -} - -static void -monkey_sslcert_handle_go(int argc, char **argv) -{ - struct monkey_cert *mcrt_ctx; - - if (argc != 3) { - moutf(MOUT_ERROR, "SSLCERT GO ARGS BAD"); - return; - } - - mcrt_ctx = monkey_find_sslcert_by_num(atoi(argv[2])); - if (mcrt_ctx == NULL) { - moutf(MOUT_ERROR, "SSLCERT NUM BAD"); - return; - } - - urldb_set_cert_permissions(mcrt_ctx->url, true); - - mcrt_ctx->cb(true, mcrt_ctx->cbpw); - - free_sslcert_context(mcrt_ctx); -} - -static void -monkey_sslcert_handle_destroy(int argc, char **argv) -{ - struct monkey_cert *mcrt_ctx; - - if (argc != 3) { - moutf(MOUT_ERROR, "SSLCERT DESTROY ARGS BAD"); - return; - } - - mcrt_ctx = monkey_find_sslcert_by_num(atoi(argv[2])); - if (mcrt_ctx == NULL) { - moutf(MOUT_ERROR, "SSLCERT NUM BAD"); - return; - } - - mcrt_ctx->cb(false, mcrt_ctx->cbpw); - - free_sslcert_context(mcrt_ctx); -} - -void -monkey_sslcert_handle_command(int argc, char **argv) -{ - if (argc == 1) - return; - - if (strcmp(argv[1], "DESTROY") == 0) { - monkey_sslcert_handle_destroy(argc, argv); - } else if (strcmp(argv[1], "GO") == 0) { - monkey_sslcert_handle_go(argc, argv); - } else { - moutf(MOUT_ERROR, "SSLCERT COMMAND UNKNOWN %s", argv[1]); - } -} diff --git a/frontends/monkey/cert.h b/frontends/monkey/cert.h deleted file mode 100644 index ff499ed16..000000000 --- a/frontends/monkey/cert.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2012 Vincent Sanders <vince@netsurf-browser.org> - * - * This file is part of NetSurf, http://www.netsurf-browser.org/ - * - * NetSurf is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * NetSurf is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef NETSURF_MONKEY_CERT_H -#define NETSURF_MONKEY_CERT_H - -struct cert_chain; - -nserror gui_cert_verify(nsurl *url, const struct cert_chain *certs, - nserror (*cb)(bool proceed, void *pw), - void *cbpw); - - -void monkey_sslcert_handle_command(int argc, char **argv); - -#endif diff --git a/frontends/monkey/main.c b/frontends/monkey/main.c index 3fd06960a..6ff480cbc 100644 --- a/frontends/monkey/main.c +++ b/frontends/monkey/main.c @@ -43,7 +43,6 @@ #include "monkey/output.h" #include "monkey/dispatch.h" #include "monkey/browser.h" -#include "monkey/cert.h" #include "monkey/401login.h" #include "monkey/filetype.h" #include "monkey/fetch.h" @@ -250,7 +249,6 @@ static struct gui_misc_table monkey_misc_table = { .quit = monkey_quit, .launch_url = gui_launch_url, - .cert_verify = gui_cert_verify, .login = gui_401login_open, }; @@ -464,11 +462,6 @@ main(int argc, char **argv) die("login handler failed to register"); } - ret = monkey_register_handler("SSLCERT", monkey_sslcert_handle_command); - if (ret != NSERROR_OK) { - die("sslcert handler failed to register"); - } - moutf(MOUT_GENERIC, "STARTED"); monkey_run(); diff --git a/frontends/monkey/output.c b/frontends/monkey/output.c index a3390ea35..d7eb7cdb6 100644 --- a/frontends/monkey/output.c +++ b/frontends/monkey/output.c @@ -31,7 +31,6 @@ static const char *type_text[]={ "GENERIC", "WINDOW", "LOGIN", - "SSLCERT", "DOWNLOAD", "PLOT", }; diff --git a/frontends/monkey/output.h b/frontends/monkey/output.h index 5e77ab3ac..8e6a0abd6 100644 --- a/frontends/monkey/output.h +++ b/frontends/monkey/output.h @@ -26,7 +26,6 @@ enum monkey_output_type { MOUT_GENERIC, MOUT_WINDOW, MOUT_LOGIN, - MOUT_SSLCERT, MOUT_DOWNLOAD, MOUT_PLOT, }; |