]> git.ipfire.org Git - thirdparty/krb5.git/log
thirdparty/krb5.git
6 years agoRemove more dead code 922/head
Robbie Harwood [Thu, 9 May 2019 18:07:24 +0000 (14:07 -0400)] 
Remove more dead code

6 years agoImprove error messages from kadmin change_password
Robbie Harwood [Mon, 6 May 2019 17:13:16 +0000 (13:13 -0400)] 
Improve error messages from kadmin change_password

The checks for missing option arguments were dead code, because the
loop condition requires at least two remaining arguments.  Instead
check for at least one argument with a leading "-", and check for too
many or too few arguments after the loop.  Add an initial message for
unrecognized options.

[ghudson@mit.edu: adjusted logic to improve mesages in more cases]

6 years agoSimply OpenSSL PKCS7 decryption code
Robbie Harwood [Mon, 6 May 2019 17:13:06 +0000 (13:13 -0400)] 
Simply OpenSSL PKCS7 decryption code

Fold pkcs7_decrypt() and pkcs7_dataDecode() into a single function,
and make it output the plaintext rather than a BIO.

[ghudson@mit.edu: continued a modernization of pkcs7_dataDecode() into
a larger refactoring]

6 years agoAdd a Travis job to build with OpenSSL crypto 927/head
Robbie Harwood [Mon, 6 May 2019 18:29:53 +0000 (14:29 -0400)] 
Add a Travis job to build with OpenSSL crypto

[ghudson@mit.edu: simplified configure option passing]

6 years agoAvoid alignment warnings in openssl rc4.c
Robbie Harwood [Mon, 6 May 2019 19:14:49 +0000 (15:14 -0400)] 
Avoid alignment warnings in openssl rc4.c

Add a comment to k5_arcfour_init_state() explaining how we stretch the
krb5_data cipher state contract.  Use void * casts when interpreting
the data pointer to avoid alignment warnings.

[ghudson@mit.edu: moved and expanded comment; rewrote commit message]

6 years agoRename hmac() function 926/head
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]

ticket: 8803 (new)
tags: pullup
target_version: 1.17-next

6 years agoSimplify SAM-2 as_key handling 924/head
Greg Hudson [Sun, 5 May 2019 22:53:27 +0000 (18:53 -0400)] 
Simplify SAM-2 as_key handling

The ctx->gak_fct() call in sam2_process() used an empty salt instead
of the default salt when the KDC did not supply an explicit salt.
This bug arose when commit bc096a77ffdab283d77c2e0fc1fdd15b9f77eb41
changed the internal contracts around salts but did not adjust the
SAM-2 code.  Commit e9aa891fcdb4c08d39902ab89afb268042b60c86 fixed the
resulting bug, but mistakenly did not adjust the gak_fct call to use
the correct salt.

Later on, the code contains a redundant call to krb5_c_string_to_key()
in the non-USE_SAD_AS_KEY modes, replacing ctx->as_key.  This call was
properly adjusted by commit e9aa891fcdb4c08d39902ab89afb268042b60c86,
so the improper gak_fct call did not manifest as a bug.

Fix the gak_fct call to supply the correct salt, and remove the
redundant string_to_key operation.

6 years agoRemove outdated text in krb5kdc/kadmind man pages 925/head
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.

ticket: 8802 (new)
tags: pullup
target_version: 1.17-next

6 years agoModernize exit path in gss_krb5int_copy_ccache()
Robbie Harwood [Thu, 2 May 2019 18:32:33 +0000 (14:32 -0400)] 
Modernize exit path in gss_krb5int_copy_ccache()

Move to a single lock / single unlock paradigm, and eliminate some
dead code in the old error handling.

6 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]

ticket: 8801 (new)
tags: pullup
target_version: 1.17-next
target_version: 1.16-next

6 years agoInitialize some data structure magic fields
Robbie Harwood [Thu, 2 May 2019 17:36:38 +0000 (13:36 -0400)] 
Initialize some data structure magic fields

Static analyzers may complain if they see a data structure copied with
an uninitialized field, even if the copy target won't use the field.
Add magic field initializers in three such places.

[ghudson@mit.edu: rewrote commit message]

6 years agoUse secure_getenv() where appropriate 921/head
Greg Hudson [Wed, 24 Apr 2019 20:19:50 +0000 (16:19 -0400)] 
Use secure_getenv() where appropriate

ticket: 8800

