]> git.ipfire.org Git - thirdparty/krb5.git/log
thirdparty/krb5.git
8 years agoAdd support to query the SSF of a GSS context 625/head
Simo Sorce [Thu, 30 Mar 2017 15:27:09 +0000 (11:27 -0400)] 
Add support to query the SSF of a GSS context

Cyrus SASL provides a Security Strength Factor number to assess the
relative "strength" of the negotiated mechanism, and applications
sometimes make access control decisions based on it.

Add a call that allows us to query the mechanism that established the
GSS security context to ask what is the current SSF, based on the
enctype of the session key.

ticket: 8569 (new)

8 years agoNotice errors from t_fortuna in make check 632/head
Greg Hudson [Sat, 8 Apr 2017 01:25:28 +0000 (21:25 -0400)] 
Notice errors from t_fortuna in make check

8 years agoUn-deprecate krb5_auth_con_initivector() 631/head
Greg Hudson [Fri, 7 Apr 2017 15:05:16 +0000 (11:05 -0400)] 
Un-deprecate krb5_auth_con_initivector()

The kprop protocol uses cipher state via this call, perhaps along with
other.  As there is no replacement, the call should not be deprecated
in the API.

ticket: 8572 (new)

8 years agoUse the canonical client principal name for OTP 628/head
Matt Rogers [Wed, 5 Apr 2017 20:48:55 +0000 (16:48 -0400)] 
Use the canonical client principal name for OTP

In the OTP module, when constructing the RADIUS request, use the
canonicalized client principal (using the new client_name kdcpreauth
callback) instead of the request client principal.

ticket: 8571 (new)

8 years agoAdd the client_name() kdcpreauth callback
Matt Rogers [Tue, 4 Apr 2017 20:54:56 +0000 (16:54 -0400)] 
Add the client_name() kdcpreauth callback

Add a kdcpreauth callback to returns the canonicalized client principal.

ticket: 8570 (new)

8 years agoExport GSS_KRB5_GET_CRED_IMPERSONATOR on Windows 629/head
Greg Hudson [Wed, 5 Apr 2017 15:42:17 +0000 (11:42 -0400)] 
Export GSS_KRB5_GET_CRED_IMPERSONATOR on Windows

Add the new public data symbol GSS_KRB5_GET_CRED_IMPERSONATOR to the
gssapi DLL export list.

ticket: 8548

8 years agoConvert some pkiDebug messages to TRACE macros 624/head
Matt Rogers [Wed, 29 Mar 2017 14:35:13 +0000 (10:35 -0400)] 
Convert some pkiDebug messages to TRACE macros

ticket: 8568 (new)

8 years agoCorrect formatting error in gss_duplicate_name() 621/head
Martin Kittel [Thu, 16 Mar 2017 15:03:54 +0000 (16:03 +0100)] 
Correct formatting error in gss_duplicate_name()

8 years agoFix krb5int_open_plugin_dirs() error handling
Martin Kittel [Wed, 15 Mar 2017 16:21:28 +0000 (17:21 +0100)] 
Fix krb5int_open_plugin_dirs() error handling

In krb5int_open_plugin_dirs(), if constructing filepath fails,
filepath is set to null but accessed a few lines later.  Add an error
check before calling krb5int_open_plugin().

ticket: 8565 (new)
target_version: 1.15-next
target_version: 1.14-next
tags: pullup

8 years agoAdd null check to placate static analysis tools
Martin Kittel [Wed, 29 Mar 2017 07:22:18 +0000 (09:22 +0200)] 
Add null check to placate static analysis tools

In trace_format() when processing lenstr, if p is NULL and len is 0,
skip the call to buf_add_printable_len() as Coverity considers it an
unconditional dereference of p.

[ghudson@mit.edu: added explanation to commit message]

8 years agoRemove unnecessary null checks
Martin Kittel [Wed, 29 Mar 2017 06:55:57 +0000 (08:55 +0200)] 
Remove unnecessary null checks

Remove some null checks for values that should never be null.  These
checks were performed inconsistently and triggered static code
analysis tools.

8 years agoSimplify null salt handling in string-to-key 622/head
Greg Hudson [Mon, 27 Mar 2017 19:40:08 +0000 (15:40 -0400)] 
Simplify null salt handling in string-to-key

The per-enctype string_to_key implementations are inconsistent about
whether a null salt is treated as empty or results in a null
dereference.  Since the original DES string-to-key allowed a null
salt, substitute an empty salt in krb5_c_string_to_key_with_params().
Eliminate conditionals on accessing salt in the per-enctype
implementations as they are no longer needed.  Based on a patch by
Martin Kittel.

8 years agoCompile less libev code 623/head
Greg Hudson [Tue, 28 Mar 2017 18:12:48 +0000 (14:12 -0400)] 
Compile less libev code

In verto-k5ev.c, turn off optional watchers in ev.c, and enable the
specific watcher types we use.

8 years agoIgnore dotfiles in profile includedir 619/head
Greg Hudson [Fri, 24 Mar 2017 15:07:21 +0000 (11:07 -0400)] 
Ignore dotfiles in profile includedir

Editors and filesystems may create artifacts related to .conf files
which don't change the file suffix; these artifacts generally begin
with "." so that they don't appear in normal directory listings
(e.g. ".#filename" for emacs interlock files).  Make sure to ignore
any such artifacts when processing a profile includedir directive.

ticket: 8563 (new)
target_version: 1.15-next
tags: pullup

