Compare commits

..

No commits in common. "a9-beta" and "c8" have entirely different histories.
a9-beta ... c8

38 changed files with 3188 additions and 2131 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/libreport-2.15.2.tar.gz
SOURCES/libreport-2.9.5.tar.gz

View File

@ -1 +1 @@
664ec7534bb2207e380d5b34f2260d41abb1a31b SOURCES/libreport-2.15.2.tar.gz
e2e3124c591fbc2668d99537ec086185348c1d93 SOURCES/libreport-2.9.5.tar.gz

View File

@ -0,0 +1,30 @@
From 8c00a86dddaf240d4a836a5e278190bcc51b0b66 Mon Sep 17 00:00:00 2001
From: Matej Habrnal <mhabrnal@redhat.com>
Date: Mon, 18 Jun 2018 14:51:23 +0200
Subject: [PATCH] ureport: use python3 to get consumerCertDir
Related to #1592073
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
---
src/lib/ureport.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lib/ureport.c b/src/lib/ureport.c
index c32c948a..d2045f0f 100644
--- a/src/lib/ureport.c
+++ b/src/lib/ureport.c
@@ -81,9 +81,9 @@ rhsm_config_get_consumer_cert_dir(void)
return xstrdup(result);
result = run_in_shell_and_save_output(0,
- "python -c \"from rhsm.config import initConfig; print(initConfig().get('rhsm', 'consumerCertDir'))\"",
+ "python3 -c \"from rhsm.config import initConfig; print(initConfig().get('rhsm', 'consumerCertDir'))\"",
NULL, NULL);
/* run_in_shell_and_save_output always returns non-NULL */
if (result[0] != '/')
goto error;
--
2.17.0

View File

