]> git.ipfire.org Git - thirdparty/krb5.git/log
thirdparty/krb5.git
3 years agoUpdate copyright years to 2022
Greg Hudson [Wed, 23 Feb 2022 06:27:01 +0000 (01:27 -0500)] 
Update copyright years to 2022

3 years agoRun Windows CI on windows-2019 image for now
Greg Hudson [Wed, 23 Feb 2022 05:31:13 +0000 (00:31 -0500)] 
Run Windows CI on windows-2019 image for now

The Github Actions windows-latest runner label now uses Windows Server
2022, which requires different setup steps for the Visual Studio
environment and does not contain CRT merge modules for VS 2022 (though
it does for VS 2017).  For now, run the Windows build on windows-2019.

3 years agoRemove unneeded SPAKE free_modreq method
Greg Hudson [Fri, 28 Jan 2022 15:44:21 +0000 (10:44 -0500)] 
Remove unneeded SPAKE free_modreq method

Commit ff57dc682a27bd205d715f3c0bed84890f2453c4 removed the use of
per-request module data in SPAKE, but neglected to remove the
corresponding free_modreq method.

ticket: 9049

3 years agoAvoid passing null for asprintf strings 1235/head
Greg Hudson [Fri, 21 Jan 2022 15:58:46 +0000 (10:58 -0500)] 
Avoid passing null for asprintf strings

It is undefined behavior to pass null to a printf function for a %.*s
substitution, even if the accompanying length is zero.  OpenBSD
generates syslog warnings from libc when it sees a null pointer in a
string substitution (reported by Nathanael Rensen).
krb5_sname_to_principal() passes a null pointer in the usual case
where there is no port trailer.  Address this case and others where we
use asprintf() with %.*s substitutions and might pass null, either by
avoiding the use of asprintf() or by ensuring that the pointer isn't
null.

ticket: 9047 (new)

3 years agoPass client flag to KDB for client preauth match 1236/head
Greg Hudson [Tue, 18 Jan 2022 22:06:46 +0000 (17:06 -0500)] 
Pass client flag to KDB for client preauth match

In the kdcpreauth match_client() callback, if it is necessary to look
up the given principal in the KDB, pass KRB5_KDB_FLAG_CLIENT to
krb5_db_get_principal().  Samba requires this flag to properly handle
enterprise client principals.

ticket: 9048 (new)

3 years agoImplement replaced_reply_key input to issue_pac()
Greg Hudson [Thu, 13 Jan 2022 19:33:14 +0000 (14:33 -0500)] 
Implement replaced_reply_key input to issue_pac()

If a kdcpreauth module fully replaces the reply key during an AS
request, pass the reply key as the replaced_reply_key input to
issue_pac().  In Windows environments this is used to provide an NTLM
hash to the LSA when the client cannot be presumed to have a password
to derive it from.

To test this, add a fake PAC_CREDENTIALS_INFO buffer to the PAC in the
test KDB module, and alter adata.c to display the set of PAC buffer
types when a PAC is present.

ticket: 9050 (new)

3 years agoAdd replace_reply_key kdcpreauth callback
Greg Hudson [Thu, 13 Jan 2022 17:58:32 +0000 (12:58 -0500)] 
Add replace_reply_key kdcpreauth callback

Provide an explicit way for kdcpreauth modules to replace the reply
key, and internally track when the reply key is fully replaced (as
opposed to strengthened by replacing it with a derivative of the
client long-term key).  Use this facility in the FAST OTP, PKINIT, and
SPAKE kdcpreauth modules.

ticket: 9049 (new)

3 years agoAdd k5test.py facilities for PKINIT
Greg Hudson [Mon, 24 Jan 2022 16:20:12 +0000 (11:20 -0500)] 
Add k5test.py facilities for PKINIT

Add the global variables pkinit_enabled and pkinit_certs.  Add the
realm flag pkinit=True.  Add the realm method pkinit().  Use these
facilities in t_pkinit.py, t_certauth.py, and t_authdata.py.

3 years agoRemove unimplemented GSSRPC symbols 1222/head
Greg Hudson [Sun, 2 Jan 2022 04:32:58 +0000 (23:32 -0500)] 
Remove unimplemented GSSRPC symbols

3 years agoFactor out PAC checksum verification 1237/head
Greg Hudson [Fri, 14 Jan 2022 07:05:58 +0000 (02:05 -0500)] 
Factor out PAC checksum verification

Reduce code repetition in PAC checksum handling by adding a helper
function.  Remove the unnecessary prefix on several function names.

3 years agoReplace AD-SIGNEDPATH with minimal PACs 1225/head
Greg Hudson [Sat, 8 Jan 2022 03:41:30 +0000 (22:41 -0500)] 
Replace AD-SIGNEDPATH with minimal PACs

Remove all of the AD-SIGNEDPATH code.  Instead, issue a signed minimal
PAC in all tickets and require a valid PAC to be present in all
tickets presented for S4U operations.  Remove the get_authdata_info()
and sign_authdata() DAL methods, and add an issue_pac() method to
allow the KDB to add or copy buffers to the PAC.  Add a disable_pac
realm flag.

Microsoft revised the S4U2Proxy rules for forwardable tickets.  All
S4U2Proxy operations require forwardable evidence tickets, but
S4U2Self should issue a forwardable ticket if the requesting service
has no ok-to-auth-as-delegate bit but also no constrained delegation
privileges for traditional S4U2Proxy.  Implement these rules,
extending the check_allowed_to_delegate() DAL method so that the KDC
can ask if a principal has any delegation privileges.

Combine the KRB5_KDB_FLAG_ISSUE_PAC and
KRB5_FLAG_CLIENT_REFERRALS_ONLY flags into KRB5_KDB_FLAG_CLIENT.

Rename the KRB5_KDB_FLAG_CANONICALIZE flag to
KRB5_KDB_FLAG_REFERRAL_OK, and only pass it to get_principal() for
lookup operations that can use a realm referral.

For consistency with Active Directory, honor the no-auth-data-required
server principal flag for S4U2Proxy but not for S4U2Self.  Previously
we did the reverse.

ticket: 9044 (new)

3 years agoAdd minimal KDC MS-RPCE (NDR) encoder/decoder
Greg Hudson [Sat, 8 Jan 2022 00:58:42 +0000 (19:58 -0500)] 
Add minimal KDC MS-RPCE (NDR) encoder/decoder

Add NDR marshalling functions for S4U_DELEGATION_INFO PAC buffers.

[ghudson@mit.edu: added safety checks; made minor style changes;
edited commit message]

