RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 973764 - When utility exits with error, it should give as detailed error message as possible
Summary: When utility exits with error, it should give as detailed error message as po...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: ipa
Version: 7.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Martin Kosek
QA Contact: Namita Soman
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-06-12 16:17 UTC by Martin Kosek
Modified: 2016-01-29 13:12 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-01-29 13:12:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Martin Kosek 2013-06-12 16:17:14 UTC
This bug is created as a clone of upstream ticket:
https://fedorahosted.org/freeipa/ticket/3689

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) {
                        fprintf(stderr,
                                _("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);
 			fprintf(stderr,
-                                _("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"));
  exit(somevalue);
}
}}}

be replaced with code which would also call krb5_get_error_message and printed it out?

Comment 1 Martin Kosek 2016-01-29 13:12:00 UTC
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.