@ -0,0 +1,177 @@
From 602124e481d700e334de20418b94b2fdf015c834 Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Mon, 9 Jul 2018 10:45:37 +0200
Subject: [PATCH] Remove option to screencast problems
The fros package is broken and hasn't been maintained for quite some time.
closes #104
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
---
libreport.spec.in | 1 -
src/gui-wizard-gtk/wizard.c | 75 ---------------------------------
src/gui-wizard-gtk/wizard.glade | 40 ------------------
3 files changed, 116 deletions(-)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index b02bc7de..ea49a2ea 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -127,7 +127,6 @@ static gboolean g_warning_issued;
static GtkSpinner *g_spinner_event_log;
static GtkImage *g_img_process_fail;
-static GtkButton *g_btn_startcast;
static GtkExpander *g_exp_report_log;
static GtkWidget *g_top_most_window;
@@ -3487,7 +3486,6 @@ static void add_pages(void)
g_exp_search = GTK_EXPANDER( gtk_builder_get_object(g_builder, "expander_search"));
g_spinner_event_log = GTK_SPINNER( gtk_builder_get_object(g_builder, "spinner_event_log"));
g_img_process_fail = GTK_IMAGE( gtk_builder_get_object(g_builder, "img_process_fail"));
- g_btn_startcast = GTK_BUTTON( gtk_builder_get_object(g_builder, "btn_startcast"));
g_exp_report_log = GTK_EXPANDER( gtk_builder_get_object(g_builder, "expand_report"));
g_vb_simple_details = GTK_BOX( gtk_builder_get_object(g_builder, "vb_simple_details"));
g_cmb_reproducible = GTK_COMBO_BOX_TEXT(gtk_builder_get_object(g_builder, "cmb_reproducible"));
@@ -3618,59 +3616,6 @@ static void assistant_quit_cb(void *obj, void *data)
g_wnd_assistant = (void *)0xdeadbeaf;
}
-static void on_btn_startcast(GtkWidget *btn, gpointer user_data)
-{
- const char *args[15];
- args[0] = (char *) "fros";
- args[1] = NULL;
-
- pid_t castapp = 0;
- castapp = fork_execv_on_steroids(
- EXECFLG_QUIET,
- (char **)args,
- NULL,
- /*env_vec:*/ NULL,
- g_dump_dir_name,
- /*uid (ignored):*/ 0
- );
- gtk_widget_hide(GTK_WIDGET(g_wnd_assistant));
- /*flush all gui events before we start waitpid
- * otherwise the main window wouldn't hide
- */
- while (gtk_events_pending())
- gtk_main_iteration_do(false);
-
- int status;
- safe_waitpid(castapp, &status, 0);
- problem_data_reload_from_dump_dir();
- update_gui_state_from_problem_data(0 /* don't update the selected event */);
- gtk_widget_show(GTK_WIDGET(g_wnd_assistant));
-}
-
-static bool is_screencast_available()
-{
- const char *args[3];
- args[0] = (char *) "fros";
- args[1] = "--is-available";
- args[2] = NULL;
-
- pid_t castapp = 0;
- castapp = fork_execv_on_steroids(
- EXECFLG_QUIET,
- (char **)args,
- NULL,
- /*env_vec:*/ NULL,
- g_dump_dir_name,
- /*uid (ignored):*/ 0
- );
-
- int status;
- safe_waitpid(castapp, &status, 0);
-
- /* 0 means that it's available */
- return status == 0;
-}
-
void create_assistant(GtkApplication *app, bool expert_mode)
{
g_loaded_texts = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
@@ -3805,26 +3750,6 @@ void create_assistant(GtkApplication *app, bool expert_mode)
g_signal_connect(g_btn_add_file, "clicked", G_CALLBACK(on_btn_add_file), NULL);
g_signal_connect(g_btn_detail, "clicked", G_CALLBACK(on_btn_detail), NULL);
- if (is_screencast_available()) {
- /* we need to override the activate-link handler, because we use
- * the link button instead of normal button and if we wouldn't override it
- * gtk would try to run it's defualt action and open the associated URI
- * but since the URI is empty it would complain about it...
- */
- g_signal_connect(g_btn_startcast, "activate-link", G_CALLBACK(on_btn_startcast), NULL);
- }
- else {
- gtk_widget_set_sensitive(GTK_WIDGET(g_btn_startcast), false);
- gtk_widget_set_tooltip_markup(GTK_WIDGET(g_btn_startcast),
- _("In order to enable the built-in screencasting "
- "functionality the package fros-recordmydesktop has to be installed. "
- "Please run the following command if you want to install it."
- "\n\n"
- "<b>su -c \"dnf install fros-recordmydesktop\"</b>"
- ));
- }
-
-
g_signal_connect(g_search_entry_bt, "changed", G_CALLBACK(search_timeout), NULL);
g_signal_connect (g_tv_event_log, "key-press-event", G_CALLBACK (key_press_event), NULL);
diff --git a/src/gui-wizard-gtk/wizard.glade b/src/gui-wizard-gtk/wizard.glade
index 47713370..f0bd2a77 100644
--- a/src/gui-wizard-gtk/wizard.glade
+++ b/src/gui-wizard-gtk/wizard.glade
@@ -506,46 +506,6 @@
<property name="position">4</property>
</packing>
</child>
- <child>
- <object class="GtkBox" id="box3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkLabel" id="label9">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">end</property>
- <property name="label" translatable="yes">If you don't know how to describe it, you can</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLinkButton" id="btn_startcast">
- <property name="label" translatable="yes">add a screencast</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="has_tooltip">True</property>
- <property name="halign">start</property>
- <property name="relief">none</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">5</property>
- </packing>
- </child>
</object>
</child>
</object>
--
2.17.1

View File

@ -1,48 +0,0 @@
From 50fdc7f23f35744ffff1763fe2d804b18c1c5340 Mon Sep 17 00:00:00 2001
From: Michal Srb <michal@redhat.com>
Date: Tue, 7 Sep 2021 14:40:21 +0200
Subject: [PATCH] [rhbz] Be a little bit more defensive when working with
subcomponents
Components in RHEL can have "subcomponents" in Bugzilla. Some of them
have, some of them don't. Better be careful.
See: rhbz#1998435
Signed-off-by: Michal Srb <michal@redhat.com>
---
src/plugins/rhbz.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c
index c2855a70..0dae1e93 100644
--- a/src/plugins/rhbz.c
+++ b/src/plugins/rhbz.c
@@ -1036,13 +1036,17 @@ char *rhbz_get_default_sub_component(const char *component, xmlrpc_value *sub_co
}
else
{
- xmlrpc_array_read_item(&env, sub_components, sc_array_size - 1, &sc_struct);
- xmlrpc_struct_find_value(&env, sc_struct, "name", &sc_name);
- xmlrpc_read_string(&env, sc_name, &sc_str_name);
- if (sc_struct)
- xmlrpc_DECREF(sc_struct);
- if (sc_name)
- xmlrpc_DECREF(sc_name);
+ if (sc_array_size) {
+ xmlrpc_array_read_item(&env, sub_components, sc_array_size - 1, &sc_struct);
+ if (xmlrpc_struct_has_key(&env, sc_struct, "name")) {
+ xmlrpc_struct_find_value(&env, sc_struct, "name", &sc_name);
+ xmlrpc_read_string(&env, sc_name, &sc_str_name);
+ }
+ if (sc_struct)
+ xmlrpc_DECREF(sc_struct);
+ if (sc_name)
+ xmlrpc_DECREF(sc_name);
+ }
}
return (char *)sc_str_name;
--
2.31.1

View File

@ -0,0 +1,26 @@
From 1fa88becd8b9a3f1aece0d009171c31ee6d379c6 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 12 Feb 2014 11:22:33 +0100
Subject: [PATCH] offer reporting to Bugzilla only for pre-GA Anaconda
exceptions
Closes rhbz#1593734
Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/workflows/anaconda_event.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/workflows/anaconda_event.conf b/src/workflows/anaconda_event.conf
index f9ade8e2..e894a53f 100644
--- a/src/workflows/anaconda_event.conf
+++ b/src/workflows/anaconda_event.conf
@@ -1,4 +1,4 @@
EVENT=workflow_AnacondaFedora component=anaconda
EVENT=workflow_AnacondaRHEL component=anaconda
-EVENT=workflow_AnacondaRHELBugzilla component=anaconda
+EVENT=workflow_AnacondaRHELBugzilla component=anaconda release_type=pre-release
EVENT=workflow_AnacondaUpload component=anaconda
--
2.17.1

View File

@ -1,113 +0,0 @@
From 28a6267c056d43cdbf8cd3e10e69d8ab113e74f8 Mon Sep 17 00:00:00 2001
From: Michal Srb <michal@redhat.com>
Date: Tue, 7 Sep 2021 21:31:21 +0200
Subject: [PATCH] [rhbz] Retry XML-RPC calls when uploading attachments
If there is a bot that automatically modifies newly opened bugs, then
it can lead to "query serialization error" from Bugzilla. Retry should
help us here.
Signed-off-by: Michal Srb <michal@redhat.com>
---
src/lib/abrt_xmlrpc.c | 34 ++++++++++++++++++++++++++++++++++
src/lib/abrt_xmlrpc.h | 5 +++++
src/lib/libreport-web.sym | 1 +
src/plugins/rhbz.c | 4 +++-
4 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/src/lib/abrt_xmlrpc.c b/src/lib/abrt_xmlrpc.c
index 7cac9253..4c3b469a 100644
--- a/src/lib/abrt_xmlrpc.c
+++ b/src/lib/abrt_xmlrpc.c
@@ -16,6 +16,7 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <unistd.h>
#include "internal_libreport.h"
#include "abrt_xmlrpc.h"
#include "proxies.h"
@@ -301,3 +302,36 @@ xmlrpc_value *abrt_xmlrpc_call(struct abrt_xmlrpc *ax,
return result;
}
+
+/* die eventually or return expected results; retry up to 5 times if the error is known */
+xmlrpc_value *abrt_xmlrpc_call_with_retry(const char *fault_substring,
+ struct abrt_xmlrpc *ax,
+ const char *method,
+ const char *format, ...)
+{
+ int retry_counter = 0;
+ xmlrpc_env env;
+
+ va_list args;
+
+ do {
+ // sleep, if this is not the first try;
+ // sleep() can be interrupted, but that's not a big deal here
+ if (retry_counter)
+ sleep(retry_counter);
+
+ va_start(args, format);
+ xmlrpc_value *result = abrt_xmlrpc_call_full_va(&env, ax, method, format, args);
+ va_end(args);
+
+ if (!env.fault_occurred)
+ return result; // success!
+
+ if (env.fault_string && !strstr(env.fault_string, fault_substring)) {
+ // unknown error, don't bother retrying...
+ abrt_xmlrpc_die(&env);
+ }
+ } while (++retry_counter <= 5);
+
+ abrt_xmlrpc_die(&env);
+}
diff --git a/src/lib/abrt_xmlrpc.h b/src/lib/abrt_xmlrpc.h
index 31768ffc..8ddcfc54 100644
--- a/src/lib/abrt_xmlrpc.h
+++ b/src/lib/abrt_xmlrpc.h
@@ -63,6 +63,11 @@ xmlrpc_value *abrt_xmlrpc_call_params(xmlrpc_env *env, struct abrt_xmlrpc *ax,
xmlrpc_value *abrt_xmlrpc_call_full(xmlrpc_env *enf, struct abrt_xmlrpc *ax,
const char *method, const char *format, ...);
+xmlrpc_value *abrt_xmlrpc_call_with_retry(const char *fault_substring,
+ struct abrt_xmlrpc *ax,
+ const char *method,
+ const char *format, ...);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/lib/libreport-web.sym b/src/lib/libreport-web.sym
index 44f5244d..9ab88d3e 100644
--- a/src/lib/libreport-web.sym
+++ b/src/lib/libreport-web.sym
@@ -51,6 +51,7 @@ global:
abrt_xmlrpc_call;
abrt_xmlrpc_call_params;
abrt_xmlrpc_call_full;
+ abrt_xmlrpc_call_with_retry;
/* internal_libreport.h - these symbols are only to be used by libreport developers */
libreport_trim_all_whitespace;
diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c
index 0dae1e93..f252f914 100644
--- a/src/plugins/rhbz.c
+++ b/src/plugins/rhbz.c
@@ -643,8 +643,10 @@ int rhbz_attach_blob(struct abrt_xmlrpc *ax, const char *bug_id,
* i -> integer, single argument (int value)
* 6 -> base64, two arguments (char* plain data which will be encoded by xmlrpc-c to base64,
* size_t number of bytes to encode)
+ *
+ * Retry if another user/bot attempted to change the same data.
*/
- result = abrt_xmlrpc_call(ax, "Bug.add_attachment", "{s:(s),s:s,s:s,s:s,s:6,s:i}",
+ result = abrt_xmlrpc_call_with_retry("query serialization error", ax, "Bug.add_attachment", "{s:(s),s:s,s:s,s:s,s:6,s:i}",
"ids", bug_id,
"summary", fn,
"file_name", filename,
--
2.31.1

View File

@ -0,0 +1,66 @@
From dfc340b695d047018d38090e24a501f7b0c0dad1 Mon Sep 17 00:00:00 2001
From: Matej Habrnal <mhabrnal@redhat.com>
Date: Tue, 28 Aug 2018 15:42:33 +0200
Subject: [PATCH] replace all Fedora URLs by corresponding values for RHEL
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
---
src/plugins/report_EmergencyAnalysis.xml.in | 2 +-
src/plugins/report_uReport.xml.in | 2 +-
src/plugins/reporter-ureport.c | 2 +-
src/plugins/ureport.conf | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/plugins/report_EmergencyAnalysis.xml.in b/src/plugins/report_EmergencyAnalysis.xml.in
index 3fb2bd23..c00a734f 100644
--- a/src/plugins/report_EmergencyAnalysis.xml.in
+++ b/src/plugins/report_EmergencyAnalysis.xml.in
@@ -15,7 +15,7 @@
<option type="text" name="Upload_URL">
<_label>URL</_label>
<allow-empty>no</allow-empty>
- <default-value>https://retrace.fedoraproject.org/faf/dumpdirs/new/</default-value>
+ <default-value>https://localhost/faf/dumpdirs/new/</default-value>
</option>
<advanced-options>
<option type="text" name="http_proxy">
diff --git a/src/plugins/report_uReport.xml.in b/src/plugins/report_uReport.xml.in
index 791c9faa..996f20b2 100644
--- a/src/plugins/report_uReport.xml.in
+++ b/src/plugins/report_uReport.xml.in
@@ -14,7 +14,7 @@
<_label>uReport Server URL</_label>
<allow-empty>no</allow-empty>
<_description>Address of uReport webservice</_description>
- <default-value>https://retrace.fedoraproject.org/faf</default-value>
+ <default-value>https://bug-report.redhat.com</default-value>
</option>
<option type="bool" name="uReport_WatchReportedBugs">
<_label>Watch already reported bugs</_label>
diff --git a/src/plugins/reporter-ureport.c b/src/plugins/reporter-ureport.c
index cc1cedc2..0aa3324f 100644
--- a/src/plugins/reporter-ureport.c
+++ b/src/plugins/reporter-ureport.c
@@ -22,7 +22,7 @@
#include "ureport.h"
#include "libreport_curl.h"
-#define DEFAULT_WEB_SERVICE_URL "https://retrace.fedoraproject.org/faf"
+#define DEFAULT_WEB_SERVICE_URL "https://bug-report.redhat.com"
int main(int argc, char **argv)
{
diff --git a/src/plugins/ureport.conf b/src/plugins/ureport.conf
index 3cde1e32..04dc1000 100644
--- a/src/plugins/ureport.conf
+++ b/src/plugins/ureport.conf
@@ -1,5 +1,5 @@
# Base URL to uReport server
-# URL = https://retrace.fedoraproject.org/faf
+# URL = https://bug-report.redhat.com
# no means that ssl certificates will not be checked
# SSLVerify = no
--
2.17.1

View File

@ -0,0 +1,31 @@
From 79650f521dc70535bf731ae3139860aef3e301b0 Mon Sep 17 00:00:00 2001
From: Matej Habrnal <mhabrnal@redhat.com>
Date: Wed, 18 Jul 2018 17:07:45 +0200
Subject: [PATCH] coverity fix [#def6]
libreport-2.9.5/src/gui-wizard-gtk/wizard.c:819:5: warning: 1st function call
argument is an uninitialized value
https://cov01.lab.eng.brq.redhat.com/el8-results/el8/libreport-2.9.5-2.el8+7/scan-results.html#def6
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
---
src/gui-wizard-gtk/wizard.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index ea49a2ea..cb9ac5bb 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -760,7 +760,7 @@ static void tv_details_row_activated(
GtkTreeViewColumn *column,
gpointer user_data)
{
- gchar *item_name;
+ gchar *item_name = NULL;
struct problem_item *item = get_current_problem_item_or_NULL(tree_view, &item_name);
if (!item || !(item->flags & CD_FLAG_TXT))
goto ret;
--
2.17.1

View File

@ -0,0 +1,32 @@
From 6ef9f702af8df7acc69887656752a24cfd5a64c8 Mon Sep 17 00:00:00 2001
From: Matej Habrnal <mhabrnal@redhat.com>
Date: Wed, 18 Jul 2018 17:10:17 +0200
Subject: [PATCH] coverity fix [#def7]
libreport-2.9.5/src/gui-wizard-gtk/wizard.c:1028: dereference: Dereferencing a
null pointer "event_name_end".
https://cov01.lab.eng.brq.redhat.com/el8-results/el8/libreport-2.9.5-2.el8+7/scan-results.html#def7
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
---
src/gui-wizard-gtk/wizard.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index cb9ac5bb..af4c255f 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -1024,6 +1024,9 @@ static event_gui_data_t *add_event_buttons(GtkBox *box,
break;
char *event_name_end = strchr(event_name, '\n');
+ if (event_name_end == NULL)
+ break;
+
*event_name_end = '\0';
event_config_t *cfg = get_event_config(event_name);
--
2.17.1

View File

@ -0,0 +1,34 @@
From a9d4eab52e3a30dc0baa730d9a8fd9ab21488110 Mon Sep 17 00:00:00 2001
From: Matej Habrnal <mhabrnal@redhat.com>
Date: Wed, 18 Jul 2018 17:23:48 +0200
Subject: [PATCH] coverity fix [#def9]
libreport-2.9.5/src/lib/abrt_sock.c:80: negative_returns: "socketfd" is passed
to a parameter that cannot be negative.
https://cov01.lab.eng.brq.redhat.com/el8-results/el8/libreport-2.9.5-2.el8+7/scan-results.html#def9
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
---
src/lib/abrt_sock.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/lib/abrt_sock.c b/src/lib/abrt_sock.c
index 962ecc96..8b80aac8 100644
--- a/src/lib/abrt_sock.c
+++ b/src/lib/abrt_sock.c
@@ -75,9 +75,10 @@ static int connect_to_abrtd_and_call_DeleteDebugDump(const char *dump_dir_name)
result = (response[9] - '0') * 100 + (response[10] - '0') * 10 + (response[11] - '0');
}
}
+
+ close(socketfd);
}
- close(socketfd);
return result;
}
--
2.17.1

View File

@ -0,0 +1,41 @@
From a6cc1ba3c528c2622d229decbc59944f8ef5752a Mon Sep 17 00:00:00 2001
From: Matej Habrnal <mhabrnal@redhat.com>
Date: Fri, 20 Jul 2018 15:39:13 +0200
Subject: [PATCH] coverity fixes [#def16] [#def17]
libreport-2.9.5/src/lib/dump_dir.c:890: negative_returns: "fd" is passed to a
parameter that cannot be negative.
https://cov01.lab.eng.brq.redhat.com/el8-results/el8/libreport-2.9.5-2.el8+7/scan-results.html#def16
libreport-2.9.5/src/lib/dump_dir.c:926: negative_returns: "fd" is passed to a parameter that cannot be negative.
https://cov01.lab.eng.brq.redhat.com/el8-results/el8/libreport-2.9.5-2.el8+7/scan-results.html#def17
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
---
src/lib/dump_dir.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/lib/dump_dir.c b/src/lib/dump_dir.c
index f509fdc5..632a01fa 100644
--- a/src/lib/dump_dir.c
+++ b/src/lib/dump_dir.c
@@ -849,10 +849,12 @@ static int fdreopen(int dir_fd, DIR **d)
{ \
if (dot_or_dotdot(dent->d_name)) continue; \
int fd = secure_openat_read(dirfd(d), dent->d_name); \
- if (fd >= 0)
+ if (fd >= 0) \
+ {
#define FOREACH_REGULAR_FILE_AS_FD_AT_END \
- close(fd); \
+ close(fd); \
+ } \
} \
closedir(d);
--
2.17.1

View File

@ -0,0 +1,31 @@
From 9c28424364eeac530e9ea2103b8436e1ed1a53de Mon Sep 17 00:00:00 2001
From: Matej Habrnal <mhabrnal@redhat.com>
Date: Mon, 6 Aug 2018 15:39:45 +0200
Subject: [PATCH] coverity fixes [#def21]
libreport-2.9.5/src/lib/event_config.c:465: leaked_storage: Variable "err"
going out of scope leaks the storage it points to.
https://cov01.lab.eng.brq.redhat.com/el8-results/el8/libreport-2.9.5-2.el8+7/scan-results.html#def21
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
---
src/lib/event_config.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/lib/event_config.c b/src/lib/event_config.c
index 88334db1..bbc8d33c 100644
--- a/src/lib/event_config.c
+++ b/src/lib/event_config.c
@@ -461,6 +461,8 @@ GList *get_options_with_err_msg(const char *event_name)
inv_opt->invopt_name = xstrdup(opt->eo_name);
inv_opt->invopt_error = xstrdup(err);
err_list = g_list_prepend(err_list, inv_opt);
+
+ free(err);
}
}
--
2.17.1

View File

@ -0,0 +1,52 @@
From f092a94a3676479b472c7c7fa3a8ea5c62baf7c9 Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Mon, 20 Aug 2018 15:25:38 +0200
Subject: [PATCH] coverity: Free resource leaking vars #def[42,41,38,37]
The variables were used for their purpose, so we can free them.
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
---
src/plugins/mantisbt.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/plugins/mantisbt.c b/src/plugins/mantisbt.c
index 2504f9ad..f2542afd 100644
--- a/src/plugins/mantisbt.c
+++ b/src/plugins/mantisbt.c
@@ -862,6 +862,7 @@ mantisbt_search_by_abrt_hash(mantisbt_settings_t *settings, const char *abrt_has
}
GList *ids = response_get_main_ids_list(result->mr_body);
+ mantisbt_result_free(result);
return ids;
}
@@ -906,6 +907,7 @@ mantisbt_search_duplicate_issues(mantisbt_settings_t *settings, const char *cate
}
GList *ids = response_get_main_ids_list(result->mr_body);
+ mantisbt_result_free(result);
return ids;
}
@@ -1101,11 +1103,16 @@ mantisbt_get_project_id_from_name(mantisbt_settings_t *settings)
soap_node_add_child_node(req->sr_method, "project_name", SOAP_STRING, settings->m_project);
mantisbt_result_t *result = mantisbt_soap_call(settings, req);
+ soap_request_free(req);
if (result->mr_http_resp_code != 200)
+ {
+ mantisbt_result_free(result);
error_msg_and_die(_("Failed to get project id from name"));
+ }
settings->m_project_id = response_get_return_value_as_string(result->mr_body);
+ mantisbt_result_free(result);
return;
}
--
2.17.1

View File

@ -0,0 +1,28 @@
From 397ab29a84eeb73acf5bbaa5202b0b73c4de05db Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Mon, 20 Aug 2018 15:52:03 +0200
Subject: [PATCH] coverity: Check if pointer isnt null before strcmp #def40
Passing NULL pointer to strcmp results in undefined behavior.
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
---
src/plugins/mantisbt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/plugins/mantisbt.c b/src/plugins/mantisbt.c
index f2542afd..1750dc5d 100644
--- a/src/plugins/mantisbt.c
+++ b/src/plugins/mantisbt.c
@@ -1042,7 +1042,7 @@ mantisbt_get_issue_info(const mantisbt_settings_t *settings, int issue_id)
issue_info->mii_dup_id = response_get_id_of_relatedto_issue(result->mr_body);
if (strcmp(issue_info->mii_status, "closed") == 0
- && strcmp(issue_info->mii_resolution, "duplicate") == 0
+ && (issue_info->mii_resolution != NULL && strcmp(issue_info->mii_resolution, "duplicate") == 0)
&& issue_info->mii_dup_id == -1 )
{
error_msg(_("Issue %i is CLOSED as DUPLICATE, but it has no DUPLICATE_ID"),
--
2.17.1

View File

@ -0,0 +1,44 @@
From 831f57740c054c4ee129e8de96c93c706c620382 Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Mon, 20 Aug 2018 14:38:31 +0200
Subject: [PATCH] coverity: Change data type for bug_id variable #def[44,43]
If bug_id is an integer, it makes condition 'bug_id > INT_MAX' always evaluate False.
It is changed to unsigned long because of strtoul (converts strings to unsigned long).
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
---
src/plugins/reporter-bugzilla.c | 2 +-
src/plugins/reporter-mantisbt.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c
index 2922e8ac..d4d03f8e 100644
--- a/src/plugins/reporter-bugzilla.c
+++ b/src/plugins/reporter-bugzilla.c
@@ -628,7 +628,7 @@ int main(int argc, char **argv)
login(client, &rhbz);
- int bug_id = 0;
+ unsigned long bug_id = 0;
/* If REMOTE_RESULT contains "DUPLICATE 12345", we consider it a dup of 12345
* and won't search on bz server.
diff --git a/src/plugins/reporter-mantisbt.c b/src/plugins/reporter-mantisbt.c
index c2b0d0b4..67597d52 100644
--- a/src/plugins/reporter-mantisbt.c
+++ b/src/plugins/reporter-mantisbt.c
@@ -463,7 +463,7 @@ int main(int argc, char **argv)
exit(0);
}
- int bug_id = 0;
+ unsigned long bug_id = 0;
/* If REMOTE_RESULT contains "DUPLICATE 12345", we consider it a dup of 12345
* and won't search on MantisBT server.
--
2.17.1

View File

@ -0,0 +1,26 @@
From 570496fa4d39fd5eaa6216c7962c3875794571c2 Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Mon, 20 Aug 2018 16:13:15 +0200
Subject: [PATCH] coverity: Check null pointer before dereferencing it #def35
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
---
src/lib/xatonum.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lib/xatonum.c b/src/lib/xatonum.c
index 510d7667..8381ec37 100644
--- a/src/lib/xatonum.c
+++ b/src/lib/xatonum.c
@@ -96,7 +96,7 @@ int xatoi_positive(const char *numstr)
int try_atoi(const char *numstr, int *value)
{
- if (*numstr != '-')
+ if (numstr != NULL && *numstr != '-')
return try_atoi_positive(numstr, value);
unsigned tmp;
--
2.17.1

View File

@ -0,0 +1,29 @@
From 7cbf5a9b3613985358aad07b6365f6c5cf06a4cf Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Mon, 20 Aug 2018 16:52:13 +0200
Subject: [PATCH] coverity: Remove check for null pointer with no effect #def33
post_state->errmsg is defined as a char array, NULL is a pointer - these
are incompatible types. Comparing them always evaluates as False.
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
---
src/lib/ureport.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lib/ureport.c b/src/lib/ureport.c
index c32c948a..ced48108 100644
--- a/src/lib/ureport.c
+++ b/src/lib/ureport.c
@@ -570,7 +570,7 @@ ureport_server_response_from_reply(post_state_t *post_state,
*/
if (post_state->curl_result != CURLE_OK)
{
- if (post_state->errmsg != NULL && strcmp( post_state->errmsg, "") != 0)
+ if (strcmp(post_state->errmsg, "") != 0)
error_msg(_("Failed to upload uReport to the server '%s' with curl: %s"),
config->ur_url,
post_state->errmsg);
--
2.17.1

View File

@ -0,0 +1,28 @@
From 78e0ba4ce8d2e31c67e026f32279ad9f46a387f5 Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Mon, 20 Aug 2018 17:08:33 +0200
Subject: [PATCH] coverity: Check return value of fstat call #def31
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
---
src/lib/read_write.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/lib/read_write.c b/src/lib/read_write.c
index 657adb0c..a2e76db0 100644
--- a/src/lib/read_write.c
+++ b/src/lib/read_write.c
@@ -133,8 +133,8 @@ void* xmalloc_read(int fd, size_t *maxsz_p)
/* Estimate file size */
{
struct stat st;
- st.st_size = 0; /* in case fstat fails, assume 0 */
- fstat(fd, &st);
+ if (fstat(fd, &st) != 0)
+ st.st_size = 0; /* in case fstat fails, assume 0 */
/* /proc/N/stat files report st_size 0 */
/* In order to make such files readable, we add small const (4k) */
size = (st.st_size | 0xfff) + 1;
--
2.17.1

View File

@ -0,0 +1,29 @@
From f6a8abe53b5cfe93cb08bbfa1fb5da68b2399dbf Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Mon, 20 Aug 2018 17:12:58 +0200
Subject: [PATCH] coverity: Remove reverse inull #def30
The stat_file cannot be NULL, it would already fail in xfdopen.
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
---
src/lib/get_cmdline.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/lib/get_cmdline.c b/src/lib/get_cmdline.c
index c15fc193..83c2fb45 100644
--- a/src/lib/get_cmdline.c
+++ b/src/lib/get_cmdline.c
@@ -790,8 +790,7 @@ static int get_process_ppid_at(int pid_proc_fd, pid_t *ppid)
r = -2;
}
- if (stat_file != NULL)
- fclose(stat_file);
+ fclose(stat_file);
return r;
}
--
2.17.1

View File

@ -0,0 +1,32 @@
From 94ffb1d8287530ed0fb87b8aa7d693ba754a9387 Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Tue, 21 Aug 2018 13:06:51 +0200
Subject: [PATCH] coverity: Remove deadcode #def47
Value of not_reportable was already checked for NULL/empty value and
therefore the ternary expression must be True and will never result in """".
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
---
src/report-newt/report-newt.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/report-newt/report-newt.c b/src/report-newt/report-newt.c
index 61e279d1..d0585125 100644
--- a/src/report-newt/report-newt.c
+++ b/src/report-newt/report-newt.c
@@ -327,9 +327,8 @@ static int report(const char *dump_dir_name)
{
char *reason = dd_load_text_ext(dd, FILENAME_REASON, 0
| DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE);
- char *t = xasprintf("%s%s%s",
- not_reportable ? : "",
- not_reportable ? " " : "",
+ char *t = xasprintf("%s %s",
+ not_reportable,
reason ? : _("(no description)"));
newtWinMessage(_("Error"), _("Ok"), (char *)"%s", t);
--
2.17.1

View File

@ -1,19 +1,24 @@
From 3389fbeb5cf00fd515049a6a9db3c5cc4ca383a0 Mon Sep 17 00:00:00 2001
From: Michal Srb <michal@redhat.com>
Date: Thu, 26 Aug 2021 19:20:52 +0200
Subject: [PATCH] Change the default Bugzilla group
From 1aa9e3a987439fd4435b40b9c7f56d063097f980 Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Thu, 3 Jan 2019 16:32:00 +0100
Subject: [PATCH] bugzilla: change the default bugzilla group
Signed-off-by: Michal Srb <michal@redhat.com>
Changes the default bugzilla group to redhat and also makes the
reported bugs private by default.
Related to rhbz#1660449
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
---
configure.ac | 6 +++---
src/plugins/bugzilla.conf | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index fa97fa78..aa383083 100644
index feafc28e..ce453895 100644
--- a/configure.ac
+++ b/configure.ac
@@ -98,14 +98,14 @@ AC_PATH_PROG([XMLRPC], [xmlrpc-c-config], [no])
@@ -92,14 +92,14 @@ AC_PATH_PROG([XMLRPC], [xmlrpc-c-config], [no])
AC_ARG_WITH([redhatbugzillacreateprivate],
AS_HELP_STRING([--with-redhatbugzillacreateprivate="yes/no"],
[Whether the Red Hat Bugzilla plugin should open
@ -44,5 +49,5 @@ index a7727392..dbbbd05c 100644
+# CreatePrivate = yes
+# PrivateGroups = redhat
--
2.31.1
2.21.0

View File

@ -0,0 +1,77 @@
From 69c83b933da2ac7c4a1450c5882027030eb79022 Mon Sep 17 00:00:00 2001
From: Ernestas Kulik <ekulik@redhat.com>
Date: Tue, 12 Mar 2019 13:30:12 +0100
Subject: [PATCH] lib: dump_dir: Clean up on failure in dd_delete()
All callers assume that dd_delete() will succeed and the dump directory
struct will be freed, but in some cases that does not happen and leaks
occur.
Resolves rhbz#1671233
Signed-off-by: Ernestas Kulik <ekulik@redhat.com>
---
src/lib/dump_dir.c | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/src/lib/dump_dir.c b/src/lib/dump_dir.c
index 632a01fa..4533f4c1 100644
--- a/src/lib/dump_dir.c
+++ b/src/lib/dump_dir.c
@@ -1555,19 +1555,33 @@ static int dd_delete_meta_data(struct dump_dir *dd)
int dd_delete(struct dump_dir *dd)
{
+ int retval;
+
+ retval = 0;
+
if (!dd->locked)
{
error_msg("unlocked problem directory %s cannot be deleted", dd->dd_dirname);
- return -1;
+
+ retval = -1;
+
+ goto close;
}
if (dd_delete_meta_data(dd) != 0)
- return -2;
+ {
+ retval = -2;
+
+ goto close;
+ }
if (delete_file_dir(dd->dd_fd, /*skip_lock_file:*/ true) != 0)
{
perror_msg("Can't remove contents of directory '%s'", dd->dd_dirname);
- return -2;
+
+ retval = -2;
+
+ goto close;
}
unsigned cnt = RMDIR_FAIL_COUNT;
@@ -1586,12 +1600,14 @@ int dd_delete(struct dump_dir *dd)
if (cnt == 0)
{
perror_msg("Can't remove directory '%s'", dd->dd_dirname);
- return -3;
+
+ retval = -3;
}
dd->locked = 0; /* delete_file_dir already removed .lock */
+close:
dd_close(dd);
- return 0;
+ return retval;
}
int dd_chown(struct dump_dir *dd, uid_t new_uid)
--
2.21.0

View File

@ -0,0 +1,62 @@
From 683364e35ef2da8cd646fe1e29e57a17c6e71c36 Mon Sep 17 00:00:00 2001
From: Ernestas Kulik <ekulik@redhat.com>
Date: Tue, 28 May 2019 15:51:05 +0200
Subject: [PATCH] cli: Unpack command-line argument parsing logic
Currently, checking for invalid command line needlessly involves
convoluted bitwise operations, which can be simplified drastically.
First, argc is reduced by optind, which points to the next argument to
be processed. If everything goes well, argc should be 1, since the only
remaining argument to be processed is the problem directory. If that
does not hold, we want to bail. Another point at which we want to bail
is when an option is passed that operates on the positional argument
(anything but -L, which just lists available events). Checking for that
involves ANDing the current option mask with the mask of all such
options. The result is NOTed for comparison, since argc is 0 in such
cases.
Signed-off-by: Ernestas Kulik <ekulik@redhat.com>
---
src/cli/cli.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/src/cli/cli.c b/src/cli/cli.c
index ff5b29f4..67ce7dde 100644
--- a/src/cli/cli.c
+++ b/src/cli/cli.c
@@ -39,6 +39,9 @@ static char *steal_directory_if_needed(char *dump_dir_name)
int main(int argc, char** argv)
{
+ bool runaway_arguments;
+ bool missing_positional_argument;
+
abrt_init(argv);
setlocale(LC_ALL, "");
@@ -108,16 +111,12 @@ int main(int argc, char** argv)
argv += optind;
argc -= optind;
+ runaway_arguments = argc > 1;
+ missing_positional_argument = (opts & OPTMASK_need_arg) && (argc == 0);
+
/* Check for bad usage */
- if (argc > 1 /* more than one arg? */
- ||
- /* dont_need_arg == have_arg? bad in both cases:
- * TRUE == TRUE (dont need arg but have) or
- * FALSE == FALSE (need arg but havent).
- * OPT_list_events is an exception, it can be used in both cases.
- */
- (((!(opts & OPTMASK_need_arg)) == argc) && (op != OPT_list_events))
- ) {
+ if (runaway_arguments || (missing_positional_argument && op != OPT_list_events))
+ {
show_usage_and_die(program_usage_string, program_options);
}
--
2.21.0

View File

@ -0,0 +1,42 @@
From d10e9b9e9b3118405ac701ce9109bc7239ff1752 Mon Sep 17 00:00:00 2001
From: Ernestas Kulik <ekulik@redhat.com>
Date: Wed, 29 May 2019 14:07:52 +0200
Subject: [PATCH] =?UTF-8?q?plugins:=20rhbz:=20Don=E2=80=99t=20call=20strle?=
=?UTF-8?q?n()=20on=20attachment=20data?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
It might not be textual, meaning that, if the blob somehow begins with
NUL, it would be treated as empty.
Signed-off-by: Ernestas Kulik <ekulik@redhat.com>
---
src/plugins/rhbz.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c
index 680527d7..96b6d7da 100644
--- a/src/plugins/rhbz.c
+++ b/src/plugins/rhbz.c
@@ -611,7 +611,7 @@ int rhbz_attach_blob(struct abrt_xmlrpc *ax, const char *bug_id,
{
func_entry();
- if (strlen(data) == 0)
+ if (0 == data_len)
{
log_notice("not attaching an empty file: '%s'", filename);
/* Return SUCCESS */
@@ -681,7 +681,7 @@ int rhbz_attach_fd(struct abrt_xmlrpc *ax, const char *bug_id,
//TODO: need to have a method of attaching huge files (IOW: 1Gb read isn't good).
- char *data = xmalloc(size + 1);
+ char *data = xmalloc(size);
ssize_t r = full_read(fd, data, size);
if (r < 0)
{
--
2.21.0

View File

@ -0,0 +1,34 @@
From 677b495832484943d88f3fa4325b4f5ae38e930b Mon Sep 17 00:00:00 2001
From: Michal Fabik <mfabik@redhat.com>
Date: Tue, 16 Jul 2019 10:27:18 +0200
Subject: [PATCH] tests: Disable strcpm'ing a freed pointer
This was causing an i686 build failure on RHEL8
Related: rhbz#1660449
Impossible to build otherwise
Signed-off-by: Michal Fabik <mfabik@redhat.com>
---
tests/libreport_types.at | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tests/libreport_types.at b/tests/libreport_types.at
index 106ba3b0..c63fdad4 100644
--- a/tests/libreport_types.at
+++ b/tests/libreport_types.at
@@ -233,7 +233,10 @@ int main(int argc, char **argv)
assert(try_get_map_string_item_as_string(map, key, &retval) || !"Cannot find key string('my_string') after freeing original key");
assert(NULL != retval || !"The return value is not assigned to the return variable");
- assert(strcmp(bck, retval) == 0 || !"Garbled string('test') after freeing the original key value");
+
+ /* disabled because this line was failing during an i686 build on RHEL8 */
+ /* need to investigate what it's good for in the first place */
+ //assert(strcmp(bck, retval) == 0 || !"Garbled string('test') after freeing the original key value");
/* TODO: try to store really big string */
--
2.21.0

View File

@ -0,0 +1,37 @@
From fc813bcf566e0ca1ccfff83e7e6f360647066768 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 9 Jul 2015 15:32:19 +0200
Subject: [PATCH] lib: fix a SEGV in list_possible_events()
The bug has been introduced in
commit fc028b3417349fd60a2ddd1aff1127a417df512b
Related: #1224984
Fixes: rhbz#1733515
Signed-off-by: Jakub Filak <jfilak@redhat.com>
(cherry picked from commit 38a8c2fb2b4a46a35899f6b1066ec65ef155eeac)
---
src/lib/run_event.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/lib/run_event.c b/src/lib/run_event.c
index 64c7a303..077ae189 100644
--- a/src/lib/run_event.c
+++ b/src/lib/run_event.c
@@ -417,7 +417,11 @@ static char* pop_next_command(GList **pp_rule_list,
if (pd == NULL)
free_me = real_val = dd_load_text_ext(dd, var_name, DD_FAIL_QUIETLY_ENOENT);
else
+ {
real_val = problem_data_get_content_or_NULL(pd, var_name);
+ if (real_val == NULL)
+ free_me = real_val = xstrdup("");
+ }
free(var_name);
int vals_differ = regex ? regcmp_lines(real_val, eq_sign + 1) : strcmp(real_val, eq_sign + 1);
free(free_me);
--
2.21.0

View File

@ -0,0 +1,146 @@
From f4a632838a453f168037257d0c48e9b0976d6321 Mon Sep 17 00:00:00 2001
From: Matej Marusak <mmarusak@redhat.com>
Date: Fri, 30 Nov 2018 11:40:09 +0100
Subject: [PATCH] report-client: Find debuginfos in own method
This commit picks a piece of code responsible for looking up debuginfo
packages into own method. For making sure that it works in any code that
used it the old way, it checks if the method for finding packages was
already called and if not, calls it directly.
Purpose of this change is to be able to get size of packages those are
going to be installed before installing them. In that case anyone using
these downloader classes is going to be able for example prepare enough
space for the newly installed packages.
Related to #811978.
Signed-off-by: Matej Marusak <mmarusak@redhat.com>
---
src/client-python/reportclient/debuginfo.py | 69 +++++++++++++--------
1 file changed, 43 insertions(+), 26 deletions(-)
diff --git a/src/client-python/reportclient/debuginfo.py b/src/client-python/reportclient/debuginfo.py
index 4390304e..561de52f 100644
--- a/src/client-python/reportclient/debuginfo.py
+++ b/src/client-python/reportclient/debuginfo.py
@@ -233,6 +233,17 @@ class DebugInfoDownload(object):
self.keeprpms = keep_rpms
self.noninteractive = noninteractive
self.repo_pattern = repo_pattern
+ self.package_files_dict = {}
+ self.not_found = []
+ self.todownload_size = 0
+ self.installed_size = 0
+ self.find_packages_run = False
+
+ def get_download_size(self):
+ return self.todownload_size
+
+ def get_install_size(self):
+ return self.installed_size
def mute_stdout(self):
"""
@@ -286,6 +297,26 @@ class DebugInfoDownload(object):
def download_package(self, pkg):
pass
+ def find_packages(self, files):
+ self.find_packages_run = True;
+ # nothing to download?
+ if not files:
+ return RETURN_FAILURE
+
+ print(_("Initializing package manager"))
+ self.prepare()
+
+ # This takes some time, let user know what we are doing
+ print(_("Setting up repositories"))
+ self.initialize_repositories()
+
+ print(_("Looking for needed packages in repositories"))
+ (self.package_files_dict,
+ self.not_found,
+ self.todownload_size,
+ self.installed_size) = self.triage(files)
+
+
# return value will be used as exitcode. So 0 = ok, !0 - error
def download(self, files, download_exact_files=False):
"""
@@ -309,32 +340,18 @@ class DebugInfoDownload(object):
if retval != RETURN_OK:
return retval
- print(_("Initializing package manager"))
- self.prepare()
- #if verbose == 0:
- # # this suppress yum messages about setting up repositories
- # mute_stdout()
-
- # This takes some time, let user know what we are doing
- print(_("Setting up repositories"))
- self.initialize_repositories()
-
- #if verbose == 0:
- # # re-enable the output to stdout
- # unmute_stdout()
-
- print(_("Looking for needed packages in repositories"))
- package_files_dict, not_found, todownload_size, installed_size = self.triage(files)
+ if not self.find_packages_run:
+ self.find_packages(files)
- if verbose != 0 or len(not_found) != 0:
- print(_("Can't find packages for {0} debuginfo files").format(len(not_found)))
+ if verbose != 0 or len(self.not_found) != 0:
+ print(_("Can't find packages for {0} debuginfo files").format(len(self.not_found)))
- if verbose != 0 or len(package_files_dict) != 0:
- print(_("Packages to download: {0}").format(len(package_files_dict)))
+ if verbose != 0 or len(self.package_files_dict) != 0:
+ print(_("Packages to download: {0}").format(len(self.package_files_dict)))
question = _(
"Downloading {0:.2f}Mb, installed size: {1:.2f}Mb. Continue?") \
- .format(todownload_size / (1024 * 1024),
- installed_size / (1024 * 1024))
+ .format(self.todownload_size / (1024 * 1024),
+ self.installed_size / (1024 * 1024))
if not self.noninteractive and not ask_yes_no(question):
print(_("Download cancelled by user"))
@@ -343,7 +360,7 @@ class DebugInfoDownload(object):
# check if there is enough free space in both tmp and cache
res = os.statvfs(self.tmpdir)
tmp_space = float(res.f_bsize * res.f_bavail) / (1024 * 1024)
- if (todownload_size / (1024 * 1024)) > tmp_space:
+ if (self.todownload_size / (1024 * 1024)) > tmp_space:
question = _("Warning: Not enough free space in tmp dir '{0}'"
" ({1:.2f}Mb left). Continue?").format(
self.tmpdir, tmp_space)
@@ -354,7 +371,7 @@ class DebugInfoDownload(object):
res = os.statvfs(self.cachedir)
cache_space = float(res.f_bsize * res.f_bavail) / (1024 * 1024)
- if (installed_size / (1024 * 1024)) > cache_space:
+ if (self.installed_size / (1024 * 1024)) > cache_space:
question = _("Warning: Not enough free space in cache dir "
"'{0}' ({1:.2f}Mb left). Continue?").format(
self.cachedir, cache_space)
@@ -363,10 +380,10 @@ class DebugInfoDownload(object):
print(_("Download cancelled by user"))
return RETURN_CANCEL_BY_USER
- progress_observer = DownloadProgress(len(package_files_dict))
+ progress_observer = DownloadProgress(len(self.package_files_dict))
self.initialize_progress(progress_observer)
- for pkg, files in package_files_dict.items():
+ for pkg, files in self.package_files_dict.items():
# Download
package_full_path, err = self.download_package(pkg)
--
2.24.1

View File

@ -0,0 +1,77 @@
From 23110cb7198e53c1e211ba8a41c7406b04641574 Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Mon, 3 Dec 2018 13:54:34 +0100
Subject: [PATCH] reportclient: Find and download required debuginfo packages
The current solution finds packages for given build-ids and then
downloads them. The problem is that some debuginfo packages require
other packages and if they are not available the generated backtrace
becomes unusable.
This commit adds a query for required packages and downloads them together
with the main packages.
Related: rhbz#1515265
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
---
.../reportclient/dnfdebuginfo.py | 34 +++++++++++++------
1 file changed, 23 insertions(+), 11 deletions(-)
diff --git a/src/client-python/reportclient/dnfdebuginfo.py b/src/client-python/reportclient/dnfdebuginfo.py
index 1867484f..04f98579 100644
--- a/src/client-python/reportclient/dnfdebuginfo.py
+++ b/src/client-python/reportclient/dnfdebuginfo.py
@@ -106,26 +106,38 @@ class DNFDebugInfoDownload(DebugInfoDownload):
print(_("Error setting up repositories: '{0!s}'").format(str(ex)))
def triage(self, files):
- q = self.base.sack.query()
- i = q.available()
+ dnf_query = self.base.sack.query()
+ dnf_available = dnf_query.available()
package_files_dict = {}
not_found = []
todownload_size = 0
installed_size = 0
for debuginfo_path in files:
- packages = i.filter(file=debuginfo_path)
+ di_package_list = []
+ packages = dnf_available.filter(file=debuginfo_path)
+
if not packages:
log2("not found package for %s", debuginfo_path)
not_found.append(debuginfo_path)
else:
- if packages[0] in package_files_dict.keys():
- package_files_dict[packages[0]].append(debuginfo_path)
- else:
- package_files_dict[packages[0]] = [debuginfo_path]
- todownload_size += float(packages[0].downloadsize)
- installed_size += float(packages[0].installsize)
-
- log2("found packages for %s: %s", debuginfo_path, packages[0])
+ di_package_list.append(packages[0])
+ if packages[0].requires:
+ package_reqs = dnf_available.filter(provides=packages[0].requires,
+ arch=packages[0].arch)
+ for pkg in package_reqs:
+ if pkg not in di_package_list:
+ di_package_list.append(pkg)
+ log2("found required package {0} for {1}".format(pkg, packages[0]))
+
+ for pkg in di_package_list:
+ if pkg in package_files_dict.keys():
+ package_files_dict[pkg].append(debuginfo_path)
+ else:
+ package_files_dict[pkg] = [debuginfo_path]
+ todownload_size += float(pkg.downloadsize)
+ installed_size += float(pkg.installsize)
+
+ log2("found packages for %s: %s", debuginfo_path, pkg)
return (package_files_dict, not_found, todownload_size, installed_size)
def download_package(self, pkg):
--
2.24.1

View File

@ -0,0 +1,60 @@
From c0d0e59df7d73feb971ba495c81f4651a8cea8a6 Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Wed, 5 Dec 2018 16:52:07 +0100
Subject: [PATCH] reportclient: Search for required packages recursively
Adds recursive function to search for required packages of required packages
of re...
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
---
.../reportclient/dnfdebuginfo.py | 21 +++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/client-python/reportclient/dnfdebuginfo.py b/src/client-python/reportclient/dnfdebuginfo.py
index 04f98579..165c12d0 100644
--- a/src/client-python/reportclient/dnfdebuginfo.py
+++ b/src/client-python/reportclient/dnfdebuginfo.py
@@ -112,6 +112,23 @@ class DNFDebugInfoDownload(DebugInfoDownload):
not_found = []
todownload_size = 0
installed_size = 0
+
+ def required_packages(query, package, origin):
+ """
+ Recursive function to find all required packages of required packages of ...
+ origin - should stop infinite recursion (A => B => ... => X => A)
+ """
+ required_pkg_list = []
+ if package.requires:
+ pkg_reqs = query.filter(provides=package.requires, arch=package.arch)
+ for p in pkg_reqs:
+ if p.name != origin.name and p not in required_pkg_list:
+ required_pkg_list.append(p)
+ required_pkg_list += required_packages(query, p, origin)
+
+ return required_pkg_list
+
+
for debuginfo_path in files:
di_package_list = []
packages = dnf_available.filter(file=debuginfo_path)
@@ -122,13 +139,13 @@ class DNFDebugInfoDownload(DebugInfoDownload):
else:
di_package_list.append(packages[0])
if packages[0].requires:
- package_reqs = dnf_available.filter(provides=packages[0].requires,
- arch=packages[0].arch)
+ package_reqs = required_packages(dnf_available, packages[0], packages[0])
for pkg in package_reqs:
if pkg not in di_package_list:
di_package_list.append(pkg)
log2("found required package {0} for {1}".format(pkg, packages[0]))
+
for pkg in di_package_list:
if pkg in package_files_dict.keys():
package_files_dict[pkg].append(debuginfo_path)
--
2.24.1

View File

@ -0,0 +1,41 @@
From 0b37412bc975d6e043c34dbff379029fd94a1758 Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Wed, 14 Aug 2019 14:46:08 +0000
Subject: [PATCH] dirsize: Skip dirs in which sosreport is being generated
With these changes ABRT will skip directories in which sosreport is running
and won't delete them when MaxCrashReportSize limit is exceeded.
I had a concern about the size of the logs that sosreport collects but
there is a limit set by sosreport for how big the individual logs can
be and the default value is 25MiB.
Fixes: rhbz#1671232
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
(cherry picked from commit eef59d2358cf63338f38727c5d08be70619e4e55)
---
src/lib/dirsize.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/lib/dirsize.c b/src/lib/dirsize.c
index 6d96e71..7ee9752 100644
--- a/src/lib/dirsize.c
+++ b/src/lib/dirsize.c
@@ -91,6 +91,11 @@ double get_dirsize_find_largest_dir(
if (dot_or_dotdot(ep->d_name))
continue;
char *dname = concat_path_file(pPath, ep->d_name);
+ if (lstat(concat_path_file(dname, "sosreport.log"), &statbuf) == 0)
+ {
+ log_debug("Skipping %s': sosreport is being generated.", dname);
+ goto next;
+ }
if (lstat(dname, &statbuf) != 0)
{
goto next;
--
2.26.0

View File

@ -0,0 +1,101 @@
From 0641129e214fa1cd2a67740c3193944285781819 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miroslav=20Such=C3=BD?= <msuchy@redhat.com>
Date: Wed, 6 May 2020 19:10:48 +0200
Subject: [PATCH] setgid instead of setuid the
abrt-action-install-debuginfo-to-abrt-cache [RHBZ 1796245]
This is called by abrt-action-install-debuginfo-to-abrt-cache which used to be setuid and now is setgid binary.
Therefore we do not need to setuid and we neither need it.
Resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=1796245
---
src/client-python/reportclient/debuginfo.py | 25 +++++++++------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/src/client-python/reportclient/debuginfo.py b/src/client-python/reportclient/debuginfo.py
index 561de52f..560629cc 100644
--- a/src/client-python/reportclient/debuginfo.py
+++ b/src/client-python/reportclient/debuginfo.py
@@ -35,41 +35,38 @@ from reportclient import (_, log1, log2, RETURN_OK, RETURN_FAILURE,
error_msg)
-def ensure_abrt_uid(fn):
+def ensure_abrt_gid(fn):
"""
- Ensures that the function is called using abrt's uid and gid
+ Ensures that the function is called using abrt's gid
Returns:
Either an unchanged function object or a wrapper function object for
the function.
"""
- current_uid = os.getuid()
current_gid = os.getgid()
abrt = pwd.getpwnam("abrt")
# if we're are already running as abrt, don't do anything
- if abrt.pw_uid == current_uid and abrt.pw_gid == current_gid:
+ if abrt.pw_gid == current_gid:
return fn
def wrapped(*args, **kwargs):
"""
Wrapper function around the called function.
- Sets up uid and gid to match abrt's and after the function finishes
- rolls its uid and gid back.
+ Sets up gid to match abrt's and after the function finishes
+ rolls its gid back.
Returns:
Return value of the wrapped function.
"""
- # switch to abrt
+ # switch to abrt group
os.setegid(abrt.pw_gid)
- os.seteuid(abrt.pw_uid)
# extract the files as abrt:abrt
retval = fn(*args, **kwargs)
# switch back to whatever we were
- os.seteuid(current_uid)
os.setegid(current_gid)
return retval
@@ -79,7 +76,7 @@ def ensure_abrt_uid(fn):
# TODO: unpack just required debuginfo and not entire rpm?
# ..that can lead to: foo.c No such file and directory
# files is not used...
-@ensure_abrt_uid
+@ensure_abrt_gid
def unpack_rpm(package_full_path, files, tmp_dir, destdir, exact_files=False):
"""
Unpacks a single rpm located in tmp_dir into destdir.
@@ -265,7 +262,7 @@ class DebugInfoDownload(object):
else:
print("ERR: unmute called without mute?")
- @ensure_abrt_uid
+ @ensure_abrt_gid
def setup_tmp_dirs(self):
if not os.path.exists(self.tmpdir):
try:
@@ -406,9 +403,9 @@ class DebugInfoDownload(object):
s = os.stat(self.cachedir)
abrt = pwd.getpwnam("abrt")
- if (s.st_uid != abrt.pw_uid) or (s.st_gid != abrt.pw_gid):
- print(_("'{0}' must be owned by abrt. "
- "Please run '# chown -R abrt.abrt {0}' "
+ if s.st_gid != abrt.pw_gid:
+ print(_("'{0}' must be owned by group abrt. "
+ "Please run '# chown -R :abrt {0}' "
"to fix the issue.").format(self.cachedir))
clean_up(self.tmpdir)
--
2.21.3

View File

@ -0,0 +1,952 @@
From 646101d558765b59bae94aa27bfbefed3a085ab5 Mon Sep 17 00:00:00 2001
From: Ernestas Kulik <ekulik@redhat.com>
Date: Tue, 2 Jun 2020 10:57:36 +0200
Subject: [PATCH] ureport: Drop Strata integration
Strata is being sunset with no replacement for our used API endpoints in
sight. This commit drops the integration code, because no one pretty
much wants it, either.
---
configure.ac | 11 --
doc/reporter-rhtsupport.txt | 17 --
doc/reporter-ureport.txt | 8 -
src/include/ureport.h | 4 +-
src/lib/ureport.c | 138 +--------------
src/plugins/Makefile.am | 6 -
src/plugins/cert-api.access.redhat.com.pem | 74 --------
src/plugins/report_RHTSupport.xml.in | 5 -
src/plugins/reporter-rhtsupport.c | 186 +--------------------
src/plugins/ureport.conf | 4 -
tests/ureport.at | 174 -------------------
tests/ureport/rhsm/__init__.py | 0
tests/ureport/rhsm/config.py | 8 -
13 files changed, 7 insertions(+), 628 deletions(-)
delete mode 100644 src/plugins/cert-api.access.redhat.com.pem
delete mode 100644 tests/ureport/rhsm/__init__.py
delete mode 100644 tests/ureport/rhsm/config.py
diff --git a/configure.ac b/configure.ac
index ce45389..ef35f84 100644
--- a/configure.ac
+++ b/configure.ac
@@ -172,17 +172,6 @@ do
done
fi dnl end NO_MANTISBT
-dnl enable import of certificate for rhtsupport plugin
-AC_ARG_ENABLE([import-rhtsupport-cert],
-AS_HELP_STRING([--enable-import-rhtsupport-cert],
- [import certificate needed for rhtsupport plugin (default is NO)]),
-[], [enable_import_rhtsupport_cert="no"])
-
-AS_IF([test "x$enable_import_rhtsupport_cert" != "xno"],
-AM_CONDITIONAL(ENABLE_IMPORT_RHTSUPPORT_CERT, true),
-AM_CONDITIONAL(ENABLE_IMPORT_RHTSUPPORT_CERT, false))
-
-
AC_ARG_WITH(python2,
AS_HELP_STRING([--with-python2],[use python2 (default is YES)]),
LIBREPORT_PARSE_WITH([python2]))
diff --git a/doc/reporter-rhtsupport.txt b/doc/reporter-rhtsupport.txt
index e52a152..132c0ea 100644
--- a/doc/reporter-rhtsupport.txt
+++ b/doc/reporter-rhtsupport.txt
@@ -18,9 +18,6 @@ DESCRIPTION
The tool reads problem directory DIR. Then it logs in to RHTSupport
and creates a new case.
-The tool can be configured to submit an uReport to RHTSupport together with
-creating a new case.
-
The URL to new case is printed to stdout and recorded in 'reported_to'
element in DIR.
@@ -36,10 +33,6 @@ to enter case ID to which you want to upload the FILEs.
Option -tCASE uploads FILEs to the case CASE on RHTSupport site.
-d DIR is ignored.
-Option -u uploads uReport along with creating a new case. uReport configuration
-is loaded from UR_CONFFILE which defaults to
-/etc/libreport/plugins/ureport.conf.
-
Configuration file
~~~~~~~~~~~~~~~~~~
Configuration file lines should have 'PARAM = VALUE' format. The parameters are:
@@ -56,10 +49,6 @@ Configuration file lines should have 'PARAM = VALUE' format. The parameters are:
'SSLVerify'::
Use yes/true/on/1 to verify server's SSL certificate. (default: yes)
-'SubmitUReport'::
- Use yes/true/on/1 to enable submitting uReport together wit creating a new
- case. (default: no)
-
Parameters can be overridden via $RHTSupport_PARAM environment variables.
Integration with ABRT events
@@ -84,12 +73,6 @@ OPTIONS
-t[ID]::
Upload FILEs to the already created case on RHTSupport site.
--u::
- Submit uReport together with creating a new case.
-
--C UR_CONFFILE::
- Configuration file for submitting uReports.
-
-F CONF_FORMAT_FILE::
Formatting file for a new case.
diff --git a/doc/reporter-ureport.txt b/doc/reporter-ureport.txt
index 7deb911..fc06541 100644
--- a/doc/reporter-ureport.txt
+++ b/doc/reporter-ureport.txt
@@ -34,10 +34,6 @@ Configuration file lines should have 'PARAM = VALUE' format. The parameters are:
Possible values are:
- 'rhsm';;
- Uses the system V3 entitlement certificate that is used for Red Hat
- subscription management.
-
'puppet';;
Uses the certificate that is used by the Puppet configuration management tool.
@@ -51,10 +47,6 @@ Configuration file lines should have 'PARAM = VALUE' format. The parameters are:
Possible values are::
- 'rhts-credentials';;
- Uses Login= and Password= values from /etc/libreport/plugins/rhtsupport.conf and
- user's local ~/.config/libreport/rhtsupport.conf.
-
'<user_name>:<password>';;
Manually supply credentials.
diff --git a/src/include/ureport.h b/src/include/ureport.h
index 63d9bf2..2e6de49 100644
--- a/src/include/ureport.h
+++ b/src/include/ureport.h
@@ -115,8 +115,7 @@ ureport_server_config_set_url(struct ureport_server_config *config,
* Configure client certificate paths
*
* @param config Where the paths are stored
- * @param client_path Path in form of cert_full_path:key_full_path or one of
- * the following string: 'rhsm', 'puppet'.
+ * @param client_path Path in form of cert_full_path:key_full_path or 'puppet'.
*/
#define ureport_server_config_set_client_auth libreport_ureport_server_config_set_client_auth
void
@@ -139,7 +138,6 @@ ureport_server_config_set_basic_auth(struct ureport_server_config *config,
* Configure user name and password for HTTP Basic authentication according to
* user preferences.
*
- * "rhts-credentials" - Uses Login= and Password= from rhtsupport.conf
* "<user_name>:<password>" - Manually supply user name and password.
* "<user_name>" - Manually supply user name and be asked for password.
*
diff --git a/src/lib/ureport.c b/src/lib/ureport.c
index ced4810..5d0a820 100644
--- a/src/lib/ureport.c
+++ b/src/lib/ureport.c
@@ -30,19 +30,6 @@
#define BTHASH_URL_SFX "reports/bthash/"
-#define RHSM_WEB_SERVICE_URL "https://cert-api.access.redhat.com/rs/telemetry/abrt"
-
-#define RHSMCON_PEM_DIR_PATH "/etc/pki/consumer"
-#define RHSMCON_CERT_NAME "cert.pem"
-#define RHSMCON_KEY_NAME "key.pem"
-
-/* Using the same template as for RHSM certificate, macro for cert dir path and
- * macro for cert name. Cert path can be easily modified for example by reading
- * an environment variable LIBREPORT_DEBUG_AUTHORITY_CERT_DIR_PATH
- */
-#define CERT_AUTHORITY_CERT_PATH "/etc/libreport"
-#define CERT_AUTHORITY_CERT_NAME "cert-api.access.redhat.com.pem"
-
static char *
puppet_config_print(const char *key)
{
@@ -73,55 +60,6 @@ ureport_server_config_set_url(struct ureport_server_config *config,
config->ur_url = server_url;
}
-static char *
-rhsm_config_get_consumer_cert_dir(void)
-{
- char *result = getenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH");
- if (result != NULL)
- return xstrdup(result);
-
- result = run_in_shell_and_save_output(0,
- "python3 -c \"from rhsm.config import initConfig; print(initConfig().get('rhsm', 'consumerCertDir'))\"",
- NULL, NULL);
-
- /* run_in_shell_and_save_output always returns non-NULL */
- if (result[0] != '/')
- goto error;
-
- char *newline = strchrnul(result, '\n');
- if (!newline)
- goto error;
-
- *newline = '\0';
- return result;
-error:
- free(result);
- error_msg("Failed to get 'rhsm':'consumerCertDir' from rhsm.config python module. Using "RHSMCON_PEM_DIR_PATH);
- return xstrdup(RHSMCON_PEM_DIR_PATH);
-}
-
-static bool
-certificate_exist(char *cert_name)
-{
- if (access(cert_name, F_OK) != 0)
- {
- log_notice("RHSM consumer certificate '%s' does not exist.", cert_name);
- return false;
- }
- return true;
-}
-
-static bool
-cert_authority_cert_exist(char *cert_name)
-{
- if (access(cert_name, F_OK) != 0)
- {
- log_notice("Certs validating the server '%s' does not exist.", cert_name);
- return false;
- }
- return true;
-}
-
void
ureport_server_config_set_client_auth(struct ureport_server_config *config,
const char *client_auth)
@@ -139,52 +77,6 @@ ureport_server_config_set_client_auth(struct ureport_server_config *config,
log_notice("Not using client authentication");
}
- else if (strcmp(client_auth, "rhsm") == 0)
- {
- if (config->ur_url == NULL)
- ureport_server_config_set_url(config, xstrdup(RHSM_WEB_SERVICE_URL));
-
- /* always returns non-NULL */
- char *rhsm_dir = rhsm_config_get_consumer_cert_dir();
-
- char *cert_full_name = concat_path_file(rhsm_dir, RHSMCON_CERT_NAME);
- char *key_full_name = concat_path_file(rhsm_dir, RHSMCON_KEY_NAME);
-
- /* get authority certificate dir path from environment variable, if it
- * is not set, use CERT_AUTHORITY_CERT_PATH
- */
- const char *authority_cert_dir_path = getenv("LIBREPORT_DEBUG_AUTHORITY_CERT_DIR_PATH");
- if (authority_cert_dir_path == NULL)
- authority_cert_dir_path = CERT_AUTHORITY_CERT_PATH;
-
- char *cert_authority_cert_full_name = concat_path_file(authority_cert_dir_path,
- CERT_AUTHORITY_CERT_NAME);
-
- if (certificate_exist(cert_full_name) && certificate_exist(key_full_name))
- {
- config->ur_client_cert = cert_full_name;
- config->ur_client_key = key_full_name;
- log_debug("Using cert files: '%s' : '%s'", config->ur_client_cert, config->ur_client_key);
- }
- else
- {
- free(cert_full_name);
- free(key_full_name);
- log_notice("Using the default configuration for uReports.");
- }
-
- if (cert_authority_cert_exist(cert_authority_cert_full_name))
- {
- config->ur_cert_authority_cert = cert_authority_cert_full_name;
- log_debug("Using validating server cert: '%s'", config->ur_cert_authority_cert);
- }
- else
- {
- free(cert_authority_cert_full_name);
- }
-
- free(rhsm_dir);
- }
else if (strcmp(client_auth, "puppet") == 0)
{
config->ur_client_cert = puppet_config_print("hostcert");
@@ -241,32 +133,12 @@ ureport_server_config_load_basic_auth(struct ureport_server_config *config,
const char *username = NULL;
const char *password = NULL;
- if (strcmp(http_auth_pref, "rhts-credentials") == 0)
- {
- settings = new_map_string();
-
- char *local_conf = xasprintf("%s"USER_HOME_CONFIG_PATH"/rhtsupport.conf", getenv("HOME"));
-
- if (!load_plugin_conf_file("rhtsupport.conf", settings, /*skip key w/o values:*/ false) &&
- !load_conf_file(local_conf, settings, /*skip key w/o values:*/ false))
- error_msg_and_die("Could not get RHTSupport credentials");
- free(local_conf);
-
- username = get_map_string_item_or_NULL(settings, "Login");
- password = get_map_string_item_or_NULL(settings, "Password");
-
- if (config->ur_url == NULL)
- ureport_server_config_set_url(config, xstrdup(RHSM_WEB_SERVICE_URL));
- }
- else
- {
- username = tmp_username = xstrdup(http_auth_pref);
- password = strchr(tmp_username, ':');
+ username = tmp_username = xstrdup(http_auth_pref);
+ password = strchr(tmp_username, ':');
- if (password != NULL)
- /* It is "char *", see strchr() few lines above. */
- *((char *)(password++)) = '\0';
- }
+ if (password != NULL)
+ /* It is "char *", see strchr() few lines above. */
+ *((char *)(password++)) = '\0';
if (password == NULL)
{
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index b228602..f73e7dc 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -28,12 +28,6 @@ pluginsconfdir = $(PLUGINS_CONF_DIR)
reportpluginsconfdir = $(REPORT_PLUGINS_CONF_DIR)
-if ENABLE_IMPORT_RHTSUPPORT_CERT
-libreportconfdir = $(CONF_DIR)
-dist_libreportconf_DATA = \
- cert-api.access.redhat.com.pem
-endif
-
reporters_plugin_conf =
reporters_plugin_format_conf =
if BUILD_BUGZILLA
diff --git a/src/plugins/cert-api.access.redhat.com.pem b/src/plugins/cert-api.access.redhat.com.pem
deleted file mode 100644
index 20ef8c0..0000000
--- a/src/plugins/cert-api.access.redhat.com.pem
+++ /dev/null
@@ -1,74 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIHZDCCBUygAwIBAgIJAOb+QiglyeZeMA0GCSqGSIb3DQEBBQUAMIGwMQswCQYD
-VQQGEwJVUzEXMBUGA1UECAwOTm9ydGggQ2Fyb2xpbmExEDAOBgNVBAcMB1JhbGVp
-Z2gxFjAUBgNVBAoMDVJlZCBIYXQsIEluYy4xGDAWBgNVBAsMD1JlZCBIYXQgTmV0
-d29yazEeMBwGA1UEAwwVRW50aXRsZW1lbnQgTWFzdGVyIENBMSQwIgYJKoZIhvcN
-AQkBFhVjYS1zdXBwb3J0QHJlZGhhdC5jb20wHhcNMTAwMzE3MTkwMDQ0WhcNMzAw
-MzEyMTkwMDQ0WjCBsDELMAkGA1UEBhMCVVMxFzAVBgNVBAgMDk5vcnRoIENhcm9s
-aW5hMRAwDgYDVQQHDAdSYWxlaWdoMRYwFAYDVQQKDA1SZWQgSGF0LCBJbmMuMRgw
-FgYDVQQLDA9SZWQgSGF0IE5ldHdvcmsxHjAcBgNVBAMMFUVudGl0bGVtZW50IE1h
-c3RlciBDQTEkMCIGCSqGSIb3DQEJARYVY2Etc3VwcG9ydEByZWRoYXQuY29tMIIC
-IjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA2Z+mW7OYcBcGxWS+RSKG2GJ2
-csMXiGGfEp36vKVsIvypmNS60SkicKENMYREalbdSjrgfXxPJygZWsVWJ5lHPfBV
-o3WkFrFHTIXd/R6LxnaHD1m8Cx3GwEeuSlE/ASjc1ePtMnsHH7xqZ9wdl85b1C8O
-scgO7fwuM192kvv/veI/BogIqUQugtG6szXpV8dp4ml029LXFoNIy2lfFoa2wKYw
-MiUHwtYgAz7TDY63e8qGhd5PoqTv9XKQogo2ze9sF9y/npZjliNy5qf6bFE+24oW
-E8pGsp3zqz8h5mvw4v+tfIx5uj7dwjDteFrrWD1tcT7UmNrBDWXjKMG81zchq3h4
-etgF0iwMHEuYuixiJWNzKrLNVQbDmcLGNOvyJfq60tM8AUAd72OUQzivBegnWMit
-CLcT5viCT1AIkYXt7l5zc/duQWLeAAR2FmpZFylSukknzzeiZpPclRziYTboDYHq
-revM97eER1xsfoSYp4mJkBHfdlqMnf3CWPcNgru8NbEPeUGMI6+C0YvknPlqDDtU
-ojfl4qNdf6nWL+YNXpR1YGKgWGWgTU6uaG8Sc6qGfAoLHh6oGwbuz102j84OgjAJ
-DGv/S86svmZWSqZ5UoJOIEqFYrONcOSgztZ5tU+gP4fwRIkTRbTEWSgudVREOXhs
-bfN1YGP7HYvS0OiBKZUCAwEAAaOCAX0wggF5MB0GA1UdDgQWBBSIS6ZFxEbsj9bP
-pvYazyY8kMx/FzCB5QYDVR0jBIHdMIHagBSIS6ZFxEbsj9bPpvYazyY8kMx/F6GB
-tqSBszCBsDELMAkGA1UEBhMCVVMxFzAVBgNVBAgMDk5vcnRoIENhcm9saW5hMRAw
-DgYDVQQHDAdSYWxlaWdoMRYwFAYDVQQKDA1SZWQgSGF0LCBJbmMuMRgwFgYDVQQL
-DA9SZWQgSGF0IE5ldHdvcmsxHjAcBgNVBAMMFUVudGl0bGVtZW50IE1hc3RlciBD
-QTEkMCIGCSqGSIb3DQEJARYVY2Etc3VwcG9ydEByZWRoYXQuY29tggkA5v5CKCXJ
-5l4wDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAQYwEQYJYIZIAYb4QgEBBAQDAgEG
-MCAGA1UdEQQZMBeBFWNhLXN1cHBvcnRAcmVkaGF0LmNvbTAgBgNVHRIEGTAXgRVj
-YS1zdXBwb3J0QHJlZGhhdC5jb20wDQYJKoZIhvcNAQEFBQADggIBAJ1hEdNBDTRr
-6kI6W6stoogSUwjuiWPDY8DptwGhdpyIfbCoxvBR7F52DlwyXOpCunogfKMRklnE
-gH1Wt66RYkgNuJcenKHAhR5xgSLoPCOVF9rDjMunyyBuxjIbctM21R7BswVpsEIE
-OpV5nlJ6wkHsrn0/E+Zk5UJdCzM+Fp4hqHtEn/c97nvRspQcpWeDg6oUvaJSZTGM
-8yFpzR90X8ZO4rOgpoERukvYutUfJUzZuDyS3LLc6ysamemH93rZXr52zc4B+C9G
-Em8zemDgIPaH42ce3C3TdVysiq/yk+ir7pxW8toeavFv75l1UojFSjND+Q2AlNQn
-pYkmRznbD5TZ3yDuPFQG2xYKnMPACepGgKZPyErtOIljQKCdgcvb9EqNdZaJFz1+
-/iWKYBL077Y0CKwb+HGIDeYdzrYxbEd95YuVU0aStnf2Yii2tLcpQtK9cC2+DXjL
-Yf3kQs4xzH4ZejhG9wzv8PGXOS8wHYnfVNA3+fclDEQ1mEBKWHHmenGI6QKZUP8f
-g0SQ3PNRnSZu8R+rhABOEuVFIBRlaYijg2Pxe0NgL9FlHsNyRfo6EUrB2QFRKACW
-3Mo6pZyDjQt7O8J7l9B9IIURoJ1niwygf7VSJTMl2w3fFleNJlZTGgdXw0V+5g+9
-Kg6Ay0rrsi4nw1JHue2GvdjdfVOaWSWC
------END CERTIFICATE-----
------BEGIN CERTIFICATE-----
-MIIFfTCCA2WgAwIBAgIJAJGKz8qFAAADMA0GCSqGSIb3DQEBBQUAMIGwMQswCQYD
-VQQGEwJVUzEXMBUGA1UECAwOTm9ydGggQ2Fyb2xpbmExEDAOBgNVBAcMB1JhbGVp
-Z2gxFjAUBgNVBAoMDVJlZCBIYXQsIEluYy4xGDAWBgNVBAsMD1JlZCBIYXQgTmV0
-d29yazEeMBwGA1UEAwwVRW50aXRsZW1lbnQgTWFzdGVyIENBMSQwIgYJKoZIhvcN
-AQkBFhVjYS1zdXBwb3J0QHJlZGhhdC5jb20wHhcNMTUwNTA1MTMwMzQ4WhcNMjUw
-NTAyMTMwMzQ4WjCBiTELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5PUlRIIENBUk9M
-SU5BMRAwDgYDVQQHEwdSYWxlaWdoMRAwDgYDVQQKEwdSZWQgSGF0MRgwFgYDVQQL
-Ew9SZWQgSGF0IE5ldHdvcmsxIzAhBgNVBAMTGmNlcnQtYXBpLmFjY2Vzcy5yZWRo
-YXQuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA9hTNMtZMa7Kg
-Jlux6pnuUinP0Rv0aiiPFr7qNHFore4loGrPlpzUvQbUByy3xm7lhf4R4qbINCls
-veWg6HDidvQr174RXb5YLMXuBrYAiPWQTrRRLNuvXFHKzREghRWTv48IXTIDEo0G
-fZJUO+myY2RfwqugZKic5dR6ZakHSSpQO70O6H5R0eHlKa13k4eEpG2fVY/xqFto
-WkfZyEmSacZpqxp7gIjZqreLc4MFwpiVjGFrK3Jk+Px1Z6J94LTLx2SxrYzWIeUs
-5j+lceQOvpV4/pkClnRCW1pkCKTccjFKQkpNPGwdIusRXUGl9IYc20Fa/7g9iUQc
-5fXu9EAzfwIDAQABo4G+MIG7MAkGA1UdEwQCMAAwEQYJYIZIAYb4QgEBBAQDAgZA
-MAsGA1UdDwQEAwIF4DATBgNVHSUEDDAKBggrBgEFBQcDATA5BglghkgBhvhCAQ0E
-LBYqTWFuYWdlZCBieSBSZWQgSGF0IChjYS1zdXBwb3J0QHJlZGhhdC5jb20pMB0G
-A1UdDgQWBBRfgCjd8aXf0U4VX8DKTVIn+paGBzAfBgNVHSMEGDAWgBSIS6ZFxEbs
-j9bPpvYazyY8kMx/FzANBgkqhkiG9w0BAQUFAAOCAgEAlC+r6UEEp5BUkI0Rj2T+
-1PH7oUCaGQeQoyVbGddz/WUcBk/lMMtyCEoxU+3tTwNWmCWWjYXtjoL9MlSAC/q+
-NZfBi1iq0uuSus9JI/Uu8aRhoxTK56qGRed/JNixOHEmFn891cahIPpF0exWwtYD
-ThwXo7Z6PI7t8EMKdSrGTOowp58yho8xYFL/Z7JmjL55Pf85GIrdiniNZd4i178J
-07R9zsiLvdXq9mT33iJwkm+uhO+FA9d8OE3ji21pBbGUAQSWOdkemvUCsy8zANW9
-fT+dBrMr5Buk7eaBBJ2PxECNiWLCRQJWmyff1O5zMT0daS2lBdEGUNhBZ0hnX13Q
-kabUp0bxRrNRq+WkomP7onZhfZS6SjKm0UmwoV6o3V1ED6y7muQNRmgDpA5PcbvO
-gl7OexNL4zcpyfMdAmTYf5yTRSvB42Yg5hVfuzPEnOIqupwES3mWkEHRlqbMUkHw
-qIQAxIwQqZd5PdPpElQ/6j/ZT9DwW/I6zgndX2rsS0oGYcwFTkSj0/rKKkC13hk7
-LchXMZu5ckdustM79U6OZIBairrJaL2OpR08un2nwIjgEGqhVFYc44UK1VpkE8mr
-qvqJS6OHVlTlKcEDnhVkPS3i5qjuS/PtSq0CwH8bzYKFJayLDY/z36Zv6PdttzmU
-Yb1NSDcJejHJ80pMINutyYQ=
------END CERTIFICATE-----
diff --git a/src/plugins/report_RHTSupport.xml.in b/src/plugins/report_RHTSupport.xml.in
index 357a94d..c64cb55 100644
--- a/src/plugins/report_RHTSupport.xml.in
+++ b/src/plugins/report_RHTSupport.xml.in
@@ -26,11 +26,6 @@
<allow-empty>no</allow-empty>
</option>
<advanced-options>
- <option type="bool" name="RHTSupport_SubmitUReport">
- <_label>Submit uReport</_label>
- <_note-html>Submit &lt;a href="https://access.redhat.com/articles/642323"&gt;micro-report&lt;/a&gt; when creating a new case. </_note-html>
- <default-value>yes</default-value>
- </option>
<option type="text" name="RHTSupport_URL">
<_label>RH Portal URL</_label>
<allow-empty>no</allow-empty>
diff --git a/src/plugins/reporter-rhtsupport.c b/src/plugins/reporter-rhtsupport.c
index d11b4bd..411bffc 100644
--- a/src/plugins/reporter-rhtsupport.c
+++ b/src/plugins/reporter-rhtsupport.c
@@ -222,96 +222,6 @@ ret_clean:
return retval;
}
-static
-struct ureport_server_response *ureport_do_post_credentials(const char *json, struct ureport_server_config *config, const char *action)
-{
- struct post_state *post_state = NULL;
- while (1)
- {
- post_state = ureport_do_post(json, config, action);
-
- if (post_state == NULL)
- {
- error_msg(_("Failed on submitting the problem"));
- return NULL;
- }
-
- if (post_state->http_resp_code != 401)
- break;
-
- free_post_state(post_state);
-
- char *login = NULL;
- char *password = NULL;
- ask_rh_credentials(&login, &password);
- ureport_server_config_set_basic_auth(config, login, password);
- free(password);
- free(login);
- }
-
- struct ureport_server_response *resp = ureport_server_response_from_reply(post_state, config);
- free(post_state);
- return resp;
-}
-
-static
-char *submit_ureport(const char *dump_dir_name, struct ureport_server_config *conf)
-{
- struct dump_dir *dd = dd_opendir(dump_dir_name, DD_OPEN_READONLY);
- if (dd == NULL)
- return NULL;
-
- report_result_t *rr_bthash = find_in_reported_to(dd, "uReport");
- dd_close(dd);
-
- if (rr_bthash != NULL)
- {
- log_notice("uReport has already been submitted.");
- char *ret = xstrdup(rr_bthash->bthash);
- free_report_result(rr_bthash);
- return ret;
- }
-
- char *json = ureport_from_dump_dir(dump_dir_name);
- if (json == NULL)
- {
- log_notice(_("Failed to generate microreport from the problem data"));
- return NULL;
- }
-
- struct ureport_server_response *resp = ureport_do_post_credentials(json, conf, UREPORT_SUBMIT_ACTION);
- free(json);
- if (resp == NULL)
- return NULL;
-
- char *bthash = NULL;
- if (!resp->urr_is_error)
- {
- if (resp->urr_bthash != NULL)
- bthash = xstrdup(resp->urr_bthash);
-
- ureport_server_response_save_in_dump_dir(resp, dump_dir_name, conf);
-
- if (resp->urr_message)
- log_warning("%s", resp->urr_message);
- }
- else if (g_verbose > 2)
- error_msg(_("Server responded with an error: '%s'"), resp->urr_value);
-
- ureport_server_response_free(resp);
- return bthash;
-}
-
-static
-void attach_to_ureport(struct ureport_server_config *conf,
- const char *bthash, const char *attach_id, const char *data)
-{
- char *json = ureport_json_attachment_new(bthash, attach_id, data);
- struct ureport_server_response *resp = ureport_do_post_credentials(json, conf, UREPORT_ATTACH_ACTION);
- ureport_server_response_free(resp);
- free(json);
-}
-
static
bool check_for_hints(const char *url, char **login, char **password, bool ssl_verify, const char *tempfile)
{
@@ -420,42 +330,6 @@ char *get_param_string(const char *name, map_string_t *settings, const char *dfl
return xstrdup(envvar ? envvar : (get_map_string_item_or_NULL(settings, name) ? : dflt));
}
-static
-void prepare_ureport_configuration(const char *urcfile,
- map_string_t *settings, struct ureport_server_config *urconf,
- const char *portal_url, const char *login, const char *password, bool ssl_verify)
-{
- load_conf_file(urcfile, settings, false);
- ureport_server_config_init(urconf);
-
- /* The following lines cause that we always use URL from ureport's
- * configuration becuase the GUI reporter always exports uReport_URL env
- * var.
- *
- * char *url = NULL;
- * UREPORT_OPTION_VALUE_FROM_CONF(settings, "URL", url, xstrdup);
- * if (url != NULL)
- * ureport_server_config_set_url(urconf, url);
- */
-
- ureport_server_config_set_url(urconf, concat_path_file(portal_url, "/telemetry/abrt"));
- urconf->ur_ssl_verify = ssl_verify;
-
- ureport_server_config_set_basic_auth(urconf, login, password);
-
- bool include_auth = true;
- UREPORT_OPTION_VALUE_FROM_CONF(settings, "IncludeAuthData", include_auth, string_to_bool);
-
- if (include_auth)
- {
- const char *auth_items = NULL;
- UREPORT_OPTION_VALUE_FROM_CONF(settings, "AuthDataItems", auth_items, (const char *));
- urconf->ur_prefs.urp_auth_items = parse_list(auth_items);
- }
-
- urconf->ur_prefs.urp_flags |= UREPORT_PREF_FLAG_RETURN_ON_FAILURE;
-}
-
static char *create_case_url(char *url, const char *case_no)
{
char *url1 = concat_path_file(url, RHTSUPPORT_CASE_URL_PATH);
@@ -496,7 +370,6 @@ int main(int argc, char **argv)
const char *dump_dir_name = ".";
const char *case_no = NULL;
GList *conf_file = NULL;
- const char *urconf_file = UREPORT_CONF_FILE_PATH;
const char *fmt_file = NULL;
/* Can't keep these strings/structs static: _() doesn't support that */
@@ -524,10 +397,6 @@ int main(int argc, char **argv)
"\n"
"Option -tCASE uploads FILEs to the case CASE on RHTSupport site.\n"
"-d DIR is ignored.\n"
- "\n"
- "Option -u sends ABRT crash statistics data (uReport) before creating a new case.\n"
- "uReport configuration is loaded from UR_CONFFILE which defaults to\n"
- UREPORT_CONF_FILE_PATH".\n"
);
enum {
OPT_v = 1 << 0,
@@ -547,8 +416,6 @@ int main(int argc, char **argv)
OPT_LIST( 'c', NULL, &conf_file , "FILE", _("Configuration file (may be given many times)")),
OPT_OPTSTRING('t', NULL, &case_no , "ID" , _("Upload FILEs [to case with this ID]")),
OPT_BOOL( 'f', NULL, NULL , _("Force reporting even if this problem is already reported")),
- OPT_BOOL( 'u', NULL, NULL , _("Submit uReport before creating a new case")),
- OPT_STRING( 'C', NULL, &urconf_file , "FILE", _("Configuration file for uReport")),
OPT_STRING( 'F', NULL, &fmt_file , "FILE", _("Formatting file for a new case")),
OPT_BOOL( 'D', NULL, NULL , _("Debug")),
OPT_END()
@@ -607,22 +474,10 @@ int main(int argc, char **argv)
/* RH has a 250m limit for web attachments (as of 2013) */
envvar ? envvar : (get_map_string_item_or_NULL(settings, "BigSizeMB") ? : "200")
);
- envvar = getenv("RHTSupport_SubmitUReport");
- bool submit_ur = string_to_bool(
- envvar ? envvar :
- (get_map_string_item_or_NULL(settings, "SubmitUReport") ? :
- ((opts & OPT_u) ? "1" : "0"))
- );
+
free_map_string(settings);
char *base_api_url = xstrdup(url);
- char *bthash = NULL;
-
- map_string_t *ursettings = new_map_string();
- struct ureport_server_config urconf;
-
- prepare_ureport_configuration(urconf_file, ursettings, &urconf,
- url, login, password, ssl_verify);
if (opts & OPT_t)
{
@@ -697,17 +552,6 @@ int main(int argc, char **argv)
return 0;
}
free_report_result(reported_to);
-
- if (submit_ur)
- {
- log_warning(_("Sending ABRT crash statistics data"));
-
- bthash = submit_ureport(dump_dir_name, &urconf);
-
- /* Ensure that we will use the updated credentials */
- STRCPY_IF_NOT_EQUAL(login, urconf.ur_username);
- STRCPY_IF_NOT_EQUAL(password, urconf.ur_password);
- }
}
problem_data_t *problem_data = create_problem_data_for_reporting(dump_dir_name);
@@ -930,30 +774,6 @@ int main(int argc, char **argv)
}
/* else: error msg was already emitted by dd_opendir */
- if (bthash)
- {
- log_warning(_("Linking ABRT crash statistics record with the case"));
-
- /* Make sure we use the current credentials */
- ureport_server_config_set_basic_auth(&urconf, login, password);
-
- /* Attach Customer Case ID*/
- attach_to_ureport(&urconf, bthash, "RHCID", result->url);
-
- /* Attach Contact e-mail if configured */
- const char *email = NULL;
- UREPORT_OPTION_VALUE_FROM_CONF(ursettings, "ContactEmail", email, (const char *));
- if (email != NULL)
- {
- log_warning(_("Linking ABRT crash statistics record with contact email: '%s'"), email);
- attach_to_ureport(&urconf, bthash, "email", email);
- }
-
- /* Update the credentials */
- STRCPY_IF_NOT_EQUAL(login, urconf.ur_username);
- STRCPY_IF_NOT_EQUAL(password, urconf.ur_password);
- }
-
url = result->url;
result->url = NULL;
free_rhts_result(result);
@@ -1021,10 +841,6 @@ int main(int argc, char **argv)
free_rhts_result(result_atch);
free_rhts_result(result);
- ureport_server_config_destroy(&urconf);
- free_map_string(ursettings);
- free(bthash);
-
free(base_api_url);
free(url);
free(login);
diff --git a/src/plugins/ureport.conf b/src/plugins/ureport.conf
index 04dc100..11f4531 100644
--- a/src/plugins/ureport.conf
+++ b/src/plugins/ureport.conf
@@ -22,8 +22,6 @@
# 'IncludeAuthData' to 'yes'.
# None (default):
# SSLClientAuth =
-# Using RH subscription management consumer certificate:
-# SSLClientAuth = rhsm
# Using Puppet certificate:
# SSLClientAuth = puppet
# Using custom certificate:
@@ -32,8 +30,6 @@
# HTTP Basic authentication credentials.
# Assingning any value to 'HTTPAuth' changes the default value of
# 'IncludeAuthData' to 'yes'.
-# Use Login= and Password= from /etc/libreport/plugins/rhtsupport.conf:
-# HTTPAuth = rhts-credentials
# Use username and password:
# HTTPAuth = username:password
diff --git a/tests/ureport.at b/tests/ureport.at
index ecaa3dd..51ca0c2 100644
--- a/tests/ureport.at
+++ b/tests/ureport.at
@@ -250,73 +250,6 @@ int main(void)
ureport_server_config_destroy(&config);
free_map_string(settings);
- /* value from env */
- /* HTTPAuth set to 'username:password' */
- /* SSLClientAuth set to 'rhsm' */
- ureport_server_config_init(&config);
-
- settings = new_map_string();
-
- setenv("uReport_SSLClientAuth", "rhsm", 1);
- setenv("uReport_HTTPAuth", "username:password", 1);
- setenv("uReport_AuthDataItems", "hostname, time", 1);
-
- setenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH", TESTING_CERTS_CORRECT_DIR_PATH, 1);
-
- ureport_server_config_load(&config, settings);
-
- assert(strcmp(config.ur_username, "username") == 0);
- assert(strcmp(config.ur_password, "password") == 0);
-
- assert(config.ur_client_cert == NULL);
- assert(config.ur_client_key == NULL);
- assert(size_map_string(config.ur_http_headers) == 0);
-
- l = config.ur_prefs.urp_auth_items;
- assert(strcmp(l->data, "hostname") == 0);
- assert(strcmp(l->next->data, "time") == 0);
-
- unsetenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH");
-
- unsetenv("uReport_SSLClientAuth");
- unsetenv("uReport_HTTPAuth");
- unsetenv("uReport_AuthDataItems");
-
- free_map_string(settings);
-
- ureport_server_config_destroy(&config);
-
- /* value from settings */
- /* HTTPAuth set to 'username:password' */
- /* SSLClientAuth set to 'rhsm' */
- ureport_server_config_init(&config);
-
- settings = new_map_string();
- insert_map_string(settings, xstrdup("SSLClientAuth"), xstrdup("rhsm"));
- insert_map_string(settings, xstrdup("HTTPAuth"), xstrdup("rhn-username:rhn-password"));
- insert_map_string(settings, xstrdup("AuthDataItems"), xstrdup("hostname, type"));
-
- setenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH", TESTING_CERTS_CORRECT_DIR_PATH, 1);
-
- ureport_server_config_load(&config, settings);
-
- assert(strcmp(config.ur_username, "rhn-username") == 0);
- assert(strcmp(config.ur_password, "rhn-password") == 0);
-
- assert(config.ur_client_cert == NULL);
- assert(config.ur_client_key == NULL);
- assert(size_map_string(config.ur_http_headers) == 0);
-
- l = config.ur_prefs.urp_auth_items;
- assert(strcmp(l->data, "hostname") == 0);
- assert(strcmp(l->next->data, "type") == 0);
-
- unsetenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH");
-
- free_map_string(settings);
-
- ureport_server_config_destroy(&config);
-
return 0;
}
]])
@@ -366,7 +299,6 @@ AT_TESTFUN([ureport_server_config_set_client_auth],
#include <assert.h>
#define DESTROYED_POINTER (void *)0xdeadbeef
-#define RHSM_WEB_SERVICE_URL "https://cert-api.access.redhat.com/rs/telemetry/abrt"
#define TESTING_CERTS_CORRECT_DIR_PATH "../../ureport/certs/correct"
#define TESTING_CERTS_INCORRECT_ONLY_CERT_DIR_PATH "../../ureport/certs/only_cert"
@@ -374,10 +306,6 @@ AT_TESTFUN([ureport_server_config_set_client_auth],
#define TESTING_PYTHONPATH "../../ureport/"
#define WRONG_TESTING_PYTHONPATH "../../ureportxxxxxx/"
-#define RHSMCON_PEM_DIR_PATH "/etc/pki/consumer"
-#define RHSMCON_CERT_NAME "cert.pem"
-#define RHSMCON_KEY_NAME "key.pem"
-
char *my_strdup(const char *str)
{
if (str == NULL)
@@ -500,52 +428,6 @@ int main(void)
ureport_server_config_destroy(&config);
- /* client_auth == rhsm */
- /* ur_url == NULL */
- /* no certs */
- char *empty_cert_dir = mkdtemp(strdup("/tmp/cert_XXXXXX"));
- assert(empty_cert_dir);
- setenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH", empty_cert_dir, 1);
-
- int status = test_ureport_server_config_set_client_auth_exit_code_ext(&config, "rhsm", NULL, NULL);
- assert(status == 0);
-
- assert(rmdir(empty_cert_dir) == 0);
-
- /* client_auth == rhsm */
- /* ur_url == NULL */
- /* certs exists (only RHSMCON_CERT_NAME exists) */
-
- setenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH", TESTING_CERTS_INCORRECT_ONLY_CERT_DIR_PATH, 1);
-
- status = test_ureport_server_config_set_client_auth_exit_code_ext(&config, "rhsm", NULL, NULL);
- assert(status == 0);
-
- /* client_auth == rhsm */
- /* ur_url == NULL */
- /* certs exists (only RHSMCON_KEY_NAME exists) */
-
- setenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH", TESTING_CERTS_INCORRECT_ONLY_KEY_DIR_PATH, 1);
-
- status = test_ureport_server_config_set_client_auth_exit_code_ext(&config, "rhsm", NULL, NULL);
- assert(status == 0);
-
- /* client_auth == rhsm */
- /* ur_url == NULL */
- /* certs exists (correct) */
- ureport_server_config_init(&config);
-
- setenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH", TESTING_CERTS_CORRECT_DIR_PATH, 1);
-
- ureport_server_config_set_client_auth(&config, "rhsm");
-
- assert_ureport_server_config(&config, RHSM_WEB_SERVICE_URL, true,
- TESTING_CERTS_CORRECT_DIR_PATH"/cert.pem",
- TESTING_CERTS_CORRECT_DIR_PATH"/key.pem",
- NULL, NULL);
-
- ureport_server_config_destroy(&config);
-
/* client_auth == cert:key */
/* ur_url == NULL */
ureport_server_config_init(&config);
@@ -572,44 +454,6 @@ int main(void)
ret_val = test_ureport_server_config_set_client_auth_exit_code(&config, "cert");
assert(ret_val != 0 && ret_val != -1);
-/* rhsm_config_get_consumer_cert_dir */
-/* certs exists (correct content) */
- unsetenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH");
- setenv("PYTHONPATH", TESTING_PYTHONPATH, 1);
-
- ureport_server_config_init(&config);
- ureport_server_config_set_client_auth(&config, "rhsm");
-
- char *abs_path_cert = realpath(TESTING_CERTS_CORRECT_DIR_PATH"/cert.pem", NULL);
- char *abs_path_key = realpath(TESTING_CERTS_CORRECT_DIR_PATH"/key.pem", NULL);
-
- assert_ureport_server_config(&config, RHSM_WEB_SERVICE_URL, true,
- abs_path_cert,
- abs_path_key,
- NULL, NULL);
- free(abs_path_cert);
- free(abs_path_key);
-
- ureport_server_config_destroy(&config);
-
- /* python script fails, '/etc/pki/consumer' is returned */
-
- /* set cert dir path to '/etc/pki/consumer' */
- /* store return value of ureport_server_config_set_client_auth */
- setenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH", RHSMCON_PEM_DIR_PATH, 1);
-
- int exp_ret_val = test_ureport_server_config_set_client_auth_exit_code(&config, "rhsm");
-
- /* Do the same with unset LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH and wrong PYTHONPATH */
- /* function rhsm_config_get_consumer_cert_dir has to return RHSMCON_PEM_DIR_PATH */
- unsetenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH");
- setenv("PYTHONPATH", WRONG_TESTING_PYTHONPATH, 1);
-
- int rec_ret_val = test_ureport_server_config_set_client_auth_exit_code(&config, "rhsm");
-
- /* we expect the same return value */
-// assert(exp_ret_val == rec_ret_val);
-
return 0;
}
]])
@@ -1208,8 +1052,6 @@ AT_TESTFUN([ureport_server_config_load_basic_auth],
#include "libreport_curl.h"
#include "problem_data.h"
-#define RHSM_WEB_SERVICE_URL "https://cert-api.access.redhat.com/rs/telemetry/abrt"
-
int main(void)
{
g_verbose=3;
@@ -1226,22 +1068,6 @@ int main(void)
ureport_server_config_destroy(&config);
}
- {
- struct ureport_server_config config;
- ureport_server_config_init(&config);
-
- setenv("LIBREPORT_DEBUG_PLUGINS_CONF_DIR", "../../ureport-rhts-credentials/", 1);
-
- ureport_server_config_load_basic_auth(&config, "rhts-credentials");
-
- assert(strcmp(config.ur_username, "rhn-user-name") == 0);
- assert(strcmp(config.ur_password, "rhn-password") == 0);
- assert(strcmp(config.ur_url, RHSM_WEB_SERVICE_URL) == 0);
-
- unsetenv("LIBREPORT_DEBUG_PLUGINS_CONF_DIR");
- ureport_server_config_destroy(&config);
- }
-
{
pid_t pid = fork();
if (pid < 0)
diff --git a/tests/ureport/rhsm/__init__.py b/tests/ureport/rhsm/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/tests/ureport/rhsm/config.py b/tests/ureport/rhsm/config.py
deleted file mode 100644
index 44483d8..0000000
--- a/tests/ureport/rhsm/config.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os
-
-def initConfig():
- return myConfig()
-
-class myConfig():
- def get(self, key, value):
- return os.path.abspath("../../ureport/certs/correct")

View File

@ -0,0 +1,34 @@
From aea02b3719a161a05dac815955cfa1bb630e8da4 Mon Sep 17 00:00:00 2001
From: Ernestas Kulik <ekulik@redhat.com>
Date: Fri, 24 Jul 2020 10:45:37 +0200
Subject: [PATCH] plugins: reporter-rhtsupport: Fix command-line parsing
cb81dc0870949fbacaa6e2384e91fc4de4df43a5 drops -u and -C options, but
does not remove them from the enumeration, which maps the options to the
option struct, leading to -F and -D not being parsed.
https://bugzilla.redhat.com/show_bug.cgi?id=1860285
---
src/plugins/reporter-rhtsupport.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/plugins/reporter-rhtsupport.c b/src/plugins/reporter-rhtsupport.c
index 411bffc..7f5aafa 100644
--- a/src/plugins/reporter-rhtsupport.c
+++ b/src/plugins/reporter-rhtsupport.c
@@ -404,10 +404,8 @@ int main(int argc, char **argv)
OPT_c = 1 << 2,
OPT_t = 1 << 3,
OPT_f = 1 << 4,
- OPT_u = 1 << 5,
- OPT_C = 1 << 6,
- OPT_F = 1 << 7,
- OPT_D = 1 << 8,
+ OPT_F = 1 << 5,
+ OPT_D = 1 << 6,
};
/* Keep enum above and order of options below in sync! */
struct options program_options[] = {
--
2.26.2

View File

@ -0,0 +1,44 @@
From 143c76e6db52881a8da188f54ec0ec1aacb209de Mon Sep 17 00:00:00 2001
From: Ernestas Kulik <ekulik@redhat.com>
Date: Wed, 19 Aug 2020 09:30:28 +0300
Subject: [PATCH] Drop remaining references to removed command-line options
cb81dc0870949fbacaa6e2384e91fc4de4df43a5 drops -u and -C options, but
the report_RHTSupport event handler still passes one of them, resulting
in failures.
https://bugzilla.redhat.com/show_bug.cgi?id=1867064
---
doc/reporter-rhtsupport.txt | 2 +-
src/plugins/rhtsupport_event.conf | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/doc/reporter-rhtsupport.txt b/doc/reporter-rhtsupport.txt
index 132c0eaa..7d79e33b 100644
--- a/doc/reporter-rhtsupport.txt
+++ b/doc/reporter-rhtsupport.txt
@@ -7,7 +7,7 @@ reporter-rhtsupport - Reports problem to RHTSupport.
SYNOPSIS
--------
-'reporter-rhtsupport' [-v] [-c CONFFILE] [-F FMTFILE] [-u -C UR_CONFFILE] -d DIR
+'reporter-rhtsupport' [-v] [-c CONFFILE] [-F FMTFILE] -d DIR
Or:
diff --git a/src/plugins/rhtsupport_event.conf b/src/plugins/rhtsupport_event.conf
index cc2f05d1..6b0b3e67 100644
--- a/src/plugins/rhtsupport_event.conf
+++ b/src/plugins/rhtsupport_event.conf
@@ -1,6 +1,6 @@
EVENT=report_RHTSupport
- # Submit an uReport and create a case in Red Hat Customer Portal
- reporter-rhtsupport -u
+ # Create a case in Red Hat Customer Portal
+ reporter-rhtsupport
EVENT=report_RHTSupport_AddData
# Attach data to a case in Red Hat Customer Portal
--
2.28.0

View File

@ -0,0 +1,116 @@
From 9636b85c5570911c753bc8074ce5bd73f490d4da Mon Sep 17 00:00:00 2001
From: Michal Fabik <mfabik@redhat.com>
Date: Wed, 19 Jun 2019 13:42:07 +0200
Subject: [PATCH] Add autogen.sh
---
autogen.sh | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 97 insertions(+)
create mode 100755 autogen.sh
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 00000000..fd48b5f0
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,97 @@
+#!/bin/sh
+
+print_help()
+{
+cat << EOH
+Prepares the source tree for configuration
+
+Usage:
+ autogen.sh [sysdeps [--install]]
+
+Options:
+
+ sysdeps prints out all dependencies
+ --install install all dependencies ('sudo yum install \$DEPS')
+
+EOH
+}
+
+parse_build_requires_from_spec_file()
+{
+ PACKAGE=$1
+ TEMPFILE=$(mktemp -u --suffix=.spec)
+ sed 's/@@LIBREPORT_VERSION@@/1/' < $PACKAGE.spec.in | sed 's/@.*@//' > $TEMPFILE
+ rpmspec -P $TEMPFILE | grep "^\(Build\)\?Requires:" | \
+ tr -s " " | tr "," "\n" | cut -f2- -d " " | \
+ grep -v "\(^\|python[23]-\)"$PACKAGE | sort -u | sed -E 's/^(.*) (.*)$/"\1 \2"/' | tr \" \'
+ rm $TEMPFILE
+}
+
+list_build_dependencies()
+{
+ local BUILD_SYSTEM_DEPS_LIST="gettext-devel"
+ echo $BUILD_SYSTEM_DEPS_LIST $(parse_build_requires_from_spec_file libreport)
+}
+
+case "$1" in
+ "--help"|"-h")
+ print_help
+ exit 0
+ ;;
+ "sysdeps")
+ DEPS_LIST=$(list_build_dependencies)
+
+ if [ "$2" == "--install" ]; then
+ set -x verbose
+ eval sudo dnf install --setopt=strict=0 $DEPS_LIST
+ set +x verbose
+ else
+ echo $DEPS_LIST
+ fi
+ exit 0
+ ;;
+ *)
+ echo "Running gen-version"
+ ./gen-version
+
+ mkdir -p m4
+ echo "Creating m4/aclocal.m4 ..."
+ test -r m4/aclocal.m4 || touch m4/aclocal.m4
+
+ echo "Running autopoint"
+ autopoint --force || exit 1
+
+ echo "Running intltoolize..."
+ intltoolize --force --copy --automake || exit 1
+
+ echo "Running aclocal..."
+ aclocal || exit 1
+
+ echo "Running libtoolize..."
+ libtoolize || exit 1
+
+ echo "Running autoheader..."
+ autoheader || return 1
+
+ echo "Running autoconf..."
+ autoconf --force || exit 1
+
+ echo "Running automake..."
+ automake --add-missing --force --copy || exit 1
+
+ echo "Running configure ..."
+ if [ 0 -eq $# ]; then
+ ./configure \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --sharedstatedir=/var/lib \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --enable-debug
+ echo "Configured for local debugging ..."
+ else
+ ./configure "$@"
+ fi
+ ;;
+esac
--
2.21.0

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff