From 5f8e410f899f8ea70ee800642eb8a8d149e1b4ff Mon Sep 17 00:00:00 2001 From: Joshua Sled Date: Sun, 25 Feb 2007 16:21:46 +0000 Subject: [PATCH] Remove src/network-utils/, module, lingering usages of (obsolete/stubbed-out) gnc-http, form-submission. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15658 57a11ea4-9604-0410-9ed3-97b8803252fd --- configure.in | 12 +- src/Makefile.am | 1 - src/gnome-utils/Makefile.am | 2 - src/gnome-utils/gnc-html.c | 111 +----- src/gnome-utils/gnc-html.h | 10 - src/gnome-utils/gncmod-gnome-utils.c | 6 - src/gnome-utils/test/Makefile.am | 1 - src/gnome/Makefile.am | 1 - src/import-export/qif/test/Makefile.am | 1 - src/import-export/test/Makefile.am | 1 - src/network-utils/Makefile.am | 32 -- src/network-utils/gnc-gpg.c | 417 ---------------------- src/network-utils/gnc-gpg.h | 54 --- src/network-utils/gnc-http.c | 334 ----------------- src/network-utils/gnc-http.h | 43 --- src/network-utils/gncmod-network-utils.c | 41 --- src/network-utils/test/Makefile.am | 32 -- src/network-utils/test/test-link-module.c | 6 - src/network-utils/test/test-load-module | 11 - src/report/report-gnome/test/Makefile.am | 1 - src/report/stylesheets/test/Makefile.am | 1 - 21 files changed, 8 insertions(+), 1110 deletions(-) delete mode 100644 src/network-utils/Makefile.am delete mode 100644 src/network-utils/gnc-gpg.c delete mode 100644 src/network-utils/gnc-gpg.h delete mode 100644 src/network-utils/gnc-http.c delete mode 100644 src/network-utils/gnc-http.h delete mode 100644 src/network-utils/gncmod-network-utils.c delete mode 100644 src/network-utils/test/Makefile.am delete mode 100644 src/network-utils/test/test-link-module.c delete mode 100755 src/network-utils/test/test-load-module diff --git a/configure.in b/configure.in index bcaa84bf91..5cfeba788f 100644 --- a/configure.in +++ b/configure.in @@ -1969,14 +1969,8 @@ GNUCASH_APP_UTILS_LIBS="${GNUCASH_ENGINE_LIBS} -lgncmod-calculation -lgncmod-app AC_SUBST(GNUCASH_APP_UTILS_CFLAGS) AC_SUBST(GNUCASH_APP_UTILS_LIBS) -GNUCASH_NETWORK_UTILS_CFLAGS="${GLIB_CFLAGS} ${GHTTP_CFLAGS} ${GNOME_INCLUDEDIR}" -GNUCASH_NETWORK_UTILS_LIBS="${GHTTP_LIBS} ${GNOME_LIBDIR} ${GNOME_LIBS} ${GNOMEUI_LIBS} -lgncmod-network-utils" - -AC_SUBST(GNUCASH_NETWORK_UTILS_CFLAGS) -AC_SUBST(GNUCASH_NETWORK_UTILS_LIBS) - -GNUCASH_GNOME_UTILS_CFLAGS="${GNUCASH_APP_UTILS_CFLAGS} ${GNUCASH_NETWORK_UTILS_CFLAGS} ${GNOME_PRINT_CFLAGS} ${GNOME_INCLUDEDIR} ${GDK_PIXBUF_CFLAGS}" -GNUCASH_GNOME_UTILS_LIBS="${GNUCASH_APP_UTILS_LIBS} ${GNUCASH_NETWORK_UTILS_LIBS} ${GNOME_LIBDIR} ${GNOMEUI_LIBS} ${GNOME_PRINT_LIBS} ${GTKHTML_LIBS} ${GLADE_LIBS} ${GDK_PIXBUF_LIBS} -lgncmod-gnome-utils" +GNUCASH_GNOME_UTILS_CFLAGS="${GNUCASH_APP_UTILS_CFLAGS} ${GNOME_PRINT_CFLAGS} ${GNOME_INCLUDEDIR} ${GDK_PIXBUF_CFLAGS}" +GNUCASH_GNOME_UTILS_LIBS="${GNUCASH_APP_UTILS_LIBS} ${GNOME_LIBDIR} ${GNOMEUI_LIBS} ${GNOME_PRINT_LIBS} ${GTKHTML_LIBS} ${GLADE_LIBS} ${GDK_PIXBUF_LIBS} -lgncmod-gnome-utils" AC_SUBST(GNUCASH_GNOME_UTILS_CFLAGS) AC_SUBST(GNUCASH_GNOME_UTILS_LIBS) @@ -2207,8 +2201,6 @@ AC_CONFIG_FILES(po/Makefile.in src/import-export/hbci/glade/Makefile src/import-export/hbci/schemas/Makefile src/import-export/hbci/test/Makefile - src/network-utils/Makefile - src/network-utils/test/Makefile src/optional/Makefile src/optional/xsl/Makefile src/pixmaps/Makefile diff --git a/src/Makefile.am b/src/Makefile.am index 6e3527bb40..7436e7ad02 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -10,7 +10,6 @@ NONGUI_SUBDIRS = \ quotes GUI_SUBDIRS_1 = \ - network-utils \ calculation \ tax \ app-utils \ diff --git a/src/gnome-utils/Makefile.am b/src/gnome-utils/Makefile.am index 2d58b0dd60..93666e0d51 100644 --- a/src/gnome-utils/Makefile.am +++ b/src/gnome-utils/Makefile.am @@ -9,7 +9,6 @@ AM_CFLAGS = \ -I${top_srcdir}/src/gnc-module \ -I${top_srcdir}/src/engine \ -I${top_srcdir}/src/backend/file \ - -I${top_srcdir}/src/network-utils \ -I${top_srcdir}/src/app-utils \ -I${top_srcdir}/src \ -I${top_builddir}/src \ @@ -180,7 +179,6 @@ libgncmod_gnome_utils_la_LIBADD = \ ${top_builddir}/src/engine/libgncmod-engine.la \ ${top_builddir}/src/backend/file/libgnc-backend-file-utils.la \ ${top_builddir}/src/calculation/libgncmod-calculation.la \ - ${top_builddir}/src/network-utils/libgncmod-network-utils.la \ ${top_builddir}/src/app-utils/libgncmod-app-utils.la \ $(top_builddir)/lib/libc/libc-missing.la \ ${GNOME_LIBS} \ diff --git a/src/gnome-utils/gnc-html.c b/src/gnome-utils/gnc-html.c index 0daa06068f..b6ac248742 100644 --- a/src/gnome-utils/gnc-html.c +++ b/src/gnome-utils/gnc-html.c @@ -48,7 +48,6 @@ #include "gnc-engine.h" #include "gnc-gui-query.h" #include "gnc-html.h" -#include "gnc-http.h" #include "gnc-html-history.h" #include "gnc-html-graph-gog.h" #include "gnc-ui.h" @@ -64,7 +63,7 @@ struct gnc_html_struct { URLType base_type; /* base of URL (path - filename) */ gchar * base_location; - gnc_http * http; /* handles HTTP requests */ + //gnc_http * http; /* handles HTTP requests */ GHashTable * request_info; /* hash uri to GList of GtkHTMLStream * */ /* callbacks */ @@ -540,9 +539,7 @@ gnc_html_start_request(gnc_html * html, gchar * uri, GtkHTMLStream * handle) g_hash_table_insert(html->request_info, uri, handles); if(need_request) { - gnc_set_busy_cursor (html->html, FALSE); - gnc_http_start_request(html->http, uri, gnc_html_http_request_cb, - (gpointer)html); + g_critical("we've not supported network requests for years"); } } @@ -897,13 +894,8 @@ gnc_html_submit_cb(GtkHTML * html, const gchar * method, DEBUG(" "); form_data = gnc_html_unpack_form_data(encoded_form_data); type = gnc_html_parse_url(gnchtml, action, &location, &label); - - if(!strcasecmp(method, "get")) { - gnc_html_generic_get_submit(gnchtml, action, form_data); - } - else if(!strcasecmp(method, "post")) { - gnc_html_generic_post_submit(gnchtml, action, form_data); - } + + g_critical("form submission hasn't been supported in years."); g_free(location); g_free(label); @@ -1148,7 +1140,7 @@ gnc_html_new( GtkWindow *parent ) GTK_WIDGET(retval->html)); retval->request_info = g_hash_table_new(g_str_hash, g_str_equal); - retval->http = gnc_http_new(); + //retval->http = gnc_http_new(); retval->history = gnc_html_history_new(); g_object_ref (retval->container); @@ -1208,7 +1200,7 @@ void gnc_html_cancel(gnc_html * html) { /* remove our own references to requests */ - gnc_http_cancel_requests(html->http); + //gnc_http_cancel_requests(html->http); g_hash_table_foreach_remove(html->request_info, html_cancel_helper, NULL); } @@ -1612,94 +1604,3 @@ gnc_html_escape_newlines(const gchar * in) g_string_free(escaped, FALSE); return out; } - - -/******************************************************************** - * gnc_html_generic_get_submit() : normal 'get' submit method. - ********************************************************************/ - -void -gnc_html_generic_get_submit(gnc_html * html, const char * action, - GHashTable * form_data) -{ - URLType type; - char * location = NULL; - char * label = NULL; - char * fullurl = NULL; - char * encoded = gnc_html_pack_form_data(form_data); - - type = gnc_html_parse_url(html, action, &location, &label); - fullurl = g_strconcat(location, "?", encoded, NULL); - gnc_html_show_url(html, type, fullurl, label, 0); - - g_free(encoded); - g_free(location); - g_free(label); - g_free(fullurl); -} - - -/******************************************************************** - * gnc_html_generic_post_submit() : normal 'post' submit method. - ********************************************************************/ - -void -gnc_html_generic_post_submit(gnc_html * html, const char * action, - GHashTable * form_data) -{ - char * encoded = gnc_html_pack_form_data(form_data); - char * copy = strdup(encoded); - gnc_http_start_post(html->http, action, - "application/x-www-form-urlencoded", - copy, strlen(copy), - gnc_html_http_request_cb, html); - g_free(encoded); -} - - -/******************************************************************** - * gnc_html_multipart_post_submit() : this is really sort of useless - * but I'll make it better later. It's useless because FTMP CGI/php - * don't properly decode the urlencoded values. - ********************************************************************/ - -static void -multipart_post_helper(gpointer key, gpointer val, - gpointer user_data) -{ - char * old_str = *(char **)user_data; - char * new_str = - g_strconcat(old_str, - "--XXXgncXXX\r\n", - "Content-Disposition: form-data; name=\"", - (char *)key, "\"\r\n\r\n", - (char *)val, "\r\n", - NULL); - *(char **)user_data = new_str; - g_free(old_str); -} - - -void -gnc_html_multipart_post_submit(gnc_html * html, const char * action, - GHashTable * form_data) -{ - - char * htmlstr = g_strdup(""); - char * next_htmlstr; - - /* encode the arguments from the hash table */ - g_hash_table_foreach(form_data, multipart_post_helper, &htmlstr); - - /* add the closing boundary marker */ - next_htmlstr = g_strconcat(htmlstr, "--XXXgncXXX--\r\n", NULL); - g_free(htmlstr); - htmlstr = next_htmlstr; - next_htmlstr = NULL; - gnc_http_start_post(html->http, action, - "multipart/form-data; boundary=XXXgncXXX", - htmlstr, strlen(htmlstr), - gnc_html_http_request_cb, html); - - g_free(htmlstr); -} diff --git a/src/gnome-utils/gnc-html.h b/src/gnome-utils/gnc-html.h index 5cd522dfb0..d88925e9a2 100644 --- a/src/gnome-utils/gnc-html.h +++ b/src/gnome-utils/gnc-html.h @@ -138,16 +138,6 @@ void gnc_html_register_url_handler(URLType url_type, GncHTMLUrlCB hand); void gnc_html_unregister_url_handler(URLType url_type); -/* default action handlers for GET and POST methods. 'generic_post' - * is the trivial application/x-www-form-urlencoded submit, - * multipart-post is a multipart/form-data submit. */ -void gnc_html_generic_get_submit(gnc_html * html, const char * act, - GHashTable * form_data); -void gnc_html_generic_post_submit(gnc_html * html, const char * act, - GHashTable * form_data); -void gnc_html_multipart_post_submit(gnc_html * html, const char * a, - GHashTable * form_data); - URLType gnc_html_parse_url(gnc_html * html, const gchar * url, char ** url_location, char ** url_label); diff --git a/src/gnome-utils/gncmod-gnome-utils.c b/src/gnome-utils/gncmod-gnome-utils.c index 5acd552833..ace535410e 100644 --- a/src/gnome-utils/gncmod-gnome-utils.c +++ b/src/gnome-utils/gncmod-gnome-utils.c @@ -64,12 +64,6 @@ gnc_module_init(int refcount) { return FALSE; } - /* load the calculation module (we depend on it) */ - if(!gnc_module_load("gnucash/network-utils", 0)) { - return FALSE; - } - - /* load the calculation module (we depend on it) */ if(!gnc_module_load("gnucash/app-utils", 0)) { return FALSE; } diff --git a/src/gnome-utils/test/Makefile.am b/src/gnome-utils/test/Makefile.am index 0535266566..4fec0c79df 100644 --- a/src/gnome-utils/test/Makefile.am +++ b/src/gnome-utils/test/Makefile.am @@ -18,7 +18,6 @@ GNC_TEST_DEPS := @GNC_TEST_SRFI_LOAD_CMD@ \ --library-dir ${top_builddir}/src/gnc-module \ --library-dir ${top_builddir}/src/engine \ --library-dir ${top_builddir}/src/backend/file \ - --library-dir ${top_builddir}/src/network-utils \ --library-dir ${top_builddir}/src/calculation \ --library-dir ${top_builddir}/src/app-utils \ --library-dir ${top_builddir}/src/gnome-utils diff --git a/src/gnome/Makefile.am b/src/gnome/Makefile.am index 9885ef40ac..68906c41a8 100644 --- a/src/gnome/Makefile.am +++ b/src/gnome/Makefile.am @@ -106,7 +106,6 @@ AM_CFLAGS = \ -I${top_srcdir}/src/core-utils \ -I${top_srcdir}/src/calculation \ -I${top_srcdir}/src/engine \ - -I${top_srcdir}/src/network-utils \ -I${top_srcdir}/src/app-utils \ -I${top_srcdir}/src/backend/file \ -I${top_srcdir}/src/gnome-utils \ diff --git a/src/import-export/qif/test/Makefile.am b/src/import-export/qif/test/Makefile.am index 07bc566f12..9ebdf5524d 100644 --- a/src/import-export/qif/test/Makefile.am +++ b/src/import-export/qif/test/Makefile.am @@ -36,7 +36,6 @@ GNC_TEST_DEPS := @GNC_TEST_SRFI_LOAD_CMD@ \ --gnc-module-dir ${top_srcdir}/src/app-utils \ --gnc-module-dir ${top_srcdir}/src/gnome-utils \ --gnc-module-dir ${top_builddir}/src/gnome-utils \ - --gnc-module-dir ${top_builddir}/src/network-utils \ --gnc-module-dir ${top_builddir}/src/gnome \ --guile-load-dir ${top_srcdir}/src/scm \ --guile-load-dir ${top_srcdir}/src/import-export \ diff --git a/src/import-export/test/Makefile.am b/src/import-export/test/Makefile.am index 9666d124d9..b00bc2b10a 100644 --- a/src/import-export/test/Makefile.am +++ b/src/import-export/test/Makefile.am @@ -30,7 +30,6 @@ GNC_TEST_DEPS := @GNC_TEST_SRFI_LOAD_CMD@ \ --library-dir ${top_builddir}/src/gnc-module \ --library-dir ${top_builddir}/src/engine \ --library-dir ${top_builddir}/src/backend/file \ - --library-dir ${top_builddir}/src/network-utils \ --library-dir ${top_builddir}/src/calculation \ --library-dir ${top_builddir}/src/app-utils \ --library-dir ${top_builddir}/src/gnome-utils \ diff --git a/src/network-utils/Makefile.am b/src/network-utils/Makefile.am deleted file mode 100644 index a51c593aba..0000000000 --- a/src/network-utils/Makefile.am +++ /dev/null @@ -1,32 +0,0 @@ -# 2003-03-11 TomF changes for Gnome-2 branch, 5th batch -# Add src/engine to allow including gnc-engine-util.h - -SUBDIRS = . test - -pkglib_LTLIBRARIES = libgncmod-network-utils.la - -AM_CFLAGS = \ - -I${top_srcdir}/src \ - -I${top_srcdir}/src/gnc-module \ - -I${top_srcdir}/src/engine \ - ${GLIB_CFLAGS} \ - ${QOF_CFLAGS} \ - ${GNOME_CFLAGS} \ - ${GUILE_INCS} - -libgncmod_network_utils_la_SOURCES = \ - gnc-http.c \ - gncmod-network-utils.c - -gncincludedir = ${GNC_INCLUDE_DIR} -gncinclude_HEADERS = \ - gnc-http.h - -libgncmod_network_utils_la_LDFLAGS = -avoid-version - -libgncmod_network_utils_la_LIBADD = \ - ${top_builddir}/src/gnc-module/libgnc-module.la \ - ${GNOME_LIBS} ${QOF_LIBS} - - -INCLUDES = -DG_LOG_DOMAIN=\"gnc.net\" diff --git a/src/network-utils/gnc-gpg.c b/src/network-utils/gnc-gpg.c deleted file mode 100644 index f83e994ce8..0000000000 --- a/src/network-utils/gnc-gpg.c +++ /dev/null @@ -1,417 +0,0 @@ -/******************************************************************** - * gnc-gpg.c -- encrypt/decrypt data using GPG and the gnucash * - * keyrings * - * Copyright (C) 2000 Bill Gribble * - * * - * This program 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; either version 2 of * - * the License, or (at your option) any later version. * - * * - * This program 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, contact: * - * * - * Free Software Foundation Voice: +1-617-542-5942 * - * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * - * Boston, MA 02110-1301, USA gnu@gnu.org * - ********************************************************************/ - -#include "config.h" - -#include -#include -#include -#include -#include -#include - -#include "gnc-gpg.h" - -/******************************************************************** - * gnc_gpg_transform(_async) : call GPG with specified input and args - * the _async variety returns immediately and calls a callback when - * complete. - ********************************************************************/ - -struct gpg_transform_data { - GString * str; - gint tag; - GncGPGCb cb; - gpointer data; -}; - -static void -gnc_gpg_transform_helper(gpointer data, gint fd, GdkInputCondition cond) { - struct gpg_transform_data * td = data; - int bytes_read; - char buf[1025]; - char * cstr; - - buf[1024] = 0; - - if(cond == GDK_INPUT_READ) { - while((bytes_read = read(fd, buf, 1024)) == 1024) { - g_string_append(td->str, buf); - } - if(bytes_read > 0) { - buf[bytes_read] = 0; - g_string_append(td->str, buf); - } - else { - /* we're done. call the callback */ - gdk_input_remove(td->tag); - cstr = td->str->str; - g_string_free(td->str, FALSE); - (td->cb)(cstr, td->data); - g_free(td); - } - } - else { - gdk_input_remove(td->tag); - } -} - -static void -gnc_gpg_transform_async(const gchar * input, gint input_size, - const char * passphrase, char ** gpg_argv, - GncGPGCb cb, gpointer cb_data) { - int pid; - int to_child[2]; - int from_child[2]; - int bytes; - int total_bytes; - struct gpg_transform_data * td; - - /* create a pipe for talking to the child gpg process */ - if((pipe(to_child) != 0) || (pipe(from_child) != 0)) { - return; - } - - /* create the process. */ - if((pid = fork()) != 0) { - close(to_child[0]); - close(from_child[1]); - - /* parent process. write passphrase to pipe first. */ - if(passphrase) { - total_bytes = 0; - while(total_bytes < (int)strlen(passphrase)) { - bytes = write(to_child[1], - passphrase+total_bytes, - strlen(passphrase)-total_bytes); - if(bytes < 0) { - break; - } - else { - total_bytes += bytes; - } - } - } - - /* now write data */ - total_bytes = 0; - while(total_bytes < input_size) { - bytes = write(to_child[1], input+total_bytes, input_size-total_bytes); - if(bytes < 0) break; - else { - total_bytes += bytes; - } - } - close(to_child[1]); - - td = g_new0(struct gpg_transform_data, 1); - td->str = g_string_new(""); - td->cb = cb; - td->data = cb_data; - - /* read transformed data back in the input handler */ - td->tag = gdk_input_add(from_child[0], GDK_INPUT_READ, - gnc_gpg_transform_helper, td); - } - else { - close(to_child[1]); - close(from_child[0]); - - /* child process. Set up pipes. */ - close(0); - close(1); - /* stderr to /dev/null ... gpg is a chatty thing */ - close(2); - - /* hook up the pipes */ - dup(to_child[0]); - dup(from_child[1]); - - /* new files aren't readable by anybody but the user */ - umask(077); - - if(execvp("gpg", gpg_argv)) { - char buf[1024]; - /* get data from parent */ - while((bytes = read(to_child[0], buf, 1024)) > 0) { - bytes = 0; - } - /* give 'em a little back */ - write(from_child[1], "\n", 1); - _exit(0); - } - } -} - -static void -gnc_gpg_transform_sync_helper(char * output, gpointer data) { - const char ** status = data; - status[1] = output; - status[0] = (char *)1; - -} - -static char * -gnc_gpg_transform(const gchar * input, gint input_size, - const char * passphrase, char ** gpg_argv) { - char * out[2] = { NULL, NULL }; - gnc_gpg_transform_async(input, input_size, passphrase, gpg_argv, - gnc_gpg_transform_sync_helper, (gpointer)out); - while(!out[0]) { - gtk_main_iteration(); - } - return out[1]; -} - - - -/******************************************************************** - * gnc_gpg_encrypt - * transform a cleartext to a crypted text for the given recipient - ********************************************************************/ - -char * -gnc_gpg_encrypt(const gchar * cleartext, int cleartext_size, - const gchar * recipient, const gchar * passphrase) { - char * retval = NULL; - char * argv[] = - { - "gpg", - "-q", - "--batch", - "-sea", - "--keyring", - "~/.gnucash/gnucash.pub", - "--secret-keyring", - "~/.gnucash/gnucash.sec", - "-r", - NULL, - "--passphrase-fd", - "0", - NULL - }; - - argv[7] = (char *)recipient; - - retval = gnc_gpg_transform(cleartext, cleartext_size, passphrase, argv); - return retval; -} - -void -gnc_gpg_encrypt_async(const gchar * cleartext, int cleartext_size, - const gchar * recipient, const gchar * passphrase, - GncGPGCb cb, gpointer data) { - char * argv[] = - { - "gpg", - "-q", - "--batch", - "-sea", - "--keyring", - "~/.gnucash/gnucash.pub", - "--secret-keyring", - "~/.gnucash/gnucash.sec", - "-r", - NULL, - "--passphrase-fd", - "0", - NULL - }; - - argv[7] = (char *)recipient; - - gnc_gpg_transform_async(cleartext, cleartext_size, passphrase, argv, - cb, data); -} - - -/******************************************************************** - * gnc_gpg_decrypt - * transform a crypted text into a cleartext. - ********************************************************************/ - -char * -gnc_gpg_decrypt(const gchar * cryptext, int cryptext_size, - const gchar * passphrase) { - char * retval = NULL; - - char * argv[] = - { "gpg", - "-q", - "--batch", - "-da", - "--keyring", - "~/.gnucash/gnucash.pub", - "--secret-keyring", - "~/.gnucash/gnucash.sec", - "--passphrase-fd", - "0", - NULL - }; - - retval = gnc_gpg_transform(cryptext, cryptext_size, passphrase, argv); - return retval; -} - -void -gnc_gpg_decrypt_async(const gchar * cryptext, int cryptext_size, - const gchar * passphrase, - void (* cb)(char * clrtxt, gpointer d), - gpointer data) { - char * argv[] = - { "gpg", - "-q", - "--batch", - "-da", - "--keyring", - "~/.gnucash/gnucash.pub", - "--secret-keyring", - "~/.gnucash/gnucash.sec", - "--passphrase-fd", - "0", - NULL - }; - - gnc_gpg_transform_async(cryptext, cryptext_size, passphrase, argv, - cb, data); -} - - -/******************************************************************** - * gnc_gpg_export - * get a public key (ASCII armored) - ********************************************************************/ - -char * -gnc_gpg_export(const gchar * keyname) { - char * retval; - char * argv[] = - { "gpg", - "-q", - "--export", - "-a", - "--keyring", - "~/.gnucash/gnucash.pub", - NULL, - NULL - }; - argv[6] = g_strdup_printf("(%s)", keyname ? keyname : ""); - retval = gnc_gpg_transform(NULL, 0, NULL, argv); - g_free(argv[6]); - return retval; -} - -void -gnc_gpg_export_async(const gchar * keyname, GncGPGCb cb, gpointer data) { - char * argv[] = - { "gpg", - "-q", - "--export", - "-a", - "--keyring", - "~/.gnucash/gnucash.pub", - NULL, - NULL - }; - argv[6] = g_strdup_printf("(%s)", keyname ? keyname : ""); - gnc_gpg_transform_async(NULL, 0, NULL, argv, cb, data); - g_free(argv[6]); -} - - -/******************************************************************** - * gnc_gpg_make_keypair - * make a keypair for gnucash use - ********************************************************************/ - -char * -gnc_gpg_make_keypair(const gchar * username, - const gchar * idstring, - const gchar * email, - const gchar * passphrase) { - char * gpg_input = - g_strdup_printf("Key-Type: DSA\n" - "Key-Length: 1024\n" - "Subkey-Type: ELG-E\n" - "Subkey-Length: 1024\n" - "Name-Real: %s\n" - "Name-Comment: %s\n" - "Name-Email: %s\n" - "Passphrase: %s\n" - "%%commit\n", - username ? username : "", - idstring ? idstring : "", - email ? email : "", - passphrase ? passphrase : ""); - char * argv [] = - { "gpg", - "--batch", - "-q", - "--gen-key", - "--keyring", - "~/.gnucash/gnucash.pub", - "--secret-keyring", - "~/.gnucash/gnucash.sec", - NULL - }; - - char * retval = gnc_gpg_transform(gpg_input, strlen(gpg_input), NULL, argv); - g_free(gpg_input); - return retval; -} - -void -gnc_gpg_make_keypair_async(const gchar * username, - const gchar * idstring, - const gchar * email, - const gchar * passphrase, - GncGPGCb cb, gpointer data) { - char * gpg_input = - g_strdup_printf("Key-Type: DSA\n" - "Key-Length: 1024\n" - "Subkey-Type: ELG-E\n" - "Subkey-Length: 1024\n" - "Name-Real: %s\n" - "Name-Comment: %s\n" - "Name-Email: %s\n" - "Passphrase: %s\n" - "%%commit\n", - username ? username : "", - idstring ? idstring : "", - email ? email : "", - passphrase ? passphrase : ""); - char * argv [] = - { "gpg", - "--batch", - "-q", - "--gen-key", - "--keyring", - "~/.gnucash/gnucash.pub", - "--secret-keyring", - "~/.gnucash/gnucash.sec", - NULL - }; - - gnc_gpg_transform_async(gpg_input, strlen(gpg_input), NULL, argv, cb, data); - g_free(gpg_input); -} diff --git a/src/network-utils/gnc-gpg.h b/src/network-utils/gnc-gpg.h deleted file mode 100644 index 314fa76921..0000000000 --- a/src/network-utils/gnc-gpg.h +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************** - * gnc-gpg.h -- encrypt/decrypt data using GPG and the gnucash * - * keyrings * - * Copyright (C) 2000-2001 Bill Gribble * - * * - * This program 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; either version 2 of * - * the License, or (at your option) any later version. * - * * - * This program 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, contact: * - * * - * Free Software Foundation Voice: +1-617-542-5942 * - * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * - * Boston, MA 02110-1301, USA gnu@gnu.org * - ********************************************************************/ - -#ifndef GNC_GPG_H -#define GNC_GPG_H - -#include - -typedef void (* GncGPGCb)(char * output, gpointer data); - -char * gnc_gpg_export(const gchar * keyname); -void gnc_gpg_export_async(const gchar * keyname, GncGPGCb cb, - gpointer data); - -char * gnc_gpg_encrypt(const gchar * cleartext, int cleartext_size, - const gchar * recipient, const gchar * passphrase); -void gnc_gpg_encrypt_async(const gchar * cleartext, int cleartext_size, - const gchar * recipient, const gchar * pp, - GncGPGCb cb, gpointer data); - -char * gnc_gpg_decrypt(const gchar * crypttext, int crypttext_size, - const gchar * passphrase); -void gnc_gpg_decrypt_async(const gchar * crypttext, int crypttext_size, - const gchar * passphrase, - GncGPGCb cb, gpointer data); - -char * gnc_gpg_make_keypair(const gchar * name, const gchar * id, - const gchar * email, const gchar * passphrase); -void gnc_gpg_make_keypair_async(const gchar * name, const gchar * id, - const gchar * email, const gchar * pp, - GncGPGCb cb, gpointer data); - - -#endif diff --git a/src/network-utils/gnc-http.c b/src/network-utils/gnc-http.c deleted file mode 100644 index 3a54027160..0000000000 --- a/src/network-utils/gnc-http.c +++ /dev/null @@ -1,334 +0,0 @@ -/******************************************************************** - * gnc-http.c -- handle processing of HTTP requests via gnome-http * - * Copyright (C) 2001 Bill Gribble * - * * - * This program 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; either version 2 of * - * the License, or (at your option) any later version. * - * * - * This program 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, contact: * - * * - * Free Software Foundation Voice: +1-617-542-5942 * - * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * - * Boston, MA 02110-1301, USA gnu@gnu.org * - ********************************************************************/ - -/******************************************************************** - * 3/11/03 TomF Gnome2 changes for Gnome2 * - * gnc_http.c Disable all functions to bypass missing ghttp * - * include "qof.h" to allow PERR warnings * - * Use long if 0 to make it easy to go back to the original to * - * start developing a ghttp replacement. * -*********************************************************************/ - -#include "config.h" - -#if 0 -#ifdef HAVE_OPENSSL -#include -#include -#include -#include -#include - -#ifdef HAVE_GHTTP_SSL_H -#include -#endif /* HAVE_GHTTP_SSL_H */ - -#endif /* HAVE_OPENSSL */ - -#include -#include -#include -#include -#include -#include -#include -#endif - -#include "gnc-http.h" -#include "gnc-engine.h" /* To allow PERR messages */ - -/* ***Warning*** Find a gnome2 replacement for ghttp ***************/ -#if 0 - -struct _gnc_http { - GList * requests; - guint callback_tag; - gint callback_enabled; -}; - -struct request_info { - gchar * uri; - ghttp_request * request; - GncHTTPRequestCB callback; - gpointer callback_data; -}; -#endif - -gnc_http * -gnc_http_new(void) { - return NULL; -} - -#if 0 -gnc_http * -gnc_http_new(void) { - gnc_http * ret = g_new0(struct _gnc_http, 1); - ret->requests = NULL; - ret->callback_tag = 0; - ret->callback_enabled = FALSE; - return ret; -} - -void -gnc_http_destroy(gnc_http * http) { - gnc_http_cancel_requests(http); - g_free(http); -} - -void -gnc_http_cancel_requests(gnc_http * http) { - GList * current; - - if(http->callback_enabled == TRUE) { - /* FIXME : should replace this with glib idle function -- bg */ - gtk_timeout_remove(http->callback_tag); - http->callback_enabled = FALSE; - http->callback_tag = 0; - - /* go through and destroy all the requests */ - for(current = http->requests; current; current = current->next) { - if(current->data) { - struct request_info * r = current->data; - current->data = NULL; - ghttp_request_destroy(r->request); - r->request = NULL; - g_free(r->uri); - g_free(r); - } - } - - /* free the list backbone */ - g_list_free(http->requests); - http->requests = NULL; - } -} - -static gboolean -ghttp_check_callback(gpointer data) { - gnc_http * http = data; - GList * current = NULL; - ghttp_status status; - struct request_info * req = NULL; - - /* walk the request list to deal with any complete requests */ - for(current = http->requests; current; current = current->next) { - req = current->data; - - if(!req) { - g_warning("NULL request."); - continue; - } - - status = ghttp_process(req->request); - switch(status) { - case ghttp_done: - if(req->callback) { - (req->callback)(req->uri, TRUE, - ghttp_get_body(req->request), - ghttp_get_body_len(req->request), - req->callback_data); - } - ghttp_request_destroy(req->request); - req->request = NULL; - current->data = NULL; - g_free(req); - break; - - case ghttp_error: - if(req->callback) { - (req->callback)(req->uri, FALSE, - ghttp_get_error(req->request), - strlen(ghttp_get_error(req->request)), - req->callback_data); - } - ghttp_request_destroy(req->request); - req->request = NULL; - current->data = NULL; - g_free(req); - break; - - case ghttp_not_done: - break; - } - } - - /* walk the list again to remove dead requests */ - current = http->requests; - while(current) { - if(current->data == NULL) { - http->requests = g_list_remove_link(http->requests, current); - current = http->requests; - } - else { - current = current->next; - } - } - - /* if all requests are done, disable the timeout */ - if(http->requests == NULL) { - http->callback_enabled = FALSE; - http->callback_tag = 0; - return FALSE; - } - else { - return TRUE; - } -} - - -#ifdef HAVE_OPENSSL -static int -gnc_http_certificate_check_cb(ghttp_request * req, X509 * cert, - void * user_data) { - printf("checking SSL certificate..."); - X509_print_fp(stdout, cert); - printf(" ... done\n"); - return TRUE; -} -#endif - -void -gnc_http_start_request(gnc_http * http, const gchar * uri, - GncHTTPRequestCB cb, gpointer user_data) { - - struct request_info * info = g_new0(struct request_info, 1); - const gchar *oldlocale; - - info->request = ghttp_request_new(); - info->uri = g_strdup (uri); - info->callback = cb; - info->callback_data = user_data; - -#ifdef HAVE_OPENSSL - ghttp_enable_ssl(info->request); - ghttp_set_ssl_certificate_callback(info->request, - gnc_http_certificate_check_cb, - (void *)http); -#endif - ghttp_set_uri(info->request, strdup(uri)); - ghttp_set_header(info->request, http_hdr_User_Agent, - strdup(PACKAGE "/" VERSION " ; http://gnucash.org")); - ghttp_set_sync(info->request, ghttp_async); - ghttp_set_type(info->request, ghttp_type_get); - ghttp_prepare(info->request); - oldlocale = setlocale(LC_NUMERIC, "C"); - ghttp_process(info->request); - setlocale(LC_NUMERIC, oldlocale); - - http->requests = g_list_append(http->requests, info); - - /* start the gtk timeout if not started */ - /* FIXME : should replace this with glib idle function -- bg */ - if(!http->callback_enabled) { - - http->callback_tag = - g_timeout_add(100, ghttp_check_callback, http); - http->callback_enabled = TRUE; - } -} - -void -gnc_http_start_post(gnc_http * http, const char * uri, - const char * content_type, - const char * data, int datalen, - GncHTTPRequestCB cb, gpointer user_data) { - struct request_info * info = g_new0(struct request_info, 1); - char * new_body = malloc(datalen); - - info->request = ghttp_request_new(); - info->uri = g_strdup (uri); - info->callback = cb; - info->callback_data = user_data; -#ifdef HAVE_OPENSSL - ghttp_enable_ssl(info->request); - ghttp_set_ssl_certificate_callback(info->request, - gnc_http_certificate_check_cb, - (void *)http); -#endif - ghttp_set_uri(info->request, strdup(uri)); - ghttp_set_header(info->request, http_hdr_User_Agent, - strdup(PACKAGE "/" VERSION " ; http://gnucash.org")); - ghttp_set_header(info->request, http_hdr_Content_Type, content_type); - ghttp_set_sync(info->request, ghttp_async); - ghttp_set_type(info->request, ghttp_type_post); - memcpy(new_body, data, datalen); - ghttp_set_body(info->request, (char*)new_body, datalen); - - ghttp_prepare(info->request); - ghttp_process(info->request); - - http->requests = g_list_append(http->requests, info); - - /* start the gtk timeout if not started */ - if(!http->callback_enabled) { - http->callback_tag = - g_timeout_add(100, ghttp_check_callback, http); - http->callback_enabled = TRUE; - } -} - -#else -static QofLogModule log_module = GNC_MOD_IO; - -/* ***Warning*** Find a gnome2 replacement for ghttp ***************/ - -void -gnc_http_destroy(gnc_http * http) { - PERR ("***Warning*** Find a gnome2 replacement for ghttp *******"); - return; -} - -void -gnc_http_cancel_requests(gnc_http * http) { - PERR ("***Warning*** Find a gnome2 replacement for ghttp *******"); - return; -} - - -#ifdef HAVE_OPENSSL -static int -gnc_http_certificate_check_cb(ghttp_request * req, X509 * cert, - void * user_data) { - PERR ("***Warning*** Find a gnome2 replacement for ghttp *******"); - return; -} -#endif - -void -gnc_http_start_request(gnc_http * http, const gchar * uri, - GncHTTPRequestCB cb, gpointer user_data) { - PERR ("***Warning*** Find a gnome2 replacement for ghttp *******"); - return; -} - -void -gnc_http_start_post(gnc_http * http, const char * uri, - const char * content_type, - const char * data, int datalen, - GncHTTPRequestCB cb, gpointer user_data) { - PERR ("***Warning*** Find a gnome2 replacement for ghttp *******"); - return; -} - - - /* ***Warning*** Find a gnome2 replacement for ghttp *************/ -#endif diff --git a/src/network-utils/gnc-http.h b/src/network-utils/gnc-http.h deleted file mode 100644 index 52601a0419..0000000000 --- a/src/network-utils/gnc-http.h +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************** - * gnc-http.h -- handle HTTP requests. thin wrapper on gnome-http. * - * Copyright (C) 2001 Bill Gribble * - * * - * This program 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; either version 2 of * - * the License, or (at your option) any later version. * - * * - * This program 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, contact: * - * * - * Free Software Foundation Voice: +1-617-542-5942 * - * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * - * Boston, MA 02110-1301, USA gnu@gnu.org * - ********************************************************************/ - -#ifndef GNC_HTTP_H -#define GNC_HTTP_H - -#include - -typedef struct _gnc_http gnc_http; - -typedef void (* GncHTTPRequestCB)(const char * uri, int completed_ok, - const char * body, int body_len, - gpointer user_data); -gnc_http * gnc_http_new(void); -void gnc_http_destroy(gnc_http * html); -void gnc_http_start_request(gnc_http * http, const char * uri, - GncHTTPRequestCB cb, gpointer user_data); -void gnc_http_start_post(gnc_http * http, const char * uri, - const char * content_type, - const char * body, int body_len, - GncHTTPRequestCB cb, gpointer user_data); -void gnc_http_cancel_requests(gnc_http * http); - -#endif diff --git a/src/network-utils/gncmod-network-utils.c b/src/network-utils/gncmod-network-utils.c deleted file mode 100644 index a4ffb32dd0..0000000000 --- a/src/network-utils/gncmod-network-utils.c +++ /dev/null @@ -1,41 +0,0 @@ -/********************************************************************* - * gncmod-netword-utils.c - * module definition/initialization for network communication utilities - * - * Copyright (c) 2001 Linux Developers Group, Inc. - *********************************************************************/ - -#include -#include - -#include "gnc-module.h" -#include "gnc-module-api.h" - -/* version of the gnc module system interface we require */ -int gnc_module_system_interface = 0; - -/* module versioning uses libtool semantics. */ -int gnc_module_current = 0; -int gnc_module_revision = 0; -int gnc_module_age = 0; - - -char * -gnc_module_path(void) { - return g_strdup("gnucash/network-utils"); -} - -char * -gnc_module_description(void) { - return g_strdup("Utilities for performing network communication"); -} - -int -gnc_module_init(int refcount) { - return TRUE; -} - -int -gnc_module_end(int refcount) { - return TRUE; -} diff --git a/src/network-utils/test/Makefile.am b/src/network-utils/test/Makefile.am deleted file mode 100644 index 112a068374..0000000000 --- a/src/network-utils/test/Makefile.am +++ /dev/null @@ -1,32 +0,0 @@ -# 2003-03-11 TomF changes for Gnome-2 branch, 6th batch -# src/network-utils/test/Makefile.am: -# Add libgncmod-engine.la to fix undefined ref to `gnc_should_log' - -TESTS = \ - test-link-module \ - test-load-module - -GNC_TEST_DEPS := \ - --gnc-module-dir ${top_builddir}/src/network-utils \ - --guile-load-dir ${top_builddir}/src/gnc-module \ - --library-dir ${top_builddir}/lib/libqof/qof \ - --library-dir ${top_builddir}/src/core-utils \ - --library-dir ${top_builddir}/src/gnc-module - -TESTS_ENVIRONMENT := \ - $(shell ${top_srcdir}/src/gnc-test-env --no-exports ${GNC_TEST_DEPS}) - -check_PROGRAMS = \ - test-link-module - -test_link_module_SOURCES=test-link-module.c -test_link_module_LDADD= \ - ${top_builddir}/src/engine/libgncmod-engine.la \ - ../libgncmod-network-utils.la - -EXTRA_DIST = test-load-module - -AM_CFLAGS = \ - -I${top_srcdir}/src/test-core \ - -I.. \ - ${GLIB_CFLAGS} diff --git a/src/network-utils/test/test-link-module.c b/src/network-utils/test/test-link-module.c deleted file mode 100644 index c0d815b3d5..0000000000 --- a/src/network-utils/test/test-link-module.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int -main(int argc, char ** argv) { - exit(0); -} diff --git a/src/network-utils/test/test-load-module b/src/network-utils/test/test-load-module deleted file mode 100755 index c28da1c9a4..0000000000 --- a/src/network-utils/test/test-load-module +++ /dev/null @@ -1,11 +0,0 @@ -#! /bin/sh -exec guile -s $0 -!# - -(use-modules (gnucash gnc-module)) -(gnc:module-system-init) - -(display " testing network-utils module load ... ") -(gnc:module-load "gnucash/network-utils" 0) - -(display " ok\n") diff --git a/src/report/report-gnome/test/Makefile.am b/src/report/report-gnome/test/Makefile.am index 2acbf283d9..91308cb386 100644 --- a/src/report/report-gnome/test/Makefile.am +++ b/src/report/report-gnome/test/Makefile.am @@ -13,7 +13,6 @@ GNC_TEST_DEPS := @GNC_TEST_SRFI_LOAD_CMD@ \ --library-dir ${top_builddir}/src/gnc-module \ --library-dir ${top_builddir}/src/engine \ --library-dir ${top_builddir}/src/backend/file \ - --library-dir ${top_builddir}/src/network-utils \ --library-dir ${top_builddir}/src/calculation \ --library-dir ${top_builddir}/src/app-utils \ --library-dir ${top_builddir}/src/gnome-utils \ diff --git a/src/report/stylesheets/test/Makefile.am b/src/report/stylesheets/test/Makefile.am index 94b1881917..848e2cf0c0 100644 --- a/src/report/stylesheets/test/Makefile.am +++ b/src/report/stylesheets/test/Makefile.am @@ -11,7 +11,6 @@ GNC_TEST_DEPS := @GNC_TEST_SRFI_LOAD_CMD@ \ --library-dir ${top_builddir}/src/gnc-module \ --library-dir ${top_builddir}/src/engine \ --library-dir ${top_builddir}/src/backend/file \ - --library-dir ${top_builddir}/src/network-utils \ --library-dir ${top_builddir}/src/calculation \ --library-dir ${top_builddir}/src/app-utils \ --library-dir ${top_builddir}/src/gnome-utils \