From e003198a662f2d3ad11fa7719043dc6a1ee12829 Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Thu, 1 Mar 2001 23:55:24 +0000 Subject: [PATCH] Bill Gribble's ssl patch. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3731 57a11ea4-9604-0410-9ed3-97b8803252fd --- acconfig.h | 1 + configure.in | 4 ++++ src/gnome/gnc-html.c | 33 ++++++++++++++++++++++++++++++++- src/gnome/window-help.c | 7 ++++++- src/scm/qif-import/qif-file.scm | 10 ++++++++-- 5 files changed, 51 insertions(+), 4 deletions(-) diff --git a/acconfig.h b/acconfig.h index 61293f2a5c..00bb326700 100644 --- a/acconfig.h +++ b/acconfig.h @@ -69,6 +69,7 @@ #undef HAVE_LIBGTKHTML #undef HAVE_LIBGHTTP +#undef HAVE_OPENSSL /* misc image and compression libs needed by html widget */ #undef HAVE_ZLIB diff --git a/configure.in b/configure.in index cf1aeeb32a..d6bcc1ef03 100644 --- a/configure.in +++ b/configure.in @@ -327,6 +327,10 @@ AC_CHECK_LIB(ghttp, ghttp_request_new, AC_MSG_ERROR([Cannot find ghttp. See the README for more info.]), $GHTTP_LIBS) +AC_CHECK_LIB(ghttp, ghttp_enable_ssl, + AC_DEFINE(HAVE_OPENSSL), + AC_MSG_WARN([ghttp does not have SSL support.]), + $GHTTP_LIBS) AC_SUBST(GTKHTML_LIBS) AC_SUBST(GTKHTML_CFLAGS) diff --git a/src/gnome/gnc-html.c b/src/gnome/gnc-html.c index 1ae3944a41..86b3ea6439 100644 --- a/src/gnome/gnc-html.c +++ b/src/gnome/gnc-html.c @@ -24,8 +24,22 @@ #include #include +#include +#include +#include #include #include + +#ifdef HAVE_OPENSSL +#include +#include +#include +#include +#include +#include +#endif + +#include #include #include #ifdef USE_GUPPI @@ -34,7 +48,6 @@ #include #include #include -#include #include #include "Account.h" @@ -413,6 +426,18 @@ ghttp_check_callback(gpointer data) { } } + +#ifdef HAVE_OPENSSL +static int +gnc_html_certificate_check_cb(ghttp_request * req, X509 * cert, + void * user_data) { + printf("gnc-html: checking SSL certificate...\n"); + X509_print_fp(stdout, cert); + printf(" ... done\n"); + return TRUE; +} +#endif + static void gnc_html_start_request(gnc_html * html, gchar * uri, GtkHTMLStream * handle) { @@ -421,6 +446,12 @@ gnc_html_start_request(gnc_html * html, gchar * uri, GtkHTMLStream * handle) { info->request = ghttp_request_new(); info->handle = handle; info->uri = g_strdup (uri); +#ifdef HAVE_OPENSSL + ghttp_enable_ssl(info->request); + ghttp_set_ssl_certificate_callback(info->request, + gnc_html_certificate_check_cb, + (void *)html); +#endif ghttp_set_uri(info->request, uri); ghttp_set_header(info->request, http_hdr_User_Agent, "gnucash/1.5 (Financial Browser for Linux; http://gnucash.org)"); diff --git a/src/gnome/window-help.c b/src/gnome/window-help.c index 8d5659566e..6a894cc13c 100644 --- a/src/gnome/window-help.c +++ b/src/gnome/window-help.c @@ -218,7 +218,12 @@ gnc_help_window_reload_button_cb(GtkWidget * w, gpointer data) { static void goto_string_cb(char * string, gpointer data) { - strncpy(data, string, 250); + if(string) { + strncpy(data, string, 250); + } + else if(data) { + *(char *)data = 0; + } } static int diff --git a/src/scm/qif-import/qif-file.scm b/src/scm/qif-import/qif-file.scm index f5f5322554..bd5f1a9d6e 100644 --- a/src/scm/qif-import/qif-file.scm +++ b/src/scm/qif-import/qif-file.scm @@ -672,13 +672,19 @@ (begin (set! all-ok #f) (errormsg - (list "Parse ambiguity : between formats " + (with-output-to-string + (lambda () + (for-each + (lambda (elt) + (display elt)) + (list + "Parse ambiguity : between formats " formats "\nValue " unparsed " could be " (printer parsed) " or " (printer this-parsed) "\nand no evidence exists to distinguish." "\nUsing " (printer parsed) ". " - "\nSee help for more info.")))))) + "\nSee help for more info."))))))))) (cdr formats)))) (if (and all-ok (not (null? (cdr objlist)))) (obj-loop (cdr objlist)))))