Use correct profile var in krb5_get_tgs_ktypes

In r21879, when we converted to using KRB5_CONF macros for profile
variable names, we made a typo in krb5_get_tgs_ktypes and erroneously
started using default_tkt_enctypes instead of default_tgs_enctypes for
TGS requests.  Fix the typo and return to the documented behavior.

ticket: 7155
target_version: 1.10.3
tags: pullup
Sphinx HTML: Collapse l4 in ToC in the sidebar

Also,
- resize the width of the document vs sidebar;
- decrease padding in the sidebar;
- mark current l2 in ToC in the sidebar.
Tighten up error checking in t_keytab.c

When checking for specific error codes, using CHECK() meant that we
wouldn't properly fail if we got error code 0.  Define and use a
CHECK_ERR() to test for a specific error code, and define CHECK() in
terms of it.
Add krb5_kt_have_content API

Add the krb5_kt_have_content API from Heimdal, which can be used to
test whether a keytab exists and contains entries.  Add tests to
t_keytab.c.

There is a deviation from Heimdal in the function signature.
Heimdal's signature returns a krb5_boolean at the moment, because the
Heimdal implementation actually returns a krb5_error_code.  These are
generally the same type anyway (int).

ticket: 7158 (new)
Remove outdated comment in k5test.py
Improve error message from krb5_kt_have_content
Use first mech's status in gss_acquire_cred

If we can't acquire creds for any mech in gss_acquire_cred, return the
status of the first mech instead of the last mech, as it's more useful
in the typical case (where the first mech is krb5 and the last mech is
SPNEGO).  This error reporting is not ideal when the user was
expecting to use some mech other than krb5, but it's about as good as
things were prior to #6894.

ticket: 6973
Fail from gss_acquire_cred if we have no keytab

If a caller tries to acquire krb5 acceptor creds with no desired name
and we have no keytab keys, fail from gss_acquire_cred instead of
deferring until gss_accept_sec_context.

ticket: 7159 (new)
Fix -DDEBUG compilation errors

ticket: 7150
Fix trace log unit test

Only use common denominator Bourne shell syntax for exporting
environment variables.  Don't rely on /dev/stdout working.  Compare
the output with a reference file to detect changes, instead of just
sending it to stdout.
Disable trace test comparison for now

The t_trace output isn't consistent from run to run.  To fix "make
check", disable the comparison against the reference file until we can
make the output consistent.
Fix uninitialized memory errors in t_trace.c
Fix k5test.py hostname canonicalization

r25844 (#7124) stopped using AI_ADDRCONFIG when canonicalizing
hostnames in sn2princ.  So we need to also stop using it in k5test.c's
_get_hostname() or we could come up with a different result on a
system where forward and reverse resolution via IPv4 and IPv6 produce
different results.  That in turn causes a t_gssapi.py test (the one
using the un-canonicalized hostname) to fail, because libkrb5 looks
for a different host principal than k5test.py put in the keytab.
Allow daemon debugging in k5test.py

Allow --debug to be used for commands which start daemons, to make it
easier to debug startup issues.  After debugging a daemon, the script
will exit, since the daemon won't be running after the debugging
session is over.
Add control over session key enctype negotiation

Adds a principal string attribute named "session_enctypes" which can
specify what enctypes the principal supports for session keys.  (For
what it's worth, this actually allows one to list des-cbc-md5 as a
supported session key enctype, though obviously this hardly matters
now.)

Add a [realms] section parameter for specifying whether to assume that
principals (which lack the session_enctypes attribute) support
des-cbc-crc for session keys.  This allows those who still need to use
allow_weak_crypto=true, for whatever reason, to start reducing the
number of tickets issued with des-cbc-crc session keys to clients
which still give des-cbc-crc preference in their default_tgs_enctypes
list.

[ghudson@mit.edu: Miscellaneous edits, cleanups, and fixes; refactored
test script; documented session_enctypes attribute]
Try to make t_trace.c output consistent

Attempt to choose tracing inputs in t_trace.c which will produce
consistent output across platforms and logins.  Re-enable the
comparison against the reference file.
Don't free caller's principal in vfy_increds

#7125 took out the copy of the krb5_verify_init_creds server argument
but left in the corresponding free, so it was freeing a caller-owned
principal.  Reported by Russ Allbery.

ticket: 7162
Turn off use of a replay cache in krb5_verify_init_creds(). The library isn't attempting a replay attack on itself, so any detected replays are only going to be false-positives.
Add a -C flag to klist to have it show configuration entries. The output format could use some tweaking.
Remember all of the etype-info values from a preauth challenge, and instead of just using the first one, try to use each in succession until we stop getting KRB5_KT_NOTFOUND errors.