]> git.ipfire.org Git - thirdparty/krb5.git/log
thirdparty/krb5.git
4 years agoFix runstatedir makefile substitution krb5-1.17
Greg Hudson [Tue, 5 Jan 2021 19:37:44 +0000 (14:37 -0500)] 
Fix runstatedir makefile substitution

Set localstatedir and runstatedir in config/pre.in so that the default
runstatedir value of ${localstatedir}/run works.  Reported by Mike
Jetzer.

(cherry picked from commit fd005a1967510004c9197f7da9f1d85ee81f4734)

ticket: 8975
version_fixed: 1.17.3

4 years agoUpdate for krb5-1.17.2-postrelease
Greg Hudson [Wed, 18 Nov 2020 01:06:54 +0000 (20:06 -0500)] 
Update for krb5-1.17.2-postrelease

4 years agoUpdate for krb5-1.17.2 krb5-1.17.2-final
Greg Hudson [Tue, 17 Nov 2020 17:13:04 +0000 (12:13 -0500)] 
Update for krb5-1.17.2

4 years agomake update-po
Greg Hudson [Tue, 17 Nov 2020 05:58:06 +0000 (00:58 -0500)] 
make update-po

4 years agoUpdate man pages
Greg Hudson [Tue, 17 Nov 2020 05:57:40 +0000 (00:57 -0500)] 
Update man pages

4 years agoFix compatibility with upcoming autoconf 2.70
Sergei Trofimovich [Fri, 6 Nov 2020 08:14:57 +0000 (08:14 +0000)] 
Fix compatibility with upcoming autoconf 2.70

Mainline autoconf generates no shell code for AC_CONFIG_AUX_DIR().
Call it unconditionally to avoid a syntax error.

[ghudson@mit.edu: rewrote commit message]

(cherry picked from commit f78edbe30816f049e1360cb6e203fabfdf7b98df)

ticket: 8960
version_fixed: 1.17.2

4 years agoAdd recursion limit for ASN.1 indefinite lengths
Greg Hudson [Sat, 31 Oct 2020 21:07:05 +0000 (17:07 -0400)] 
Add recursion limit for ASN.1 indefinite lengths

The libkrb5 ASN.1 decoder supports BER indefinite lengths.  It
computes the tag length using recursion; the lack of a recursion limit
allows an attacker to overrun the stack and cause the process to
crash.  Reported by Demi Obenour.

CVE-2020-28196:

In MIT krb5 releases 1.11 and later, an unauthenticated attacker can
cause a denial of service for any client or server to which it can
send an ASN.1-encoded Kerberos message of sufficient length.

(cherry picked from commit 57415dda6cf04e73ffc3723be518eddfae599bfd)

ticket: 8959
version_fixed: 1.17.2

4 years agoSuppress Leash error popup on MSLSA renew failure
Greg Hudson [Wed, 19 Aug 2020 15:49:29 +0000 (11:49 -0400)] 
Suppress Leash error popup on MSLSA renew failure

Attempting to renew the MSLSA cache can commonly fail with
KRB5_CC_NOTFOUND due to LSA policy.  Do not display an error popup in
this case.  Also fix a logic error in the existing suppressions.

(cherry picked from commit bfd407703a938573610af3f17aad4d5ebad615fd)

ticket: 8939
version_fixed: 1.17.2

4 years agoFix Leash crash when ticket autorenewal fails
Greg Hudson [Wed, 19 Aug 2020 15:37:12 +0000 (11:37 -0400)] 
Fix Leash crash when ticket autorenewal fails

CLeashView::RenewTicket() falls back to an ImportTicket or InitTicket
operation if ticket renewal fails.  A 2004 commit (from the old
pismere repository) added code to heuristically determine whether
Leash's cache was imported by comparing the MSLSA cache principal name
to ticketinfo.Krb5.principal.  Commit
9bc411e72fce5bed3ed00ae5b09f8c239309bae0 broke this code by removing
the call to initialize ticketinfo.Krb5 and by making
ticketinfo.Krb5.principal ephemeral.  The strcmp() call now crashes
the process with a null dereference.

Fix the crash by removing the heuristic detection of imported tickets,
using the current value of m_importedTickets (which should be correct
unless Leash was restarted after the tickets were obtained) to decide
whether to import or initialize tickets.

(cherry picked from commit 7fc4cdae79d0689afed32f9bcfeb28f410a9d79c)

ticket: 8938
version_fixed: 1.17.2

4 years agoSet lockdown attribute when creating LDAP KDB
Greg Hudson [Mon, 10 Aug 2020 16:44:21 +0000 (12:44 -0400)] 
Set lockdown attribute when creating LDAP KDB

In kdb5_ldap_util, set lockdown_keys on the special principals when
creating an LDAP KDB, as we do in kdb5_util when creating a regular
KDB.

(cherry picked from commit 6cdf7d82e74f21fb8a37efe6b1bba45744f891ba)

ticket: 8936
version_fixed: 1.17.2

4 years agoFix input length checking in SPNEGO DER decoding
Greg Hudson [Tue, 28 Jul 2020 16:58:26 +0000 (12:58 -0400)] 
Fix input length checking in SPNEGO DER decoding

In get_mech_set(), check the length before reading the first byte, and
decrease the length by the tag byte when reading and verifying the
sequence length.

In get_req_flags(), check the length before reading the first byte,
and check the context tag length after decoding it.

(cherry picked from commit 64f4b75a22212681ca293f8f09ddd24b0244d5b4)

ticket: 8933
version_fixed: 1.17.2

4 years agoAvoid using LMDB environments across forks
Greg Hudson [Fri, 19 Jun 2020 19:05:37 +0000 (15:05 -0400)] 
Avoid using LMDB environments across forks

In krb5kdc and kadmind, reinitialize the DB state after daemonizing,
to prevent using an LMDB environment in a different process than it
was created.  Otherwise the daemon's reader table slot appears to be
stale and can be claimed by another process.

In kadmind, this change means that global_server_handle changes value
after the loop setup.  Add an extra level of pointer indirection so
that the handle passed to the loop remains valid.

kdb_init_hist() is now called twice by kadmind.  Change it to avoid
leaking hist_princ on the second invocation.

(cherry picked from commit 38b98a14433b8858a3ca5979a0afa194df0df1e9)

ticket: 8918
version_fixed: 1.17.2