6 years agoAdd secure_getenv() support
Greg Hudson [Wed, 24 Apr 2019 19:56:43 +0000 (15:56 -0400)] 
Add secure_getenv() support

On systems with secure_getenv() (glibc 2.17+) use it directly.  For
the fallback implementation, check the current process uids and gids
in a library initializer, looking at the saved uid and gid where
possible.  Include a comment about more aggressive approaches to
detecting elevated privilege.

ticket: 8800 (new)

6 years agoCheck more errors in OpenSSL crypto backend 919/head
Greg Hudson [Mon, 22 Apr 2019 18:26:42 +0000 (14:26 -0400)] 
Check more errors in OpenSSL crypto backend

In krb5int_hmac_keyblock() and krb5int_pbkdf2_hmac(), check for errors
from previously unchecked OpenSSL function calls and return
KRB5_CRYPTO_INTERNAL if they fail.

HMAC_Init() is deprecated in OpenSSL 1.0 and later; as we are
modifying the call to check for errors, call HMAC_Init_ex() instead.

ticket: 8799 (new)

6 years agoSimplify libreadline configure support 920/head
Greg Hudson [Tue, 23 Apr 2019 16:41:11 +0000 (12:41 -0400)] 
Simplify libreadline configure support

If configure is explicitly asked to build with libreadline, look for
and link against only -lreadline, relying on the platform to resolve
any dependencies.

ticket: 8795

6 years agoFix gss_get_mic_iov() example code 917/head
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.

ticket: 8797
tags: pullup
target_version: 1.17-next

6 years agoFix potential close(-1) in cc_file.c 918/head
Robbie Harwood [Thu, 18 Apr 2019 17:39:37 +0000 (13:39 -0400)] 
Fix potential close(-1) in cc_file.c

As part of error handling in d3b39a8bac6206b5ea78b0bf6a2958c1df0b0dd5,
an error path in delete_cred() may result in close(-1).  While this
shouldn't be a prolblem in practice (just returning EBADF), it does
upset Coverity.

ticket: 8792

6 years agoRemove ovsec_adm_export dump format support 914/head
Robbie Harwood [Tue, 22 Jan 2019 23:34:58 +0000 (18:34 -0500)] 
Remove ovsec_adm_export dump format support

Dumping only suported single-DES principals.  While importing still
functioned, it would only have been useful for extremely old (1.3-era)
KDCs.

ticket: 8798 (new)

6 years agoRemove confvalidator utility
Robbie Harwood [Wed, 3 Apr 2019 18:58:19 +0000 (14:58 -0400)] 
Remove confvalidator utility

This utility has not been maintained with encryption types and salt
changes, which suggests it is unused.

6 years agoDocument default realm for krb5kdc 916/head
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.

ticket: 8796
tags: pullup
target_version: 1.17-next

6 years agoFix config realm change logic in FILE remove_cred 915/head
Greg Hudson [Tue, 16 Apr 2019 14:47:35 +0000 (10:47 -0400)] 
Fix config realm change logic in FILE remove_cred

Use data_eq_string() to check the server realm, and do not check if
cred->server is NULL since it is not expected to be (and
k5_marshal_cred() would have already crashed if it were).

ticket: 8792

6 years agoRemove Kerberos v4 support vestiges from ccapi 913/head
Robbie Harwood [Thu, 4 Apr 2019 18:37:38 +0000 (14:37 -0400)] 
Remove Kerberos v4 support vestiges from ccapi

6 years agoRemove doxygen-generated HTML output for ccapi
Robbie Harwood [Thu, 4 Apr 2019 18:15:58 +0000 (14:15 -0400)] 
Remove doxygen-generated HTML output for ccapi

6 years agoRemove ccapi-related comments in configure.ac
Robbie Harwood [Wed, 3 Apr 2019 20:01:22 +0000 (16:01 -0400)] 
Remove ccapi-related comments in configure.ac

These suggested ccapi is buildable on non-Windows, and empirically it
is not.

6 years agoRemove kadmin RPC support for setting v4 key
Robbie Harwood [Thu, 4 Apr 2019 20:14:46 +0000 (16:14 -0400)] 
Remove kadmin RPC support for setting v4 key

ticket: 8794 (new)

6 years agoRemove srvtab support
Robbie Harwood [Mon, 9 Oct 2017 19:58:33 +0000 (15:58 -0400)] 
Remove srvtab support

