]> git.ipfire.org Git - thirdparty/krb5.git/log
thirdparty/krb5.git
8 years agoSet alg param correctly for PKCS1 550/head
Tom Yu [Tue, 4 Oct 2016 22:14:51 +0000 (18:14 -0400)] 
Set alg param correctly for PKCS1

When using a smart card and constructing a DigestInfo to pass to the
CKM_RSA_PKCS mechanism, make sure to set the AlgorithmIdentifier
parameters correctly.  This is typically an ASN.1 NULL value.

Reported to Ubuntu in Launchpad #1629370.

ticket: 8506
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

8 years agoDocument aes-sha2 enctypes
Greg Hudson [Thu, 10 Dec 2015 18:17:31 +0000 (13:17 -0500)] 
Document aes-sha2 enctypes

Add minimal documentation for the new aes-sha2 enctypes.

ticket: 8490

8 years agoAdd aes-sha2 to permitted_enctypes and aes family
Greg Hudson [Tue, 8 Dec 2015 18:50:06 +0000 (13:50 -0500)] 
Add aes-sha2 to permitted_enctypes and aes family

Add the new aes-sha2 enctypes to the default value of
permitted_enctype, and to the enctypes implied by the "aes" family
when parsing enctype lists.

ticket: 8490

8 years agoAdd aes-sha2 test cases
Greg Hudson [Tue, 8 Dec 2015 04:32:18 +0000 (23:32 -0500)] 
Add aes-sha2 test cases

Add test cases for all of the test vectors in the aes-sha2 draft.  In
t_cksums.c and t_decrypt.c, modify the test structure to allow for
binary plaintexts.  In t_str2key.c, modify the test structure to allow
for binary salts.  In t_derive.c, allow tests to have outputs which
don't match the key size, using krb5int_derive_random() instead of
krb5int_derive_key().

Add test cases for KRB-FX-CF2 and for gss_pseudo_random() using test
vectors generated ourselves.

Add k5test and dejagnu test passes for aes-sha2 enctypes.

ticket: 8490

8 years agoRewrite t_prf crypto test program
Greg Hudson [Tue, 8 Dec 2015 03:16:24 +0000 (22:16 -0500)] 
Rewrite t_prf crypto test program

Rewrite the pseudo-random test program to use hardcoded test cases
instead of input and expected output files.  The test cases are the
same, using hardcoded keys instead of running string-to-key over
"key1" or "key2".

8 years agoAdd aes128-sha1, aes256-sha1 enctype aliases
Greg Hudson [Fri, 23 Sep 2016 19:11:43 +0000 (15:11 -0400)] 
Add aes128-sha1, aes256-sha1 enctype aliases

For parallelism with aes128-sha2 and aes256-sha2, add enctype aliases
aes128-sha1 and aes256-sha1 for the older AES enctypes.

ticket: 8490

8 years agoAdd aes-sha2 enctype support
Greg Hudson [Sun, 6 Dec 2015 00:36:57 +0000 (19:36 -0500)] 
Add aes-sha2 enctype support

Add support to libk5crypto for the aes128-cts-hmac-sha256-128 and
aes256-cts-hmac-sha384-192 encryption types, and the
hmac-sha256-128-aes128 and hmac-sha384-192-aes256 checksum types.

Key derivation for the new encryption types uses a hash, so we need to
add a hash parameter to the krb5int_derive_ functions, which can be
null except when DERIVE_SP800_108_HMAC is given.  Rename the helper
function derive_random_sp800_108_cmac() to
derive_random_sp800_108_feedback_cmac() to make it clear that feedback
mode is used, since the new enctype uses counter mode.

ticket: 8490

8 years agoEnable PBKDF2 with SHA-256 and SHA-384
Greg Hudson [Mon, 7 Dec 2015 16:16:06 +0000 (11:16 -0500)] 
Enable PBKDF2 with SHA-256 and SHA-384

Rename krb5int_pbkdf2_hmac_sha1() to krb5int_pbkdf2_hmac() and add a
hash parameter.  In the OpenSSL implementation, look up the
corresponding PBKDF2 parameter based on the hash pointer.  In
pbkdf2_string_to_key(), pass the hash function for the key type if one
is present, and use SHA-1 if it does not (as for the Camellia
enctypes).

In the builtin implementation, use the hash provider instead of
assuming SHA-1.  Remove the functional parameterization of the PRF and
turn it into an hmac() helper function.  Use krb5int_hmac_keyblock()
to remove the need for a krb5_key object containing the password.
Rename the internal function from krb5int_pbkdf2() to pbkdf2().

ticket: 8490

8 years agoAdd libk5crypto SHA-256 and SHA-384 hash providers
Greg Hudson [Sun, 6 Dec 2015 00:36:41 +0000 (19:36 -0500)] 
Add libk5crypto SHA-256 and SHA-384 hash providers

Add SHA-256 and SHA-384 hash providers to each of the libk5crypto back
ends, in preparation for AES-SHA2 support.  For the builtin back end,
adapt SHA-512 code from Heimdal (SHA-384 is just truncated SHA-512
with different initial values).  Replace builtin/sha2/t_sha256.c with
a program under crypto_tests which tests SHA-256 and SHA-384 in all
back ends.

ticket: 8490

8 years agoConsolidate libk5crypto OpenSSL hash providers
Greg Hudson [Sat, 5 Dec 2015 22:20:26 +0000 (17:20 -0500)] 
Consolidate libk5crypto OpenSSL hash providers

In the libk5crypto OpenSSL back end, combine all of the hash providers
which use the OpenSSL EVP interface into a single file to reduce code
duplication.

8 years agoProperly handle EOF condition on libkrad sockets 547/head
Nathaniel McCallum [Fri, 30 Sep 2016 14:03:33 +0000 (10:03 -0400)] 
Properly handle EOF condition on libkrad sockets

In the previous code, when the remote peer performed an orderly shutdown
on the socket, libkrad would enter a state in which all future requests
timed out.  Instead, if the peer shuts down its socket, we need to
attempt to reopen it.

ticket: 8504 (new)
target_version: 1.14-next
tags: pullup

8 years agoFix use_dns_uri() type safety 546/head
Greg Hudson [Thu, 29 Sep 2016 19:41:04 +0000 (15:41 -0400)] 
Fix use_dns_uri() type safety

profile_get_boolean() outputs an int, not a krb5_boolean.  Adjust the
local variable "use" to match, or we get a warning.  Reported by Will
Fiveash.

ticket: 8502

8 years agoClarify kinit principal selection 544/head
Tom Yu [Wed, 28 Sep 2016 16:33:52 +0000 (12:33 -0400)] 
Clarify kinit principal selection

Describe the principal selection behavior of kinit when the principal
argument is absent.

ticket: 8403
target_version: 1.14-next
tags: pullup

8 years agoFix typo in install_kdc.rst
Greg Hudson [Mon, 26 Sep 2016 22:01:12 +0000 (18:01 -0400)] 
Fix typo in install_kdc.rst

ticket: 8500

8 years agoImprove keytab documentation
Ben Kaduk [Mon, 26 Jan 2015 16:15:42 +0000 (11:15 -0500)] 
Improve keytab documentation

In the k5srvutil man page, do not give the impression that arbitrary
new keys can be added to the keytab (requested by Dan Gillmor), since
only the new keys randomly generated by the KDC via 'k5srvutil change'
can be added to the keytab.  Reiterate the importance of running
k5srvutil delold after running k5srvutil change in the description of
k5srvutil change, as well as in the description of k5srvutil delold
itself.

In install_kdc.rst, mention using a separate keytab file when
generating a keytab on a KDC for use on another host.

[ghudson@mit.edu: squashed two commits, condensed commit message]

ticket: 8500

8 years agoDocument krb5_kt_next_entry() requirement
Ben Kaduk [Wed, 11 Jun 2014 20:38:57 +0000 (16:38 -0400)] 
Document krb5_kt_next_entry() requirement

Successful calls to krb5_kt_next_entry() return a krb5_keytab_entry
that the caller is responsible for freeing.  Note this, and the
proper function to do so, in the doxygen comments.

ticket: 8500 (new)
target_version: 1.14-next
tags: pullup

8 years agoFix unlikely leak in KDC AS-REQ error path 542/head
Greg Hudson [Thu, 22 Sep 2016 06:21:39 +0000 (02:21 -0400)] 
Fix unlikely leak in KDC AS-REQ error path

In prepare_error_as(), if krb5_us_timeofday() fails and error pa-data
was supplied, the FAST cookie and a shallow copy of the error padata
can be leaked.  Reported by Will Fiveash.

ticket: 8498
target_version: 1.14-next
tags: pullup

8 years agoAdd the kdc_tcp_listen_backlog KDC option
Matt Rogers [Wed, 14 Sep 2016 18:01:10 +0000 (14:01 -0400)] 
Add the kdc_tcp_listen_backlog KDC option

Allow setting the listen() queue for TCP connections to krb5kdc.

8 years agoFix typo in prng.c comment
Greg Hudson [Fri, 23 Sep 2016 03:11:34 +0000 (23:11 -0400)] 
Fix typo in prng.c comment

(The typo was mine, introduced during a final editing pass.)

8 years agoAdd PKINIT support for OpenSSL 1.1.0 447/head
Greg Hudson [Tue, 3 May 2016 17:22:46 +0000 (13:22 -0400)] 
Add PKINIT support for OpenSSL 1.1.0

OpenSSL 1.1 makes the DH, EVP_MD_CTX, X509, and X509_STORE_CTX types
opaque, removes asn1_mac.h, removes the M_ASN1_* macros, and removes
CRYPTO_malloc_init().  Change the PKINIT code to work with OpenSSL 1.1
while retaining compatibility with OpenSSL 1.0.  The new code uses
X509_STORE_set_verify_cb(), which is not present in OpenSSL 0.9, so
require OpenSSL 1.0 for PKINIT support.

ticket: 8398

8 years agoAdd k5tls support for OpenSSL 1.1.0
Greg Hudson [Tue, 3 May 2016 17:14:48 +0000 (13:14 -0400)] 
Add k5tls support for OpenSSL 1.1.0

OpenSSL 1.1 makes the X509 type opaque and removes the M_ASN1_*
macros.  Adjust the k5tls OpenSSL implementation accordingly.

ticket: 8398

8 years agoAdd libk5crypto support for OpenSSL 1.1.0
Greg Hudson [Fri, 17 Jun 2016 16:00:21 +0000 (12:00 -0400)] 
Add libk5crypto support for OpenSSL 1.1.0

OpenSSL 1.1.0 makes the EVP_MD_CTX, EVP_CIPH_CTX, and EVP_HMAC_CTX
types opaque.  Change the libk5crypto OpenSSL code to work with
OpenSSL 1.1 while retaining compatibility with previous versions.

ticket: 8398 (new)

8 years agoAdd OS prng intended for use with getrandom()
Robbie Harwood [Wed, 14 Sep 2016 20:12:57 +0000 (16:12 -0400)] 
Add OS prng intended for use with getrandom()

Add the prng_os.c module, using the name previously occupied by what
is now prng_device.c.  Unlike prng_device.c, this PRNG module
maintains no file descriptor and just uses k5_os_random(), which is
most efficient on platforms which have a getrandom() system call.

[ghudson@mit.edu: expanded on commit message]

ticket: 8499

8 years agoAdd getrandom to k5_get_os_entropy() using syscall
Robbie Harwood [Wed, 14 Sep 2016 20:10:34 +0000 (16:10 -0400)] 
Add getrandom to k5_get_os_entropy() using syscall

ticket: 8499

8 years agoRename prng_os.c to prng_device.c
Robbie Harwood [Wed, 14 Sep 2016 16:53:10 +0000 (12:53 -0400)] 
Rename prng_os.c to prng_device.c

ticket: 8499

8 years agoDon't feed OS RNG output into the OS RNG
Robbie Harwood [Mon, 12 Sep 2016 16:25:05 +0000 (12:25 -0400)] 
Don't feed OS RNG output into the OS RNG

krb5_c_random_os_entropy() now must be provided by PRNG modules.

ticket: 8499

8 years agoAdd KDC lookaside cache tests
Sarah Day [Fri, 19 Aug 2016 17:50:54 +0000 (13:50 -0400)] 
Add KDC lookaside cache tests

Add cmocka unit tests for the KDC lookaside cache.

8 years agoFix KDC lookaside cache entry count tracking
Sarah Day [Fri, 19 Aug 2016 17:47:22 +0000 (13:47 -0400)] 
Fix KDC lookaside cache entry count tracking

The KDC lookaside cache was incrementing num_entries when an entry was
added, but it did not decrement num_entries when an entry was removed.
Decrement num_entries in discard_entry().  Also fix some function
comments to correctly explain what the function is doing, and refactor
kdc_insert_lookaside by moving the code that inserts an entry into a
new static function called insert_entry().

8 years agoSilence warnings in lib/rpc 541/head
Tom Yu [Tue, 20 Sep 2016 19:58:50 +0000 (15:58 -0400)] 
Silence warnings in lib/rpc

Cast through (void *) in xdr.c to silence pointer target width
warnings.  In xdr_sizeof.c, use x_private and x_base as proper
pointers as in xdr_mem.c instead of trying to store an integer in a
pointer.

8 years agoAdd URI lookup testing with resolv_wrapper
Matt Rogers [Mon, 22 Aug 2016 19:34:52 +0000 (15:34 -0400)] 
Add URI lookup testing with resolv_wrapper

Run t_discover_uri.py during make check when resolv_wrapper is
available.  Remove tabs from the t_locate_kdc output for simpler line
matching.

ticket: 8496

8 years agoAdd documentation for DNS URI lookups
Matt Rogers [Wed, 24 Aug 2016 00:03:22 +0000 (20:03 -0400)] 
Add documentation for DNS URI lookups

ticket: 8496

8 years agoAdd configuration option for URI lookups
Matt Rogers [Wed, 24 Aug 2016 04:42:16 +0000 (00:42 -0400)] 
Add configuration option for URI lookups

Add the boolean option 'dns_uri_lookup' to krb5.conf's libdefaults
section, to allow disabling URI lookups seperately from SRV lookups.
The default value is 'true'.

ticket: 8496

8 years agoStyle fixes for locate_kdc.c and dnssrv.c
Matt Rogers [Fri, 12 Aug 2016 21:13:01 +0000 (17:13 -0400)] 
Style fixes for locate_kdc.c and dnssrv.c

8 years agoConstify function parameters in locate_kdc.c
Matt Rogers [Fri, 12 Aug 2016 19:40:23 +0000 (15:40 -0400)] 
Constify function parameters in locate_kdc.c

Constify parse_uri_if_https() and add_host_to_list() char parameters
as well as the variables passed by their callers.

8 years agoEnable KDC discovery through DNS URI records
Matt Rogers [Mon, 18 Jul 2016 16:13:55 +0000 (12:13 -0400)] 
Enable KDC discovery through DNS URI records

Add the dns_locate_server_uri(), locate_uri(), and parse_uri_fields()
functions to find and process KDC service information from specially
formatted URI records detailed at
http://k5wiki.kerberos.org/wiki/Projects/KDC_Discovery

Search for URI records before searching for SRV records.  Rename
dns_locate_server() to dns_locate_server_srv() for consistency.  Add
URI-specific information to the t_locate_kdc host entry output.

ticket: 8496

8 years agoAdd DNS URI query function
Matt Rogers [Mon, 18 Jul 2016 14:18:45 +0000 (10:18 -0400)] 
Add DNS URI query function

Add the k5_make_uri_query() function for finding URI records of a
given realm and service tag.  Turn some common code shared with
krb5int_make_srv_query_realm() into helper functions.

ticket: 8496

8 years agoAdd a master flag to struct server_entry
Matt Rogers [Wed, 13 Jul 2016 20:27:57 +0000 (16:27 -0400)] 
Add a master flag to struct server_entry

URI lookups will contain a flag to indicate if the KDC is a master or
normal KDC, so add a master variable to server_entry.  The default
value is -1 and means that the status has not been determined by the
information source.  If the flag is set, use it to avoid a seperate
lookup in k5_kdc_is_master().

Also add a "master" argument to add_host_to_list().  Adjust the
existing calls of add_host_to_list() for the new argument (set to -1
as they are from non-URI lookups).

ticket: 8496

8 years agoRemove more non-DFSG documentation 540/head
Tom Yu [Fri, 16 Sep 2016 23:02:45 +0000 (19:02 -0400)] 
Remove more non-DFSG documentation

Delete an Internet-Draft that we missed on an earlier pass.  Also
remove ISOC/BCP 78 copyright language because the remaining extracts
from RFCs are small enough to be fair use.

ticket: 8497 (new)

8 years agoStop generating doc/CHANGES 530/head
Tom Yu [Wed, 31 Aug 2016 17:40:22 +0000 (13:40 -0400)] 
Stop generating doc/CHANGES

Shipping a 10MB+ doc/CHANGES file in the release tarball doesn't make
much sense in a modern context where historical information is readily
available in a distributed version control system.

ticket: 8488 (new)

8 years agoUpdate config.guess, config.sub 531/head
Tom Yu [Wed, 31 Aug 2016 22:58:09 +0000 (18:58 -0400)] 
Update config.guess, config.sub

ticket: 8489 (new)
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

8 years agoClean up libdb2 warnings 526/head
Tom Yu [Wed, 24 Aug 2016 23:49:11 +0000 (19:49 -0400)] 
Clean up libdb2 warnings

Clean up many pointer alignment warnings by casting through (void *).

Clean up many signed-unsigned comparison warnings by casting to
unsigned types or redeclaring variables as unsigned types as
appropriate.

8 years agoTest bt_split.c unaligned access 537/head
Tom Yu [Wed, 7 Sep 2016 22:20:56 +0000 (18:20 -0400)] 
Test bt_split.c unaligned access

ticket: 8493

8 years agoFix unaligned accesses in bt_split.c
Tom Yu [Wed, 7 Sep 2016 21:28:34 +0000 (17:28 -0400)] 
Fix unaligned accesses in bt_split.c

In the libdb2 btree back end, splitting a page at an overflow key
could result in an unaligned access, causing a crash (and data
corruption) on platforms with strict alignment.  This probably occurs
only rarely in practice.

ticket: 8493 (new)
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

8 years agoFix bt_debug.c unaligned accesses and formats
Tom Yu [Wed, 7 Sep 2016 21:21:55 +0000 (17:21 -0400)] 
Fix bt_debug.c unaligned accesses and formats

Use memcpy to fix some unaligned accesses in bt_debug.c.  Also fix
some argument width issues with fprintf.  Clean up warnings.

ticket: 8478

8 years agoUse krb5_db_register_keytab() in kinit, kadmind
Andreas Schneider [Wed, 7 Sep 2016 16:40:58 +0000 (18:40 +0200)] 
Use krb5_db_register_keytab() in kinit, kadmind

8 years agoAdd krb5_db_register_keytab()
Andreas Schneider [Wed, 7 Sep 2016 16:33:43 +0000 (18:33 +0200)] 
Add krb5_db_register_keytab()

Add a public libkdb5 function to register the KDB keytab type.  This
functionality is needed for out-of-tree KDC servers such as the Samba
kpasswd service.

[ghudson@mit.edu: edited comments, whitespace, commit message]

ticket: 8494 (new)

8 years agoFix build with -O3 on ppc64el 511/head
Ben Kaduk [Thu, 11 Aug 2016 04:25:47 +0000 (23:25 -0500)] 
Fix build with -O3 on ppc64el

Ubuntu runs ppc64el builds with -O3, which elicited a few warnings
from gcc that were not generated elsewhere, as documented at
https://bugs.launchpad.net/ubuntu/+source/krb5/+bug/1592841 .

Initialize the output variable at the top of a couple of helper functions
to silence the uninitialized-variable warnings.

ticket: 8475 (new)
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

8 years agoRemove meaningless checks decoding DB2 principals
Greg Hudson [Tue, 6 Sep 2016 16:58:57 +0000 (12:58 -0400)] 
Remove meaningless checks decoding DB2 principals

Commit e3d9f03a658e247dbb43cb345aa93a28782fd995 (ticket 8481) added
several checks for negative length values when decoding DB2 principal
entries, including two unnecessary checks on unsigned values.  Remove
those checks as they can generate warnings.

ticket: 8491 (new)
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

8 years agoConsolidate sn2princ_realm() in kprop and kpropd 525/head
Greg Hudson [Thu, 25 Aug 2016 19:37:23 +0000 (15:37 -0400)] 
Consolidate sn2princ_realm() in kprop and kpropd

In kprop and kpropd, factor out the duplicated implementation of
sn2princ_with_realm() into kprop_util.c.  Rename it to
sn2princ_realm(), remove the type parameter, and require the sname
parameter to be specified.  Rewrite the function to use
krb5_expand_hostname(), avoiding an unnecessary hostrealm lookup.

8 years agoRename kprop_sock.c to kprop_util.c
Greg Hudson [Thu, 25 Aug 2016 18:58:28 +0000 (14:58 -0400)] 
Rename kprop_sock.c to kprop_util.c

Change the name of kprop_sock.c so that additional common functions
can be added to it.

8 years agoFix directory changes to use explicit subshells
Robbie Harwood [Fri, 2 Sep 2016 18:53:59 +0000 (14:53 -0400)] 
Fix directory changes to use explicit subshells

We depend on the behavior of having a separate subshell for each line in
our Makefiles, so force it where make (observed FreeBSD 10.3) does not
create one.

[ghudson@mit.edu: also changed rules in config/post.in]

ticket: 8492 (new)
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

8 years agoAvoid byte-swap cache corruption in libdb2 527/head
Tom Yu [Thu, 25 Aug 2016 22:02:56 +0000 (18:02 -0400)] 
Avoid byte-swap cache corruption in libdb2

Apply a patch from NetBSD to restore the cached copy of a page to the
machine byte order after a write operation swapped it to the file byte
order.  As a regression test, modify test13 to sync the database file
after each put to exercise this bug.

ticket: 8483 (new)
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

8 years agoAdd known file test case for btree byte swap
Tom Yu [Fri, 26 Aug 2016 22:40:49 +0000 (18:40 -0400)] 
Add known file test case for btree byte swap

Add a regression test for the preceding bugfix.  This test uses btree
database files with known contents and byte orders with short keys and
overflow data items.

ticket: 8485

8 years agoFix btree byte swapping for overflow data
Tom Yu [Fri, 26 Aug 2016 19:24:52 +0000 (15:24 -0400)] 
Fix btree byte swapping for overflow data

When operating on a btree database file of the opposite endianness,
libdb2 was swapping the wrong bytes if a record had a short key but
overflow data.  Fix this bug by not incrementing p when swapping a
P_BIGKEY overflow pointer, and by always skipping the full key size
before swapping a P_BIGDATA overflow pointer (instead of assuming that
a P_BIGKEY pointer always precedes a P_BIGDATA pointer).

ticket: 8485 (new)
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

8 years agoTest btree unaligned byte swapping
Tom Yu [Fri, 26 Aug 2016 16:47:00 +0000 (12:47 -0400)] 
Test btree unaligned byte swapping

Add a regression test for unaligned accesses during btree byte
swapping.

ticket: 8484

8 years agoAvoid unaligned access in btree byte swapping
Tom Yu [Fri, 26 Aug 2016 17:56:18 +0000 (13:56 -0400)] 
Avoid unaligned access in btree byte swapping

Apply a patch from NetBSD to use temporary character buffers instead
of doing an unaligned read when swapping bytes.

ticket: 8484 (new)
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

8 years agoFix thread support for Solaris and simplify 528/head
Greg Hudson [Fri, 26 Aug 2016 16:55:40 +0000 (12:55 -0400)] 
Fix thread support for Solaris and simplify

threads.c failed to build on Solaris afer commit
17932091cc0d5981c5a78d389ffa4a5c7b532bd6 because k5-thread.h did not
define the conditional k5_once_t structure (because NO_WEAK_PTHREADS
is defined) but threads.c tried to build the conditional k5_once()
function.

Use a single preprocessor symbol, USE_CONDITIONAL_PTHREADS, to
determine whether to use and define pthreads functions which
conditionalize on whether pthreads is loaded.  In threads.c, move the
new k5_once() definitions into the USE_CONDITIONAL_PTHREADS block,
defining a stub function if other code will not refer to it.

Also move #pragma weak declarations from k5-threads.h into threads.c,
as we should no longer be conditionally referring to those symbols
outside of threads.c.

Also eliminate some missing-prototype warnings where we define
functions for linker-visibility but don't have corresponding
prototypes in k5-threads.h.

8 years agoImprove checking of decoded DB2 principal values 522/head
Greg Hudson [Tue, 23 Aug 2016 17:41:00 +0000 (13:41 -0400)] 
Improve checking of decoded DB2 principal values

In krb5_decode_princ_entry(), verify the length of the principal name
before calling krb5_parse_name() or strlen(), to avoid a possible
buffer read overrun.  Check all length fields for negative values.
Avoid performing arithmetic as part of bounds checks.  If the value of
key_data_ver is unexpected, return KRB5_KDB_BAD_VERSION instead of
aborting.

ticket: 8481 (new)
target_version: 1.14-next
target_version: 1.13-next

8 years agoFix check-pytests-no 529/head
Tom Yu [Sat, 27 Aug 2016 21:04:11 +0000 (17:04 -0400)] 
Fix check-pytests-no

Commit 0db097ba8b605ea7a6e0364ad786da6528868179 accidentally removed
the $(SKIPTESTS) line from check-pytests-no, causing a syntax error
when running "make check" when python is missing or not sufficiently
new.

8 years agoGuess Samba client mutual flag using ap_options
Andreas Schneider [Thu, 25 Aug 2016 08:41:33 +0000 (10:41 +0200)] 
Guess Samba client mutual flag using ap_options

To work correctly with older Samba clients, we should guess the mutual
flag based on the ap_options from the AP-REQ and not set it
unconditionally.  Found by the Samba torture testsuite.

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

ticket: 8486 (new)
target_version: 1.14-next
tags: pullup

8 years agoRemove outdated TeX documentation from doc/api
Robbie Harwood [Fri, 19 Aug 2016 21:06:25 +0000 (17:06 -0400)] 
Remove outdated TeX documentation from doc/api

8 years agoFix leak in krb5_server_decrypt_ticket_keytab()
Seemant Choudhary [Wed, 24 Aug 2016 16:20:01 +0000 (12:20 -0400)] 
Fix leak in krb5_server_decrypt_ticket_keytab()

When we skip a keytab entry because it is of the wrong enctype, free
it before continuing.

ticket: 8482
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

8 years agoRemove svcauth_gss_creds
Greg Hudson [Tue, 23 Aug 2016 16:38:54 +0000 (12:38 -0400)] 
Remove svcauth_gss_creds

svcauth_gss_creds was in the libgssrpc library export list (as
gssrpc_svc_auth_gss_creds) but was not declared in a public header and
has no value to applications.  Remove it.

8 years agoFix GSSRPC server credential memory leak
Greg Hudson [Tue, 23 Aug 2016 16:35:50 +0000 (12:35 -0400)] 
Fix GSSRPC server credential memory leak

In svc_auth_gss.c, stop using the global svcauth_gss_creds, and
instead keep a credential in struct svc_rpc_gss_data.  This change
ensures that the same credential is used for each accept_sec_context
call for a particular context, and ensures that the credential is
freed when the authentication data is destroyed.  Also, do not acquire
a credential when the default name is used (as it is in kadmind) as it
is not needed.

Leave the svcauth_gss_creds around for the backportable fix as it is
in the library export list.  It will be removed in a subsequent
commit.

ticket: 8480 (new)
target_version: 1.14-next
target_version: 1.13-next

8 years agoConvert k5-thread macros to functions
Sarah Day [Mon, 8 Aug 2016 20:40:17 +0000 (16:40 -0400)] 
Convert k5-thread macros to functions

k5-thread.h has several pthread support calls defined as macros which
conditionally call pthread functions.  If a program is linked with
libkrb5support and uses these macros, and the program isn't compiled
with -fPIC, then it can crash if the pthread functions are linked at
runtime (via LD_PRELOAD, for instance) but not at compile time.
Convert the conditional macros to functions, so that libkrb5support is
responsible for determining whether pthreads is loaded and for calling
the pthreads functions if it is.

[ghudson@mit.edu: clarified commit message, adjusted whitespace]

8 years agoUse krb5_expand_hostname() to get admin service 349/head
Greg Hudson [Fri, 20 Nov 2015 00:32:11 +0000 (19:32 -0500)] 
Use krb5_expand_hostname() to get admin service

In libkadm5's kadm5_get_admin_service_name(), use
krb5_expand_hostname() instead of custom canonicalization code to
canonicalize the hostname.  There are some minor behavior differences;
in addition to the changes listed in the previous commit, the old code
did not downcase the result of the getaddrinfo() lookup, while the new
code does.

ticket: 8278

8 years agoUse krb5_expand_hostname() when creating KDB
Greg Hudson [Tue, 17 Nov 2015 18:33:21 +0000 (13:33 -0500)] 
Use krb5_expand_hostname() when creating KDB

In kdb5_util's add_admin_princs(), use krb5_expand_hostname() instead
of custom canonicalization code to canonicalize the hostname.  There
are some minor behavior differences:

* Canonicalization will no longer use AI_ADDRCONFIG.
* Canonicalization will use reverse DNS if configuration permits.
* Canonicalization will be affected by the dns_canonicalize_hostname
  and rdns profile variables.
* If name lookup fails, the original hostname will be used.
* A trailing dot will be removed from the name lookup result, if
  present.

ticket: 8278

8 years agoAdd krb5_expand_hostname() API
Greg Hudson [Tue, 17 Nov 2015 18:06:31 +0000 (13:06 -0500)] 
Add krb5_expand_hostname() API

Add a new public libkrb5 function expand_hostname().  It follows the
same contract as the Heimdal function, except that the caller should
use krb5_free_string() instead of krb5_xfree() to free the result.

As a small side effect, we no longer remove trailing dots from the
hostname in krb5_sname_to_principal() when invoked with type
KRB5_NT_UNKNOWN.  Adjust a test case in t_sn2princ.py accordingly.

ticket: 8278 (new)

8 years agoTest the minclasses policy field in LDAP
Sarah Day [Fri, 19 Aug 2016 20:06:48 +0000 (16:06 -0400)] 
Test the minclasses policy field in LDAP

[ghudson@mit.edu: added reference to ticket 8193 in comment]

8 years agoRemove "XXX" from KRB5_CC_IO error description
Robbie Harwood [Wed, 17 Aug 2016 20:00:46 +0000 (16:00 -0400)] 
Remove "XXX" from KRB5_CC_IO error description

[tlyu@mit.edu: edit commit message]

8 years agoBump copyright years in src/prototype 519/head
Tom Yu [Fri, 19 Aug 2016 20:17:00 +0000 (16:17 -0400)] 
Bump copyright years in src/prototype

[ci skip]

8 years agoFix SPNEGO imported cred initialization 488/head
Greg Hudson [Wed, 20 Jul 2016 21:08:55 +0000 (17:08 -0400)] 
Fix SPNEGO imported cred initialization

In spnego_gss_import_cred(), use create_spnego_cred() to create the
SPNEGO credential structure.  Prior to this change, an imported SPNEGO
cred did not initialize the no_ask_integ field (added by commit
cf39ed349976908626cad3e05e17788f8334bce9, ticket #6938).

ticket: 8460 (new)
target_version: 1.14-next
tags: pullup

8 years agoAdd another AD-SIGNTICKET corner case test 508/head
Greg Hudson [Mon, 8 Aug 2016 18:39:24 +0000 (14:39 -0400)] 
Add another AD-SIGNTICKET corner case test

Prior to the fix for #8139, forwarded TGTs obtained across a krbtgt
re-key could fail if the preferred krbtgt enctype changed, because
krb5_c_verify_checksum() returns an bad-enctype error due to the
mismatched checksum.  Add a test case for this scenario, using a new
test harness program which obtains a forwarded TGT.

8 years agoOutput last command info on k5test failures 515/head
Greg Hudson [Wed, 17 Aug 2016 15:50:31 +0000 (11:50 -0400)] 
Output last command info on k5test failures

When a k5test failure occurs, display the last executed command, its
command index, and its output.  This will make it easier to understand
"make check" failures when it is not easy to run subsequent commands
or investigate the filesystem of the build host.

8 years agoRefactor AS reply decryption code in get_in_tkt.c 504/head
Greg Hudson [Fri, 5 Aug 2016 16:39:41 +0000 (12:39 -0400)] 
Refactor AS reply decryption code in get_in_tkt.c

Expand the contract of decrypt_as_reply() to encompass more of the
logic in init_creds_step_reply(), and clarify comments.

8 years agoUse responder for non-preauth AS requests
Greg Hudson [Fri, 5 Aug 2016 16:28:03 +0000 (12:28 -0400)] 
Use responder for non-preauth AS requests

If no AS reply key is computed during pre-authentication (typically
because no pre-authentication was required by the KDC), ask for the
password using the responder before calling gak_fct for the key, and
supply any resulting responder items to gak_fct.

ticket: 8454
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

8 years agoRestore recursive dump functionality 510/head
Tom Yu [Thu, 11 Aug 2016 22:05:33 +0000 (18:05 -0400)] 
Restore recursive dump functionality

Use the new recursive traversal interface to restore recursive dump
functionality.

ticket: 8476

8 years agoHandle errors from curs_init in db2 back end
Tom Yu [Thu, 11 Aug 2016 20:27:33 +0000 (16:27 -0400)] 
Handle errors from curs_init in db2 back end

ctx_iterate could ignore errors from curs_init.  Actually pass them up
to the caller.

ticket: 8473 (new)
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

8 years agoRecursive btree traversal test case
Tom Yu [Tue, 9 Aug 2016 01:46:16 +0000 (21:46 -0400)] 
Recursive btree traversal test case

Add an unlink page command to the dbtest program.  This dbtest command
finds a page that has both a left and a right neighbor and unlinks it,
making it inaccessible to conventional sequential traversal.  This
simulates some btree corruption that has been seen in the field.

Unlike the bttest command, the dbtest unlink command always searches
for a leaf page with both a left and a right sibling, and doesn't
allow the user to specify internal pages or a specific page number.

Add a new dbtest command to recursively dump a btree database.

Add a new test case to run.test that uses these new commands to verify
the correct functioning of the recursive btree traversal options.

ticket: 8476

8 years agoAdd bttest unlink page command
Tom Yu [Mon, 8 Aug 2016 12:50:40 +0000 (08:50 -0400)] 
Add bttest unlink page command

To enable testing of recursive btree traversal, add an unlink page
command to the bttest program (used for debugging the libdb2 btree
back end).  This new bttest command can unlink a specified page
number, or it can search for and unlink a page that has both a left
and a right sibling.  (The user can specify whether to find an
internal page or a leaf page.)

This unlinking makes the page inaccessible to conventional sequential
traversal, simulating some btree corruption that has been seen in the
field.

ticket: 8476

8 years agoRefactor btree recursive traversal code
Tom Yu [Mon, 8 Aug 2016 13:15:42 +0000 (09:15 -0400)] 
Refactor btree recursive traversal code

Previous releases had a nonstandard entry point (bt_rseq) into libdb2
to perform recursive traversal of a btree database that might be
corrupt so that an operator could attempt data recovery.  This entry
point became inaccessible to user commands after krb5-1.5 due to
integration of the DAL.

Refactor the recursive traversal code into the existing btree
sequential traversal code, accepting new movement flags R_RNEXT
(recursively advance to next item) and R_RPREV.

Add commands to the libdb2 btree test program bttest to exercise this
functionality.  Fix up the existing "rlist" command of bttest to use
the updated interface.

ticket: 8476 (new)
subject: Restore recursive dump functionality

8 years agoFix MPOOL_IGNOREPIN to ease btree debugging
Tom Yu [Mon, 8 Aug 2016 13:06:16 +0000 (09:06 -0400)] 
Fix MPOOL_IGNOREPIN to ease btree debugging

Various libdb2 test programs use the MPOOL_IGNOREPIN flag to examine
arbitrary mpool pages that may or may not be pinned.  This flag is
apparently intended to allow fetching pages that are already pinned,
and to avoid setting the MPOOL_PINNED flag.  When there was a cache
hit, mpool_get was setting MPOOL_PINNED anyway, causing aborts when
using debugging programs such as dbtest and bttest.

Fix this inconsistency by not setting MPOOL_PINNED when returning a
cached page when the caller requested MPOOL_IGNOREPIN.  In bttest, add
MPOOL_IGNOREPIN to allow dumping of pages while they are pinned
without disrupting their pinned status.

ticket: 8478

8 years agoFix void return in __bt_dpage
Tom Yu [Mon, 8 Aug 2016 13:15:09 +0000 (09:15 -0400)] 
Fix void return in __bt_dpage

ticket: 8478

8 years agoMake bttest build with restricted lib exports
Tom Yu [Mon, 8 Aug 2016 13:13:59 +0000 (09:13 -0400)] 
Make bttest build with restricted lib exports

On platforms that use strict library export lists, the libdb2 btree
debugging program bttest won't build with -DDEBUG or -DSTATISTICS
because some needed functions aren't in the export list.

Add the missing bt_debug.c and mpool.c functions to libdb.exports.
Stub out these functions when built without -DDEBUG or -DSTATISTICS to
avoid unreferenced symbols, because conditionalizing library export
lists isn't easy.

ticket: 8478

8 years agoFix bttest printing of unterminated strings
Tom Yu [Mon, 8 Aug 2016 13:12:53 +0000 (09:12 -0400)] 
Fix bttest printing of unterminated strings

The libdb2 btree debugging program bttest can attempt to print keys or
data that aren't null-terminated, reading past the end of the
length-counted byte array.  Use the "%.*s" format specifier to provide
an explicit length when printing keys or data.

ticket: 8478

8 years agoImprove EINTR handling in bttest
Tom Yu [Mon, 8 Aug 2016 13:12:16 +0000 (09:12 -0400)] 
Improve EINTR handling in bttest

The libdb2 btree debugging program bttest doesn't handle EINTR in its
input loop.  This causes difficulties with debugging using lldb,
because bttest gets signals like SIGSTOP when being attached, and lldb
doesn't seem to share the terminal well with a program being debugged.

ticket: 8478 (new)
subject: usability improvements for bttest

8 years agoAllow libev to use pthreads on old platforms 513/head
Greg Hudson [Sun, 14 Aug 2016 23:00:12 +0000 (19:00 -0400)] 
Allow libev to use pthreads on old platforms

The upgrade to libev 4.22 introduced the use of "memory fences" for
more reliable signal processing.  Memory fences are usually
implemented using assembly or compiler primitives, but may be
implemented using pthreads as a last resort.  The unmodified libev
errors out at compile time if pthreads is used, but notes that this
error can be removed if relying on pthreads is okay.  Because the
project's nightly build infrastructure includes an old Solaris machine
whose toolchain is too old for any of the non-pthreads memory fence
implementations, remove the error to allow the build to succeed.  (A
dependency on pthreads functions on Solaris does not require linking
with libpthread.)

8 years agoFix KDC to drop repeated in-progress requests
Sarah Day [Mon, 15 Aug 2016 20:11:31 +0000 (16:11 -0400)] 
Fix KDC to drop repeated in-progress requests

When a KDC receives a repeated request while the original request is
still in progress, it is supposed to be to drop the request.  Commit
f07760088b72a11c54dd72efbc5739f231a4d4b0 introduced a bug in this
logic, causing the KDC to instead send an empty reply.  In
kdc_check_lookaside(), return a NULL reply_packet for empty entries,
restoring the expected behavior.

[ghudson@mit.edu: edited commit message, added a comment]

ticket: 8477 (new)
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

8 years agoWork around glibc OFD lock bug on 32-bit Linux 512/head
Greg Hudson [Sun, 14 Aug 2016 16:08:16 +0000 (12:08 -0400)] 
Work around glibc OFD lock bug on 32-bit Linux

A bug in Gnu libc causes OFD locking to fail unpredictably on 32-bit
Linux, typically leading to deadlocks.  Work around this bug by using
the fcntl64 system call and struct flock64.

See also: https://sourceware.org/bugzilla/show_bug.cgi?id=20251

ticket: 8474
target_version: 1.14-next
tags: pullup

8 years agoProperly escape quotes for otp set_string example 501/head
Ben Kaduk [Wed, 3 Aug 2016 15:23:56 +0000 (10:23 -0500)] 
Properly escape quotes for otp set_string example

The libss parser will consume paired double quotes, but within
a double-quoted region, repeated double quotes will be treated
as an escape and passed through as a single double quote.

(The new kadmin(1) parser in 1.14 that lets commands be specified
on the command line without -q does not go through the libss parser,
so standard shell methods for escaping quotes function as usual.)

ticket: 8469 (new)
target_version: 1.14-next
tags: pullup

8 years agoAdd asan build support 478/head
Greg Hudson [Thu, 30 Jun 2016 16:32:20 +0000 (12:32 -0400)] 
Add asan build support

Add the --enable-asan configure option.  This option suppresses the
undefined symbol check when building shared libraries on Linux, and
adds -fsanitize=address to the compiler and linker options.

8 years agoFix memory leaks in test programs 477/head
Greg Hudson [Thu, 23 Jun 2016 15:12:55 +0000 (11:12 -0400)] 
Fix memory leaks in test programs

Eliminate memory leaks detected by asan in test programs, to make it
easier to find more serious leaks.

8 years agoFix a variety of one-time leaks
Greg Hudson [Wed, 29 Jun 2016 21:13:33 +0000 (17:13 -0400)] 
Fix a variety of one-time leaks

Eliminate some memory leaks which should not affect normal operation,
but which make it harder to detect more serious memory leaks.

In kdb5_util, start using the already existing quit() function and
remove redundant DB and master key cleanup performed by individual
commands.  In kdb5_destroy(), use util_context instead of creating a
new one.  Add an mkey_fullname global variable and use it to make
a bunch of krb5_db_setup_mkey_name() calls unnecessary.

8 years agoAdd ulog_fini()
Greg Hudson [Wed, 29 Jun 2016 21:12:47 +0000 (17:12 -0400)] 
Add ulog_fini()

Add a function to unmap and free the iprop logging resources attached
to a krb5_context.

8 years agoFix leak on error in libkadm5_srv initialization 476/head
Greg Hudson [Thu, 14 Jul 2016 15:15:40 +0000 (11:15 -0400)] 
Fix leak on error in libkadm5_srv initialization

In init_any(), free handle->params on failure.

ticket: 8453 (new)
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

8 years agoFix leak in capaths processing
Greg Hudson [Wed, 29 Jun 2016 04:01:04 +0000 (00:01 -0400)] 
Fix leak in capaths processing

In k5_client_realm_path(), free the list of strings returned by
rtree_capaths_vals().

ticket: 8447 (new)
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

8 years agoFix leak in key change operations
Greg Hudson [Wed, 29 Jun 2016 02:20:22 +0000 (22:20 -0400)] 
Fix leak in key change operations

In preserve_one_old_key(), if the initial decryption in the current
master key succeeds, free the decrypted keyblock contents before
exiting.

ticket: 8446 (new)
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

8 years agoFix leak in kadm5_hook interface
Greg Hudson [Wed, 29 Jun 2016 02:15:17 +0000 (22:15 -0400)] 
Fix leak in kadm5_hook interface

In k5_kadm5_hook_free_handles(), free each handle structure as well as
its module data.

ticket: 8445 (new)
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

8 years agoFix unlikely leak in sendto_kdc
Greg Hudson [Wed, 29 Jun 2016 02:10:35 +0000 (22:10 -0400)] 
Fix unlikely leak in sendto_kdc

If a TCP connection is killed after it allocates the buffer (so is no
longer in READING state), free the buffer during cleanup.

ticket: 8444 (new)
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

8 years agoFix leak in FAST OTP client processing
Greg Hudson [Wed, 29 Jun 2016 01:38:57 +0000 (21:38 -0400)] 
Fix leak in FAST OTP client processing

In set_pa_data(), after encoding the OTP request and stealing the
pointer from the resulting krb5_data object, free the krb5_data
container.

ticket: 8443 (new)
target_version: 1.14-next
target_version: 1.13-next
tags: pullup