4 years agoSet pw_expiration during LDAP load
Greg Hudson [Thu, 4 Jun 2020 17:19:53 +0000 (13:19 -0400)] 
Set pw_expiration during LDAP load

When loading a principal entry in process_k5beta7_princ(), set the
KADM5_PW_EXPIRATION mask bit so that the password expiration time is
set on the principal entry.  Add a regression test.

Reported (with fix) by Glenn Machin.

(cherry picked from commit 778d3fd9de50ab0c87cf0031e1dd24a8ec4bd552)

ticket: 8882
version_fixed: 1.17.2

4 years agoUnregister thread key in SPNEGO finalization
Greg Hudson [Fri, 16 Oct 2020 15:35:18 +0000 (11:35 -0400)] 
Unregister thread key in SPNEGO finalization

Commit d160bc733a3dbeb6d84f4e175234ff18738d9f66 (ticket 7045) added a
new thread key K5_KEY_GSS_SPNEGO_STATUS and registered it in SPNEGO
library initialization, but neglected to unregister it in
finalization.  As a result, loading, unloading, and reloading
libgssapi_krb5 could throw an assertion failure if libkrb5support
remained loaded.  Unregister the key in SPNEGO finalization and add a
test case.

Reported and investigated by Adam Dabrowski.

(cherry picked from commit 07ff54d0bb85109df114612bbbfa6559f4a1e0cb)

ticket: 8614
tags: pullup
target_version: 1.18-next
target_version: 1.17-next

4 years agoUpdate copyright years to 2020
Greg Hudson [Mon, 9 Mar 2020 20:21:17 +0000 (16:21 -0400)] 
Update copyright years to 2020

5 years agoCorrect formatting of trace log microseconds
Greg Hudson [Fri, 3 Apr 2020 05:04:06 +0000 (01:04 -0400)] 
Correct formatting of trace log microseconds

Always use six digits with leading 0s to format the microseconds in
trace log timestamps; otherwise a small value appears as too large of
a fraction of a second.

(cherry picked from commit 734bf341da54e09add9160e65ea7308072b97f13)

ticket: 8894
version_fixed: 1.17.2

5 years agoAllow deletion of require_auth with LDAP KDB
Greg Hudson [Tue, 25 Feb 2020 16:32:09 +0000 (11:32 -0500)] 
Allow deletion of require_auth with LDAP KDB

In update_ldap_mod_auth_ind(), if there is no string attribute value
for require_auth, check for krbPrincipalAuthInd attributes that might
need to be removed.  (This will only work if the entry is loaded and
then modified, but that is the normal case for an existing entry.)

Move the update_ldap_mod_auth_ind() call inside the tl-data
conditional (which should perhaps be a check for KADM5_TL_DATA in the
mask instead).  A modification which did not intend to update tl-data
should not remove the krbPrincipalAuthInd attributes.

Change get_int_from_tl_data() to to zero its output so that it can't
leave a garbage value behind if it returns 0 (as it does if no
KDB_TL_USER_INFO tl-data is present).

Based on a patch by Glenn Machin.

(cherry picked from commit 6d9da7bb216f96cbdd731aa894714bd84213a9d0)

ticket: 8877
version_fixed: 1.17.2

5 years agoDon't assume OpenSSL failures are memory errors
Robbie Harwood [Wed, 5 Feb 2020 17:56:00 +0000 (12:56 -0500)] 
Don't assume OpenSSL failures are memory errors

More recent versions of OpenSSL can fail for other reasons.  Indicate
a crypto-related error occurred rather than a memory error to aid
debugging.

(cherry picked from commit bf9b2134ceddd6c727362be894b1c95c297a0f17)

ticket: 8873
version_fixed: 1.17.2

5 years agoPut KDB authdata first
Isaac Boukris [Sat, 1 Feb 2020 15:13:30 +0000 (16:13 +0100)] 
Put KDB authdata first

Windows services, as well as some versions of Samba, may refuse
tickets if the PAC is not in the first AD-IF-RELEVANT container.  In
fetch_kdb_authdata(), change the merge order so that authdata from the
KDB module appears first.

[ghudson@mit.edu: added comment and clarified commit message]

(cherry picked from commit 331fa4bdd34263ea20667a0f51338cb84357fdaa)

ticket: 8872
version_fixed: 1.17.2

5 years agoFix error handling in gssint_mechglue_init()
Greg Hudson [Sat, 11 Jan 2020 04:47:34 +0000 (23:47 -0500)] 
Fix error handling in gssint_mechglue_init()

In the unlikely event that one of the functions called by
gssint_mechglue_init() returns an error, return that error to the
caller rather than continuing on and discarding the error status.
Returning success when some of the operations failed could fool the
library finalizer into thinking that initialization completed.
Reported by Spencer Malone.

(cherry picked from commit c120ed5b211ee684b830a6722fc3ab3222afbfa1)

ticket: 8864
version_fixed: 1.17.2

5 years agoFix LDAP policy enforcement of pw_expiration
Robbie Harwood [Tue, 17 Dec 2019 22:37:41 +0000 (17:37 -0500)] 
Fix LDAP policy enforcement of pw_expiration

In the LDAP backend, the change mask is used to determine what LDAP
attributes to update.  As a result, password expiration was not set
from policy when running during addprinc, among other issues.
However, when the mask did not contain KADM5_PRINCIPAL, pw_expiration
would be applied regardless, which meant that (for instance) changing
the password would cause the password application to be applied.

Remove the check for KADM5_PRINCIPAL, and fix the mask to contain
KADM5_PW_EXPIRATION where appropriate.  Add a regression test to
t_kdb.py.

[ghudson@mit.edu: also set KADM5_ATTRIBUTES for randkey and setkey
since they both unset KRB5_KDB_REQUIRES_PWCHANGE; edited comments and
commit message]

(cherry picked from commit 6b004dd5739bded71be4290c11e7ac3a816c7e09)

ticket: 8861
version_fixed: 1.17.2

5 years agoFix handling of invalid CAMMAC service verifier
Jeffrey Arbuckle [Sun, 22 Dec 2019 03:59:20 +0000 (22:59 -0500)] 
Fix handling of invalid CAMMAC service verifier

In extract_cammacs(), avoid a null dereference if the CAMMAC service
verifier is invalid or the CAMMAC is empty.

(cherry picked from commit 8451ff6ed57361de585a35f35a39c54dc48172c7)