Also change internal names from "srvtab" to "keytab" where the old
name was used.

ticket: 8793 (new)

6 years agoImplement krb5_cc_remove_cred for remaining types 911/head
Robbie Harwood [Mon, 1 Apr 2019 18:28:48 +0000 (14:28 -0400)] 
Implement krb5_cc_remove_cred for remaining types

Previously, only KCM and MSLA implemented credential removal.  Add
support for FILE (and therefore DIR), MEMORY, and KEYRING.

The FILE logic is similar Heimdal's implementation, with additional
logic for skipping removed creds during iteration.  In addition to
setting endtime to 0 and changing the realm for config entries as
Heimdal does, we set authtime to -1 to make deleted entries
distinguishable from gssproxy encrypted creds and config entries.

For MEMORY, leave behind empty list elements when removing a cred will
leave behind an empty list element, in case an iterator holds a
pointer to that element.

[ghudson@mit.edu: edited commit message; made minor style and comment
changes; fixed memory leaks detected by asan]

ticket: 8792 (new)

6 years agoClarify header comment for krb5_cc_start_seq_get()
Robbie Harwood [Tue, 2 Apr 2019 18:18:57 +0000 (14:18 -0400)] 
Clarify header comment for krb5_cc_start_seq_get()

Previously this comment seemed to suggest that applications needed to
block all other access to the ccache (including by other processes)
during iteration.

6 years agoAdd SPAKE's t_vectors to .gitignore 910/head
Robbie Harwood [Mon, 1 Apr 2019 15:28:59 +0000 (11:28 -0400)] 
Add SPAKE's t_vectors to .gitignore

6 years agoSuppress krb5_cc_start_seq_get() popups in Leash 909/head
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.

ticket: 8790
tags: pullup
target_version: 1.17-next

6 years agoAdd option to build without libkeyutils 905/head
Robert Marshall [Wed, 13 Mar 2019 03:20:06 +0000 (23:20 -0400)] 
Add option to build without libkeyutils

Add a --without-keyutils option to disable the keyring ccache, for
scenarios where minimizing libkrb5 dependencies is important.

[ghudson@mit.edu: moved processing to configure.ac; added error if
explicit --without-keyutils is given and libkeyutils is not found;
nested persistent keyring check for clarity; moved new documentation
to appropriate place and don't mention persistent keyrings; rephrased
commit message]

ticket: 8791 (new)

6 years agoFix memory leak in test KDB module 908/head
Greg Hudson [Tue, 19 Mar 2019 16:22:33 +0000 (12:22 -0400)] 
Fix memory leak in test KDB module

test_get_s4u_x509_principal() needs to free canon before exiting.

6 years agoFix free of auth context memory replay cache 907/head
Greg Hudson [Tue, 19 Mar 2019 15:22:08 +0000 (11:22 -0400)] 
Fix free of auth context memory replay cache

Also fix a memory leak in t_memrcache.c.

ticket: 8785

6 years agoUse zapfreedata() where appropriate 906/head
Greg Hudson [Thu, 14 Mar 2019 15:54:00 +0000 (11:54 -0400)] 
Use zapfreedata() where appropriate

6 years agoAdd zapfreedata() convenience function
Greg Hudson [Thu, 14 Mar 2019 15:26:44 +0000 (11:26 -0400)] 
Add zapfreedata() convenience function

6 years agoAdd tests for S4U2Self with certificate 887/head
Isaac Boukris [Thu, 17 Jan 2019 09:36:46 +0000 (11:36 +0200)] 
Add tests for S4U2Self with certificate

[ghudson@mit.edu: fixed memory leaks in test KDB method]

ticket: 8781

6 years agoAdd KDC support for X.509 S4U2Self requests
Isaac Boukris [Wed, 16 Jan 2019 22:23:25 +0000 (00:23 +0200)] 
Add KDC support for X.509 S4U2Self requests

Add a KDB function krb5_db_get_s4u_x509_principal() and an associated
method in the DAL, bumping the minor version and cleaning up a
leftover comment in the table from major version 6.

When processing an AS-REQ, look up the client principal by certificate
if the request contains a non-empty PA-S4U-X509-USER value.  When
processing an S4U2Self TGS-REQ, allow requests with certificates, and
look up the client principal by certificate if one is presented.

[ghudson@mit.edu: factored out lookup_client() in AS code; rewrote
commit message and some comments; adjusted flow control changes in
kdc_process_s4u_x509_user()]

