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