3 years agoAdd PAC ticket signature APIs
Isaac Boukris [Fri, 7 Jan 2022 18:46:24 +0000 (13:46 -0500)] 
Add PAC ticket signature APIs

Microsoft added a third PAC signature over the ticket to prevent
servers from setting the forwardable flag on evidence tickets.  Add
new APIs to generate and verify ticket signatures, as well as defines
for this and other new PAC buffer types.  Deprecate the old signing
functions as they cannot generate ticket signatures.  Modify several
error returns to better match the protocol errors generated by Active
Directory.

[ghudson@mit.edu: adjusted contracts for KDC requirements; simplified
and commented code changes; wrote commit message.  rharwood@redhat.com
also did some work on this commit.]

ticket: 9043 (new)

3 years agoCorrect CKSUMTYPE_SHA1 value and comment
Greg Hudson [Fri, 7 Jan 2022 06:48:40 +0000 (01:48 -0500)] 
Correct CKSUMTYPE_SHA1 value and comment

ticket: 9040

3 years agoDon't fail krb5_cc_select() for no default realm 1234/head
Isaac Boukris [Sun, 26 Dec 2021 01:28:41 +0000 (03:28 +0200)] 
Don't fail krb5_cc_select() for no default realm

If the target server principal is a host-based service without
multiple dotted components and no default realm is configured,
krb5_cc_select() can fail, and therefore gss_init_sec_context().
Continue without filling in the realm in this case.

[ghudson@mit.edu: edited commit message and comment; slightly adjusted
flow control]

ticket: 9042 (new)

3 years agoAdd PA-REDHAT-IDP-OAUTH2 padata type 1231/head
Pavel Březina [Thu, 2 Dec 2021 13:24:35 +0000 (14:24 +0100)] 
Add PA-REDHAT-IDP-OAUTH2 padata type

Recognize the Red Hat IdP preauth mechanism in trace messages, and add
a declaration for it in krb5.h.

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

ticket: 9041 (new)

3 years agoRemove unnecessary flag in macOS build 1233/head
Nikhil Benesch [Wed, 22 Dec 2021 23:58:17 +0000 (18:58 -0500)] 
Remove unnecessary flag in macOS build

The configuration logic for adding the `-search_paths_first` linker
flag on Darwin does not correctly handle cross compilation.  It should
check the value of $krb5_cv_host rather than `uname -s` to detect when
the compilation target is Darwin, rather than the build machine.

It turns out `-search_paths_first` has been the default behavior of ld
on macOS since XCode 4.  So just remove that bit of logic entirely.
(The flag was added in commit acd27af0e845f8b93de2e226cc2ec9ac8af52077
in 2004; XCode 4 was released in 2010.)

[ghudson@mit.edu: edited commit message]

3 years agoUse 14 instead of 9 for unkeyed SHA-1 checksum 1232/head
Greg Hudson [Sat, 11 Dec 2021 06:25:34 +0000 (01:25 -0500)] 
Use 14 instead of 9 for unkeyed SHA-1 checksum

Although MIT krb5 had been using the value 9 for unkeyed SHA-1 since
its 1.0 release in 1996, RFC 3961 instead assigned this value to
rsa-md5-des3 (likely never used), and assigned the values 10 and 14 to
SHA-1.  Heimdal and Microsoft use the value 14.  Unkeyed SHA-1 almost
never appears on the wire, but has been seen in PKINIT asChecksum
fields in replies from Windows KDCs (despite the field being specified
as a keyed checksum).

Define a new symbol CKSUMTYPE_SHA1 with the value 14, and use it where
we currently use CKSUMTYPE_NIST_SHA.  Continue to allow the value 9
for ABI compatibility.  Remove the pkinit_clnt.c workaround as the
value 14 will now work without adjustment.

ticket: 9040 (new)

3 years agoFix PAC handling of authtimes after y2038
Greg Hudson [Thu, 2 Dec 2021 00:35:32 +0000 (19:35 -0500)] 
Fix PAC handling of authtimes after y2038

Remove the unnecessary handling of negative inputs in
k5_time_to_seconds_since_1970() and k5_seconds_since_1970_to_time(),
and cast the krb5_timestamp input to uint32_t to properly handle
values after y2038.

ticket: 9039 (new)

3 years agoFix OpenSSL conditionals for two files
Isaac Boukris [Sun, 5 Dec 2021 21:08:41 +0000 (16:08 -0500)] 
Fix OpenSSL conditionals for two files

Commit 7e8c41afc54db2ca75de5a1e2e440b034be8887b mistakenly left
two files.  Fix them.

[ghudson@mit.edu: keep crypto_int.h include unconditional; wrote
commit message]

3 years agoIssue an error from KDC on S4U2Self failures
Andreas Schneider [Wed, 20 Oct 2021 05:12:19 +0000 (07:12 +0200)] 
Issue an error from KDC on S4U2Self failures

Commit 3b163eed1cf1f55dd4a7bc6d6fffc34f55695b00 mistakenly separated
the call to kdc_process_s4u2self_req() from its error check, causing
the KDC to ignore S4U2Self padata with bad checksums.  Restore the
error check so that the KDC replies with an error as intended.

[ghudson@mit.edu: removed old error check later on in the code;
rewrote commit message]

ticket: 9038 (new)

3 years agoUse OpenSSL CMAC implementation with OpenSSL 3 1212/head
Greg Hudson [Tue, 19 Oct 2021 14:42:34 +0000 (10:42 -0400)] 
Use OpenSSL CMAC implementation with OpenSSL 3

Make krb5int_cmac_checksum() a crypto module interface.  Move the
existing CMAC implementation from krb to builtin.  Add an OpenSSL 3
implementation using EVP_MAC.  Only implement Camellia CBC-MAC if
using the builtin CMAC implementation (it uses functions deprecated in
OpenSSL 3).  Switch to using krb5int_camellia_encrypt() for
camellia-test.c since krb5int_camellia_cbc_mac() won't always be
available.

3 years agoUpdate PKINIT for OpenSSL 3
Robbie Harwood [Thu, 15 Jul 2021 22:12:27 +0000 (18:12 -0400)] 
Update PKINIT for OpenSSL 3

[ghudson@mit.edu: made the new SHA-1 and key decryption code work with
all suported OpenSSL versions with just one implementation; added
Diffie-Hellman changes]

3 years agoUse the supported version of openssl 3's CTS mode
Robbie Harwood [Tue, 17 Aug 2021 21:11:19 +0000 (17:11 -0400)] 
Use the supported version of openssl 3's CTS mode

Fixes deprecation warnings about AES_cbc_encrypt and friends.

