Blame SOURCES/0008-Remove-ipa-join-errors-from-behind-the-debug-option_rhbz#2048558.patch

e0e1b7
From 7c5540bb47799b4db95673d22f61995ad5c56440 Mon Sep 17 00:00:00 2001
e0e1b7
From: Rob Crittenden <rcritten@redhat.com>
e0e1b7
Date: Mon, 31 Jan 2022 17:31:50 -0500
e0e1b7
Subject: [PATCH] Remove ipa-join errors from behind the debug option
e0e1b7
e0e1b7
This brings it inline with the previous XML-RPC output which
e0e1b7
only hid the request and response from the output and not
e0e1b7
any errors returned.
e0e1b7
e0e1b7
https://pagure.io/freeipa/issue/9103
e0e1b7
e0e1b7
Signed-off-by: Rob Crittenden <rcritten@redhat.com>
e0e1b7
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
e0e1b7
Reviewed-By: Peter Keresztes Schmidt <carbenium@outlook.com>
e0e1b7
---
e0e1b7
 client/ipa-join.c | 27 +++++++++------------------
e0e1b7
 1 file changed, 9 insertions(+), 18 deletions(-)
e0e1b7
e0e1b7
diff --git a/client/ipa-join.c b/client/ipa-join.c
e0e1b7
index d98739a9a..5888a33bf 100644
e0e1b7
--- a/client/ipa-join.c
e0e1b7
+++ b/client/ipa-join.c
e0e1b7
@@ -743,8 +743,7 @@ jsonrpc_request(const char *ipaserver, const json_t *json, curl_buffer *response
e0e1b7
 
e0e1b7
     json_str = json_dumps(json, 0);
e0e1b7
     if (!json_str) {
e0e1b7
-        if (debug)
e0e1b7
-            fprintf(stderr, _("json_dumps() failed\n"));
e0e1b7
+        fprintf(stderr, _("json_dumps() failed\n"));
e0e1b7
 
e0e1b7
         rval = 17;
e0e1b7
         goto cleanup;
e0e1b7
@@ -758,8 +757,7 @@ jsonrpc_request(const char *ipaserver, const json_t *json, curl_buffer *response
e0e1b7
     CURLcode res = curl_easy_perform(curl);
e0e1b7
     if (res != CURLE_OK)
e0e1b7
     {
e0e1b7
-        if (debug)
e0e1b7
-            fprintf(stderr, _("JSON-RPC call failed: %s\n"), curl_easy_strerror(res));
e0e1b7
+        fprintf(stderr, _("JSON-RPC call failed: %s\n"), curl_easy_strerror(res));
e0e1b7
 
e0e1b7
         rval = 17;
e0e1b7
         goto cleanup;
e0e1b7
@@ -769,8 +767,7 @@ jsonrpc_request(const char *ipaserver, const json_t *json, curl_buffer *response
e0e1b7
     curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &resp_code);
e0e1b7
 
e0e1b7
     if (resp_code != 200) {
e0e1b7
-        if (debug)
e0e1b7
-            fprintf(stderr, _("JSON-RPC call failed with status code: %li\n"), resp_code);
e0e1b7
+        fprintf(stderr, _("JSON-RPC call failed with status code: %li\n"), resp_code);
e0e1b7
 
e0e1b7
         if (!quiet && resp_code == 401)
e0e1b7
             fprintf(stderr, _("JSON-RPC call was unauthorized. Check your credentials.\n"));
e0e1b7
@@ -848,8 +845,7 @@ jsonrpc_parse_response(const char *payload, json_t** j_result_obj, bool quiet) {
e0e1b7
 
e0e1b7
     j_root = json_loads(payload, 0, &j_error);
e0e1b7
     if (!j_root) {
e0e1b7
-        if (debug)
e0e1b7
-            fprintf(stderr, _("Parsing JSON-RPC response failed: %s\n"), j_error.text);
e0e1b7
+        fprintf(stderr, _("Parsing JSON-RPC response failed: %s\n"), j_error.text);
e0e1b7
 
e0e1b7
         rval = 17;
e0e1b7
         goto cleanup;
e0e1b7
@@ -864,8 +860,7 @@ jsonrpc_parse_response(const char *payload, json_t** j_result_obj, bool quiet) {
e0e1b7
 
e0e1b7
     *j_result_obj = json_object_get(j_root, "result");
e0e1b7
     if (!*j_result_obj) {
e0e1b7
-        if (debug)
e0e1b7
-            fprintf(stderr, _("Parsing JSON-RPC response failed: no 'result' value found.\n"));
e0e1b7
+        fprintf(stderr, _("Parsing JSON-RPC response failed: no 'result' value found.\n"));
e0e1b7
 
e0e1b7
         rval = 17;
e0e1b7
         goto cleanup;
e0e1b7
@@ -897,8 +892,7 @@ jsonrpc_parse_join_response(const char *payload, join_info *join_i, bool quiet)
e0e1b7
                        &tmp_hostdn,
e0e1b7
                        "krbprincipalname", &tmp_princ,
e0e1b7
                        "krblastpwdchange", &tmp_pwdch) != 0) {
e0e1b7
-        if (debug)
e0e1b7
-            fprintf(stderr, _("Extracting the data from the JSON-RPC response failed: %s\n"), j_error.text);
e0e1b7
+        fprintf(stderr, _("Extracting the data from the JSON-RPC response failed: %s\n"), j_error.text);
e0e1b7
 
e0e1b7
         rval = 17;
e0e1b7
         goto cleanup;
e0e1b7
@@ -941,8 +935,7 @@ join_krb5_jsonrpc(const char *ipaserver, const char *hostname, char **hostdn, co
e0e1b7
                              "nshardwareplatform", uinfo.machine);
e0e1b7
 
e0e1b7
     if (!json_req) {
e0e1b7
-        if (debug)
e0e1b7
-            fprintf(stderr, _("json_pack_ex() failed: %s\n"), j_error.text);
e0e1b7
+        fprintf(stderr, _("json_pack_ex() failed: %s\n"), j_error.text);
e0e1b7
 
e0e1b7
         rval = 17;
e0e1b7
         goto cleanup;
e0e1b7
@@ -990,8 +983,7 @@ jsonrpc_parse_unenroll_response(const char *payload, bool* result, bool quiet) {
e0e1b7
 
e0e1b7
     if (json_unpack_ex(j_result_obj, &j_error, 0, "{s:b}",
e0e1b7
                        "result", result) != 0) {
e0e1b7
-        if (debug)
e0e1b7
-            fprintf(stderr, _("Extracting the data from the JSON-RPC response failed: %s\n"), j_error.text);
e0e1b7
+        fprintf(stderr, _("Extracting the data from the JSON-RPC response failed: %s\n"), j_error.text);
e0e1b7
 
e0e1b7
         rval = 20;
e0e1b7
         goto cleanup;
e0e1b7
@@ -1021,8 +1013,7 @@ jsonrpc_unenroll_host(const char *ipaserver, const char *host, bool quiet) {
e0e1b7
                             host);
e0e1b7
 
e0e1b7
     if (!json_req) {
e0e1b7
-        if (debug)
e0e1b7
-            fprintf(stderr, _("json_pack_ex() failed: %s\n"), j_error.text);
e0e1b7
+        fprintf(stderr, _("json_pack_ex() failed: %s\n"), j_error.text);
e0e1b7
 
e0e1b7
         rval = 17;
e0e1b7
         goto cleanup;
e0e1b7
-- 
e0e1b7
2.34.1
e0e1b7