ticket: 8781 (new)

6 years agoExpand S4U2Self exception in KDC lineage check
Isaac Boukris [Tue, 15 Jan 2019 00:53:25 +0000 (02:53 +0200)] 
Expand S4U2Self exception in KDC lineage check

An S4U2Self TGS-REQ using only a certificate to identify the user will
not include PA-FOR-USER, so we need to check both types when making an
exception in the lineage check.  (S4U2Self requests are allowed to
bypass the lineage check because cross-realm S4U2Self ends with a
backwards cross-realm request to the server realm.)

[ghudson@mit.edu: factored out padata check; deindented the code block
by combining conditionals; rewrote commit message]

ticket: 8780 (new)

6 years agoAdd new kvno protocol transition options
Isaac Boukris [Tue, 8 Jan 2019 05:19:20 +0000 (07:19 +0200)] 
Add new kvno protocol transition options

Add kvno -I to do S4U2Self without treating the principal as an
enterprise name (as -U does).  Add kvno -F to do S4U2Self with an
X.509 certificate.

[ghudson@mit.edu: changed code to read cert in PEM format; updated RST
man page instead of generated nroff file, and regenerated nroff file]

ticket: 8778 (new)

6 years agoFix client code for S4U2Self with certificate
Isaac Boukris [Fri, 11 Jan 2019 08:49:19 +0000 (10:49 +0200)] 
Fix client code for S4U2Self with certificate

During realm identification, don't send the certificate in the AS
request if we have an enterprise name, for consistency with the
Windows LSA API behavior.  If we are using just a certificate, use the
appropriate client principal name type with a single empty data
component.

krb5int_process_tgs_reply() needs to see an S4U2Self padata type in
in_padata to apply the correct logic when verifying the client
principal in the reply.  If we are using only a certificate, we
currently do not pass any in_padata (because we do not send
PA-FOR-USER in this case, and the PA-S4U-X509-USER is constructed via
a callback).  Change the code to place an empty PA-S4U-X509-USER in
in_padata, to be modified by the callback; that way we can reliably
detect the S4U2Self case when processing the reply.

In krb5_get_self_cred_from_kdc(), when constructing an empty client
principal for a cert-only S4U2Self request, properly terminate the
krb5_build_principal_ext() argument list to avoid a crash.  Don't
bother setting the name type as it isn't sent.

Only send the certificate in the first TGS-REQ to the client realm.
To the intermediate and final realms, send the principal name only.
Use the checksum-protected principal name in the first KDC's
PA-S4U-X509-USER response for subsequent requests and to verify the
unprotected client name in the final reply.

After receiving the final reply, check if we had cached credentials
under the discovered client name (unless it's the same as the input
client name) and return the cached credentials if we find them.

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

ticket: 8777

6 years agoUse memory replay cache for DO_TIME auth contexts 901/head
Greg Hudson [Fri, 1 Mar 2019 02:28:43 +0000 (21:28 -0500)] 
Use memory replay cache for DO_TIME auth contexts

Instead of requiring the caller to set up a persistent replay cache
for KRB-PRIV/KRB-SAFE/KRB-CRED messages produced in DO_TIME auth
contexts, use an in-memory replay cache.

Update the API documentation for the affected functions and correct
some inaccuracies.

ticket: 8785 (new)

6 years agoAdd memory replay cache facility
Greg Hudson [Thu, 28 Feb 2019 16:47:26 +0000 (11:47 -0500)] 
Add memory replay cache facility

Add a k5_memrcache type which can efficiently detect replayed tags
without any persistence or inteprocess sharing.  Also add unit tests.

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

ticket: 8789 (new)
tags: pullup
target_version: 1.17-next

6 years agoImprove S4U2Self realm identification internals 890/head
Greg Hudson [Wed, 2 Jan 2019 21:54:28 +0000 (16:54 -0500)] 
Improve S4U2Self realm identification internals

Realm identification for S4U2Self requests ([MS-SFU] 3.1.5.1.1.1) uses
the AS code path with some differences: we might want to include a
subject certificate in pa-data, we want to stop as soon as we get a
reply indicating which realm the client is in, and we want to
communicate that realm to the caller.  The current method of making
these changes is fragile--it uses an optimistic preauth type but does
not actually pre-authenticate, and it assumes that the AS code will
terminate with a predictable error if there is no prompter and a
trivial GAK function.

