Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 973764 - When utility exits with error, it should give as detailed error message as possible
When utility exits with error, it should give as detailed error message as po...
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: ipa (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Martin Kosek
Namita Soman
Depends On:
  Show dependency treegraph
Reported: 2013-06-12 12:17 EDT by Martin Kosek
Modified: 2016-01-29 08:12 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2016-01-29 08:12:00 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Martin Kosek 2013-06-12 12:17:14 EDT
This bug is created as a clone of upstream ticket:

I did run

ipa-getkeytab -s server.example.com -p HTTP/broker.example.net -k /var/www/openshift/broker/httpd/conf.d/http.keytab

and the call failed with exit status 11 and message

Failed to add key to the keytab

I took me some time (this being a scripted operation) that the directory to which I wanted to put the keytab did not exist.

Looking at the code, it does

                krberr = krb5_kt_add_entry(krbctx, kt, &kt_entry);
                if (krberr) {
                                _("Failed to add key to the keytab\n"));
                        exit (11);

Alexander suggests that it should be possible to get some more detailed error message about the cause of the problem from the krb5* library using krb5_get_error_message. I tried to apply the following patch

--- ipa-getkeytab.c.orig	2012-10-12 10:05:55.000000000 -0400
+++ ipa-getkeytab.c	2013-06-05 06:53:15.378200294 -0400
@@ -604,8 +604,10 @@
 		krberr = krb5_kt_add_entry(krbctx, kt, &kt_entry);
 		if (krberr) {
+                        const char * krberr_str = krb5_get_error_message(krbctx, krberr);
-                                _("Failed to add key to the keytab\n"));
+                                _("Failed to add key to the keytab: %s\n"), krberr_str);
+			krb5_free_error_message(krbctx, krberr_str);
 			exit (11);

(noto sure how critical it is to call the free if we are about to exit) and the error message is

Failed to add key to the keytab: Key table file '/var/www/openshift/broker/httpd/conf.dx/http.keytab' not found

It might not be exactly the 'Directory does not exist' but at least it points to the existence of the file as the source of the problem.

Could all ocurences of

if (error_code_that_ve_got_from_kr5_call) {
  fprintf(stderr, _("some fixed string\n"));

be replaced with code which would also call krb5_get_error_message and printed it out?
Comment 1 Martin Kosek 2016-01-29 08:12:00 EST
Thank you taking your time and submitting this request for Red Hat Enterprise Linux. Unfortunately, this bug was not given a priority and was deferred both in the upstream project and in Red Hat Enterprise Linux.

Given that we are unable to fulfill this request in following Red Hat Enterprise Linux releases, I am closing the Bugzilla as WONTFIX. To request that Red Hat re-considers the decision, please re-open the Bugzilla via appropriate support channels and provide additional business and/or technical details about its importance to you.

Note that you can still track this request or even contribute patches in the referred upstream Trac ticket.

Note You need to log in before you can comment on or make changes to this bug.