3 years agoPrefer openssl's EVP_MAC interface for HMAC
Robbie Harwood [Tue, 13 Jul 2021 19:07:39 +0000 (15:07 -0400)] 
Prefer openssl's EVP_MAC interface for HMAC

OpenSSL 3 has deprecated the HMAC interface.

3 years agoUse OpenSSL 3 versions of remaining KDFs
Robbie Harwood [Fri, 20 Sep 2019 21:20:59 +0000 (17:20 -0400)] 
Use OpenSSL 3 versions of remaining KDFs

In OpenSSL's terminology, id-pkinit-kdf is an instance of SSKDF,
AES-SHA2 and Camellia use KBKDF, and the KDF for DES3 and AES-SHA1 has
been named KRB5KDF.  Support for these KDFs was added in OpenSSL 3; we
already supported the existing PBKDF2.

[ghudson@mit.edu: reorganize into builtin and openssl versions of the
file; detect hash and encryption provider identity using pointer
equality like we do in the OpenSSL PBKDF implementation; add helpers
for this translation; simplify and better refactor the PKINIT code;
fix some latent pkinit_kdf_test.c bugs]

3 years agoSupport larger RADIUS attributes in libkrad 1229/head
Sumit Bose [Mon, 8 Nov 2021 16:48:50 +0000 (17:48 +0100)] 
Support larger RADIUS attributes in libkrad

In kr_attrset_decode(), explicitly treat the length byte as unsigned.
Otherwise attributes longer than 125 characters will be rejected with
EBADMSG.

Add a 253-character-long NAS-Identifier attribute to the tests to make
sure that attributes with the maximal number of characters are working
as expected.

[ghudson@mit.edu: used uint8_t cast per current practices; edited
commit message]

ticket: 9036 (new)

3 years agoMore python3 fixes for t_daemon.py 1230/head
Sumit Bose [Mon, 8 Nov 2021 16:47:17 +0000 (17:47 +0100)] 
More python3 fixes for t_daemon.py

[ghudson@mit.edu: use a list comprehension instead of map()]

3 years agoAvoid use after free during libkrad cleanup
Greg Hudson [Tue, 9 Nov 2021 18:00:43 +0000 (13:00 -0500)] 
Avoid use after free during libkrad cleanup

libkrad client requests contain a list of references to remotes, with
no back-references or reference counts.  To prevent accesses to
dangling references during cleanup, cancel all requests on all remotes
before freeing any remotes.

Remove the code for aging out unused servers.  This code was fairly
safe as all requests referencing a remote should have completed or
timed out during an hour of disuse, but in the current design we have
no way to guarantee or check that.  The set of addresses we send
RADIUS requests to will generally be small, so aging out servers is
unnecessary.

ticket: 9035 (new)

3 years agoRemove pkinit_kdf_constants.c
Greg Hudson [Fri, 5 Nov 2021 23:22:32 +0000 (19:22 -0400)] 
Remove pkinit_kdf_constants.c

Commit 9a0575f84e988a23709429f7d4e626db833ab562 renamed this file to
pkinit_constants.c but neglected to remove it.  Remove it now, and
also regenerate dependencies.

3 years agoUse EVP key agreement in PKINIT 1228/head
Greg Hudson [Thu, 28 Oct 2021 04:00:20 +0000 (00:00 -0400)] 
Use EVP key agreement in PKINIT

In pkinit_crypto_openssl.c, use EVP_PKEY objects and interfaces to
perform DH operations to the extent possible in OpenSSL 1.0 and 1.1.
Define helper functions for DH operations to make it easier to
conditionalize on OpenSSL version.

3 years agoUse OpenSSL SubjectPublicKeyInfo parsing in PKINIT 1227/head
Greg Hudson [Mon, 25 Oct 2021 05:51:59 +0000 (01:51 -0400)] 
Use OpenSSL SubjectPublicKeyInfo parsing in PKINIT

Shift responsibility for encoding and decoding SubjectPublicKeyInfo
from libkrb5 to the PKINIT ASN.1 module.  OpenSSL 1.0 does not support
DHX (RFC 3279 section 3), so for that version use custom ASN.1
marshalling of the parameters and compose that into
SubjectPublicKeyInfo marshalling using X509_PUBKEY.

3 years agoUse pre-encoded DH parameter constants in PKINIT 1226/head
Greg Hudson [Sat, 23 Oct 2021 20:40:23 +0000 (16:40 -0400)] 
Use pre-encoded DH parameter constants in PKINIT

Rename pkinit_kdf_constants.c to pkinit_constants.c and add encodings
of the three well-known Oakley groups.  Use them to greatly simplify
pkinit_create_td_dh_parameters() and eliminate make_oakley_dh().
Change the interface for decoding parameters to take a krb5_data
pointer for caller convenience.

3 years agoSupport KRB5_CERTAUTH_HWAUTH_PASS in certauth 1220/head
Ken Hornstein [Thu, 30 Sep 2021 21:10:06 +0000 (17:10 -0400)] 
Support KRB5_CERTAUTH_HWAUTH_PASS in certauth

If a certauth module returns KRB5_CERTAUTH_HWAUTH_PASS, the certauth
accumulator sets the hw-authent flag in the ticket (like it would for
KRB5_CERTAUTH_HWAUTH), but defers authorization to other modules (like
it would for KRB5_PLUGIN_NO_HANDLE).

[ghudson@mit.edu: simplify tests by removing the HWAUTH returns from
the test2 module and allowing it to pass by authenticating as nocert]

3 years agoUse builtin MD4, RC4 for OpenSSL 3.0
Greg Hudson [Fri, 8 Oct 2021 21:45:03 +0000 (17:45 -0400)] 
Use builtin MD4, RC4 for OpenSSL 3.0

In OpenSSL 3.0, to use MD4 or RC4 one must load the "legacy" crypto
provider.  To do this in libk5crypto, we would need to create and use
an OpenSSL library context to avoid interfering with other users of
the library.  Tearing down this context at finalization time would be
further complicated by OpenSSL's use of atexit() for library
finalization, which causes its finalizer to be run earlier than
properly registered finalizers on Linux.

For simplicity, use the builtin implementations of MD4 and RC4 for
OpenSSL 3.0 and later.  Also use the builtin DES key parity
implementation since OpenSSL 3.0 deprecates DES_set_odd_parity() with
no replacement.

ticket: 9034 (new)

3 years agoMake test PKINIT certs work with OpenSSL 3.0 1224/head
Greg Hudson [Fri, 8 Oct 2021 21:44:15 +0000 (17:44 -0400)] 
Make test PKINIT certs work with OpenSSL 3.0

Add shell functions to reduce repetition in make-certs.sh.  Create
PKCS12 files with the -descert flag so that they can be read by
OpenSSL 3.0 without enabling the legacy provider.