Instead, add fields to krb5_get_init_creds_context for realm
identification, and support them in the AS state machine, making sure
never to invoke preauth modules.  Add a new library-internal function
k5_identify_realm() to set up an appropriate context, run the state
machine, and copy out the client principal of the last request on
success.

6 years agoUpdate comment in lock_file.c
Greg Hudson [Mon, 4 Mar 2019 21:11:11 +0000 (16:11 -0500)] 
Update comment in lock_file.c

Gnu libc commit 06ab719d30b01da401150068054d3b8ea93dd12f fixed the OFD
locking issue on 32-bit Linux.  We still need to work around the bug
for older versions, but update the comment to note the release in
which the bug was fixed.

6 years agoFix ASN.1 test secure cookie comparison 903/head
Greg Hudson [Mon, 4 Mar 2019 16:07:45 +0000 (11:07 -0500)] 
Fix ASN.1 test secure cookie comparison

One of the comparisons in ktest_equal_secure_cookie() was
tautological.  Use scalar_equal() for consistency with other tests.
Also use scalar_equal() in ktest_equal_kkdcp_message().

6 years agoRename configure.in to configure.ac 902/head
Greg Hudson [Sun, 3 Mar 2019 20:42:04 +0000 (15:42 -0500)] 
Rename configure.in to configure.ac

autotools plans to drop support for the name configure.in.
(automake's NEWS file expresses plans to drop support for it in
autoconf 2.0; autoconf added a warning in commit
560f16b52d3d3db1536d9ca5b863ce9b1a5c9e35, indicating in the commit
message that support will be dropped in a future version.)

ticket: 8788 (new)

6 years agoFix memory leak in 'none' replay cache type 897/head
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]

ticket: 8783
tags: pullup
target_version: 1.17-next
target_version: 1.16-next

6 years agoUse better name type for PKINIT KDC certs 898/head
Greg Hudson [Mon, 18 Feb 2019 00:51:35 +0000 (19:51 -0500)] 
Use better name type for PKINIT KDC certs

RFC 4120 recommends NT-SRV-INST for krbtgt principals; use it in
PKINIT KDC certificates rather than NT-PRINCIPAL.  Regenerate test
certificates.  Reported by Rick van Rein.

ticket: 8784 (new)

6 years agoModernize KRB-PRIV/KRB-SAFE/KRB-CRED functions 896/head
Greg Hudson [Fri, 15 Feb 2019 16:59:06 +0000 (11:59 -0500)] 
Modernize KRB-PRIV/KRB-SAFE/KRB-CRED functions

In krb5_mk_safe(), krb5_mk_priv(), krb5_mk_ncred(), krb5_rd_safe(),
and krb5_rd_priv(), modify naming, formatting, and memory management
to meet current standards.  Add k5_privsafe helpers to generate replay
data and addresses and to store replay records.  For krb5_mk_ncred(),
expand the contract of the encoding function to be similar to the
other two krb5_mk functions, and use pointer aliases to reduce the
number of copies required.

6 years agoProperly size #ifdef in k5_cccol_lock() 895/head
Robbie Harwood [Thu, 14 Feb 2019 16:50:35 +0000 (11:50 -0500)] 
Properly size #ifdef in k5_cccol_lock()

The cleanup code only could get executed in the USE_CCAPI_V3 case, so
move it inside that block.  Reported by Coverity.

6 years agoProcess SPNEGO error tokens through mech 885/head
Luke Howard [Fri, 28 Dec 2018 12:13:05 +0000 (23:13 +1100)] 
Process SPNEGO error tokens through mech

In the SPNEGO initiator code, if the acceptor returns a token with
negState=REJCET and a mechanism token, process the token through the
mech to get a better error status.

[ghudson@mit.edu: modified approach for clarity and to prevent some
edge cases; rewrote commit message]

ticket: 8775 (new)

6 years agoSimplify negState choice in SPNEGO initiator
Greg Hudson [Tue, 22 Jan 2019 17:07:54 +0000 (12:07 -0500)] 
Simplify negState choice in SPNEGO initiator

In the SPNEGO initiator code, simplify the choice of the outgoing
negState value, and remember the acceptor negState choice throughout
the process.  The outgoing negState value is REJECT if sending an
error token, ACCEPT_COMPLETE when sending a final MIC, and
ACCEPT_INCOMPLETE otherwise.