ticket: 8856
version_fixed: 1.17.2

5 years agoUpdates for kfw-4.2-beta2-mit
Greg Hudson [Fri, 13 Dec 2019 06:26:19 +0000 (01:26 -0500)] 
Updates for kfw-4.2-beta2-mit

5 years agoUpdate for krb5-1.17.1-postrelease
Greg Hudson [Wed, 11 Dec 2019 19:42:04 +0000 (14:42 -0500)] 
Update for krb5-1.17.1-postrelease

5 years agoUpdate for krb5-1.17.1 krb5-1.17.1-final
Greg Hudson [Wed, 11 Dec 2019 16:46:55 +0000 (11:46 -0500)] 
Update for krb5-1.17.1

5 years agomake update-po
Greg Hudson [Wed, 11 Dec 2019 16:15:06 +0000 (11:15 -0500)] 
make update-po

5 years agoUpdate man pages
Greg Hudson [Wed, 11 Dec 2019 16:14:42 +0000 (11:14 -0500)] 
Update man pages

5 years agomake depend
Greg Hudson [Wed, 11 Dec 2019 16:12:18 +0000 (11:12 -0500)] 
make depend

5 years agoIn mkrel, build documentation with python3
Greg Hudson [Wed, 11 Dec 2019 17:09:27 +0000 (12:09 -0500)] 
In mkrel, build documentation with python3

After commit 95830231758de259abbbccedbac01613f578768a, the
documentation cannot be built with Python 2.  Run make with
"PYTHON=python3" to ensure that we use Python 3.

(cherry picked from commit 17b40b1acb8f2e2c1f646ae76a9919089c4ba85c)

5 years agoVarious gssalloc fixes
Greg Hudson [Sat, 23 Nov 2019 16:42:59 +0000 (11:42 -0500)] 
Various gssalloc fixes

The DEBUG_GSSALLOC version of gssalloc_realloc() must add the sentinel
size to the byte count.

The mechglue gss_decapsulate_token(), gss_encapsulate_token(), and
gss_export_sec_context() must use gssalloc_malloc() to allocate
output buffers.

The krb5 mech's gss_export_name_composite() and gss_pseudo_random()
implementations must use gssalloc_malloc() to allocate output buffers.

SPNEGO's gss_display_status() implementation must use gssalloc for the
output buffer.

The sample GSS server must use gss_release_buffer() to free the result
of gss_export_sec_context().

(cherry picked from commit ab5c4259bdbe51dd3f4b5c5aff22628188d04322)

ticket: 8852
version_fixed: 1.17.1

5 years agoFix gss_set_sec_context_option() context creation
Luke Howard [Tue, 19 Nov 2019 18:00:50 +0000 (13:00 -0500)] 
Fix gss_set_sec_context_option() context creation

If gss_set_sec_context_option() creates a union context object, it
must set the loopback pointer.

[ghudson@mit.edu: extracted this from a larger commit and wrote commit
message]

(cherry picked from commit 93b6d2a83849e157d7bec4f83fd94dbef10d6f05)

ticket: 8850
version_fixed: 1.17.1

5 years agoFix kadmin addprinc -randkey -kvno
Greg Hudson [Sun, 17 Nov 2019 00:54:51 +0000 (19:54 -0500)] 
Fix kadmin addprinc -randkey -kvno

Commit f07bca9fc94a5cf2e3c0f58226c7973a4b86b7a9 made addprinc -randkey
use a single RPC request, but the server-side handling always creates
the random keys with kvno 1.  If a kvno is specified in the RPC
request, set the kvno of the key data after creating it.  Reported by
Andreas Ladanyi.

(cherry picked from commit 462e85208d57b8d4120c99e801fbd156b9ccf16f)

ticket: 8848
version_fixed: 1.17.1

5 years agoFix SPNEGO fallback context handling
Greg Hudson [Mon, 11 Nov 2019 17:25:41 +0000 (12:25 -0500)] 
Fix SPNEGO fallback context handling

In init_ctx_call_init(), if gss_init_sec_context() fails while
producing the first SPNEGO initiator token, we remove the first
candidate mechanism from sc->mech_set and try again.  If
sc->ctx_handle is present after the error (more likely after commit
56f7b1bc95a2a3eeb420e069e7655fb181ade5cf), we must clear it before
falling back or it will cause subsequent attempts to fail.

(cherry picked from commit 40ecfad10dd36700028ff0f3d0d79ce7925fe545)

ticket: 8846
version_fixed: 1.17.1

5 years agoAccept GSS mechs which don't supply attributes
Greg Hudson [Sun, 6 Oct 2019 22:35:50 +0000 (18:35 -0400)] 
Accept GSS mechs which don't supply attributes

If gss_inquire_attrs_for_mech() is called for a mechanism which does
not implement it, the call will succeed with mech_attrs set to
GSS_C_NO_OID_SET (as is explicitly allowed by RFC 5587).
generic_gss_test_oid_set_member() returns an error on this value,
causing gss_accept_sec_context() to erroneously deny the mechanism
when no verifier credential handle is supplied.  Change
allow_mech_by_default() to explicitly check for no mech attribute set.

(cherry picked from commit bd321c9caa6dc4b034bc3279a1af39af4c41210d)

ticket: 8840
version_fixed: 1.17.1

5 years agoFix missing field in /etc/gss/mech documentation
Greg Hudson [Sun, 6 Oct 2019 22:26:03 +0000 (18:26 -0400)] 
Fix missing field in /etc/gss/mech documentation

/etc/gss/mech lines begin with a name field, but this field was not
included in the format documentation.

(cherry picked from commit 208e85530f8a0d0490e50d89aed4f6f11acfd86a)

ticket: 8839
version_fixed: 1.17.1

5 years agoRemove some outdated iprop documentation
Greg Hudson [Mon, 23 Sep 2019 20:59:05 +0000 (16:59 -0400)] 
Remove some outdated iprop documentation

Commit 969331732b62e73d1e073ff3ad87bf1774ee9fd1 (ticket 7369) removed
the code to return UPDATE_BUSY if the database was modified within the
last ten seconds, but did not remove the corresponding documentation
text.  Remove it now.

(cherry picked from commit 16c3a5917a8fd2706a1e1b2e5a58e1319f8fa8f7)

ticket: 8835
version_fixed: 1.17.1

