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