8 years agoRemove the NSS PKINIT crypto implementation 620/head
Matt Rogers [Fri, 24 Mar 2017 20:57:42 +0000 (16:57 -0400)] 
Remove the NSS PKINIT crypto implementation

Remove the unused and buggy NSS PKINIT crypto backend.

8 years agoRemove some unnecessary PKINIT code 618/head
Greg Hudson [Thu, 23 Mar 2017 18:26:50 +0000 (14:26 -0400)] 
Remove some unnecessary PKINIT code

In cms_signeddata_create(), alg_buf and digest_buf are allocated but
never used.  (Instead, a combined buffer is allocated and the alg and
digest objects are marshalled into it.)  Remove them.

8 years agoCorrect error handling bug in prior commit 617/head
Greg Hudson [Thu, 23 Mar 2017 17:42:55 +0000 (13:42 -0400)] 
Correct error handling bug in prior commit

In crypto_encode_der_cert(), if the second i2d_X509() invocation
fails, make sure to free the allocated pointer and not the
possibly-modified alias.

ticket: 8561

8 years agoAdd the certauth dbmatch module 610/head
Matt Rogers [Wed, 15 Mar 2017 23:57:15 +0000 (19:57 -0400)] 
Add the certauth dbmatch module

Add and enable the "dbmatch" builtin module.  Add the
pkinit_client_cert_match() and crypto_req_cert_matching_data() helper
functions.  Add dbmatch tests to t_pkinit.py.  Add documentation to
krb5_conf.rst, pkinit.rst, and kadmin_local.rst.

[ghudson@mit.edu: simplified code, edited docs]

ticket: 8562 (new)

8 years agoSimplify PKINIT cert iteration and selection
Matt Rogers [Wed, 22 Mar 2017 01:24:14 +0000 (21:24 -0400)] 
Simplify PKINIT cert iteration and selection

Remove the pkinit_cert_handle structures and iteration functions used
during certificate matching.  Instead, make pkinit_matching.c obtain a
list of matching data objects from the crypto code, and then select a
cert based on the index into that list.

Also fix a typo in the name of crypto_retrieve_X509_key_usage().

[ghudson@mit.edu: simplified code]

8 years agoAdd certauth pluggable interface
Matt Rogers [Tue, 28 Feb 2017 20:55:24 +0000 (15:55 -0500)] 
Add certauth pluggable interface

Add the header include/krb5/certauth_plugin.h, defining a pluggable
interface to control authorization of PKINIT client certificates.

Add the "pkinit_san" and "pkinit_eku" builtin certauth modules and
related PKINIT crypto X.509 helper functions.  Add authorize_cert() as
the entry function for certauth plugin module checks called in
pkinit_server_verify_padata().  Modify kdcpreauth_moddata to hold the
list of certauth module handles, and load the modules when the PKINIT
kdcpreauth server plugin is initialized.  Change
crypto_retrieve_X509_sans() to return ENOENT when no SAN is found.

Add test modules in plugins/certauth/test.  Create t_certauth.py with
basic certauth tests.  Add plugin interface documentation in
doc/plugindev/certauth.rst and doc/admin/krb5_conf.rst.

[ghudson@mit.edu: simplified code, edited docs]

ticket: 8561 (new)

8 years agoForce autoconf rebuild in maintainer rules 615/head
Greg Hudson [Tue, 14 Mar 2017 23:39:38 +0000 (19:39 -0400)] 
Force autoconf rebuild in maintainer rules

