Blame SOURCES/0085-ureport-provide-default-URLs.patch

562801
From b4379865f019888e3e0c6480e7ba02711168b17a Mon Sep 17 00:00:00 2001
562801
From: Jakub Filak <jfilak@redhat.com>
562801
Date: Tue, 23 Sep 2014 16:12:33 +0200
562801
Subject: [LIBREPORT PATCH 85/93] ureport: provide default URLs
562801
562801
We have two general use cases:
562801
1. Completely anonymous uReporting
562801
2. Authenticated uReporting
562801
562801
For good security reasons, we have to use a standalone server for each of
562801
these use cases and this requirement complicates the configuration.
562801
Users would have to change two options to switch between these two
562801
configurations.
562801
562801
The configuration can be simplified by providing default URL for both of
562801
them and single out the URL according to state of the "SSLClientAuth"
562801
configuration option.
562801
562801
1. Completely anonymous uReporting
562801
  - empty "SSLClientAuth"
562801
562801
2. Authenticated uReporting
562801
  - "rhsm" or "rhsm-entitlement" in "SSLClientAuth"
562801
562801
Related to rhbz#1140224
562801
562801
Signed-off-by: Jakub Filak <jfilak@redhat.com>
562801
---
562801
 src/lib/ureport.c              | 9 +++++++++
562801
 src/plugins/reporter-ureport.c | 4 +++-
562801
 src/plugins/ureport.conf       | 2 +-
562801
 3 files changed, 13 insertions(+), 2 deletions(-)
562801
562801
diff --git a/src/lib/ureport.c b/src/lib/ureport.c
562801
index 26f3562..1a1520a 100644
562801
--- a/src/lib/ureport.c
562801
+++ b/src/lib/ureport.c
562801
@@ -30,6 +30,8 @@
562801
 
562801
 #define BTHASH_URL_SFX "reports/bthash/"
562801
 
562801
+#define RHSM_WEB_SERVICE_URL "https://api.access.redhat.com/rs/telemetry/abrt"
562801
+
562801
 #define RHSM_CERT_PATH "/etc/pki/consumer/cert.pem"
562801
 #define RHSM_KEY_PATH "/etc/pki/consumer/key.pem"
562801
 
562801
@@ -39,6 +41,7 @@
562801
 #define RHSMENT_SIG_DATA_BEGIN_TAG "-----BEGIN RSA SIGNATURE-----"
562801
 #define RHSMENT_SIG_DATA_END_TAG "-----END RSA SIGNATURE-----"
562801
 
562801
+
562801
 static char *
562801
 puppet_config_print(const char *key)
562801
 {
562801
@@ -88,11 +91,17 @@ ureport_server_config_set_client_auth(struct ureport_server_config *config,
562801
     }
562801
     else if (strcmp(client_auth, "rhsm") == 0)
562801
     {
562801
+        if (config->ur_url == NULL)
562801
+            ureport_server_config_set_url(config, xstrdup(RHSM_WEB_SERVICE_URL));
562801
+
562801
         config->ur_client_cert = xstrdup(RHSM_CERT_PATH);
562801
         config->ur_client_key = xstrdup(RHSM_KEY_PATH);
562801
     }
562801
     else if (strcmp(client_auth, "rhsm-entitlement") == 0)
562801
     {
562801
+        if (config->ur_url == NULL)
562801
+            ureport_server_config_set_url(config, xstrdup(RHSM_WEB_SERVICE_URL));
562801
+
562801
         GList *certs = get_file_list(RHSMENT_PEM_DIR_PATH, "pem");
562801
         if (g_list_length(certs) != 2)
562801
         {
562801
diff --git a/src/plugins/reporter-ureport.c b/src/plugins/reporter-ureport.c
562801
index 06b5341..f15d56d 100644
562801
--- a/src/plugins/reporter-ureport.c
562801
+++ b/src/plugins/reporter-ureport.c
562801
@@ -22,6 +22,8 @@
562801
 #include "ureport.h"
562801
 #include "libreport_curl.h"
562801
 
562801
+#define DEFAULT_WEB_SERVICE_URL "http://bug-report.itos.redhat.com"
562801
+
562801
 int main(int argc, char **argv)
562801
 {
562801
     setlocale(LC_ALL, "");
562801
@@ -112,7 +114,7 @@ int main(int argc, char **argv)
562801
     }
562801
 
562801
     if (!config.ur_url)
562801
-        error_msg_and_die("You need to specify server URL");
562801
+        ureport_server_config_set_url(&config, xstrdup(DEFAULT_WEB_SERVICE_URL));
562801
 
562801
     if (ureport_hash && ureport_hash_from_rt)
562801
         error_msg_and_die("You need to pass either -a bthash or -A");
562801
diff --git a/src/plugins/ureport.conf b/src/plugins/ureport.conf
562801
index fc0dc21..a20695d 100644
562801
--- a/src/plugins/ureport.conf
562801
+++ b/src/plugins/ureport.conf
562801
@@ -1,5 +1,5 @@
562801
 # Base URL to uReport server
562801
-URL = http://bug-report.itos.redhat.com
562801
+# URL = http://bug-report.itos.redhat.com
562801
 
562801
 # no means that ssl certificates will not be checked
562801
 # SSLVerify = no
562801
-- 
562801
1.8.3.1
562801