5 years agoUpdate supported_enctypes documentation
Robbie Harwood [Fri, 20 Sep 2019 17:09:04 +0000 (13:09 -0400)] 
Update supported_enctypes documentation

In commit 38a31852c3e58f6e2f6b3b035a87f817d1db5537, the aes-sha1
enctypes became the only defaults, but the documentation was not
updated.

(cherry picked from commit 56982b666e10fbb47c1fb70947b3e176c9a5e2d1)

ticket: 8834
version_fixed: 1.17.1

5 years agoUpdate LDAP KDB module documentation
Greg Hudson [Tue, 10 Sep 2019 05:12:43 +0000 (01:12 -0400)] 
Update LDAP KDB module documentation

Remove ldapbackend.rst, as it is largely redundant with conf_ldap.rst.

Simplify conf_ldap.rst, using kerberos.openldap.ldif (added by ticket
8529) and removing unnecessary command arguments.  Mention the
possibility of using SASL authentication (added by ticket 7944) as an
alternative to binding with DN and password.  Remove unnecessary
access rights.

In kdc_conf.rst, remove ldap_servers from the list of relations read
from [dbdefaults], as it is only read from the realm's database
configuration section.

In kdb5_ldap_util.rst, document "-r" as a global parameter, as it
applies in some fashion to all commands.  Make the same changes to the
kdb5_ldap_util usage message, and make it fit within 80 columns.

Reported by Dilyan Palauzov.

(cherry picked from commit ca1057fe6a03b6679b7907ee41b8abd444acc70d)

ticket: 8831
version_fixed: 1.17.1

5 years agoFix KCM client time offset propagation
Robbie Harwood [Wed, 14 Aug 2019 17:52:27 +0000 (13:52 -0400)] 
Fix KCM client time offset propagation

An inverted status check in get_kdc_offset() would cause querying the
offset time from the ccache to always fail (silently) on KCM.  Fix the
status check so that KCM can properly handle desync.

(cherry picked from commit 323abb6d1ebe5469d6c2167c29aa5d696d099b90)

ticket: 8826
version_fixed: 1.17.1

5 years agoDon't skip past zero byte in profile parsing
Greg Hudson [Wed, 14 Aug 2019 15:46:14 +0000 (11:46 -0400)] 
Don't skip past zero byte in profile parsing

In parse_quoted_string(), only process an escape sequence if there is
a second character after the backlash, to avoid reading past the
terminating zero byte.  Reported by Lutz Justen.

(cherry picked from commit a449bfc16c32019fec8b4deea963a3e474b0d14d)

ticket: 8825
version_fixed: 1.17.1

5 years agoInitialize life/rlife in kdcpolicy interface
Robbie Harwood [Fri, 9 Aug 2019 18:07:22 +0000 (14:07 -0400)] 
Initialize life/rlife in kdcpolicy interface

A value of 0 indicates that the plugin doesn't wish to modify lifetimes.
Make this the default, rather than requiring all plugins to set these
values themselves.

(cherry picked from commit d81c5870013240c04642c8e0cb994b4c49e40ddf)

ticket: 8824
version_fixed: 1.17.1

5 years agoCorrect documentation of final profiles
Michael Mattioli [Sun, 14 Jul 2019 21:35:17 +0000 (17:35 -0400)] 
Correct documentation of final profiles

The documentation for krb5.conf explaining final values is incorrect.
Only sections and subsections may usefully be marked as final, and
final designations only apply to later files, not to the same file.

[ghudson@mit.edu: corrected and shortened documentation; rewrote
commit message]

(cherry picked from commit 5105a91c9dc3210e242dff156b861e77aa80959a)

ticket: 8821
version_fixed: 1.17.1

5 years agoImprove logging documentation
Greg Hudson [Thu, 6 Jun 2019 15:35:36 +0000 (11:35 -0400)] 
Improve logging documentation

The default severity was removed by commit
6ce8fd4cfa2e9b1e92debd204a5b2ddf053cca55 (ticket 8630) but the example
still talks about it; remove that text.  Add a note about the default
being syslog if nothing else is specified, and a note on how to
disable logging.

(cherry picked from commit 4dabc3d0bcdcdcd5aad070b97a27141a3abd0bbd)

ticket: 8813
version_fixed: 1.17.1

5 years agoFix Python fallback in configure.ac
Greg Hudson [Tue, 28 May 2019 14:55:56 +0000 (10:55 -0400)] 
Fix Python fallback in configure.ac

Commit 2bd410ecdb366083fe9b4e5f6ac4b741b624230b (ticket 8709)
contained a typo "text" for "test", preventing the Python path check
from falling back from python2 to python.  This is now a fallback from
python3 to python, but the typo remains.  Fix it now.

Based on a patch by Michael Osipov.

(cherry picked from commit b7c260b22c5d815b83ff37a35569e07e847cd9c3)

ticket: 8810
version_fixed: 1.17.1

5 years agoRename hmac() function
Thomas Klausner [Mon, 6 May 2019 14:03:38 +0000 (16:03 +0200)] 
Rename hmac() function

NetBSD 8's stdlib.h declares a hmac() function; rename ours to avoid a
conflict.

[ghudson@mit.edu: picked a different name and added a comment]

(cherry picked from commit e8b463c8d2c9b903d61c8646af3c0106808f906d)

ticket: 8803
version_fixed: 1.17.1

5 years agoRemove outdated text in krb5kdc/kadmind man pages
Greg Hudson [Sun, 5 May 2019 23:32:21 +0000 (19:32 -0400)] 
Remove outdated text in krb5kdc/kadmind man pages

Some init systems, such as systemd, can run daemon processes in the
foreground, so admonishments to let krb5kdc and kadmind background
themselves in normal operation can be confusing.  Remove those
sentences.

(cherry picked from commit 4ded6dbc23d27068567943bccf4d2d986b6f7d08)

ticket: 8802
version_fixed: 1.17.1

5 years agoFix some return code handling bugs
Robbie Harwood [Thu, 2 May 2019 18:05:38 +0000 (14:05 -0400)] 
Fix some return code handling bugs

Fix five cases where return codes could be set (in unlikely cases) but
did not result in error exits.

[ghudson@mit.edu: squashed commits and rewrote commit message]

(cherry picked from commit 7c26740f9df3c79c3f01c3a4dda4d9dabba5298d)

ticket: 8801
version_fixed: 1.17.1

