|
|
a60cd7 |
From 2b16db2fea5552225437ac7d622706b597b7a71d Mon Sep 17 00:00:00 2001
|
|
|
a60cd7 |
From: Jakub Filak <jfilak@redhat.com>
|
|
|
a60cd7 |
Date: Fri, 19 Dec 2014 00:41:16 +0100
|
|
|
a60cd7 |
Subject: [ABRT PATCH 80/82] auto-reporting: add options to specify auth type
|
|
|
a60cd7 |
|
|
|
a60cd7 |
See abrt-auto-reporting man page for more details about this commit.
|
|
|
a60cd7 |
|
|
|
a60cd7 |
Related: #1174833
|
|
|
a60cd7 |
|
|
|
a60cd7 |
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
|
|
a60cd7 |
---
|
|
|
a60cd7 |
doc/abrt-auto-reporting.txt | 41 ++++++-
|
|
|
a60cd7 |
src/daemon/abrt-auto-reporting.c | 258 ++++++++++++++++++++++++++++++++++++---
|
|
|
a60cd7 |
2 files changed, 280 insertions(+), 19 deletions(-)
|
|
|
a60cd7 |
|
|
|
a60cd7 |
diff --git a/doc/abrt-auto-reporting.txt b/doc/abrt-auto-reporting.txt
|
|
|
a60cd7 |
index 1cc534e..2a27945 100644
|
|
|
a60cd7 |
--- a/doc/abrt-auto-reporting.txt
|
|
|
a60cd7 |
+++ b/doc/abrt-auto-reporting.txt
|
|
|
a60cd7 |
@@ -3,11 +3,14 @@ abrt-auto-reporting(1)
|
|
|
a60cd7 |
|
|
|
a60cd7 |
NAME
|
|
|
a60cd7 |
----
|
|
|
a60cd7 |
-abrt-auto-reporting - Get or modify a value of the auto reporting option
|
|
|
a60cd7 |
+abrt-auto-reporting - Get or modify the auto reporting option values
|
|
|
a60cd7 |
|
|
|
a60cd7 |
SYNOPSIS
|
|
|
a60cd7 |
--------
|
|
|
a60cd7 |
-'abrt-auto-reporting' [-v] [ enabled | yes | 1 | disabled | no | 0 ]
|
|
|
a60cd7 |
+'abrt-auto-reporting' [-v] [ enabled | yes | 1 | on | disabled | no | 0 | off ]
|
|
|
a60cd7 |
+ [ [--anonymous] |
|
|
|
a60cd7 |
+ [--username USERNAME [--password PASSWORD] ] |
|
|
|
a60cd7 |
+ [--certificate SOURCE] ]
|
|
|
a60cd7 |
|
|
|
a60cd7 |
DESCRIPTION
|
|
|
a60cd7 |
-----------
|
|
|
a60cd7 |
@@ -23,6 +26,9 @@ process and will be persistent.
|
|
|
a60cd7 |
ABRT uploads an uReport which was generated for a detected problem
|
|
|
a60cd7 |
immediately after the detection phase.
|
|
|
a60cd7 |
|
|
|
a60cd7 |
+Reads and saves the authentication configuration options in
|
|
|
a60cd7 |
+/etc/libreport/plugins/ureport.conf and /etc/libreport/plugins/rhtsupport.conf
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
uReport description
|
|
|
a60cd7 |
~~~~~~~~~~~~~~~~~~~
|
|
|
a60cd7 |
ABRT supports uReports for four types of crashes: crashes of C/C++ programs
|
|
|
a60cd7 |
@@ -51,6 +57,14 @@ for kernel oopses::
|
|
|
a60cd7 |
these are list of loaded kernel modules, list of taint flags, and full text
|
|
|
a60cd7 |
of the kernel oops.
|
|
|
a60cd7 |
|
|
|
a60cd7 |
+The authenticated uReports also contains *hostname* and *machineid* to enable a
|
|
|
a60cd7 |
+server side filtering at https://access.redhat.com/.
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+The authenticated uReports have the benefit of rich server replies which may
|
|
|
a60cd7 |
+include a solution for the submitted crash. The authentication is done using
|
|
|
a60cd7 |
+either Red Hat Subscription Certificates or Red Hat Customer Portal
|
|
|
a60cd7 |
+credentials.
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
'Warning':
|
|
|
a60cd7 |
The full text of a kernel oops might contain information like the
|
|
|
a60cd7 |
identification of the host hardware type. You should disable the autoreporting
|
|
|
a60cd7 |
@@ -62,9 +76,30 @@ OPTIONS
|
|
|
a60cd7 |
-v, --verbose::
|
|
|
a60cd7 |
Be more verbose. Can be given multiple times.
|
|
|
a60cd7 |
|
|
|
a60cd7 |
+-a, --anonymous::
|
|
|
a60cd7 |
+ Turns the authentication off by clearing both 'SSLClientAuth' and 'HTTPAuth'
|
|
|
a60cd7 |
+ configuration options in /etc/libreport/plugins/ureport.conf
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+-u, --username USERNAME::
|
|
|
a60cd7 |
+ Turns HTTP Authentication on by setting 'HTTPAuth' configuration option to
|
|
|
a60cd7 |
+ *rhts-credentials* in /etc/libreport/plugins/ureport.conf and storing
|
|
|
a60cd7 |
+ USERNAME and PASSWORD in /etc/libreport/plugins/rhtsupport.conf
|
|
|
a60cd7 |
+ Also turns the SSL Client Authentication off, because these methods cannot
|
|
|
a60cd7 |
+ be used together.
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+-p, --password PASSWORD::
|
|
|
a60cd7 |
+ Password for HTTP Authentication. If not provided, a prompt asking for it
|
|
|
a60cd7 |
+ will be issued.
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+-c, --certificate SOURCE::
|
|
|
a60cd7 |
+ Turns SSL Client Authentication on by setting 'SSLClientAuth' configuration
|
|
|
a60cd7 |
+ option to SOURCE in /etc/libreport/plugins/ureport.conf.
|
|
|
a60cd7 |
+ Also turns the HTTP Authentication off, because these methods cannot
|
|
|
a60cd7 |
+ be used together.
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
SEE ALSO
|
|
|
a60cd7 |
--------
|
|
|
a60cd7 |
-abrt.conf(5)
|
|
|
a60cd7 |
+abrt.conf(5), ureport.conf(5), rhtsupport.conf(5)
|
|
|
a60cd7 |
|
|
|
a60cd7 |
AUTHORS
|
|
|
a60cd7 |
-------
|
|
|
a60cd7 |
diff --git a/src/daemon/abrt-auto-reporting.c b/src/daemon/abrt-auto-reporting.c
|
|
|
a60cd7 |
index 0909bed..f50c4c2 100644
|
|
|
a60cd7 |
--- a/src/daemon/abrt-auto-reporting.c
|
|
|
a60cd7 |
+++ b/src/daemon/abrt-auto-reporting.c
|
|
|
a60cd7 |
@@ -17,6 +17,7 @@
|
|
|
a60cd7 |
*/
|
|
|
a60cd7 |
|
|
|
a60cd7 |
#include "libabrt.h"
|
|
|
a60cd7 |
+#include "client.h"
|
|
|
a60cd7 |
|
|
|
a60cd7 |
#include <stdio.h>
|
|
|
a60cd7 |
|
|
|
a60cd7 |
@@ -26,13 +27,24 @@
|
|
|
a60cd7 |
#define STATE_MANUAL "disabled"
|
|
|
a60cd7 |
#define STATE_AUTO "enabled"
|
|
|
a60cd7 |
|
|
|
a60cd7 |
-const char *const REPORTING_STATES[6][2] = {
|
|
|
a60cd7 |
+#define RHTS_NAME "rhtsupport.conf"
|
|
|
a60cd7 |
+#define RHTS_USERNAME_OPTION "Login"
|
|
|
a60cd7 |
+#define RHTS_PASSWORD_OPTION "Password"
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+#define UREPORT_NAME "ureport.conf"
|
|
|
a60cd7 |
+#define UREPORT_HTTP_AUTH_OPTION "HTTPAuth"
|
|
|
a60cd7 |
+#define UREPORT_CLIENT_AUTH_OPTION "SSLClientAuth"
|
|
|
a60cd7 |
+#define UREPORT_RTHS_CREDENTIALS_AUTH "rhts-credentials"
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+const char *const REPORTING_STATES[8][2] = {
|
|
|
a60cd7 |
{STATE_MANUAL, "no" },
|
|
|
a60cd7 |
{STATE_AUTO, "yes"},
|
|
|
a60cd7 |
{"no", "no" },
|
|
|
a60cd7 |
{"yes", "yes"},
|
|
|
a60cd7 |
{"0", "no" },
|
|
|
a60cd7 |
{"1", "yes"},
|
|
|
a60cd7 |
+ {"off", "no" },
|
|
|
a60cd7 |
+ {"on", "yes"},
|
|
|
a60cd7 |
};
|
|
|
a60cd7 |
|
|
|
a60cd7 |
static int
|
|
|
a60cd7 |
@@ -52,6 +64,77 @@ set_abrt_reporting(map_string_t *conf, const char *opt_value)
|
|
|
a60cd7 |
return 1;
|
|
|
a60cd7 |
}
|
|
|
a60cd7 |
|
|
|
a60cd7 |
+static int
|
|
|
a60cd7 |
+set_ureport_http_auth(map_string_t *conf, const char *opt_value)
|
|
|
a60cd7 |
+{
|
|
|
a60cd7 |
+ const char *const cur_value = get_map_string_item_or_NULL(conf, UREPORT_HTTP_AUTH_OPTION);
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ if (cur_value == NULL || strcmp(cur_value, opt_value) != 0)
|
|
|
a60cd7 |
+ {
|
|
|
a60cd7 |
+ replace_map_string_item(conf, xstrdup(UREPORT_HTTP_AUTH_OPTION), xstrdup(opt_value));
|
|
|
a60cd7 |
+ remove_map_string_item(conf, UREPORT_CLIENT_AUTH_OPTION);
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ return save_plugin_conf_file(UREPORT_NAME, conf);
|
|
|
a60cd7 |
+ }
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ /* No changes needed -> success */
|
|
|
a60cd7 |
+ return 1;
|
|
|
a60cd7 |
+}
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+static int
|
|
|
a60cd7 |
+set_ureport_client_auth(map_string_t *conf, const char *opt_value)
|
|
|
a60cd7 |
+{
|
|
|
a60cd7 |
+ const char *const cur_value = get_map_string_item_or_NULL(conf, UREPORT_CLIENT_AUTH_OPTION);
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ if (cur_value == NULL || strcmp(cur_value, opt_value) != 0)
|
|
|
a60cd7 |
+ {
|
|
|
a60cd7 |
+ replace_map_string_item(conf, xstrdup(UREPORT_CLIENT_AUTH_OPTION), xstrdup(opt_value));
|
|
|
a60cd7 |
+ remove_map_string_item(conf, UREPORT_HTTP_AUTH_OPTION);
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ return save_plugin_conf_file(UREPORT_NAME, conf);
|
|
|
a60cd7 |
+ }
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ /* No changes needed -> success */
|
|
|
a60cd7 |
+ return 1;
|
|
|
a60cd7 |
+}
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+static int
|
|
|
a60cd7 |
+clear_ureport_auth(map_string_t *conf)
|
|
|
a60cd7 |
+{
|
|
|
a60cd7 |
+ const char *const http_cur_value = get_map_string_item_or_NULL(conf, UREPORT_HTTP_AUTH_OPTION);
|
|
|
a60cd7 |
+ const char *const ssl_cur_value = get_map_string_item_or_NULL(conf, UREPORT_CLIENT_AUTH_OPTION);
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ if (http_cur_value != NULL || ssl_cur_value != NULL)
|
|
|
a60cd7 |
+ {
|
|
|
a60cd7 |
+ remove_map_string_item(conf, UREPORT_HTTP_AUTH_OPTION);
|
|
|
a60cd7 |
+ remove_map_string_item(conf, UREPORT_CLIENT_AUTH_OPTION);
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ return save_plugin_conf_file(UREPORT_NAME, conf);
|
|
|
a60cd7 |
+ }
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ /* No changes needed -> success */
|
|
|
a60cd7 |
+ return 1;
|
|
|
a60cd7 |
+}
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+static int
|
|
|
a60cd7 |
+set_rhts_credentials(map_string_t *conf, const char *username, const char *password)
|
|
|
a60cd7 |
+{
|
|
|
a60cd7 |
+ const char *const username_cur_value = get_map_string_item_or_NULL(conf, RHTS_USERNAME_OPTION);
|
|
|
a60cd7 |
+ const char *const password_cur_value = get_map_string_item_or_NULL(conf, RHTS_PASSWORD_OPTION);
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ if ( (username_cur_value == NULL || strcmp(username_cur_value, username) != 0)
|
|
|
a60cd7 |
+ || (password_cur_value == NULL || strcmp(password_cur_value, password) != 0))
|
|
|
a60cd7 |
+ {
|
|
|
a60cd7 |
+ replace_map_string_item(conf, xstrdup(RHTS_USERNAME_OPTION), xstrdup(username));
|
|
|
a60cd7 |
+ replace_map_string_item(conf, xstrdup(RHTS_PASSWORD_OPTION), xstrdup(password));
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ return save_plugin_conf_file(RHTS_NAME, conf);
|
|
|
a60cd7 |
+ }
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ /* No changes needed -> success */
|
|
|
a60cd7 |
+ return 1;
|
|
|
a60cd7 |
+}
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
static const char *
|
|
|
a60cd7 |
get_abrt_reporting(map_string_t *conf)
|
|
|
a60cd7 |
{
|
|
|
a60cd7 |
@@ -60,6 +143,18 @@ get_abrt_reporting(map_string_t *conf)
|
|
|
a60cd7 |
return REPORTING_STATES[index][0];
|
|
|
a60cd7 |
}
|
|
|
a60cd7 |
|
|
|
a60cd7 |
+static const char *
|
|
|
a60cd7 |
+get_ureport_http_auth(map_string_t *conf)
|
|
|
a60cd7 |
+{
|
|
|
a60cd7 |
+ return get_map_string_item_or_NULL(conf, UREPORT_HTTP_AUTH_OPTION);
|
|
|
a60cd7 |
+}
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+static const char *
|
|
|
a60cd7 |
+get_ureport_client_auth(map_string_t *conf)
|
|
|
a60cd7 |
+{
|
|
|
a60cd7 |
+ return get_map_string_item_or_NULL(conf, UREPORT_CLIENT_AUTH_OPTION);
|
|
|
a60cd7 |
+}
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
int main(int argc, char *argv[])
|
|
|
a60cd7 |
{
|
|
|
a60cd7 |
setlocale(LC_ALL, "");
|
|
|
a60cd7 |
@@ -78,7 +173,8 @@ int main(int argc, char *argv[])
|
|
|
a60cd7 |
|
|
|
a60cd7 |
abrt_init(argv);
|
|
|
a60cd7 |
const char *program_usage_string = _(
|
|
|
a60cd7 |
- "& [ "STATE_MANUAL" | "STATE_AUTO" | yes | no | 1 | 0 ]\n"
|
|
|
a60cd7 |
+ "& [ "STATE_MANUAL" | "STATE_AUTO" | yes | no | 1 | 0 ] \\\n"
|
|
|
a60cd7 |
+ " [[--anonymous] | [--username USERNAME [--password PASSWORD]] | [--certificate SOURCE]]\n"
|
|
|
a60cd7 |
"\n"
|
|
|
a60cd7 |
"Get or modify a value of the auto-reporting option. The changes will take\n"
|
|
|
a60cd7 |
"effect immediately and will be persistent.\n"
|
|
|
a60cd7 |
@@ -94,36 +190,72 @@ int main(int argc, char *argv[])
|
|
|
a60cd7 |
"contains identification of the operating system, versions of the RPM packages\n"
|
|
|
a60cd7 |
"involved in the crash, and whether the program ran under a root user.\n"
|
|
|
a60cd7 |
"\n"
|
|
|
a60cd7 |
- "See abrt-auto-reporting(1) for more details.\n"
|
|
|
a60cd7 |
+ "See abrt-auto-reporting(1), reporter-ureport(1) and reporter-rhtsupport(1)\n"
|
|
|
a60cd7 |
+ "for more details.\n"
|
|
|
a60cd7 |
);
|
|
|
a60cd7 |
|
|
|
a60cd7 |
+ enum {
|
|
|
a60cd7 |
+ OPT_v = 1 << 0,
|
|
|
a60cd7 |
+ OPT_a = 1 << 1,
|
|
|
a60cd7 |
+ OPT_u = 1 << 2,
|
|
|
a60cd7 |
+ OPT_p = 1 << 3,
|
|
|
a60cd7 |
+ OPT_c = 1 << 4,
|
|
|
a60cd7 |
+ };
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ bool anonymous = false;
|
|
|
a60cd7 |
+ const char *username = NULL;
|
|
|
a60cd7 |
+ const char *password = NULL;
|
|
|
a60cd7 |
+ const char *certificate = NULL;
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
/* Keep enum above and order of options below in sync! */
|
|
|
a60cd7 |
struct options program_options[] = {
|
|
|
a60cd7 |
OPT__VERBOSE(&g_verbose),
|
|
|
a60cd7 |
+ OPT_BOOL ( 'a', "anonymous", &anonymous, _("Turns the authentication off")),
|
|
|
a60cd7 |
+ OPT_STRING( 'u', "username", &username, "USERNAME", _("Red Hat Support user name")),
|
|
|
a60cd7 |
+ OPT_STRING( 'p', "password", &password, "PASSWORD", _("Red Hat Support password, if not given, a prompt for it will be issued")),
|
|
|
a60cd7 |
+ OPT_STRING( 'c', "certificate", &certificate, "SOURCE", _("uReport SSL certificate paths or certificate type")),
|
|
|
a60cd7 |
OPT_END()
|
|
|
a60cd7 |
};
|
|
|
a60cd7 |
|
|
|
a60cd7 |
- const unsigned optind = parse_opts(argc, argv, program_options, program_usage_string);
|
|
|
a60cd7 |
+ const unsigned opts = parse_opts(argc, argv, program_options, program_usage_string);
|
|
|
a60cd7 |
|
|
|
a60cd7 |
argv += optind;
|
|
|
a60cd7 |
argc -= optind;
|
|
|
a60cd7 |
|
|
|
a60cd7 |
- if (argc > 2)
|
|
|
a60cd7 |
+ if ((opts & OPT_p) && !(opts & OPT_u))
|
|
|
a60cd7 |
{
|
|
|
a60cd7 |
- error_msg(_("Invalid number of arguments"));
|
|
|
a60cd7 |
+ error_msg(_("You also need to specify --username for --password"));
|
|
|
a60cd7 |
show_usage_and_die(program_usage_string, program_options);
|
|
|
a60cd7 |
}
|
|
|
a60cd7 |
|
|
|
a60cd7 |
- int exit_code = EXIT_FAILURE;
|
|
|
a60cd7 |
+ if ((opts & OPT_u) && (opts & OPT_c))
|
|
|
a60cd7 |
+ {
|
|
|
a60cd7 |
+ error_msg(_("You can use either --username or --certificate"));
|
|
|
a60cd7 |
+ show_usage_and_die(program_usage_string, program_options);
|
|
|
a60cd7 |
+ }
|
|
|
a60cd7 |
|
|
|
a60cd7 |
- map_string_t *conf = new_map_string();
|
|
|
a60cd7 |
- if (!load_abrt_conf_file(CONF_NAME, conf))
|
|
|
a60cd7 |
- goto finito;
|
|
|
a60cd7 |
+ if ((opts & OPT_u) && (opts & OPT_a))
|
|
|
a60cd7 |
+ {
|
|
|
a60cd7 |
+ error_msg(_("You can use either --username or --anonymous"));
|
|
|
a60cd7 |
+ show_usage_and_die(program_usage_string, program_options);
|
|
|
a60cd7 |
+ }
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ if ((opts & OPT_a) && (opts & OPT_c))
|
|
|
a60cd7 |
+ {
|
|
|
a60cd7 |
+ error_msg(_("You can use either --anonymous or --certificate"));
|
|
|
a60cd7 |
+ show_usage_and_die(program_usage_string, program_options);
|
|
|
a60cd7 |
+ }
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ if (argc > 1)
|
|
|
a60cd7 |
+ {
|
|
|
a60cd7 |
+ error_msg(_("Invalid number of arguments"));
|
|
|
a60cd7 |
+ show_usage_and_die(program_usage_string, program_options);
|
|
|
a60cd7 |
+ }
|
|
|
a60cd7 |
|
|
|
a60cd7 |
- if (argc == 2)
|
|
|
a60cd7 |
+ const char *opt_value = NULL;
|
|
|
a60cd7 |
+ if (argc == 1)
|
|
|
a60cd7 |
{
|
|
|
a60cd7 |
- const char *const new_value = argv[1];
|
|
|
a60cd7 |
- const char *opt_value = NULL;
|
|
|
a60cd7 |
+ const char *const new_value = argv[0];
|
|
|
a60cd7 |
for (int i = 0; i < sizeof(REPORTING_STATES)/sizeof(REPORTING_STATES[0]); ++i)
|
|
|
a60cd7 |
{
|
|
|
a60cd7 |
if (strcasecmp(new_value, REPORTING_STATES[i][0]) == 0)
|
|
|
a60cd7 |
@@ -138,15 +270,109 @@ int main(int argc, char *argv[])
|
|
|
a60cd7 |
error_msg(_("Unknown option value: '%s'\n"), new_value);
|
|
|
a60cd7 |
show_usage_and_die(program_usage_string, program_options);
|
|
|
a60cd7 |
}
|
|
|
a60cd7 |
+ }
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ int exit_code = EXIT_FAILURE;
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ map_string_t *conf = new_map_string();
|
|
|
a60cd7 |
+ map_string_t *rhts_conf = new_map_string();
|
|
|
a60cd7 |
+ map_string_t *rhts_conf_bck = NULL;
|
|
|
a60cd7 |
+ map_string_t *ureport_conf = new_map_string();
|
|
|
a60cd7 |
+ map_string_t *ureport_conf_bck = NULL;
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ if (!load_abrt_conf_file(CONF_NAME, conf))
|
|
|
a60cd7 |
+ goto finito;
|
|
|
a60cd7 |
|
|
|
a60cd7 |
- exit_code = set_abrt_reporting(conf, opt_value) ? EXIT_SUCCESS : EXIT_FAILURE;
|
|
|
a60cd7 |
+ if (!load_plugin_conf_file(RHTS_NAME, rhts_conf, false))
|
|
|
a60cd7 |
goto finito;
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ if (!load_plugin_conf_file(UREPORT_NAME, ureport_conf, false))
|
|
|
a60cd7 |
+ goto finito;
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ if ((opts & OPT_a))
|
|
|
a60cd7 |
+ {
|
|
|
a60cd7 |
+ ureport_conf_bck = clone_map_string(ureport_conf);
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ if (!clear_ureport_auth(ureport_conf))
|
|
|
a60cd7 |
+ goto finito;
|
|
|
a60cd7 |
+ }
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ if ((opts & OPT_u))
|
|
|
a60cd7 |
+ {
|
|
|
a60cd7 |
+ char *tmp_password = NULL;
|
|
|
a60cd7 |
+ if (!(opts & OPT_p))
|
|
|
a60cd7 |
+ {
|
|
|
a60cd7 |
+ password = tmp_password = ask_password(_("Password:"));
|
|
|
a60cd7 |
+ if (tmp_password == NULL)
|
|
|
a60cd7 |
+ {
|
|
|
a60cd7 |
+ error_msg(_("Cannot continue without password\n"));
|
|
|
a60cd7 |
+ goto finito;
|
|
|
a60cd7 |
+ }
|
|
|
a60cd7 |
+ }
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ ureport_conf_bck = clone_map_string(ureport_conf);
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ if (!set_ureport_http_auth(ureport_conf, UREPORT_RTHS_CREDENTIALS_AUTH))
|
|
|
a60cd7 |
+ goto finito;
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ rhts_conf_bck = clone_map_string(rhts_conf);
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ if (!set_rhts_credentials(rhts_conf, username, password))
|
|
|
a60cd7 |
+ {
|
|
|
a60cd7 |
+ save_plugin_conf_file(UREPORT_NAME, ureport_conf_bck);
|
|
|
a60cd7 |
+ goto finito;
|
|
|
a60cd7 |
+ }
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ free(tmp_password);
|
|
|
a60cd7 |
+ }
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ if ((opts & OPT_c))
|
|
|
a60cd7 |
+ {
|
|
|
a60cd7 |
+ ureport_conf_bck = clone_map_string(ureport_conf);
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ if (!set_ureport_client_auth(ureport_conf, certificate))
|
|
|
a60cd7 |
+ goto finito;
|
|
|
a60cd7 |
+ }
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ if (argc == 0)
|
|
|
a60cd7 |
+ {
|
|
|
a60cd7 |
+ printf("%s", get_abrt_reporting(conf));
|
|
|
a60cd7 |
+ exit_code = EXIT_SUCCESS;
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ if (g_verbose >= 1)
|
|
|
a60cd7 |
+ {
|
|
|
a60cd7 |
+ const char *tmp = get_ureport_http_auth(ureport_conf);
|
|
|
a60cd7 |
+ if (tmp != NULL)
|
|
|
a60cd7 |
+ /* Print only the part before ':' of a string like "username:password" */
|
|
|
a60cd7 |
+ printf(" %s (%*s)", _("HTTP Authenticated auto reporting"), (int)(strchrnul(tmp, ':') - tmp), tmp);
|
|
|
a60cd7 |
+ else if ((tmp = get_ureport_client_auth(ureport_conf)) != NULL)
|
|
|
a60cd7 |
+ printf(" %s (%s)", _("SSL Client Authenticated auto reporting"), tmp);
|
|
|
a60cd7 |
+ else
|
|
|
a60cd7 |
+ printf(" %s", _("anonymous auto reporting"));
|
|
|
a60cd7 |
+ }
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ putchar('\n');
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ goto finito;
|
|
|
a60cd7 |
+ }
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ exit_code = set_abrt_reporting(conf, opt_value) ? EXIT_SUCCESS : EXIT_FAILURE;
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ if (exit_code == EXIT_FAILURE)
|
|
|
a60cd7 |
+ {
|
|
|
a60cd7 |
+ if (ureport_conf_bck != NULL)
|
|
|
a60cd7 |
+ save_plugin_conf_file(UREPORT_NAME, ureport_conf_bck);
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ if (rhts_conf_bck != NULL)
|
|
|
a60cd7 |
+ save_plugin_conf_file(RHTS_NAME, rhts_conf_bck);
|
|
|
a60cd7 |
}
|
|
|
a60cd7 |
|
|
|
a60cd7 |
- printf("%s\n", get_abrt_reporting(conf));
|
|
|
a60cd7 |
- exit_code = EXIT_SUCCESS;
|
|
|
a60cd7 |
|
|
|
a60cd7 |
finito:
|
|
|
a60cd7 |
+ free_map_string(ureport_conf);
|
|
|
a60cd7 |
+ free_map_string(ureport_conf_bck);
|
|
|
a60cd7 |
+ free_map_string(rhts_conf);
|
|
|
a60cd7 |
+ free_map_string(rhts_conf_bck);
|
|
|
a60cd7 |
free_map_string(conf);
|
|
|
a60cd7 |
return exit_code;
|
|
|
a60cd7 |
}
|
|
|
a60cd7 |
--
|
|
|
a60cd7 |
1.8.3.1
|
|
|
a60cd7 |
|