Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1135427 - kadmin.local -q with wrong value in -e option doesn't return nonzero return code
kadmin.local -q with wrong value in -e option doesn't return nonzero return ...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: krb5 (Show other bugs)
7.0
Unspecified Unspecified
low Severity medium
: rc
: ---
Assigned To: Robbie Harwood
Marek Marusic
http://krbdev.mit.edu/rt/Ticket/Displ...
:
Depends On:
Blocks: 1205796 1135429
  Show dependency treegraph
 
Reported: 2014-08-29 05:49 EDT by David Spurek
Modified: 2016-11-03 16:22 EDT (History)
5 users (show)

See Also:
Fixed In Version: krb5-1.14.1-1.el7
Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of:
: 1135429 (view as bug list)
Environment:
Last Closed: 2016-11-03 16:22:07 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2591 normal SHIPPED_LIVE Low: krb5 security, bug fix, and enhancement update 2016-11-03 08:10:29 EDT

  None (edit)
Description David Spurek 2014-08-29 05:49:55 EDT
Description of problem:
kadmin.local -q with wrong value in -e option doesn't return nonzero  return code

[test]kadmin.local -r EXAMPLE.COM -q "addprinc -randkey -e aes256-cts,aes128-cts kvnoprinc"
Authenticating as principal root/admin@EXAMPLE.COM with password.
add_principal: Invalid argument while parsing keysalts aes256-cts,aes128-cts
usage: add_principal [options] principal
        options are:
                [-x db_princ_args]* [-expire expdate] [-pwexpire pwexpdate] [-maxlife maxtixlife]
                [-kvno kvno] [-policy policy] [-clearpolicy] [-randkey]
                [-pw password] [-maxrenewlife maxrenewlife]
                [-e keysaltlist]
                [{+|-}attribute]
        attributes are:
                allow_postdated allow_forwardable allow_tgs_req allow_renewable
                allow_proxiable allow_dup_skey allow_tix requires_preauth
                requires_hwauth needchange allow_svr password_changing_service
                ok_as_delegate ok_to_auth_as_delegate no_auth_data_required

where,
        [-x db_princ_args]* - any number of database specific arguments.
                        Look at each database documentation for supported arguments
[test]echo $?
0


Version-Release number of selected component (if applicable):
krb5-server-1.11.3-49.el7

How reproducible:
always

Steps to Reproduce:
1.kadmin.local -r EXAMPLE.COM -q "addprinc -randkey -e aes256-cts,aes128-cts kvnoprinc"
2.echo $?
3.

Actual results:
0

Expected results:
nonzero

Additional info:
cpw has incorrect behavior as well

kadmin.local -r EXAMPLE.COM -q "cpw -randkey -keepold -e aes256-cts,aes128-cts kvnoprinc"
Authenticating as principal root/admin@EXAMPLE.COM with password.
 change_password: Invalid argument while parsing keysalts aes256
Comment 1 Nalin Dahyabhai 2014-09-03 11:07:28 EDT
I don't see that kadmin makes any guarantees about its exit status.  Its implementation appears to discard any errors encountered while processing commands, so we're potentially talking about much more than just these two commands and the -e flag.
Comment 4 Roland Mainz 2014-10-31 13:14:11 EDT
(In reply to Nalin Dahyabhai from comment #1)
> I don't see that kadmin makes any guarantees about its exit status.  Its
> implementation appears to discard any errors encountered while processing
> commands, so we're potentially talking about much more than just these two
> commands and the -e flag.

Just for the log: One idea I had was to implement kadminsh, a kadmin version based on AT&T AST's libshell (which provides a POSIX shell (ksh93) as shared library) and implement the kadmin subcommands as shell builtins... that would allow getting the proper return status for each subcommand and even add control over the code flow when multiple kadmin subcommands are used.
Problem is getting time allocated for this project... implementing it is easy but getting the neccesary infrastructure into Fedora is a man-week of work.
Comment 5 Greg Hudson 2014-10-31 15:49:21 EDT
See http://krbdev.mit.edu/rt/Ticket/Display.html?id=7991 for a proposed upstream enhancement to address this issue (not using libshell).
Comment 8 Robbie Harwood 2015-10-21 16:45:54 EDT
If memory serves, this landed in the 1.14 we're passing around.
Comment 15 errata-xmlrpc 2016-11-03 16:22:07 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2016-2591.html

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