5 years agoFix gss_get_mic_iov() example code
Greg Hudson [Wed, 17 Apr 2019 05:57:28 +0000 (01:57 -0400)] 
Fix gss_get_mic_iov() example code

The example code for gss_get_mic_iov() using a caller-provided buffer
calls gss_wrap_iov_length() and gss_wrap_iov() instead of
gss_get_mic_iov_length() and gss_get_mic_iov() as intended.  Reported
by Frank Filz.

(cherry picked from commit bf4156db4f6c2e8cd420cd556bfa9e39f1a3d556)

ticket: 8797
version_fixed: 1.17.1

5 years agoDocument default realm for krb5kdc
Greg Hudson [Tue, 16 Apr 2019 15:11:19 +0000 (11:11 -0400)] 
Document default realm for krb5kdc

Document that if no krb5kdc -r option is specified, the default realm
is served.

(cherry picked from commit e5f866de8f47b91f609a6bab0d0e002f1a826222)

ticket: 8796
version_fixed: 1.17.1

5 years agoFix gssalloc_realloc() on Windows
Greg Hudson [Mon, 21 Oct 2019 14:29:35 +0000 (10:29 -0400)] 
Fix gssalloc_realloc() on Windows

gss_inquire_sec_context_by_oid(GSS_C_INQ_SSPI_SESSION_KEY) fails on
Windows because generic_gss_add_buffer_set_member() relies on the
ability to realloc() a null pointer.  Unlike realloc(), HeapReAlloc()
requires an input pointer that (from the MSDN documentation) "is
returned by an earlier call to the HeapAlloc or HeapReAlloc function".
So gssalloc_realloc() must test for null inputs and call HeapAlloc()
instead.

Reported by Eric Pauly.

(cherry picked from commit d66b311093f1782c3610bbc77bd78fce411e8f79)

ticket: 8735
version_fixed: 1.17.1

5 years agoFix t_otp.py for pyrad 2.2
Greg Hudson [Mon, 21 Oct 2019 17:56:55 +0000 (13:56 -0400)] 
Fix t_otp.py for pyrad 2.2

pyrad 2.2 throws a KeyError exception in DecodePacket if any
attributes from the packet are not defined in the dictionary.  Add a
dictionary entry for Service-Type so this doesn't happen.

(cherry picked from commit e60d01eb1686e112fba4743d4216ba61fec2bdc0)

ticket: 8841
version_fixed: 1.17.1

5 years agoConvert OTP and kdcproxy tests to Python 3
Greg Hudson [Wed, 19 Jun 2019 04:57:30 +0000 (00:57 -0400)] 
Convert OTP and kdcproxy tests to Python 3

Commit e23d24beacb73581bbf4351250f3955e6fd44361 did not convert
t_otp.py or paste-kdcproxy.py.  Convert t_otp.py to Python3.  Rewrite
paste-kdcproxy.py using wsgiref from the standard Python library to
avoid the Paste dependency.

(cherry picked from commit 56be947ac4469d9d79b2e451311278f5bcdb2063)

ticket: 8818
version_fixed: 1.17.1

5 years agoEliminate qualname.plin
Greg Hudson [Wed, 31 Jul 2019 03:59:27 +0000 (23:59 -0400)] 
Eliminate qualname.plin

Rewriting the qualname Perl script to use getaddrinfo created an
unchecked dependency on Perl 5.14.  Instead, remove the script and use
the C program in tests/resolve for the kadmin and gssrpc test suites.

(cherry picked from commit 2a852b1f3fb00c7d19f4dbfba76f5ff7ebccd2c7)

5 years agoFix test suite issues affecting Travis images
Greg Hudson [Fri, 26 Jul 2019 22:33:28 +0000 (18:33 -0400)] 
Fix test suite issues affecting Travis images

In the utilities used by the dejagnu test suites, use
getaddrinfo()/getnameinfo() instead of
gethostbyname()/gethostbyaddr(), as the results can vary when the
local hostname appears in multiple lines in /etc/hosts.

In t_ccselect.py, don't cause an error if the canonicalized local
hostname is "localhost".  The tests will continue to run in this case,
as long as we don't try to create duplicate principals.

In sim_server.c, bind to the wildcard address instead of the resolved
local hostname, to resolve a mysterious problem observed in Travis
where the second of three sim_client send() operations fails with
ECONNREFUSED.

(cherry picked from commit c2497d46b4bad473e164943d67b58cd1ae261c3a)

6 years agoBack to krb5-1.17-postrelease 933/head
Greg Hudson [Tue, 2 Apr 2019 15:23:34 +0000 (11:23 -0400)] 
Back to krb5-1.17-postrelease

6 years agoUpdates for kfw-4.2-beta1 kfw-4.2-beta1
Greg Hudson [Tue, 2 Apr 2019 15:23:01 +0000 (11:23 -0400)] 
Updates for kfw-4.2-beta1

6 years agoUpdates for kfw-4.2-beta1-mit kfw-4.2-beta1-mit
Greg Hudson [Tue, 2 Apr 2019 15:22:06 +0000 (11:22 -0400)] 
Updates for kfw-4.2-beta1-mit

6 years agoSuppress krb5_cc_start_seq_get() popups in Leash
Greg Hudson [Tue, 19 Mar 2019 15:15:26 +0000 (11:15 -0400)] 
Suppress krb5_cc_start_seq_get() popups in Leash

Under some circumstances (perhaps related to a February Windows 10
update), Leash can get past the krb5_cc_get_principal() step when
processing an empty MSLSA ccache, and get a KRB5_CC_NOMATCH error from
krb5_cc_start_seq_get().  Do not display a modal error dialog if this
happens.

(cherry picked from commit 3208e88cae1c5b3c3f0477e64565764118df6316)

ticket: 8790
version_fixed: 1.17.1

6 years agoDocument the double-colon behavior of DIR ccaches
Robbie Harwood [Wed, 6 Mar 2019 23:01:50 +0000 (18:01 -0500)] 
Document the double-colon behavior of DIR ccaches

(cherry picked from commit 5ba6e02a7b96ddd15dde01db0f9aff3d65773a8e)

ticket: 8789
version_fixed: 1.17.1

6 years agoFix memory leak in 'none' replay cache type
Corene Casper [Sat, 16 Feb 2019 05:49:26 +0000 (00:49 -0500)] 
Fix memory leak in 'none' replay cache type

