Blame SOURCES/0114-Revert-ureport-consistently-die-on-all-client-auth-e.patch

562801
From 20014427c5b225ca47a546f0d77aab981e9ee849 Mon Sep 17 00:00:00 2001
562801
From: Jakub Filak <jfilak@redhat.com>
562801
Date: Tue, 4 Nov 2014 09:14:43 +0100
562801
Subject: [LIBREPORT PATCH 114/118] Revert "ureport: consistently die on all
562801
 client auth errors"
562801
562801
This reverts commit fca34b5620a6213e1d191bcb99e8757f34bbe0a5.
562801
562801
Related #1140224
562801
562801
Signed-off-by: Jakub Filak <jfilak@redhat.com>
562801
---
562801
 src/lib/ureport.c | 28 +++++++++++++++++++++++++---
562801
 1 file changed, 25 insertions(+), 3 deletions(-)
562801
562801
diff --git a/src/lib/ureport.c b/src/lib/ureport.c
562801
index ae6a58d..fef3922 100644
562801
--- a/src/lib/ureport.c
562801
+++ b/src/lib/ureport.c
562801
@@ -119,12 +119,21 @@ ureport_server_config_set_client_auth(struct ureport_server_config *config,
562801
             ureport_server_config_set_url(config, xstrdup(RHSM_WEB_SERVICE_URL));
562801
 
562801
         char *rhsm_dir = rhsm_config_get_entitlement_cert_dir();
562801
+        if (rhsm_dir == NULL)
562801
+        {
562801
+            log_notice("Not using client authentication");
562801
+            return;
562801
+        }
562801
 
562801
         GList *certs = get_file_list(rhsm_dir, "pem");
562801
         if (g_list_length(certs) < 2)
562801
         {
562801
             g_list_free_full(certs, (GDestroyNotify)free_file_obj);
562801
-            error_msg_and_die("'%s' does not contain a cert-key files pair", rhsm_dir);
562801
+
562801
+            log_notice("'%s' does not contain a cert-key files pair", rhsm_dir);
562801
+            log_notice("Not using client authentication");
562801
+            free(rhsm_dir);
562801
+            return;
562801
         }
562801
 
562801
         /* Use the last non-key file found. */
562801
@@ -141,7 +150,11 @@ ureport_server_config_set_client_auth(struct ureport_server_config *config,
562801
         if (cert == NULL)
562801
         {
562801
             g_list_free_full(certs, (GDestroyNotify)free_file_obj);
562801
-            error_msg_and_die("'%s' does not contain a cert file (only keys)", rhsm_dir);
562801
+
562801
+            log_notice("'%s' does not contain a cert file (only keys)", rhsm_dir);
562801
+            log_notice("Not using client authentication");
562801
+            free(rhsm_dir);
562801
+            return;
562801
         }
562801
 
562801
         config->ur_client_cert = xstrdup(fo_get_fullpath(cert));
562801
@@ -177,7 +190,16 @@ ureport_server_config_set_client_auth(struct ureport_server_config *config,
562801
                         xasprintf(RHSMENT_SIG_DATA_BEGIN_TAG"%s"RHSMENT_SIG_DATA_END_TAG, sig_data));
562801
             }
562801
             else
562801
-                error_msg_and_die("Cert file '%s' doesn't contain Entitlement and RSA Signature sections", config->ur_client_cert);
562801
+            {
562801
+                log_notice("Cert file '%s' doesn't contain Entitlement and RSA Signature sections", config->ur_client_cert);
562801
+                log_notice("Not using client authentication");
562801
+
562801
+                free(config->ur_client_cert);
562801
+                config->ur_client_cert = NULL;
562801
+
562801
+                free(config->ur_client_key);
562801
+                config->ur_client_key = NULL;
562801
+            }
562801
 
562801
             free(sig_data);
562801
             free(ent_data);
562801
-- 
562801
1.8.3.1
562801