From 89de28a3510c6e7a30ca053caea35ccabfbde75a Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Thu, 21 Jul 2011 15:34:50 +0200 Subject: [PATCH 3/4] remove forgotten abrt-action-kerneloops files --- src/plugins/abrt-action-kerneloops.c | 173 -------------------------------- src/plugins/abrt-action-kerneloops.txt | 68 ------------- 2 files changed, 0 insertions(+), 241 deletions(-) delete mode 100644 src/plugins/abrt-action-kerneloops.c delete mode 100644 src/plugins/abrt-action-kerneloops.txt diff --git a/src/plugins/abrt-action-kerneloops.c b/src/plugins/abrt-action-kerneloops.c deleted file mode 100644 index a117266..0000000 --- a/src/plugins/abrt-action-kerneloops.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - Copyright (C) 2010 ABRT team - Copyright (C) 2010 RedHat Inc - - 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. - - Authors: - Anton Arapov - Arjan van de Ven - */ -#include -#include "abrtlib.h" - -/* helpers */ -static size_t writefunction(void *ptr, size_t size, size_t nmemb, void *stream) -{ - size *= nmemb; -/* - char *c, *c1, *c2; - - log("received: '%*.*s'", (int)size, (int)size, (char*)ptr); - c = (char*)xzalloc(size + 1); - memcpy(c, ptr, size); - c1 = strstr(c, "201 "); - if (c1) - { - c1 += 4; - c2 = strchr(c1, '\n'); - if (c2) - *c2 = 0; - } - free(c); -*/ - - return size; -} - -/* Send oops data to kerneloops.org-style site, using HTTP POST */ -/* Returns 0 on success */ -static CURLcode http_post_to_kerneloops_site(const char *url, const char *oopsdata) -{ - CURLcode ret; - CURL *handle; - struct curl_httppost *post = NULL; - struct curl_httppost *last = NULL; - - handle = curl_easy_init(); - if (!handle) - error_msg_and_die("Can't create curl handle"); - - curl_easy_setopt(handle, CURLOPT_URL, url); - - curl_formadd(&post, &last, - CURLFORM_COPYNAME, "oopsdata", - CURLFORM_COPYCONTENTS, oopsdata, - CURLFORM_END); - curl_formadd(&post, &last, - CURLFORM_COPYNAME, "pass_on_allowed", - CURLFORM_COPYCONTENTS, "yes", - CURLFORM_END); - - curl_easy_setopt(handle, CURLOPT_HTTPPOST, post); - curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, writefunction); - - ret = curl_easy_perform(handle); - - curl_formfree(post); - curl_easy_cleanup(handle); - - return ret; -} - -static void report_to_kerneloops( - const char *dump_dir_name, - map_string_h *settings) -{ - problem_data_t *problem_data = create_problem_data_for_reporting(dump_dir_name); - if (!problem_data) - xfunc_die(); /* create_problem_data_for_reporting already emitted error msg */ - - const char *backtrace = get_problem_item_content_or_NULL(problem_data, FILENAME_BACKTRACE); - if (!backtrace) - error_msg_and_die("Error sending kernel oops due to missing backtrace"); - - const char *env = getenv("KerneloopsReporter_SubmitURL"); - const char *submitURL = (env ? env : get_map_string_item_or_empty(settings, "SubmitURL")); - if (!submitURL[0]) - submitURL = "http://submit.kerneloops.org/submitoops.php"; - - log(_("Submitting oops report to %s"), submitURL); - - CURLcode ret = http_post_to_kerneloops_site(submitURL, backtrace); - if (ret != CURLE_OK) - error_msg_and_die("Kernel oops has not been sent due to %s", curl_easy_strerror(ret)); - - free_problem_data(problem_data); - - /* Server replies with: - * 200 thank you for submitting the kernel oops information - * RemoteIP: 34192fd15e34bf60fac6a5f01bba04ddbd3f0558 - * - no URL or bug ID apparently... - */ - struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0); - if (dd) - { - char *msg = xasprintf("kerneloops: URL=%s", submitURL); - add_reported_to(dd, msg); - free(msg); - dd_close(dd); - } - - log("Kernel oops report was uploaded"); -} - -int main(int argc, char **argv) -{ - abrt_init(argv); - - map_string_h *settings = new_map_string(); - const char *dump_dir_name = "."; - GList *conf_file = NULL; - - /* Can't keep these strings/structs static: _() doesn't support that */ - const char *program_usage_string = _( - "\b [-v] [-c CONFFILE]... -d DIR\n" - "\n" - "Reports kernel oops to kerneloops.org (or similar) site.\n" - "\n" - "Files with names listed in $EXCLUDE_FROM_REPORT are not included\n" - "into the tarball.\n" - "\n" - "CONFFILE lines should have 'PARAM = VALUE' format.\n" - "Recognized string parameter: SubmitURL.\n" - "Parameter can be overridden via $KerneloopsReporter_SubmitURL." - ); - enum { - OPT_v = 1 << 0, - OPT_d = 1 << 1, - OPT_c = 1 << 2, - }; - /* Keep enum above and order of options below in sync! */ - struct options program_options[] = { - OPT__VERBOSE(&g_verbose), - OPT_STRING('d', NULL, &dump_dir_name, "DIR" , _("Dump directory")), - OPT_LIST( 'c', NULL, &conf_file , "FILE", _("Configuration file")), - OPT_END() - }; - /*unsigned opts =*/ parse_opts(argc, argv, program_options, program_usage_string); - - export_abrt_envvars(0); - - while (conf_file) - { - char *fn = (char *)conf_file->data; - VERB1 log("Loading settings from '%s'", fn); - load_conf_file(fn, settings, /*skip key w/o values:*/ true); - VERB3 log("Loaded '%s'", fn); - conf_file = g_list_remove(conf_file, fn); - } - - report_to_kerneloops(dump_dir_name, settings); - - free_map_string(settings); - return 0; -} diff --git a/src/plugins/abrt-action-kerneloops.txt b/src/plugins/abrt-action-kerneloops.txt deleted file mode 100644 index 468287f..0000000 --- a/src/plugins/abrt-action-kerneloops.txt +++ /dev/null @@ -1,68 +0,0 @@ -abrt-action-kerneloops(1) -========================= - -NAME ----- -abrt-action-kerneloops - Reports kernel oops to kerneloops.org (or similar) -site. - -SYNOPSIS --------- -'abrt-action-kerneloops' [-v] [-c CONFFILE]... [ -d DIR ] - -DESCRIPTION ------------ -The tool is used to report the crash to the Kerneloops tracker. - -Configuration file -~~~~~~~~~~~~~~~~~~ -Configuration file contains entries in a format "Option = Value". - -The options are: - -'SubmitURL':: - The URL of the kerneloops tracker, the default is - "http://submit.kerneloops.org/submitoops.php". - -Integration with ABRT events -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -'abrt-action-kerneloops' can be used as a reporter, to allow users to report -problems to the Kerneloops tracker. This usage is pre-configured in -/etc/libreport/events.d/koops_event.conf: - ------------- -EVENT=report_Kerneloops analyzer=Kerneloops abrt-action-kerneloops ------------- - -It can be also used automatically and immediately without user interaction. -When this is desired, modify the event configuration file to run the tool on -the 'post-create' event: - ------------- -EVENT=post-create analyzer=Kerneloops abrt-action-kerneloops ------------- - -OPTIONS -------- --v:: - Be more verbose. Can be given multiple times. - --d DIR:: - Path to dump directory. - --c CONFFILE:: - Path to configration file. When used in ABRT event system, the file - contains site-wide configuration. Users can change the values via - environment variables. - -ENVIRONMENT VARIABLES ---------------------- -Environment variables take precedence over values provided in -the configuration file. - -'KerneloopsReporter_SubmitURL':: - The URL of the kerneloops tracker. - -AUTHORS -------- -* ABRT team -- 1.7.6