3 years agoAllow selective overrides in crypto back-ends 1223/head
Greg Hudson [Thu, 7 Oct 2021 14:45:26 +0000 (10:45 -0400)] 
Allow selective overrides in crypto back-ends

In the build system, always descend into all crypto subdirectories and
build all library objects.  Conditionalize each object (or
enc_provider/hash_provider entry) on a preprocessor symbol defined in
crypto_int.h.

Remove crypto_mod.h and the libk5crypto initialization and
finalization functions as they are not currently needed.  Remove stub
directories in the openssl back-end as it is no longer required to
maintain the same directory structure as builtin.

Make CRYPTO_IMPL_CFLAGS work if it is set manually at configure time
(previously only CRYPTO_IMPL_LIBS worked).

3 years agoAlways use platform PRNG 1219/head
Greg Hudson [Mon, 27 Sep 2021 17:38:10 +0000 (13:38 -0400)] 
Always use platform PRNG

Remove the fortuna and device PRNG modules and PRNG modularity, and
move the prng_os implementation into prng.c.  Remove the crypto_mod.h
requirement to implement failure-free AES256 and SHA256.  Deprecate
krb5_c_random_add_entropy() and krb5_c_random_os_entropy() and remove
their call sites.  Deprecate and ignore the -W (weak random) option to
kadmind and kdb5_util create, and stop using it in the test suite.

ticket: 9032 (new)

3 years agoFix verification of RODC-issued PAC KDC signature 1208/head
Isaac Boukris [Tue, 10 Aug 2021 14:50:35 +0000 (17:50 +0300)] 
Fix verification of RODC-issued PAC KDC signature

Per [MS-PAC] 2.8, PAC_SIGNATURE_DATA may contain an RODCIdentifier
following the checksum.  In k5_pac_verify_kdc_checksum(), do not
assume that the checksum spans the remainder of the buffer; instead,
look up the checksum length by its type.

[ghudson@mit.edu: edited commit message and comment; reordered code
for clarity]

ticket: 9031 (new)

3 years agoRestore OpenSSL 1.0 compatibility in softpkcs11 1218/head
Greg Hudson [Mon, 20 Sep 2021 15:14:29 +0000 (11:14 -0400)] 
Restore OpenSSL 1.0 compatibility in softpkcs11

Commit 00de1aad7b3647b91017c7009b0bc65cd0c8b2e0 used
OPENSSL_clear_free(), which was added in OpenSSL 1.1.  Use
OPENSSL_cleanse() and OPENSSL_free() instead.

3 years agoFix trivial leak in OTP kdcpreauth module 1217/head
Pavel Březina [Wed, 15 Sep 2021 12:03:35 +0000 (14:03 +0200)] 
Fix trivial leak in OTP kdcpreauth module

The radius client object is stored in the otp state and should be
freed on exit.

[ghudson@mit.edu: edited commit message]

3 years agoFix link line for GSSAPI reload test
Greg Hudson [Wed, 15 Sep 2021 21:34:18 +0000 (17:34 -0400)] 
Fix link line for GSSAPI reload test

LIBS should be included in all link lines.

3 years agoImprove gss_store_cred() behavior 1214/head
Greg Hudson [Fri, 3 Sep 2021 15:36:01 +0000 (11:36 -0400)] 
Improve gss_store_cred() behavior

Select an output credential cache using similar logic to kinit.  Do
not require the target cache to be initialized.

Try to use the per-thread cache set by gss_krb5_ccache_name() if no
output cache was specified via a cred store.

When the destination is a collection, honor the default_cred flag by
switching the primary cache to the selected output cache.  When the
destination is not a collection, ignore the default_cred flag.
(Previously the default_cred flag was mandatory for gss_store_cred()
even though it is an advisory flag, and ignored for
gss_store_cred_into() even if no ccache was specified in the cred
store.)

Honor the overwrite_cred flag by refusing to replace an initialized
cache if it is not set.  Stop using gss_acquire_cred() for this
purpose as it could go out and fetch credentials from a client keytab.

Perform atomic replacement of the target cache when possible, using
krb5_cc_move().

Add a test harness for calling gss_store_cred() or
gss_store_cred_into() and a suite of tests.  Fix a broken trace log
message for krb5_cc_move() and update the expected trace logs for an
existing t_credstore.py test.

ticket: 8010

3 years agoConstify name field in four plugin vtables 1215/head
Pavel Březina [Wed, 8 Sep 2021 13:44:30 +0000 (15:44 +0200)] 
Constify name field in four plugin vtables

For consistency with the other plugin vtables, declare the name field
as const char * in the audit, authdata, clpreauth, and kdcpreauth
pluggable interface headers.

[ghudson@mit.edu: rewrote commit message]

ticket: 9028 (new)

3 years agoAdd OpenLDAP advice to princ_dns.rst 1216/head
Sam Morris [Wed, 8 Sep 2021 17:24:28 +0000 (18:24 +0100)] 
Add OpenLDAP advice to princ_dns.rst

ticket: 9027 (new)

3 years agoUse version-independent OpenLDAP links in docs 1213/head
Дилян Палаузов [Thu, 26 Aug 2021 15:22:32 +0000 (18:22 +0300)] 
Use version-independent OpenLDAP links in docs

[ghudson@mit.edu: switched from /admin25 links to /admin links and
updated commit message]

ticket: 9025 (new)

3 years agoIncrease use of expected_msg in GSS tests
Robbie Harwood [Wed, 15 Feb 2017 02:22:43 +0000 (21:22 -0500)] 
Increase use of expected_msg in GSS tests

This prevents additional debugging output from breaking the tests, and
reduces collision with k5test.py's output().

3 years agoUpdate gss_config explanation in mglueP.h
Robbie Harwood [Wed, 15 Feb 2017 02:20:56 +0000 (21:20 -0500)] 
Update gss_config explanation in mglueP.h

[ghudson@mit.edu: further shortened the comment, removing some
arguably inaccurate clauses]

3 years agoFind gss_get_mic_iov extensions in GSS modules
Robbie Harwood [Wed, 15 Feb 2017 02:19:45 +0000 (21:19 -0500)] 
Find gss_get_mic_iov extensions in GSS modules

Commit d750ef3130b76dd079e863ed395eb3620a37386b added
gss_get_mic_iov(), gss_verify_mic_iov(), and gss_get_mic_iov_length(),
but did not add them to the symbols looked up in external GSS modules
and interposer modules.  Add them now.

[ghudson@mit.edu: rewrote commit message]

ticket: 9024 (new)

3 years agoClarify and correct interposer plugin docs
Robbie Harwood [Wed, 15 Feb 2017 02:18:55 +0000 (21:18 -0500)] 
Clarify and correct interposer plugin docs

Most importantly, note for gss_import_name() that the mechanism OID
encoding includes the ASN.1 tag prefix (per RFC 2743 section 3.2), and
add the length prefix for the mechanism token.  For
gss_import_sec_context() and gss_import_cred(), note that the
concatenated OID must be used.

[ghudson@mit.edu: reverted part of gss_import_cred() change; reworded
gss_import_name() change; rewrote commit message]

ticket: 9017

3 years agoRemove unused internal DES functions 1204/head
Robbie Harwood [Tue, 13 Jul 2021 20:39:49 +0000 (16:39 -0400)] 
Remove unused internal DES functions

k5_des_is_weak_key() and k5_rand2key_des() have no callers since
fb2dada5eb89c4cd4e39dedd6dbb7dbd5e94f8b8 removed single-DES support.

3 years agoAdd more dump.c bounds checks 1206/head
Greg Hudson [Tue, 3 Aug 2021 03:15:12 +0000 (23:15 -0400)] 
Add more dump.c bounds checks

Although dump files are privileged inputs, the code to read them
should not admit integer overflows.  Add bounds checks for several
fields which are used as allocation lengths or are assigned to
structure fields of smaller size and different signedness.  Reported
by Sharwan Ram and Kihong Keo.

ticket: 9022

3 years agoPerform atomic ccache refreshes when possible 1207/head
Greg Hudson [Tue, 17 Aug 2021 15:26:59 +0000 (11:26 -0400)] 
Perform atomic ccache refreshes when possible

Allow ccache types to implement atomic replacement via a new replace
method (replacing the unused "move" vtable slot).  Make krb5_cc_move()
use this method when possible, falling back to non-atomic replacement.
Implement atomic replacement for FILE, DIR, MEMORY, and KCM (using a
new opcode, falling back when it is not implemented).

Use krb5_cc_move() in get_in_tkt.c when an output ccache is specified,
in kinit for ticket validation and renewal, and in kvno --out-cache.

Add a test program to exercise concurrent krb5_get_credentials() and
cache refresh.

This commit does not implement atomic replacement for KEYRING or for
gss_store_creds().

ticket: 7707

3 years agoFix conformance issue in GSSAPI tests 1210/head
Greg Hudson [Wed, 18 Aug 2021 16:07:04 +0000 (12:07 -0400)] 
Fix conformance issue in GSSAPI tests

Although some C compilers allow a function returning void to be called
in a return statement from another function returning void, it isn't
conformant and generates an error from (at least) the HP-UX native
compiler.  Reported by Michael Osipov.

ticket: 9023 (new)
tags: pullup
target_version: 1.19-next
target_version: 1.18-next

3 years agoFix KDC null deref on TGS inner body null server
Greg Hudson [Tue, 3 Aug 2021 05:15:27 +0000 (01:15 -0400)] 
Fix KDC null deref on TGS inner body null server

After the KDC decodes a FAST inner body, it does not check for a null
server.  Prior to commit 39548a5b17bbda9eeb63625a201cfd19b9de1c5b this
would typically result in an error from krb5_unparse_name(), but with
the addition of get_local_tgt() it results in a null dereference.  Add
a null check.

Reported by Joseph Sutton of Catalyst.

CVE-2021-37750:

In MIT krb5 releases 1.14 and later, an authenticated attacker can
cause a null dereference in the KDC by sending a FAST TGS request with
no server field.

ticket: 9008 (new)
tags: pullup
target_version: 1.19-next
target_version: 1.18-next

4 years agoAvoid long socket paths in KCM tests 1205/head
Greg Hudson [Sun, 1 Aug 2021 15:56:21 +0000 (11:56 -0400)] 
Avoid long socket paths in KCM tests

The build directory path may be too long for a Unix domain socket, so
use a path in a temporary directory instead.  Reported by Ryan
Schmidt.

ticket: 9019

4 years agoFix defcred leak in krb5 gss_inquire_cred() 1202/head
Greg Hudson [Fri, 16 Jul 2021 17:39:39 +0000 (13:39 -0400)] 
Fix defcred leak in krb5 gss_inquire_cred()

Commit 1cd2821c19b2b95e39d5fc2f451a035585a40fa5 altered the memory
management of krb5_gss_inquire_cred(), introducing defcred to act as
an owner pointer when the function must acquire a default credential.
The commit neglected to update the code to release the default cred
along the successful path.  The old code does not trigger because
cred_handle is now reassigned, so the default credential is leaked.

Unify the success and failure cleanup for this function so that
defcred is properly released on success.

Reported by Pavel Březina.

ticket: 9016
tags: pullup
target_version: 1.19-next
target_version: 1.18-next

4 years agoModernize kdc_preauth_ec.c 1201/head
Greg Hudson [Thu, 8 Jul 2021 23:49:59 +0000 (19:49 -0400)] 
Modernize kdc_preauth_ec.c

Reorganize ec_verify() and ec_return() to use cleanup labels instead
of if-ladders.  Also use unconditional calls to free functions and
change a few variable names.

4 years agoFix KDC null deref on bad encrypted challenge
Joseph Sutton [Tue, 6 Jul 2021 23:47:44 +0000 (11:47 +1200)] 
Fix KDC null deref on bad encrypted challenge

The function ec_verify() in src/kdc/kdc_preauth_ec.c contains a check
to avoid further processing if the armor key is NULL.  However, this
check is bypassed by a call to k5memdup0() which overwrites retval
with 0 if the allocation succeeds.  If the armor key is NULL, a call
to krb5_c_fx_cf2_simple() will then dereference it, resulting in a
crash.  Add a check before the k5memdup0() call to avoid overwriting
retval.

CVE-2021-36222:

In MIT krb5 releases 1.16 and later, an unauthenticated attacker can
cause a null dereference in the KDC by sending a request containing a
PA-ENCRYPTED-CHALLENGE padata element without using FAST.

[ghudson@mit.edu: trimmed patch; added test case; edited commit
message]

ticket: 9007 (new)
tags: pullup
target_version: 1.19-next
target_version: 1.18-next

4 years agoClean up gssapi_krb5 ccache name functions 1193/head
Robbie Harwood [Wed, 26 May 2021 22:22:10 +0000 (18:22 -0400)] 
Clean up gssapi_krb5 ccache name functions

Modernize kg_get_ccache_name() and kg_get_ccache_name().  Drop
unnecessary use of const in kg_get_ccache_name() so that its return
value can be properly freed.  Fixes some static analyzer false
positives.

4 years agoFix many unlikely memory leaks
Robbie Harwood [Wed, 26 May 2021 21:35:06 +0000 (17:35 -0400)] 
Fix many unlikely memory leaks

These are on error paths and often require allocation failures, so are
unlikely to be issues in practice.  Reported by Coverity and cppcheck.

4 years agoModernize pkinit_get_certs_pkcs11
Robbie Harwood [Sat, 29 May 2021 18:54:56 +0000 (14:54 -0400)] 
Modernize pkinit_get_certs_pkcs11

Remove unusable PKINIT_USE_MECH_LIST code since there's no build
system support and it would leak mechp.  Factor out the code to load a
cert from the card.  Avoid mixing PKCS11 and krb5 error codes.  Fix
leaks of cert and cert_id reported by Coverity.

4 years agoFix use-after-free during krad remote_shutdown()
Robbie Harwood [Sat, 29 May 2021 17:25:59 +0000 (13:25 -0400)] 
Fix use-after-free during krad remote_shutdown()

Since elements of the queue can be removed on out-of-memory errors,
the correct call is K5_TAILQ_FOREACH_SAFE, not K5_TAILQ_FOREACH.
Reported by Coverity.

ticket: 9015 (new)
tags: pullup
target_version: 1.19-next
target_version: 1.18-next

4 years agoUsing locking in MEMORY krb5_cc_get_principal() 1197/head
Greg Hudson [Sun, 20 Jun 2021 23:24:07 +0000 (19:24 -0400)] 
Using locking in MEMORY krb5_cc_get_principal()

Without locking, the principal pointer could be freed out from under
krb5_copy_principal() by another thread calling krb5_cc_initialize()
or krb5_cc_destroy().

ticket: 9014 (new)
tags: pullup
target_version: 1.19-next
target_version: 1.18-next

4 years agoUse asan in one of the CI builds 1199/head
Greg Hudson [Mon, 21 Jun 2021 23:15:26 +0000 (19:15 -0400)] 
Use asan in one of the CI builds

4 years agoClean up context after failed open in libkdb5 1198/head
Greg Hudson [Wed, 23 Jun 2021 20:57:39 +0000 (16:57 -0400)] 
Clean up context after failed open in libkdb5

If krb5_db_open() or krb5_db_create() fails, release the dal_handle,
as the caller is unlikely to call krb5_db_close() after a failure.

4 years agoFix leaks on error in kadm5 init functions
Greg Hudson [Wed, 23 Jun 2021 20:53:16 +0000 (16:53 -0400)] 
Fix leaks on error in kadm5 init functions

In the GENERIC_CHECK_HANDLE function, separate out the
version-checking logic so we can call it in the init functions before
allocating resources.

In the client and server library initialization functions, use a
single exit path after argument validation, and share the destruction
code with kadm5_destroy() via a helper.

4 years agoFix k5tls module for OpenSSL 3 1196/head
Robbie Harwood [Sat, 29 May 2021 16:05:49 +0000 (12:05 -0400)] 
Fix k5tls module for OpenSSL 3

Starting in OpenSSL 3, connection termination without a close_notify
alert causes SSL_read() to return SSL_ERROR_SSL instead of
SSL_ERROR_SYSCALL.  OpenSSL 3 also provides a new option
SSL_OP_IGNORE_UNEXPECTED_EOF which allows an application to explicitly
ignore possible truncation attacks and receive SSL_ERROR_ZERO_RETURN
instead.

Remove the call to SSL_CTX_get_options() since SSL_CTX_set_options()
doesn't clear existing options.

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

4 years agoRemove deprecated OpenSSL calls from softpkcs11 1187/head
Robbie Harwood [Sat, 15 May 2021 22:04:58 +0000 (18:04 -0400)] 
Remove deprecated OpenSSL calls from softpkcs11

Rewrite add_pubkey_info() in terms of the EVP_PKEY interface.  In this
process, fix its unchecked allocations and fail fast for non-RSA keys.

4 years agoFix softpkcs11 build issues with openssl 3.0
Robbie Harwood [Sat, 15 May 2021 21:35:25 +0000 (17:35 -0400)] 
Fix softpkcs11 build issues with openssl 3.0

EVP_PKEY_get0_RSA() has been modified to have const return type.  Remove
its usages in favor of the EVP_PKEY interface.  Also remove calls to
RSA_blinding_off(), which we don't need and would require a non-const
object.  Similarly, remove RSA_set_method() calls that set a pre-existing
default.

Since softpkcs11 doesn't link against krb5 and can't use zap(), allocate
buffers with OPENSSL_malloc() so can use OPENSSL_clear_free().

Move several argument validation checks to the top of their functions.

Fix some incorrect/inconsistent log messages.

4 years agoFix kadmin -k with fallback or referral realm 1195/head
Greg Hudson [Mon, 7 Jun 2021 19:00:41 +0000 (15:00 -0400)] 
Fix kadmin -k with fallback or referral realm

kadmin -k produces a client principal name with
krb5_sname_to_principal(), but it gets converted to a string and back
due to the signature of kadm5_init_with_skey(), which loses track of
the name type, so no canonicalization is performed.

In libkadm5clnt initialization, recognize the important subset of this
case--an empty realm indicates either fallback processing or the
referral realm--and restore the host-based name type so that the
client principal can be canonicalized against the keytab.

ticket: 9013 (new)

4 years agoAllow kinit with keytab to defer canonicalization
Robbie Harwood [Thu, 3 Jun 2021 20:03:07 +0000 (16:03 -0400)] 
Allow kinit with keytab to defer canonicalization

[ghudson@mit.edu: added tests]

ticket: 9012 (new)

4 years agoFix some principal realm canonicalization cases
Greg Hudson [Mon, 7 Jun 2021 17:27:29 +0000 (13:27 -0400)] 
Fix some principal realm canonicalization cases

The no_hostrealm and subst_defrealm flags in struct canonprinc were
only applied when dns_canonicalize_hostname=fallback; in the other
cases, the initial krb5_sname_to_principal() result is treated as
canonical.  For no_hostrealm this limitation doesn't currently matter,
because all uses pass a principal with no realm as input.  However,
subst_defrealm is used to convert the referral realm to the default
realm in krb5_get_init_creds_keytab(), krb5_cc_cache_match(), and
gss_acquire_cred() when it needs to check the desired name against a
specified ccache.

In k5_canonprinc(), if the input principal is a
krb5_sname_to_principal() result and fallback isn't in effect, apply
subst_defrealm.  Document in os-proto.h that no_hostrealm doesn't
remove an existing realm and that krb5_sname_to_principal() may
already have looked one up.

ticket: 9011 (new)

4 years agoRemove profile Tcl tests 1190/head
Greg Hudson [Wed, 26 May 2021 06:09:43 +0000 (02:09 -0400)] 
Remove profile Tcl tests

4 years agoAdd C profile test program to replace Tcl tests
Greg Hudson [Wed, 26 May 2021 05:30:14 +0000 (01:30 -0400)] 
Add C profile test program to replace Tcl tests

4 years agoAdd MAXHOSTNAME guard in Windows public header 1194/head
Vipul Mehta [Mon, 31 May 2021 06:45:07 +0000 (12:15 +0530)] 
Add MAXHOSTNAME guard in Windows public header

The ACE library defines a MAXHOSTNAMELEN macro, which conflicts if a
source file includes headers from both libraries.

ticket: 9010 (new)

4 years agoUpdate IRC pointer in resources.rst 1192/head
Greg Hudson [Thu, 27 May 2021 19:20:16 +0000 (15:20 -0400)] 
Update IRC pointer in resources.rst

ticket:  (new)
tags: pullup
target_version: 1.19-next

4 years agoRemove dejagnu test suite 1189/head
Greg Hudson [Fri, 21 May 2021 02:59:47 +0000 (22:59 -0400)] 
Remove dejagnu test suite

Of the remaining test scripts, kprop.exp has a corresponding Python
script, and standalone.exp is covered by t_general.py, t_dump.py,
t_keytab.py, and t_pkinit.py.

4 years agoMove test utilities out of dejagnu subdirectory
Greg Hudson [Fri, 21 May 2021 01:45:56 +0000 (21:45 -0400)] 
Move test utilities out of dejagnu subdirectory

Move pkinit-certs, proxy-certs, and t_inetd.c from tests/dejagnu to
tests and repoint references at the new locations.

4 years agoFix doc build for Sphinx 4.0 1191/head
Greg Hudson [Wed, 26 May 2021 19:08:28 +0000 (15:08 -0400)] 
Fix doc build for Sphinx 4.0

Use app.add_css_file() to register krb5.css if possible (it was added
in Sphinx 1.8), since the old name app.add_stylesheet() was removed in
Sphinx 4.0.

Use the highlight directive instead of the highlightlang directive,
which was removed in Sphinx 4.0.

Remove two duplicate table of contents entries to fix warnings.

In the Github Actions configuration, add a second doc build using the
newest version of Sphinx.

ticket: 9006
tags: pullup
target_version: 1.19-next

4 years agoRewrite not-yet-covered dejagnu tests in Python 1188/head
Greg Hudson [Thu, 20 May 2021 21:31:49 +0000 (17:31 -0400)] 
Rewrite not-yet-covered dejagnu tests in Python

Remove the dejagnu scripts gssapi.exp, princexpire.exp, sample.exp,
simple.exp, and tcp.exp.

Add server output checking to t_gss_sample.py to match the checks in
gssapi.exp.

Add a test to t_general.py matching the #6428 regression test in
princexpire.exp.

Add new test scripts t_sample.py and t_simply.py for the appl/sample
and appl/simple applications, to match sample.exp and simple.exp.
Adjust the simple and sample servers to allow for startup detection
when stdout is a pipe.  Both of these test servers exit after one
client execution; add a k5test function await_daemon_exit() to allow
the daemon exit status to be checked without sending a kill signal.
Change start_in_inetd() not to require the program name to be
specified twice.  Adjust the existing t_user2user.py for the
aforementioned changes.

Add a TCP test to t_bigreply.py to match the oversized-TCP-request
test in tcp.exp.  The existing t_bigreply.py test already covers a
successful TCP request.

4 years agoMove some dejagnu kadmin tests to Python tests 1185/head
Greg Hudson [Thu, 22 Apr 2021 19:51:36 +0000 (15:51 -0400)] 
Move some dejagnu kadmin tests to Python tests

Remove the dejagnu scripts kadmin.exp, pwchange.exp, and pwhist.exp.

Add a new Python test script t_kadmin.py for the miscellaneous kadmin
tests from kadmin.exp.

In t_changepw.py, use modprinc +needchange for one of the kinit
password change tests to gain the same coverage as pwchange.exp had,
and add the "password changes are usable by kinit" tests from
kadmin.exp.

In t_policy.py, add the ticket 929 regression tests from kadmin.exp
and the ticket 2841 regression tests from pwhist.exp.

4 years agoFix KCM retrieval support for sssd 1186/head
Greg Hudson [Tue, 11 May 2021 18:04:07 +0000 (14:04 -0400)] 
Fix KCM retrieval support for sssd

Commit 795ebba8c039be172ab93cd41105c73ffdba0fdb added a retrieval
handler using KCM_OP_RETRIEVE, falling back on the same error codes as
the previous KCM_OP_GET_CRED_LIST support.  But sssd (as of 2.4)
returns KRB5_CC_NOSUPP instead of KRB5_CC_IO if it recognizes an
opcode but does not implement it.  Add a helper function to recognize
all known unsupported-opcode error codes, and use it in kcm_retrieve()
and kcm_start_seq_get().

ticket: 8997

4 years agoRemove TCL-based libkadm5 API tests 1181/head
Greg Hudson [Fri, 16 Apr 2021 14:24:04 +0000 (10:24 -0400)] 
Remove TCL-based libkadm5 API tests

4 years agoAdd C test program to replace libkadm5 tcl tests
Greg Hudson [Mon, 12 Apr 2021 05:29:52 +0000 (01:29 -0400)] 
Add C test program to replace libkadm5 tcl tests

4 years agoAdd duplicate check to kadm5_create_policy() 1180/head
Greg Hudson [Fri, 16 Apr 2021 06:25:21 +0000 (02:25 -0400)] 
Add duplicate check to kadm5_create_policy()

For symmetry with kadm5_create_principal_3(), check for an existing
policy in kadm5_create_policy() and return KADM5_DUP if one is found.

ticket: 9003 (new)

4 years agoCheck for undefined kadm5 policy mask bits
Greg Hudson [Fri, 16 Apr 2021 05:37:11 +0000 (01:37 -0400)] 
Check for undefined kadm5 policy mask bits

For symmetry with the libkadm5srv functions to create and modify
principals, check for undefined mask bits when creating or modifying
policies.

ticket: 9002 (new)

4 years agoFix argument type errors on Windows 1184/head
Greg Hudson [Mon, 26 Apr 2021 18:46:31 +0000 (14:46 -0400)] 
Fix argument type errors on Windows

Fix three Windows-specific argument type errors, including a crash bug
in the default replay cache type.  Change the compiler flags to treat
several argument type warnings as errors.

The replay cache bug was reported by Thomas Wagner.

ticket: 9005 (new)
tags: pullup
target_version: 1.19-next
target_version: 1.18-next

4 years agoAdd additional KRB5_TRACE points 1172/head
Ken Hornstein [Wed, 17 Mar 2021 21:44:46 +0000 (17:44 -0400)] 
Add additional KRB5_TRACE points

Add additional tracing points to the PKINIT plugin for use with the
KRB5_TRACE facility, replacing many (but not all) of the existing
pkiDebug() trace points.

Fix a memory leak of an errinfo structure when loading a PKCS11 module
fails.

Rename pkinit_pkcs11_code_to_text() to pkcs11err() for brevity, and
modify it for thread safety.

[ghudson@mit.edu: added certificate index to regexp match trace
points; renamed various identifiers; edited commit message]

ticket: 8999 (new)

4 years agoFix multiple UPN handling in PKINIT client certs
Ken Hornstein [Wed, 17 Mar 2021 21:44:46 +0000 (17:44 -0400)] 
Fix multiple UPN handling in PKINIT client certs

Commit 0f26c1c7504777d6e7bfa1d3dee575c504ab6c05 neglected to increment
the array index when storing UPN strings.  Also remove the unused
num_found variable.

[ghudson@mit.edu: pulled from a larger commit; added removal of
num_found; wrote commit message]

ticket: 9000 (new)

4 years agoSimplify krb5_cccol_have_content() 1179/head
Greg Hudson [Wed, 31 Mar 2021 19:00:21 +0000 (15:00 -0400)] 
Simplify krb5_cccol_have_content()

For the purposes of determining whether Kerberos credentials are
present, just check for an initialized ccache (as detected by
krb5_cc_get_principal()), not one with credentials in it.  For KCM and
KEYRING caches, this changes avoids the O(n) expense of starting an
iteration.

Also fix a potential memory leak if a cache is found after an error is
saved.

ticket: 8998 (new)

4 years agoUse KCM_OP_RETRIEVE in KCM client 1178/head
Greg Hudson [Sat, 27 Mar 2021 03:38:54 +0000 (23:38 -0400)] 
Use KCM_OP_RETRIEVE in KCM client

In kcm_retrieve(), try KCM_OP_RETRIEVE.  Fall back to iteration if the
server doesn't implement it, or if we can an answer incompatible with
KRB5_TC_SUPPORTED_KTYPES.

In kcmserver.py, implement partial decoding for creds and cred tags so
that we can do a basic principal name match.

ticket: 8997 (new)

4 years agoMake KCM iteration fallback work with sssd-kcm 1177/head
Pavel Březina [Tue, 30 Mar 2021 12:35:28 +0000 (14:35 +0200)] 
Make KCM iteration fallback work with sssd-kcm

sssd-kcm returns KRB5_CC_IO if the operation code is not known.

ticket: 8990

4 years agoFix KCM flag transmission for remove_cred 1176/head
Greg Hudson [Mon, 29 Mar 2021 18:32:56 +0000 (14:32 -0400)] 
Fix KCM flag transmission for remove_cred

MIT krb5 uses low bits for KRB5_TC flags, while Heimdal uses high bits
so that the same flag word can also hold KRB5_GC flags.  Add a mapping
function and send the Heimdal flag values when performing a
remove_cred operation.

ticket: 8995

4 years agoFix gss-krb5 handling of high sequence numbers 1175/head
Greg Hudson [Sat, 27 Mar 2021 04:52:05 +0000 (00:52 -0400)] 
Fix gss-krb5 handling of high sequence numbers

Commits abcfdaff756631d73f49103f679cafa7bc45f14e and
41ddaaeb286e8bb1bba64fb557ba0e4cff9b404d incorrectly changed the
interpretation of authenticator sequence numbers in the range
2^31..2^32-1, mapping them to sign-extended 64-bit values.  The major
Kerberos implementations do not generate sequence numbers this large,
so the changed went unnoticed.  Prevent unwanted sign extension by
casting sequence numbers retrieved from auth contexts to uint32_t
before assigning them to uint64_t fields.  Reported by Jake Scott.

ticket: 8994 (new)

4 years agoAvoid rand() in aes-gen test program 1174/head
Greg Hudson [Thu, 25 Mar 2021 16:00:54 +0000 (12:00 -0400)] 
Avoid rand() in aes-gen test program

rand() can output different sequences on different platforms with the
same seed, and (since commit cb5f190056ef4d123c5fe5d4923982b830288438)
we want fixed output.  Use specified inputs instead.  Reported by Ken
Hornstein.

ticket: 8992 (new)
tags: pullup
target_version: 1.19-next

4 years agoImprove ktutil man page example keytab filename 1173/head
Ken Dreyer [Tue, 23 Mar 2021 19:16:24 +0000 (13:16 -0600)] 
Improve ktutil man page example keytab filename

The example of writing to a file named "keytab" is ambiguous.  Name
the file "alice.keytab" instead, to match the example user principal
name.

4 years agoFix PKINIT memory leaks 1169/head
Greg Hudson [Thu, 11 Mar 2021 02:53:33 +0000 (21:53 -0500)] 
Fix PKINIT memory leaks

pkinit_client_process() calls pkinit_client_profile() a second time,
leaking the values obtained the first time.  Remove the call.

Commit 13ae08e70a05768d4f65978ce1a8d4e16fec0d35 introduced more
possibilities for process_option_identity() to return failure after it
filled in some fields.  PKCS11 option parsing already prevents leaks
by freeing old values before setting new ones; do so in the other
option-parsing functions as well.

ticket: 8991 (new)

4 years agoAdd KCM_OP_GET_CRED_LIST for faster iteration 1165/head
Pavel Březina [Thu, 11 Feb 2021 14:33:10 +0000 (15:33 +0100)] 
Add KCM_OP_GET_CRED_LIST for faster iteration

For large caches, one IPC operation per credential dominates the cost
of iteration.  Instead transfer the whole list of credentials to the
client in one IPC operation.

Add optional support for the new opcode to the test KCM server to
allow testing of the main and fallback code paths.

[ghudson@mit.edu: fixed memory leaks and potential memory errors;
adjusted code style and comments; rewrote commit message; added
kcmserver.py support and tests]

ticket: 8990 (new)

4 years agoDrop extra listen() call in gss-server 1171/head
Ivan A. Melnikov [Tue, 16 Mar 2021 10:18:01 +0000 (14:18 +0400)] 
Drop extra listen() call in gss-server

There is already call to listen in create_socket(), and there is no
need to tie the backlog to the number of threads.  Also, here listen()
was sometimes called with zero backlog, making gss-server execution
(and tests) racy on slower and busy systems.