autoconf normally avoids recreating files that it does not consider
obsolete.  Since it knows nothing about patchlevel.h (which we read at
autoconf time using m4's esyscmd()), changes to patchlevel.h won't be
reflected in configure unless another input to configure has changed,
and the maintainer rule will re-run autoconf over and over again.  Fix
this issue by passing the force flag to autoconf when we invoke it
from the maintainer rule.

ticket: 8560 (new)
target_version: 1.15-next
target_verison: 1.14-next
tags: pullup

8 years agoRefactor kvno for simpler memory management
Greg Hudson [Sun, 12 Mar 2017 17:09:38 +0000 (13:09 -0400)] 
Refactor kvno for simpler memory management

Move the kvno loop body into a helper function to reduce indentation
and make freeing temporary values easier.

8 years agoFix minor memory leaks in kvno
Greg Hudson [Sun, 12 Mar 2017 16:42:37 +0000 (12:42 -0400)] 
Fix minor memory leaks in kvno

In do_k5_kvno(), free allocated values on success as well as failure.
In t_kdb.py, run kvno with multiple arguments to manifest this leak in
asan and valgrind.  Reported by Cel Skeggs.

ticket: 8558

8 years agoFix leaks in gss_inquire_cred_by_oid()
Greg Hudson [Sun, 12 Mar 2017 16:30:59 +0000 (12:30 -0400)] 
Fix leaks in gss_inquire_cred_by_oid()

In the mechglue gss_inquire_cred_by_oid(), remove an unnecessary
allocation of ret_set which is overwritten by the first mechanism's
result.

ticket: 8559 (new)
target_version: 1.15-next
target_version: 1.14-next
tags: pullup

8 years agoFix memory leaks in test programs
Greg Hudson [Sun, 12 Mar 2017 16:29:50 +0000 (12:29 -0400)] 
Fix memory leaks in test programs

Eliminate memory leaks detected by asan in test programs (and
introduced since commit 4947c270032691d556140b290e1b10846b692968), to
make it easier to find more serious leaks.

8 years agoAllow null outputs to gss_get_name_attribute() 613/head
Isaac Boukris [Sat, 4 Mar 2017 19:23:32 +0000 (21:23 +0200)] 
Allow null outputs to gss_get_name_attribute()

In krb5_gss_get_name_attribute(), always ask for kvalue and
kdisplay_value when calling krb5_authdata_get_attribute(), as it
currently expect non-null arguments.  This change allows applications
to pass GSS_C_NO_BUFFER for the value and display_value output
parameters.  (Passing NULL for the authenticated and complete output
parameters already works.)

[ghudson@mit.edu: initialized kvalue and kdisplay_value for safety]

ticket: 8557 (new)
target_version: 1.15-next
target_version: 1.14-next
tags: pullup

8 years agoFix udp_preference_limit with SRV records 612/head
Greg Hudson [Tue, 28 Feb 2017 03:35:07 +0000 (22:35 -0500)] 
Fix udp_preference_limit with SRV records

In sendto_kdc:resolve_server() when resolving a server entry with a
specified transport, defer the resulting addresses if the strategy
dictates that the specified transport is not preferred.  Reported by
Jochen Hein.

ticket: 8554
target_version: 1.15-next
target_version: 1.14-next
tags: pullup

8 years agoFix PKINIT two-component matching rule parsing 611/head
Greg Hudson [Fri, 24 Feb 2017 18:41:53 +0000 (13:41 -0500)] 
Fix PKINIT two-component matching rule parsing

In pkinit_matching.c:parse_rule_set(), apply the default relation when
parsing the second component of a rule, not the third.  Otherwise we
apply no default relation to two-component matching rules, effectively
reducing such rules to their second components.  Reported by Sumit
Bose.

ticket: 8553 (new)
target_version: 1.15-next
target_version: 1.14-next
tags: pullup

8 years agoAdd test cases for preauth fallback behavior 604/head
Greg Hudson [Fri, 20 Jan 2017 17:44:12 +0000 (12:44 -0500)] 
Add test cases for preauth fallback behavior

Add options to icred for performing optimistic preauth and setting
preauth options, and for choosing between the normal and stepwise
interfaces.  Add options to the test preauth module to allow induced
failures at several points in processing, factoring out some padata
manipulation functions into a new file to avoid repeating too much
code.  Add test cases to t_preauth.py using the new facilities to
exercise and verify several preauth fallback scenarios.  Amend the
tryagain test case in t_pkinit.py to look for more trace log messages.

ticket: 8537

8 years agoContinue after KDC_ERR_PREAUTH_FAILED
Greg Hudson [Mon, 16 Jan 2017 20:09:32 +0000 (15:09 -0500)] 
Continue after KDC_ERR_PREAUTH_FAILED

If the KDC sends KDC_ERR_PREAUTH_FAILED, try another mechanism, or
send an unauthenticated request if optimistic preauth failed.

ticket: 8537

8 years agoContinue preauth after client-side failures
Greg Hudson [Sat, 14 Jan 2017 18:55:22 +0000 (13:55 -0500)] 
Continue preauth after client-side failures

If the module for the selected preauth mechanism fails when processing
a KDC_ERR_MORE_PREAUTH_DATA_REQUIRED error, or fails a tryagain
operation, try again with a different preauth mech using the cached
method data.

If optimistic preauth fails on the client side, send an
unauthenticated request, allowing the mechanisms we tried
optimistically to be tried again.

ticket: 8537

8 years agoPreserve method data in get_in_tkt.c
Greg Hudson [Fri, 13 Jan 2017 20:35:48 +0000 (15:35 -0500)] 
Preserve method data in get_in_tkt.c

To continue after preauth failures, we need a persistent field in
krb5_init_creds_context containing the METHOD-DATA from a
KDC_PREAUTH_REQUIRED or KDC_PREAUTH_FAILED error.  If we overwrite
this field with the padata in a KDC_MORE_PREAUTH_DATA_REQUIRED error,
or conflate it with an optimistic padata list, we won't be able to
correctly continue after a preauth failure.

In krb5_init_creds_context, split the preauth_to_use field into
optimistic_padata, method_padata, and more_padata.  Separately handle
KDC_ERR_MORE_PREAUTH_DATA_REQUIRED in init_creds_step_request() and
init_creds_step_reply(), and separately handle optimistic preauth in
init_creds_step_request().  Do not call k5_preauth() if none of the
padata lists are set.

Also stop clearing ctx->err_reply when processing a
KDC_ERR_PREAUTH_REQUIRED response.  Instead look for that error code
in init_creds_step_request().  Eliminate the preauth_required field of
krb5_init_creds_context as it can be inferred from whether we are
performing optimistic preauth.

ticket: 8537

8 years agoAdd OID to inquire GSS cred impersonator name 601/head
Simo Sorce [Thu, 26 Jan 2017 10:45:17 +0000 (05:45 -0500)] 
Add OID to inquire GSS cred impersonator name

In the krb5 GSS mechanism, add support in gss_inquire_cred_by_oid()
for inquiring the impersonator name of a credential object, using OID
1.2.840.113554.1.2.2.5.14.

[ghudson@mit.edu: edited code slightly; added documentation; expanded
commit message]

ticket: 8548 (new)

8 years agoAdd GSSAPI S4U documentation 609/head
Greg Hudson [Fri, 17 Feb 2017 18:38:19 +0000 (13:38 -0500)] 
Add GSSAPI S4U documentation

Describe how a GSS application can perform S4U2Self and S4U2Proxy
requests using the MIT krb5 GSS library.  Also add a reference to RFC
7546 at the top, and fix a reference to gssapi_krb5.h.

ticket: 8552 (new)
target_version: 1.15-next
tags: pullup

8 years agoUse fallback realm for GSSAPI ccache selection 606/head
Matt Rogers [Fri, 10 Feb 2017 17:53:42 +0000 (12:53 -0500)] 
Use fallback realm for GSSAPI ccache selection

In krb5_cc_select(), if the server principal has an empty realm, use
krb5_get_fallback_host_realm() and set the server realm to the first
fallback found.  This helps with the selection of a non-default ccache
when there is no [domain_realms] configuration for the server domain.
Modify t_ccselect.py tests to account for fallback behavior.

ticket: 8549 (new)

8 years agoUse LDIF config and add mdb support in t_kdb.py 585/head
Greg Hudson [Fri, 23 Dec 2016 02:49:09 +0000 (21:49 -0500)] 
Use LDIF config and add mdb support in t_kdb.py

When setting up slapd, use slapadd with cn=config LDIF directives
instead of the deprecated config file.  By adding one cn=config object
at a time, we can detect specific specific configuration failures,
including unsupported database types.  Try the mdb and bdb database
types, to work with older and newer OpenLDAP versions.

8 years agoAdd OpenLDAP LDIF file for Kerberos schema
Greg Hudson [Fri, 23 Dec 2016 02:16:39 +0000 (21:16 -0500)] 
Add OpenLDAP LDIF file for Kerberos schema

Add an LDIF version of the Kerberos schema suitable for use with
OpenLDAP's cn=config.

ticket: 8529 (new)

8 years agoAvoid draft 9 fallback after PKINIT failure 605/head
Greg Hudson [Tue, 7 Feb 2017 18:12:24 +0000 (13:12 -0500)] 
Avoid draft 9 fallback after PKINIT failure

If a KDC offers both RFC 4556 and draft 9 PKINIT, and we experience a
client-side failure trying RFC 4556 PKINIT (e.g. due to the user
entering the wrong PKCS #11 PIN), do not try to use draft 9 PKINIT.

ticket: 8544

8 years agoTrack preauth failures instead of tries 602/head
Greg Hudson [Fri, 13 Jan 2017 17:16:04 +0000 (12:16 -0500)] 
Track preauth failures instead of tries

In preauth2.c, instead of noting whenever we try a real preauth mech,
note when a mechanism fails on our side.  Tracking only failures
eliminates the need to reset the list for multi-step preauth exchanges
or for processing padata in the AS-REP, but we will need the function
later for continuing after optimistic preauth failures.

ticket: 8537

8 years agoRemove sent_nontrivial_preauth field
Greg Hudson [Mon, 16 Jan 2017 18:42:18 +0000 (13:42 -0500)] 
Remove sent_nontrivial_preauth field

In krb5_init_creds_context, the selected_preauth_type field subsumes
the need for sent_nontrivial_preauth.  Use it instead.

8 years agoSimplify k5_preauth_tryagain()
Greg Hudson [Sat, 14 Jan 2017 01:45:48 +0000 (20:45 -0500)] 
Simplify k5_preauth_tryagain()

When retrying pre-authentication for an error, try only the module for
the selected preauth type, not all preauth types in the original
method data.  Pass the error and its padata to k5_preauth_tryagain()
explicitly, so that those fields of krb5_init_creds_context are only
referenced in get_in_tkt.c.  Handle a degenerate case in
init_creds_step_reply() to simplify the code in
init_creds_step_request().

ticket: 8537

8 years agoAdjust processing of pa_type ccache config
Greg Hudson [Fri, 13 Jan 2017 15:14:36 +0000 (10:14 -0500)] 
Adjust processing of pa_type ccache config

Read the allowed preauth type from the input ccache in
restart_init_creds_loop(); there is no need to reread it each time we
produce a request.  Move read_allowed_preauth_type() earlier in the
file to allow it to be called from restart_init_creds_loop() without a
prototype.

Clear the selected preauth type in restart_init_creds_loop(), not in
init_creds_step_request().  We want to make sure that it doesn't
survive a restart due to a realm referral or expiry, but we don't want
to forget about it when retrying after an error.

8 years agoDocument multi-component PKINIT client certs 603/head
Greg Hudson [Mon, 30 Jan 2017 17:30:51 +0000 (12:30 -0500)] 
Document multi-component PKINIT client certs

In pkinit.rst, note that the extensions.client file only works for
single-component client principals, and describe how to modify it for
multi-component principals.

ticket: 7940
target_version: 1.15-next
tags: pullup

8 years agoEcho KDC cookies in preauth tryagain 599/head
Greg Hudson [Sat, 21 Jan 2017 18:20:38 +0000 (13:20 -0500)] 
Echo KDC cookies in preauth tryagain

When trying again after a mechanism-specific error, we should send the
KDC cookie for conformance with RFC 6113.

ticket: 8539

8 years agoDocument default realm and login authorization 600/head
Greg Hudson [Wed, 25 Jan 2017 18:07:42 +0000 (13:07 -0500)] 
Document default realm and login authorization

Add documentation to host_config.rst describing what the default realm
does.  Also add documentation discussing login authorization
configuration, and give an example showing how to give login access to
principals from a realm other than the default realm.

ticket: 8540 (new)
target_version: 1.15-next
tags: pullup

8 years agoDocument and check init_creds context requirement 593/head
Greg Hudson [Mon, 9 Jan 2017 16:44:29 +0000 (11:44 -0500)] 
Document and check init_creds context requirement

To ensure that the same clpreauth plugin modules and moddata pointers
are used for each step of an initial creds operation, the caller must
use the same library context for krb5_init_creds_init(),
krb5_init_creds_step(), and krb5_init_creds_free().  Document and
enforce this requirement.

ticket: 7877

8 years agoAdd tests for per-request preauth data scoping
Greg Hudson [Wed, 4 Jan 2017 23:31:15 +0000 (18:31 -0500)] 
Add tests for per-request preauth data scoping

Add a test harness which interleaves calls for multiple initial creds
contexts using the same library context.  Add a test case to
t_preauth.py using the new harness and the test preauth module to
verify that modreq pointers are correctly tracked.

ticket: 7877

8 years agoProperly scope per-request preauth data
Greg Hudson [Tue, 20 Dec 2016 21:06:24 +0000 (16:06 -0500)] 
Properly scope per-request preauth data

It should be possible to successfully use multiple initial credentials
contexts with the same library context.  Create a new internal type
krb5_preauth_req_context containing per-request preauth state,
including the clpreauth modreq handles and the list of preauth types
already tried.  Remove this state from clpreauth_handle and
krb5_preauth_context.

ticket: 7877

8 years agoMake krb5_preauth_context a pointer type
Greg Hudson [Tue, 20 Dec 2016 20:25:29 +0000 (15:25 -0500)] 
Make krb5_preauth_context a pointer type

For consistency with krb5_context and krb5_init_creds_context, make
krb5_preauth_context a pointer type.  In preauth2.c, use the typedef
name rather than the structure tag except when defining the structure.

8 years agoAdd free_principal_e_data KDB method 596/head
Andreas Schneider [Wed, 18 Jan 2017 10:52:48 +0000 (11:52 +0100)] 
Add free_principal_e_data KDB method

Add an optional method to kdb_vftabl to free e_data pointer in a
principal entry, in case it was populated by a module using a more
complex structure than a single memory region.

[ghudson@mit.edu: handled minor version bump; simplified code; rewrote
commit message]

ticket: 8538
target_version: 1.15-next
tags: pullup

8 years agoExplicitly copy KDB vtable fields
Greg Hudson [Wed, 18 Jan 2017 16:40:49 +0000 (11:40 -0500)] 
Explicitly copy KDB vtable fields

In preparation for bumping the kdb_vftabl minor version, use explicit
field assignments when copying the module vtable to the internal copy,
so that we can conditionalize assignments for minor versions greater
than 0.

ticket: 8538

8 years agoUse expected_msg in test scripts 598/head
Greg Hudson [Wed, 18 Jan 2017 16:22:58 +0000 (11:22 -0500)] 
Use expected_msg in test scripts

8 years agoUse expected_trace in test scripts
Greg Hudson [Tue, 17 Jan 2017 16:25:22 +0000 (11:25 -0500)] 
Use expected_trace in test scripts

8 years agoAdd k5test expected_msg, expected_trace
Greg Hudson [Tue, 17 Jan 2017 16:24:41 +0000 (11:24 -0500)] 
Add k5test expected_msg, expected_trace

In k5test.py, add the optional keyword argument "expected_msg" to
methods that run commands, to make it easier to look for substrings in
the command output.  Add the optional keyword "expected_trace" to run
the command with KRB5_TRACE enabled and look for an ordered series of
substrings in the trace output.

8 years agoAdd test case for PKINIT DH renegotiation 595/head
Greg Hudson [Wed, 11 Jan 2017 15:49:30 +0000 (10:49 -0500)] 
Add test case for PKINIT DH renegotiation

In t_pkinit.py, add a PKINIT test case where the KDC sends
KDC_ERR_DH_KEY_PARAMETERS_NOT_ACCEPTED and the client retries with the
KDC's TD_DH_PARAMETERS value, using the clpreauth tryagain method.
Use the trace log to verify that the renegotiation actually takes
place.

8 years agoClean up krb5_db2_free_policy() 594/head
Greg Hudson [Wed, 11 Jan 2017 14:46:46 +0000 (09:46 -0500)] 
Clean up krb5_db2_free_policy()

Commit 03d34fcfa329fbc2f686a0b34e2731e37f483a34 (ticket 8414) removed
the prototype and all uses of krb5_db2_free_policy(), but neglected to
remove the function definition, resulting in a warning.  Remove the
definition now.

8 years agoFix detection of supported warnings in clang 592/head
Ken Raeburn [Sat, 7 Jan 2017 03:39:39 +0000 (22:39 -0500)] 
Fix detection of supported warnings in clang

Without -Werror=unknown-warning-option, clang will warn for
unrecognized -W options like "-Werror=discarded-qualifiers" but won't
return a nonzero exit status, leading configure to think the options
are supported and thus include them during the build, leading to a
rather noisy log.

This option isn't needed during the build, though it won't hurt
anything either.  It is desirable during the testing of other -W
options for cleaner results, but the existing code tests each option
independently, requiring different handling for this option than for
other -W options.

8 years agoRemove addevent flag in net-server.c 588/head
Greg Hudson [Mon, 2 Jan 2017 19:20:29 +0000 (14:20 -0500)] 
Remove addevent flag in net-server.c

The addevent flag to make_event() was always set to true except when
setting up the routing socket.  Since we no longer set up the routing
socket (ticket 8348), we can remove the flag.

8 years agoRemove struct socksetup from net-server.c
Greg Hudson [Mon, 2 Jan 2017 19:10:12 +0000 (14:10 -0500)] 
Remove struct socksetup from net-server.c

struct socksetup was required when we iterated over local addresses
using foreach_localaddr.  Since we no longer do that (ticket 8348),
the functions which use it can simply accept the parameters they
require and return error codes.

8 years agoUse sa_is_wildcard() in libapputils
Greg Hudson [Mon, 26 Dec 2016 23:56:06 +0000 (18:56 -0500)] 
Use sa_is_wildcard() in libapputils

8 years agoAdd sa_is_wildcard() helper to socket-utils.h
Greg Hudson [Mon, 26 Dec 2016 23:47:00 +0000 (18:47 -0500)] 
Add sa_is_wildcard() helper to socket-utils.h

8 years agoUse pktinfo for explicit UDP wildcard listeners 587/head
Greg Hudson [Mon, 26 Dec 2016 20:18:05 +0000 (15:18 -0500)] 
Use pktinfo for explicit UDP wildcard listeners

In net-server.c, use pktinfo on UDP server sockets if they are bound
to wildcard addresses, whether that is explicit or implicit in the
address specification.

ticket: 8530
target_version: 1.15-next
tags: pullup

8 years agoFix KDC/kadmind startup on some IPv4-only systems
Greg Hudson [Mon, 26 Dec 2016 20:09:24 +0000 (15:09 -0500)] 
Fix KDC/kadmind startup on some IPv4-only systems

getaddrinfo(NULL, ...) may yield an IPv6 wildcard address on IPv4-only
systems, and creating a socket for that address may result in an
EAFNOSUPPORT error.  Tolerate that error as long as we can bind at
least one socket for the address.

ticket: 8531
target_version: 1.15-next
tags: pullup

8 years agoFix minor bug in responder.c test program 591/head
Greg Hudson [Fri, 6 Jan 2017 17:05:29 +0000 (12:05 -0500)] 
Fix minor bug in responder.c test program

"PKCS12:" has seven characters, not five.  Reported by Dorian Ducournau.

ticket: 8533

8 years agoAdd configure option to disable nls support 584/head
Zentaro Kavanagh [Wed, 21 Dec 2016 00:52:01 +0000 (16:52 -0800)] 
Add configure option to disable nls support

ChromeOS portage disables nls support as users are not expected to see
strings from the packages built.  Add a configure option to allow
this.

[ghudson@mit.edu: rewrote commit message, reformatted code]

ticket: 8534 (new)

8 years agoDeindent crypto_retrieve_X509_sans() 590/head
Greg Hudson [Wed, 4 Jan 2017 16:33:57 +0000 (11:33 -0500)] 
Deindent crypto_retrieve_X509_sans()

Fix some long lines in crypto_retrieve_X509_sans() by returning early
if X509_get_ext_by_NID() returns a negative result.  Also ensure that
return parameters are always initialized.

8 years agoConstify rhost in krb5_fwd_tgt_creds() 579/head
Andreas Schneider [Wed, 14 Dec 2016 16:44:46 +0000 (17:44 +0100)] 
Constify rhost in krb5_fwd_tgt_creds()

ticket: 8527

8 years agoClean up memory handling in krb5_fwd_tgt_creds()
Greg Hudson [Sun, 18 Dec 2016 03:34:28 +0000 (22:34 -0500)] 
Clean up memory handling in krb5_fwd_tgt_creds()

Use distinct local variables to own allocated resources which we must
release at function exit, instead of using parameter variables and
flags.

ticket: 8527 (new)

8 years agoConstify service and hostname in krb5_mk_req()
Andreas Schneider [Wed, 14 Dec 2016 16:20:30 +0000 (17:20 +0100)] 
Constify service and hostname in krb5_mk_req()

ticket: 8526 (new)

8 years agoFix GSSAPI authind attribute name in docs 589/head
Matt Rogers [Tue, 3 Jan 2017 16:54:39 +0000 (11:54 -0500)] 
Fix GSSAPI authind attribute name in docs

The correct attribute name is "auth-indicators".

ticket: 8532 (new)
target_version: 1.15-next
tags: pullup

8 years agoAdd PKINIT UPN tests to t_pkinit.py 563/head
Matt Rogers [Fri, 9 Dec 2016 16:43:27 +0000 (11:43 -0500)] 
Add PKINIT UPN tests to t_pkinit.py

[ghudson@mit.edu: simplify and explain tests; add test for
id-pkinit-san match against canonicalized client principal]

ticket: 8528

8 years agoAdd test cert generation to make-certs.sh
Matt Rogers [Mon, 5 Dec 2016 17:22:45 +0000 (12:22 -0500)] 
Add test cert generation to make-certs.sh

Add additional test certificates for UPN matching.  Run make-certs.sh
to regenerate certs.

ticket: 8528

8 years agoImprove PKINIT UPN SAN matching
Matt Rogers [Mon, 5 Dec 2016 17:17:59 +0000 (12:17 -0500)] 
Improve PKINIT UPN SAN matching

Add the match_client() kdcpreauth callback and use it in
verify_client_san().  match_client() preserves the direct UPN to
request principal comparison and adds a direct comparison to the
client principal, falling back to an alias DB search and comparison
against the client principal.  Change crypto_retreive_X509_sans() to
parse UPN values as enterprise principals.

[ghudson@mit.edu: use match_client for both kinds of SANs]

ticket: 8528 (new)

8 years agoUpdate copyright years to 2017 586/head
Michael Mattioli [Tue, 27 Dec 2016 22:02:04 +0000 (17:02 -0500)] 
Update copyright years to 2017

8 years agoFix minor errors in skiptests messages 583/head
Greg Hudson [Fri, 16 Dec 2016 17:16:11 +0000 (12:16 -0500)] 
Fix minor errors in skiptests messages

8 years agoAdd AD-SIGNTICKET test for renewing tickets 574/head
Greg Hudson [Sun, 4 Dec 2016 05:18:25 +0000 (00:18 -0500)] 
Add AD-SIGNTICKET test for renewing tickets

Add another regression test for #8139 using renewed tickets.

8 years agoAdd header comments for gss_krb5_copy_ccache() 578/head
Greg Hudson [Wed, 14 Dec 2016 16:12:46 +0000 (11:12 -0500)] 
Add header comments for gss_krb5_copy_ccache()

8 years agoClean up PKINIT decode_data functions 581/head
Greg Hudson [Wed, 14 Dec 2016 16:31:48 +0000 (11:31 -0500)] 
Clean up PKINIT decode_data functions

In pkinit_crypto_openssl.c, fold decrypt_data() into its caller
pkinit_decode_data_fs(), and simplify its error-handling logic.
Initialize output parameters in pkinit_decode_data_pkcs11() and
pkinit_decode_data().

8 years agoFix error handling in PKINIT decode_data() 580/head
Greg Hudson [Wed, 14 Dec 2016 16:25:41 +0000 (11:25 -0500)] 
Fix error handling in PKINIT decode_data()

decode_data() mixes errno values with OpenSSL return codes.  Change
its return type to int, and return 1 on success or 0 on failure.

ticket: 8525 (new)
target_version: 1.15-next
target_version: 1.14-next
tags: pullup

8 years agoFix documented kcpreauth minor version 582/head
Greg Hudson [Wed, 14 Dec 2016 16:56:56 +0000 (11:56 -0500)] 
Fix documented kcpreauth minor version

Commit 7b12eb4757f8dd05b79c9b49d4289f0caf1f6eec erroneously changed
the documented kdcpreauth minor version from 2 to 3.  Only the
callback version changed in that commit; the interface minor version
remains at 2 (from commit 83b4ecd20e50ad330cd761977d5dadefe30a785b
which added the loop method).

8 years agoSimplify gss_krb5int_copy_ccache()
Andreas Schneider [Mon, 12 Dec 2016 15:51:53 +0000 (16:51 +0100)] 
Simplify gss_krb5int_copy_ccache()

Use krb5_cc_copy_creds() to reduce the amount of code in
gss_krb5int_copy_ccache().

8 years agoAdd caveats to krbtgt change documentation 575/head
Greg Hudson [Sun, 4 Dec 2016 23:34:41 +0000 (18:34 -0500)] 
Add caveats to krbtgt change documentation

In database.rst, describe a couple of krbtgt rollover issues and how
to avoid them.

ticket: 8524 (new)
target_version: 1.15-next
target_version: 1.14-next
tags: pullup

8 years agoImprove cleanup in krb5_rc_io_fetch() 573/head
Greg Hudson [Fri, 2 Dec 2016 16:10:52 +0000 (11:10 -0500)] 
Improve cleanup in krb5_rc_io_fetch()

In the error cleanup for krb5_rc_io_fetch(), null out rep->msghash
after freeing it, like we do with rep->client and rep->server.  This
omission is currently harmless because krb5_rc_io_fetch() never sets
rep->msghash before failing, but it could result in a double-free or
use after free if the code changes.

8 years agoAdd krbPwdPolicy attributes to kerberos.ldif 572/head
Tomas Kuthan [Fri, 2 Dec 2016 14:22:54 +0000 (15:22 +0100)] 
Add krbPwdPolicy attributes to kerberos.ldif

When LDAP backend support for policy extensions was added by
5edafa0532 (ticket 7223), the kerberos.ldif change neglected to add
the new attributes to krbPwdPolicy.

ticket: 8523 (new)
target_version: 1.15-next
target_version: 1.14-next
tags: pullup

8 years agoRelicense ccapi/common/win/OldCC/autolock.hxx 571/head
Greg Hudson [Tue, 29 Nov 2016 06:46:21 +0000 (01:46 -0500)] 
Relicense ccapi/common/win/OldCC/autolock.hxx

With permission from Danilo Almeida, change the license on
autolock.hxx to the 2-clause BSD license used by MIT krb5.

ticket: 8520 (new)
target_version: 1.15-next
target_version: 1.14-next
tags: pullup

8 years agoAllow slapd path configuration in t_kdb.py 570/head
Greg Hudson [Sun, 27 Nov 2016 23:37:12 +0000 (18:37 -0500)] 
Allow slapd path configuration in t_kdb.py

The upstream OpenLDAP installs slapd in libexec, which is not
typically in the path.  Also, copying the binary can sometimes cause
it to fail; for instance, in the OpenCSW package,
/opt/csw/libexec/slapd is a script which chooses a binary based on the
system architecture and the path to the script.  Allow the test runner
to set the SLAPD environment variable to specify the slapd location
and avoid the copy.

8 years agoSimplify LDAP module by relying on OpenLDAP 2.1 569/head
Greg Hudson [Tue, 22 Nov 2016 07:17:38 +0000 (02:17 -0500)] 
Simplify LDAP module by relying on OpenLDAP 2.1

Solaris 11 provides an OpenLDAP library (which we don't auto-detect,
but should) in addition to the old Mozilla LDAP library; this will
become the default LDAP library in the next release.  As there is no
longer a need to build against the Mozilla LDAP library, and as we
have unwittingly relied on some OpenLDAP-specific features since 1.13,
remove the compatibility code for the Mozilla LDAP library and just
require OpenLDAP 2.1 (which added ldap_str2dn).

8 years agoRemove redeclaration of ttyname() in ksu 568/head
Zentaro Kavanagh [Wed, 16 Nov 2016 21:58:06 +0000 (13:58 -0800)] 
Remove redeclaration of ttyname() in ksu

ttyname() is declared in unistd.h.  Redeclaring it causes an
issue building with clang fortify on Chrome OS.

ticket: 8518 (new)

8 years agoAdd KRB5_TRACE calls for DNS lookups 564/head
Matt Rogers [Mon, 31 Oct 2016 18:47:00 +0000 (14:47 -0400)] 
Add KRB5_TRACE calls for DNS lookups

ticket: 8517 (new)

8 years agoBuild with -Werror-implicit-int where supported 567/head
Robbie Harwood [Thu, 10 Nov 2016 18:20:49 +0000 (13:20 -0500)] 
Build with -Werror-implicit-int where supported

8 years agoFix declaration without type in t_shs3.c
Robbie Harwood [Thu, 10 Nov 2016 17:57:19 +0000 (12:57 -0500)] 
Fix declaration without type in t_shs3.c

ticket: 8516 (new)
target_version: 1.15-next
tags: pullup

8 years agoUse zap() more consistently 565/head
Greg Hudson [Mon, 31 Oct 2016 16:10:48 +0000 (12:10 -0400)] 
Use zap() more consistently

Use zap() or zapfree() in places where we previously used memset() to
scrub memory.  Reported by Zhaomo Yang and Brian Johannesmeyer.

ticket: 8514

8 years agoMake zap() more reliable
Greg Hudson [Mon, 31 Oct 2016 15:48:54 +0000 (11:48 -0400)] 
Make zap() more reliable

The gcc assembly version of zap() could still be optimized out under
gcc 5.1 or later, and the krb5int_zap() function could be optimized
out with link-time optimization.  Based on work by Zhaomo Yang and
Brian Johannesmeyer, use the C11 memset_s() when available, then fall
back to a memory barrier with gcc or clang, and finally fall back to
using krb5int_zap().  Modify krb5int_zap() to use a volatile pointer
in case link-time optimization is used.

ticket: 8514 (new)
target_version: 1.15-next
target_version: 1.14-next
tags: pullup

8 years agoFix detection of libaceclnt for securid_sam2 561/head
Greg Hudson [Fri, 28 Oct 2016 14:13:13 +0000 (10:13 -0400)] 
Fix detection of libaceclnt for securid_sam2

The symbol we need is SD_Init(), not sd_init().

ticket: 8512 (new)
target_version: 1.15-next
target_version: 1.14-next
tags: pullup

8 years agoAdd doxygen comments for RFC 8009, RFC 4757 562/head
Greg Hudson [Fri, 28 Oct 2016 14:26:04 +0000 (10:26 -0400)] 
Add doxygen comments for RFC 8009, RFC 4757

The aes-sha2 specification has been published as RFC 8009.  Add
Doxygen comments to the #defines for its enctype and checksum type
comments.  Also add comments for the RC4 enctype and checksum type
constants referring to RFC 4757.

ticket: 8513 (new)
target_version: 1.15-next
tags: pullup

8 years agoClarify krb5_kt_resolve() API documentation 554/head
Greg Hudson [Fri, 7 Oct 2016 15:23:02 +0000 (11:23 -0400)] 
Clarify krb5_kt_resolve() API documentation

Explicitly say to use krb5_kt_close() like we do for most other
allocating API calls.  Note the default type.  Instead of saying "The
key table is not opened," say that the keytab file for FILE keytabs is
not opened by this call.

ticket: 8508 (new)
target_version: 1.14-next
target_version: 1.15-next
tags: pullup

8 years agoSuggest unlocked iteration for mkey rollover 552/head
Greg Hudson [Thu, 6 Oct 2016 15:28:33 +0000 (11:28 -0400)] 
Suggest unlocked iteration for mkey rollover

In database.rst when discussing the procedure for master key rollover,
suggest using unlocked iteration for large databases.  Also make it
clear that unavailability due to locking during iteration is specific
to DB2.

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

8 years agomake depend 551/head
Greg Hudson [Wed, 5 Oct 2016 15:15:02 +0000 (11:15 -0400)] 
make depend

8 years agoFix "make depend" when cmocka.h not present
Greg Hudson [Wed, 5 Oct 2016 14:51:52 +0000 (10:51 -0400)] 
Fix "make depend" when cmocka.h not present

Add an intermediary header file k5-cmocka.h, which only includes
cmocka.h if we detected an appropriate version of cmocka at configure
time.  This allows "make depend" to successfully run over cmocka test
programs when cmocka.h isn't present on the build platform.

For convenience, k5-cmocka.h also includes stdarg.h, stddef.h, and
setjmp.h, which are required to include cmocka.h.

8 years agoUpdate acknowledgments
Tom Yu [Mon, 24 Oct 2016 18:59:58 +0000 (14:59 -0400)] 
Update acknowledgments