Commit 0f06098e2ab419d02e89a1ca6bc9f2828f6bdb1e fixed part of a memory
leak in the 'none' replay cache type by freeing the outer container,
but we also need to free the mutex.

[ghudson@mit.edu: wrote commit message]

(cherry picked from commit af2a3115cb8feb5174151b4b40223ae45aa9db17)

ticket: 8783
version_fixed: 1.17.1

6 years agoRemove erroneous text from kinit man page
Isaac Boukris [Mon, 7 Jan 2019 19:09:34 +0000 (21:09 +0200)] 
Remove erroneous text from kinit man page

Commit 4c4859fa83295db5c26f47b96c719060cfd9e2b1 changed the kinit man
page to state that kinit -E (enterprise) implies -C (canonicalize).
The client does not automatically set the canonicalize option when
getting tickets for an enterprise principal, and Windows KDCs can
issue tickets for enterprise principals without canonicalizing the
principal (contrary to the implication of RFC 6806 section 5).  Remove
the misleading text.

[ghudson@mit.edu: updated RST man page and regenerated nroff file;
rewrote commit message]

(cherry picked from commit 8e31335a7722a2f7f1722506befe4fd26d3e3f3f)

ticket: 8779
version_fixed: 1.17.1

6 years agoUpdate doxygen-RST bridge to Python 3
Greg Hudson [Thu, 17 Jan 2019 17:51:59 +0000 (12:51 -0500)] 
Update doxygen-RST bridge to Python 3

Also remove a debugging print from DocModel.__repr__.

(cherry picked from commit 95830231758de259abbbccedbac01613f578768a)

ticket: 8774
version_fixed: 1.17.1

6 years agoUpdate for krb5-1.17-postrelease
Greg Hudson [Tue, 8 Jan 2019 17:25:52 +0000 (12:25 -0500)] 
Update for krb5-1.17-postrelease

6 years agoUpdate for krb5-1.17 krb5-1.17-final
Greg Hudson [Tue, 8 Jan 2019 16:02:00 +0000 (11:02 -0500)] 
Update for krb5-1.17

6 years agoUpdate man pages
Greg Hudson [Tue, 8 Jan 2019 15:54:15 +0000 (10:54 -0500)] 
Update man pages

6 years agoUpdate copyright years to 2019
Greg Hudson [Mon, 7 Jan 2019 16:24:59 +0000 (11:24 -0500)] 
Update copyright years to 2019

(cherry picked from commit 7e127ebdbf88dccae9f9e5427e90319981a69266)

6 years agoFix build issues with Solaris native compiler
sashan [Tue, 18 Dec 2018 11:04:56 +0000 (12:04 +0100)] 
Fix build issues with Solaris native compiler

In the LDAP KDB module, fix an empty initializer.  In the SPAKE
edwards25519 code, use autoconf tests to determine whether to use the
64-bit code.  In the SPAKE update_thash() function, make sure the
types of the conditional expression results match exactly.  In
libkrb5support, link against zap.o now that k5buf.o can use zap() (as
of commit 8ee8246c14702dc03b02e31b9fb5b7c2bb674bfb).

[ghudson@mit.edu: squashed commits; rewrote commit message; adjusted
autoconf tests; minor code changes]

(cherry picked from commit ecb03a4c31cf8a6b1bca3459ae56d4122398c18e)

ticket: 8769
version_fixed: 1.17

6 years agoFix double-close in ksu get_authorized_princ_names
Robbie Harwood [Tue, 18 Dec 2018 20:18:13 +0000 (15:18 -0500)] 
Fix double-close in ksu get_authorized_princ_names

If list_union() fails due to an allocation failure, then close_time()
will attempt to fclose users_fp and login_fp a second time.

This bug was originally introduced in commit
be95b52c2d0c21b1fe92f9f90166fc2fa8eecc95, and has been present in
every krb5 release since 1.1.

(cherry picked from commit 0b8c6f3e1e8e561aa56a7d4e2171320119991dae)

ticket: 8768
version_fixed: 1.17

6 years agoRemove incorrect KDC assertion
Isaac Boukris [Sat, 15 Dec 2018 09:56:36 +0000 (11:56 +0200)] 
Remove incorrect KDC assertion

The assertion in return_enc_padata() is reachable because
kdc_make_s4u2self_rep() may have previously added encrypted padata.
It is no longer necessary because the code uses add_pa_data_element()
instead of allocating a new list.

CVE-2018-20217:

In MIT krb5 1.8 or later, an authenticated user who can obtain a TGT
using an older encryption type (DES, DES3, or RC4) can cause an
assertion failure in the KDC by sending an S4U2Self request.

[ghudson@mit.edu: rewrote commit message with CVE description]

(cherry picked from commit 94e5eda5bb94d1d44733a49c3d9b6d1e42c74def)

ticket: 8767
version_fixed: 1.17

6 years agoIgnore password attributes for S4U2Self requests
Isaac Boukris [Mon, 3 Dec 2018 00:33:07 +0000 (02:33 +0200)] 
Ignore password attributes for S4U2Self requests

For consistency with Windows KDCs, allow protocol transition to work
even if the password has expired or needs changing.

Also, when looking up an enterprise principal with an AS request,
treat ERR_KEY_EXP as confirmation that the client is present in the
realm.

[ghudson@mit.edu: added comment in kdc_process_s4u2self_req(); edited
commit message]

(cherry picked from commit 5e6d1796106df8ba6bc1973ee0917c170d929086)

ticket: 8763
version_fixed: 1.17

6 years agoUpdate for krb5-1.17-beta2 krb5-1.17-beta2
Greg Hudson [Wed, 5 Dec 2018 16:15:23 +0000 (11:15 -0500)] 
Update for krb5-1.17-beta2

6 years agoFix spelling of auth_to_local example
Simo Sorce [Thu, 29 Nov 2018 21:47:48 +0000 (16:47 -0500)] 
Fix spelling of auth_to_local example

(cherry picked from commit 23ef16ac32554e547ac42a9cb79d9040af8de5ba)

ticket: 8762
version_fixed: 1.17

6 years agoDocument necessary delay in master key rolllover
Greg Hudson [Mon, 26 Nov 2018 18:37:46 +0000 (13:37 -0500)] 
Document necessary delay in master key rolllover