RFC 4178 permits negState to be omitted in some cases, so rename
ACCEPT_DEFECTIVE_TOKEN to UNSPECIFIED for clarity.  Use this value as
the acceptor negState for the first pass through
spnego_gss_init_sec_context() when there is no acceptor token.

Decide whether to return GSS_S_COMPLETE or GSS_S_CONTINUE_NEEDED at
the end of processing, instead of it being a shared responsibility of
the helper functions.  Return GSS_S_COMPLETE on success in the helper
functions and use "goto cleanup" in a few more places.  Leave
handle_mic() alone as it is also used by the acceptor code.

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]

ticket: 8779 (new)
tags: pullup
target_version: 1.17-next

6 years agoMatch ccache functions in krb5.h with export list 893/head
Robbie Harwood [Fri, 13 Jul 2018 20:23:45 +0000 (16:23 -0400)] 
Match ccache functions in krb5.h with export list

Commit 6e83d0bd31721ac86003530dd2450221dd05d0c2 (part of release 1.7)
added new ccache functions to krb5.h, but not to either export list.
Though commit ad5aa12f13aad7ec4cafcffeec4f2e84e56c9c78 exported
krb5_cc_move(), the rest remain unexported.

krb5_cc_lock(), krb5_cc_unlock(), krb5_cccol_lock(), and
krb5_cccol_unlock() are used internally, so remove them from krb5.h
and rename them to k5_cc_lock(), k5_cc_unlock(), k5_cccol_lock(), and
k5_cccol_unlock() respectively.

krb5_cccol_last_change_time() is not used, so remove it.

krb5_cc_last_change_time() is also not used, so remove it as well.
Update ccache interface to reflect removal.  Of particular note, this
function didn't behave as documented for KCM or KEYRING ccaches at
time of removal.

ticket: 7765

6 years agoUpdate doxygen-RST bridge to Python 3 892/head
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__.

ticket: 8774 (new)
tags: pullup
target_version: 1.17-next

6 years agoMark deprecated enctypes when used 891/head
Robbie Harwood [Thu, 10 Jan 2019 21:34:54 +0000 (16:34 -0500)] 
Mark deprecated enctypes when used

Preface ETYPE_DEPRECATED enctypes with "DEPRECATED:" in klist output,
KDC logs, and kadmin interactions.  Also complain in krb5kdc when the
stash file has a deprecated enctype or a deprecated enctype is
requested with -k.

ticket: 8773 (new)

6 years agoMake etype names in KDC logs human-readable
Robbie Harwood [Tue, 8 Jan 2019 22:42:35 +0000 (17:42 -0500)] 
Make etype names in KDC logs human-readable

Introduce enctype_name() as a wrapper over krb5_enctype_to_name for
converting between registered constants and names.  Adjust signatures
and rewrite ktypes2str() and rep_etypes2str() to operate on dynamic
buffers.

ticket: 8772 (new)

6 years agoAdd function and enctype flag for deprecations
Robbie Harwood [Tue, 15 Jan 2019 21:16:57 +0000 (16:16 -0500)] 
Add function and enctype flag for deprecations

krb5int_c_deprecated_enctype() checks for the ETYPE_DEPRECATED flag on
enctypes.  All ENCTYPE_WEAK enctypes are currently deprecated; not all
deprecated enctypes are considered weak.  Deprecations follow RFC 6649
and RFC 8429.

6 years agoIn kpropd, debug-log proper ticket enctype names
Robbie Harwood [Tue, 15 Jan 2019 18:41:16 +0000 (13:41 -0500)] 
In kpropd, debug-log proper ticket enctype names

This change replaces the last call of krb5_enctype_to_string() in our
sources with krb5_enctype_to_name(), ensuring that we log consistently
to users using readily discoverable strings.

6 years agoIn rd_req_dec, always log non-permitted enctypes
Robbie Harwood [Mon, 14 Jan 2019 22:14:42 +0000 (17:14 -0500)] 
In rd_req_dec, always log non-permitted enctypes

The buffer specified in negotiate_etype() is too small for use with
the AES enctypes when used with krb5_enctype_to_string(), so switch to
using krb5_enctype_to_name().

6 years agoAvoid allocating a register in zap() assembly 889/head
Andreas Schneider [Thu, 3 Jan 2019 16:19:32 +0000 (17:19 +0100)] 
Avoid allocating a register in zap() assembly

See https://bugs.llvm.org/show_bug.cgi?id=15495

