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