During master key rollover, if the old master key is purged
immediately after updating principal encryption, running processes may
not successfully update their in-memory copies of the master key.
Document that the administrator should delay purging the master key
until after propagation and some daemon activity.

(cherry picked from commit 24425b730161c3d27d86a7ae0caa2305f70167f6)

ticket: 8744
version_fixed: 1.17

6 years agoFix spurious errors from kcmio_unix_socket_write
Robbie Harwood [Mon, 5 Nov 2018 18:49:52 +0000 (13:49 -0500)] 
Fix spurious errors from kcmio_unix_socket_write

Commit 33634a940166d0b21c3105bab8dcf5550fbbd678 accidentally changed
the return value from kcmio_unix_socket_write to be the result of the
write call.  Most commonly this resulted in it returning 8, which led
to many commands failing with "Exec format error".

(cherry picked from commit 3e76ea104cdaf22c4537833b203f8aeed1691f18)

ticket: 8758
version_fixed: 1.17

6 years agoUpdate for krb5-1.17-beta1-postrelease
Greg Hudson [Wed, 31 Oct 2018 22:38:37 +0000 (18:38 -0400)] 
Update for krb5-1.17-beta1-postrelease

6 years agoUpdate for krb5-1.17-beta1 krb5-1.17-beta1
Greg Hudson [Wed, 31 Oct 2018 18:20:38 +0000 (14:20 -0400)] 
Update for krb5-1.17-beta1

6 years agoUpdate README for krb5-1.17
Greg Hudson [Tue, 30 Oct 2018 17:54:33 +0000 (13:54 -0400)] 
Update README for krb5-1.17

6 years agoUpdate features list for 1.17 867/head
Greg Hudson [Sat, 27 Oct 2018 21:48:26 +0000 (17:48 -0400)] 
Update features list for 1.17

6 years agoUpdate auto-generated files
Greg Hudson [Sat, 27 Oct 2018 00:26:48 +0000 (20:26 -0400)] 
Update auto-generated files

Regenerate dependency files and mit-krb5.pot.  Regenerate man pages
and NOTICE with python-sphinx 1.6.7.  Regenerate deltat.c with bison
3.0.4.  Update config.guess and config.sub from upstream (commit
2fa97a8a0ed37bec720bd118d65e674cebf50404).

6 years agoRetry KCM writes once on remote hangup 863/head
Robbie Harwood [Tue, 16 Oct 2018 19:19:46 +0000 (15:19 -0400)] 
Retry KCM writes once on remote hangup

sssd's KCM daemon has a client timeout (typically 60 seconds).  Add
reconnection logic to kcmio_unix_socket_write() to allow this
behavior, and to potentially allow for the daemon to be upgraded.

[ghudson@mit.edu: adjusted commit message, comment, and code slightly]

ticket: 8760 (new)

6 years agoImprove code hygiene of kdb5_util dump helpers 866/head
Greg Hudson [Thu, 25 Oct 2018 16:55:50 +0000 (12:55 -0400)] 
Improve code hygiene of kdb5_util dump helpers

kdb5_util dump can very briefly leak a file handle if the ok file
cannot be locked, or if the existing dump file cannot be read.  Add a
cleanup handler to prep_ok_file() and use proper output parameter
handling.  Change current_dump_sno_in_ulog() to close its file handle
before checking the result of fgets().  Reported by Bean Zhang.

6 years agoFix minor leak in kadmind password change dispatch
Greg Hudson [Thu, 25 Oct 2018 16:21:45 +0000 (12:21 -0400)] 
Fix minor leak in kadmind password change dispatch

In the unlikely event that kadmind cannot resolve the KDB keytab in
schpw.c:dispatch(), don't leak the error message.  Reported by Bean
Zhang.

6 years agoFix leak on error in kadm5 randkey handling
Greg Hudson [Thu, 25 Oct 2018 15:56:58 +0000 (11:56 -0400)] 
Fix leak on error in kadm5 randkey handling

An attempt to change the kadmin/history key with the -keepold flag
would leak the KDB entry and keysalt tuple as it returned an error.
Use the cleanup handler instead of returning directly.  Reported by
Bean Zhang.

ticket: 8759
tags: pullup
target_version: 1.16-next
target_version: 1.15-next

6 years agoDocument aliases for enterprise get_principal 865/head
Greg Hudson [Wed, 24 Oct 2018 03:00:24 +0000 (23:00 -0400)] 
Document aliases for enterprise get_principal

Enterprise principals are always aliases.  In most contexts when we
see them we pass KRB5_KDB_FLAG_ALIAS_OK to the KDB module's
get_principal method, but for S4U2Self clients we currently do not.
Document that a KDB module may return an alias for enterprise
principals regardless of flags.

6 years agoUpdate README in src/man 861/head
Robbie Harwood [Mon, 15 Oct 2018 18:53:05 +0000 (14:53 -0400)] 
Update README in src/man

6 years agoUpdate man pages to reference kerberos(7)
Robbie Harwood [Mon, 15 Oct 2018 19:19:12 +0000 (15:19 -0400)] 
Update man pages to reference kerberos(7)

Remove broken references to old kerberos(1).  Reference kerberos(7)
from all man pages, and create/update their environment section so
that it references kerberos(7).

ticket: 8755

6 years agoModernize kerberos(7)
Robbie Harwood [Mon, 15 Oct 2018 17:20:30 +0000 (13:20 -0400)] 
Modernize kerberos(7)

Update environment variable descriptions, using env_variables.rst as a
guide.  Replace the content in env_variables.rst with a pointer to
documentation at kerberos(7) so that we don't break external links and
don't duplicate content.

Replace references to rlogin.  Clarify and modernize other language.

ticket: 8755

6 years agoBring back general kerberos man page
Robbie Harwood [Tue, 9 Oct 2018 21:05:10 +0000 (17:05 -0400)] 
Bring back general kerberos man page

Restore the content of kerberos(1) as it stood in
0f81e372a2830c9170f6e08dfa956841d0ebdfb1.  Convert to ReST to match
the other man pages, and install it as the more appropriate
kerberos(7).

Build kerberos(7) and check it in to avoid breaking the build.

ticket: 8755 (new)
tags: pullup
target_version: 1.16-next

6 years agoAdd GSS_KRB5_NT_ENTERPRISE_NAME name type 857/head
Isaac Boukris [Mon, 15 Oct 2018 15:33:15 +0000 (18:33 +0300)] 
Add GSS_KRB5_NT_ENTERPRISE_NAME name type