Also add explicit_bzero() (glibc, FreeBSD) and explicit_memset()
(NetBSD) as alternatives.

[ghudson@mit.edu: added explicit_bzero() and explicit_memset()]

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

6 years agoAddress some optimized-out memset() calls 886/head
Greg Hudson [Sun, 30 Dec 2018 21:40:28 +0000 (16:40 -0500)] 
Address some optimized-out memset() calls

Ilja Van Sprundel reported a list of memset() calls which gcc
optimizes out.  In krb_auth_su.c, use zap() to clear the password, and
remove two memset() calls when there is no password to clear.  In
iakerb.c, remove an unnecessary memset() before setting the only two
fields of the IAKERB header structure.  In svr_principal.c, use
krb5_free_key_keyblock_contents() instead of hand-freeing key data.
In asn1_k_encode.c, remove an unnecessary memset() of the kdc_req_hack
shell before returning.

6 years agoFix build issues with Solaris native compiler 876/head
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]

ticket: 8769 (new)
tags: pullup
target_version: 1.17

6 years agoAdd dns_canonicalize_hostname=fallback support 875/head
Simo Sorce [Tue, 4 Dec 2018 20:22:55 +0000 (15:22 -0500)] 
Add dns_canonicalize_hostname=fallback support

Turn dns_canonicalize_hostname into a tristate variable, allowing the
value "fallback" as well as the true/false booleans.  If it is set to
fallback, delay DNS canonicalization and attempt it only in
krb5_get_credentials() if the KDC responds that the requested server
principal name is unknown.

[ghudson@mit.edu: added TGS tests; refactored code; edited commit
message and documentation]

ticket: 8765 (new)

6 years agoRemove incorrect KDC assertion 882/head
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]

ticket: 8767 (new)
tags: pullup
target_version: 1.17
target_version: 1.16-next
target_version: 1.15-next

6 years agoFix double-close in ksu get_authorized_princ_names 879/head
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.

ticket: 8768 (new)
tags: pullup
target_version: 1.17
target_version: 1.16-next
target_version: 1.15-next

6 years agoAdd ksu option for non-forwardable tickets 872/head
Greg Hudson [Thu, 29 Nov 2018 16:59:25 +0000 (11:59 -0500)] 
Add ksu option for non-forwardable tickets

Add ksu -F and -P options to explicitly not request forwardable and
proxiable tickets.

ticket: 8761

6 years agoIgnore password attributes for S4U2Self requests 874/head
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]

ticket: 8763 (new)
tags: pullup
target_version: 1.17

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

ticket: 8762 (new)
tags: pullup
target_version: 1.17

6 years agoDocument necessary delay in master key rolllover 871/head
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.

ticket: 8744
tags: pullup
target_version: 1.17

6 years agoAdd tests for KCM ccache type 870/head
Greg Hudson [Thu, 22 Nov 2018 05:27:35 +0000 (00:27 -0500)] 
Add tests for KCM ccache type

Using a trivial Python implementation of a KCM server, run the
t_ccache.py tests against the KCM ccache type.

6 years agoClear forwardable flag instead of denying request 869/head
Greg Hudson [Thu, 15 Nov 2018 18:40:43 +0000 (13:40 -0500)] 
Clear forwardable flag instead of denying request

If the client requests a forwardable or proxiable ticket and the
option cannot be honored by policy, issue a non-forwardable or
non-proxiable ticket rather than denying the request.

Add a test script for testing KDC request options and populate it with
tests for the forwardable and proxiable flags.

ticket: 7871

6 years agoFix spurious errors from kcmio_unix_socket_write 868/head
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".

ticket: 8758 (new)
tags: pullup
target_version: 1.17-next

6 years agoUpdates for krb5-1.18-prerelease
Greg Hudson [Tue, 30 Oct 2018 17:58:29 +0000 (13:58 -0400)] 
Updates for krb5-1.18-prerelease

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)

6 years agoFix multiple leaks in ktutil addent 858/head
Greg Hudson [Thu, 11 Oct 2018 19:33:35 +0000 (15:33 -0400)] 
Fix multiple leaks in ktutil addent

In ktutil_add(), free allocations on success as well as failure.
Change all early returns to jumps to the cleanup label.  Free the
password buffer and unparsed principal name.  Do list manipulation as
the final step to simplify cleanup.  Reported by Bean Zhang.

ticket: 8750