Blame SOURCES/0103-ureport-consistently-die-on-all-client-auth-errors.patch

28bab8
From fca34b5620a6213e1d191bcb99e8757f34bbe0a5 Mon Sep 17 00:00:00 2001
28bab8
From: Jakub Filak <jfilak@redhat.com>
28bab8
Date: Wed, 22 Oct 2014 09:16:48 +0200
28bab8
Subject: [LIBREPORT PATCH 103/105] ureport: consistently die on all client
28bab8
 auth errors
28bab8
28bab8
Related #1140224
28bab8
28bab8
Signed-off-by: Jakub Filak <jfilak@redhat.com>
28bab8
---
28bab8
 src/lib/ureport.c | 25 ++++---------------------
28bab8
 1 file changed, 4 insertions(+), 21 deletions(-)
28bab8
28bab8
diff --git a/src/lib/ureport.c b/src/lib/ureport.c
28bab8
index 41f4531..f4f9b19 100644
28bab8
--- a/src/lib/ureport.c
28bab8
+++ b/src/lib/ureport.c
28bab8
@@ -90,9 +90,8 @@ rhsm_config_get_entitlement_cert_dir(void)
28bab8
     *newline = '\0';
28bab8
     return result;
28bab8
 error:
28bab8
-    error_msg("Failed to get 'rhsm':'entitlementCertDir' from rhsm.config python module.");
28bab8
     free(result);
28bab8
-    return NULL;
28bab8
+    error_msg_and_die("Failed to get 'rhsm':'entitlementCertDir' from rhsm.config python module.");
28bab8
 }
28bab8
 
28bab8
 void
28bab8
@@ -118,21 +117,12 @@ ureport_server_config_set_client_auth(struct ureport_server_config *config,
28bab8
             ureport_server_config_set_url(config, xstrdup(RHSM_WEB_SERVICE_URL));
28bab8
 
28bab8
         char *rhsm_dir = rhsm_config_get_entitlement_cert_dir();
28bab8
-        if (rhsm_dir == NULL)
28bab8
-        {
28bab8
-            log_notice("Not using client authentication");
28bab8
-            return;
28bab8
-        }
28bab8
 
28bab8
         GList *certs = get_file_list(rhsm_dir, "pem");
28bab8
         if (g_list_length(certs) < 2)
28bab8
         {
28bab8
             g_list_free_full(certs, (GDestroyNotify)free_file_obj);
28bab8
-
28bab8
-            log_notice("'%s' does not contain a cert-key files pair", rhsm_dir);
28bab8
-            log_notice("Not using client authentication");
28bab8
-            free(rhsm_dir);
28bab8
-            return;
28bab8
+            error_msg_and_die("'%s' does not contain a cert-key files pair", rhsm_dir);
28bab8
         }
28bab8
 
28bab8
         /* Use the last non-key file found. */
28bab8
@@ -149,11 +139,7 @@ ureport_server_config_set_client_auth(struct ureport_server_config *config,
28bab8
         if (cert == NULL)
28bab8
         {
28bab8
             g_list_free_full(certs, (GDestroyNotify)free_file_obj);
28bab8
-
28bab8
-            log_notice("'%s' does not contain a cert file (only keys)", rhsm_dir);
28bab8
-            log_notice("Not using client authentication");
28bab8
-            free(rhsm_dir);
28bab8
-            return;
28bab8
+            error_msg_and_die("'%s' does not contain a cert file (only keys)", rhsm_dir);
28bab8
         }
28bab8
 
28bab8
         config->ur_client_cert = xstrdup(fo_get_fullpath(cert));
28bab8
@@ -189,10 +175,7 @@ ureport_server_config_set_client_auth(struct ureport_server_config *config,
28bab8
                         xasprintf(RHSMENT_SIG_DATA_BEGIN_TAG"%s"RHSMENT_SIG_DATA_END_TAG, sig_data));
28bab8
             }
28bab8
             else
28bab8
-            {
28bab8
-                log_notice("Cert file '%s' doesn't contain Entitlement and RSA Signature sections", config->ur_client_cert);
28bab8
-                log_notice("Not using HTTP authentication headers");
28bab8
-            }
28bab8
+                error_msg_and_die("Cert file '%s' doesn't contain Entitlement and RSA Signature sections", config->ur_client_cert);
28bab8
 
28bab8
             free(sig_data);
28bab8
             free(ent_data);
28bab8
-- 
28bab8
1.8.3.1
28bab8