Add a new name-type OID which causes a string to be imported as an
enterprise name.  This is useful for authenticating and impersonating
users with their UPN names.

Resurrect t_imp_name test to exercise importing of the new name OID.
Also add a test using the new name in cross-realm protocol transition,
to exercise s4u_identify_user() with multiple realms.

[ghudson@mit.edu: added Windows export entry; adjusted comments and
test code; edited commit message]

ticket: 8756 (new)

6 years agoStart S4U2Self realm lookup at server realm
Isaac Boukris [Tue, 23 Oct 2018 09:52:41 +0000 (12:52 +0300)] 
Start S4U2Self realm lookup at server realm

When looking up the realm of an enterprise principal, start with the
realm of the server instead of the realm attached to the enterprise
name, as specified in [MS-SFU] 3.1.5.1.1.1.

[ghudson@mit.edu: simplified out client_data+client into just client;
edited commit message]

ticket: 8757 (new)

6 years agoDon't dump policies if principals are specified 862/head
Greg Hudson [Mon, 15 Oct 2018 22:32:31 +0000 (18:32 -0400)] 
Don't dump policies if principals are specified

If kdb5_util dump is asked to filter for specific principals, do not
dump the policy database.

ticket: 8752 (new)

6 years agoFix up kdb5_util documentation
Greg Hudson [Mon, 15 Oct 2018 22:00:35 +0000 (18:00 -0400)] 
Fix up kdb5_util documentation

In kdb5_util.rst, reorder the main option summary to match the order
they are documented in below, and document the -x option.  Remove the
kdb5_util create -h switch case as 'h' has never been in the getopt
string.  Add the -r18 option to the kdb5_util dump and load option
summaries.  Reword the kdb5_util load -hash option.  Remove the
nonexistent kdb5_util load dbname parameter.

In database.rst, alter the example for loading a single principal to
use the dump principal filtering functionality, as that functionality
does not currently exist for load.

In the kdb5_util usage error message, reorder the main options to
match the order in the documentation and to fit within 79 columns.
Also add the -P option.

ticket: 8751 (new)
tags: pullup
target_version: 1.16-next

6 years agoFix up some strings in recent t_pac.c tests 860/head
Isaac Boukris [Sat, 13 Oct 2018 13:36:55 +0000 (16:36 +0300)] 
Fix up some strings in recent t_pac.c tests

ticket: 8749

6 years agoAdd test for cross realm S4U2Self using referrals
Isaac Boukris [Sat, 13 Oct 2018 13:27:02 +0000 (16:27 +0300)] 
Add test for cross realm S4U2Self using referrals

[ghudson@mit.edu: factored out tgtname() in kdb_test.c; added trace
messages to tests and removed old redundant test]

ticket: 8747

6 years agoUse port-sockets.h macros in cc_kcm, sendto_kdc 859/head
Greg Hudson [Mon, 15 Oct 2018 23:12:45 +0000 (19:12 -0400)] 
Use port-sockets.h macros in cc_kcm, sendto_kdc

Use SOCKET_CONNECT in cc_kcm.c and sendto_kdc.c to prevent SIGPIPE on
BSD-like systems.  Use other port-sockets.h macros in cc_kcm.c in case
it is ever used on Windows.

ticket: 8753

6 years agoPrevent SIGPIPE from socket writes on UNIX-likes
Robbie Harwood [Fri, 12 Oct 2018 20:57:05 +0000 (16:57 -0400)] 
Prevent SIGPIPE from socket writes on UNIX-likes

When writing to a disconnected socket, try to only get EPIPE rather
than taking down the process with SIGPIPE.

On recent Linux and other systems which have it, switch from writev to
sendmsg and pass MSG_NOSIGNAL.

On BSD-likes, set SO_NOSIGPIPE at connect time.

ticket: 8753 (new)

6 years agoCorrect kpasswd_server description in krb5.conf(5) 864/head
Robbie Harwood [Tue, 16 Oct 2018 21:32:29 +0000 (17:32 -0400)] 
Correct kpasswd_server description in krb5.conf(5)

ticket: 8754 (new)
tags: pullup
target_version: 1.16-next

6 years agoFix 64-bit Windows socket write error handling 855/head
Greg Hudson [Thu, 4 Oct 2018 22:10:48 +0000 (18:10 -0400)] 
Fix 64-bit Windows socket write error handling

Add casts to ensure that the result type of SOCKET_WRITEV() on Windows
can represent -1.  Otherwise it will be treated as 2^32-1 when cast to
ssize_t on 64-bit Windows, which can lead to crashes in
krb5_sendto_kdc().  Reported by Puran Chand.

ticket: 8746 (new)
tags: pullup
target_version: 1.13-next

6 years agoAdd more constraints to S4U2Self processing 853/head
Isaac Boukris [Fri, 5 Oct 2018 11:43:51 +0000 (14:43 +0300)] 
Add more constraints to S4U2Self processing

Of the eight possible combinations of local or cross TGT, local or
non-local user, and local server or referral, four are valid.  The
previous commit rejects two of the invalid cases (local TGT and
referral, with local or non-local user).  Document the four valid
cases and reject the remaining two invalid combinations.

[ghudson@mit.edu: rewrote commit message; added comment documenting
valid combinations; adjusted style and comments]

ticket: 8748 (new)

6 years agoAllow referrals for cross-realm S4U2Self requests
Isaac Boukris [Fri, 5 Oct 2018 11:14:32 +0000 (14:14 +0300)] 
Allow referrals for cross-realm S4U2Self requests

According to MS-SFU 3.2.5.1.1, the KDC should issue a referral for
S4U2Self requests if the requesting service is not in the KDC's realm.
Commit 8a9909ff9ef6b51c5ed09ead6713888fbb34072f explicitly prevents
referrals for S4U2Self requests; on further analysis, this appears to
have been preserving a bug rather than applying a proper constraint.
However, we should not issue referrals for within-realm S4U2Self
requests.  (This should only come up if a server possesses a TGT but
its principal entry has been deleted.)

Remove the S4U2Self referral check in process_tgs_req().  Instead add
a more specific check in kdc_process_s4u2self_req(), adding new
parameters for the header server principal and a flag indicating
whether a referral is indicated.

[ghudson@mit.edu: rewrote commit message; adjusted style slightly]

ticket: 8747 (new)