]> git.ipfire.org Git - thirdparty/krb5.git/log
thirdparty/krb5.git
11 years agoSupport kdb5_util dump -rev again 178/head
Tom Yu [Sat, 2 Aug 2014 18:20:35 +0000 (14:20 -0400)] 
Support kdb5_util dump -rev again

Restore kdb5_util dump support for reversed dumps.

ticket: 7978 (new)

11 years agoDocument unlockiter
Tom Yu [Sat, 2 Aug 2014 18:20:35 +0000 (14:20 -0400)] 
Document unlockiter

ticket: 7977

11 years agoStop locking around iprop dumps
Tom Yu [Sat, 2 Aug 2014 18:20:35 +0000 (14:20 -0400)] 
Stop locking around iprop dumps

ticket: 7977

11 years agoIgnore iprop deletion of deleted princ
Tom Yu [Sat, 2 Aug 2014 18:20:35 +0000 (14:20 -0400)] 
Ignore iprop deletion of deleted princ

Now that an iprop full dump might not hold a lock around the entire
dump, it's possible that iprop will queue an incremental update while
the dump is in progress.  If a principal is deleted while the dump is
in progress, the dump could omit that principal, yet the deletion
event would still be queued in the ulog.  Ignore that deletion without
generating an error.

This is the same basic change as for ticket #7753.

ticket: 7977

11 years agoTests for unlocked iteration
Tom Yu [Sat, 2 Aug 2014 18:20:35 +0000 (14:20 -0400)] 
Tests for unlocked iteration

ticket: 7977

11 years agoSupport unlocked iteration in DB2
Tom Yu [Sat, 2 Aug 2014 18:20:33 +0000 (14:20 -0400)] 
Support unlocked iteration in DB2

Add support to the DB2 KDB back end to optionally release the lock
when calling the iterator callback.  This prevents the blocking of
other processes when dumps of large databases are taking place.

Also add support for reversed iteration.

ticket: 7977

11 years agoUse write lock flag for update_princ_encryption
Tom Yu [Sat, 2 Aug 2014 18:20:33 +0000 (14:20 -0400)] 
Use write lock flag for update_princ_encryption

In kdb5_util update_princ_encryption, instead of getting a write lock
on the KDB surrounding the call to krb5_db_iterate(), use the
iterflags parameter of krb5_db_iterate() to request that it obtain a
write lock around the iteration.

ticket: 7977

11 years agoSupport write locks in DB2 iteration
Tom Yu [Sat, 2 Aug 2014 18:20:33 +0000 (14:20 -0400)] 
Support write locks in DB2 iteration

Add support to krb5_db_iterate() for requesting write locks in the DB2
back end.

ticket: 7977

11 years agoAdd flag word to KDB iteration APIs
Tom Yu [Sat, 2 Aug 2014 18:20:33 +0000 (14:20 -0400)] 
Add flag word to KDB iteration APIs

ticket: 7977 (new)
subject: Enable unlocked KDB iteration

11 years agoAdd kiprop/<master-hostname> during KDB creation
Neng Xue [Fri, 11 Jul 2014 23:04:42 +0000 (16:04 -0700)] 
Add kiprop/<master-hostname> during KDB creation

To reduce the number of steps in the deployment of iprop, create the
kiprop/hostname principal for the master KDC during KDB creation.
Adjust tests to match the new behavior.

[ghudson@mit.edu: clarified commit message; avoided applying kadmin
flags/lifetime to kiprop principal]

ticket: 7979 (new)

11 years agoSimplify kdb5_ldap_util special princ creation
Greg Hudson [Tue, 22 Jul 2014 18:20:32 +0000 (14:20 -0400)] 
Simplify kdb5_ldap_util special princ creation

In kdb5_ldap_realm.c, factor out special principal creation into three
helper functions to reduce the amount of verbiage in kdb5_ldap_create.

11 years agoDocument KCM ccache type
Greg Hudson [Fri, 11 Jul 2014 19:00:09 +0000 (15:00 -0400)] 
Document KCM ccache type

Document the new KCM ccache type in ccache_def.rst.  Document the
kcm_socket and kcm_mach_service variables in krb5_conf.rst.

ticket: 7964

11 years agoMake KCM the default ccache on OS X
Greg Hudson [Fri, 11 Jul 2014 03:11:11 +0000 (23:11 -0400)] 
Make KCM the default ccache on OS X

If we do not find a default ccache value from krb5-config and we
detect that the host platform is OS X 10.7 or higher, use KCM: as the
default ccache name instead of FILE:/tmp/krb5cc_%{uid}.

ticket: 7964

11 years agoAdd KCM credential cache type (client only)
Greg Hudson [Tue, 1 Jul 2014 15:49:07 +0000 (11:49 -0400)] 
Add KCM credential cache type (client only)

Add a new credential cache type "KCM" which performs cache operations
by speaking to a Heimdal or OS X KCM daemon, via either Unix domain
sockets or (on OS X only) Mach RPC.  Add "kcm_socket" and
"kcm_mach_service" profile variables to control the socket path and
bootstrap service name respectively.  In ccmarshal.c, add
k5_marshal_mcred to marshal matching credentials in the KCM protocol
representation.

This cache type is not currently supported on Windows, as Windows does
not support Unix domain sockets.

As with the keyring cache type, the lastchange method of this cache
type is mostly useless, reporting only the time of the last change
made through that cache handle.  The KCM protocol currently has no
support for obtaining the last change time of the cache itself.

ticket: 7964 (new)

11 years agoAdjust marshalling interfaces for KCM
Greg Hudson [Tue, 1 Jul 2014 16:13:15 +0000 (12:13 -0400)] 
Adjust marshalling interfaces for KCM

Make k5_marshal_cred and k5_marshal_princ write to an existing struct
k5buf instead of allocating a new one, so that they can be marshalled
before or after other data.

11 years agoModify k5buf interfaces for easier use
Greg Hudson [Wed, 2 Jul 2014 16:03:54 +0000 (12:03 -0400)] 
Modify k5buf interfaces for easier use

Make struct k5buf less opaque and get rid of k5buf-int.h.  Make it
easy to initialize a k5buf in an error state so that it can be freed
in a cleanup handler.  Add a function k5_buf_status which returns 0 or
ENOMEM.  Remove k5_buf_data and k5_buf_len.  Rename k5_free_buf to
k5_buf_free.  Adjust all callers to match.

11 years agoAdd profile tests for deletion bugs
Greg Hudson [Wed, 16 Jul 2014 20:30:44 +0000 (16:30 -0400)] 
Add profile tests for deletion bugs

Add three new libprofile tests to prof_test1, two to test for the bugs
in #7971 and one to test a bug which would have been introduced by a
candidate fix.

11 years agoFix creation/rename of top-level profile sections
Greg Hudson [Wed, 16 Jul 2014 20:30:26 +0000 (16:30 -0400)] 
Fix creation/rename of top-level profile sections

profile_rename_section should demand only one name.

profile_add_relation should demand only one name if it is creating a
new section.  It aso needs to reset state before calling
profile_find_node for the section, in case it didn't look up any
parent sections previously.

ticket: 7972 (new)
target_version: 1.12.2
tags: pullup

11 years agoFix deleted node handling in libprofile
Greg Hudson [Wed, 16 Jul 2014 20:02:21 +0000 (16:02 -0400)] 
Fix deleted node handling in libprofile

In profile_find_node, skip deleted nodes when finding the second
match.  Otherwise, profile_clear_nodes could return an error if a node
has some values to clear but the last one is deleted.

In profile_node_iterator, skip deleted nodes when looking up the
section names.  Otherwise we could iterate over a deleted section
and/or ignore its replacement.

ticket: 7971 (new)
target_version: 1.12.2
tags: pullup

11 years agoAdd SPNEGO renegotiation test case
Greg Hudson [Tue, 15 Jul 2014 16:51:35 +0000 (12:51 -0400)] 
Add SPNEGO renegotiation test case

Modify t_spnego.c to force a renegotiation in the SPNEGO exchange, by
making the initiator propose IAKERB while the acceptor supports only
krb5.

11 years agoDon't equate IAKERB and krb5 in SPNEGO initiator
Greg Hudson [Tue, 15 Jul 2014 17:20:43 +0000 (13:20 -0400)] 
Don't equate IAKERB and krb5 in SPNEGO initiator

To work around a historical bug in Samba, the SPNEGO initiator treats
a counterproposal as matching the optimistic token if both are aliases
for the krb5 mech.  When IAKERB support was added (#6712), IAKERB was
unintentionally added to the set of mech OIDs which were considered to
be krb5 aliases for this purpose.

Remove IAKERB from gss_mech_set_krb5_both and create a new internal
mech set, kg_all_mechs, for use by krb5_gss_indicate_mechs.

ticket: 7974 (new)

11 years agoFix null deref in SPNEGO acceptor [CVE-2014-4344]
Greg Hudson [Tue, 15 Jul 2014 16:56:01 +0000 (12:56 -0400)] 
Fix null deref in SPNEGO acceptor [CVE-2014-4344]

When processing a continuation token, acc_ctx_cont was dereferencing
the initial byte of the token without checking the length.  This could
result in a null dereference.

CVE-2014-4344:

In MIT krb5 1.5 and newer, an unauthenticated or partially
authenticated remote attacker can cause a NULL dereference and
application crash during a SPNEGO negotiation by sending an empty
token as the second or later context token from initiator to acceptor.
The attacker must provide at least one valid context token in the
security context negotiation before sending the empty token.  This can
be done by an unauthenticated attacker by forcing SPNEGO to
renegotiate the underlying mechanism, or by using IAKERB to wrap an
unauthenticated AS-REQ as the first token.

    CVSSv2 Vector: AV:N/AC:L/Au:N/C:N/I:N/A:C/E:POC/RL:OF/RC:C

[kaduk@mit.edu: CVE summary, CVSSv2 vector]

ticket: 7970 (new)
subject: NULL dereference in SPNEGO acceptor for continuation tokens [CVE-2014-4344]
target_version: 1.12.2
tags: pullup

11 years agoFix double-free in SPNEGO [CVE-2014-4343]
David Woodhouse [Tue, 15 Jul 2014 16:54:15 +0000 (12:54 -0400)] 
Fix double-free in SPNEGO [CVE-2014-4343]

In commit cd7d6b08 ("Verify acceptor's mech in SPNEGO initiator") the
pointer sc->internal_mech became an alias into sc->mech_set->elements,
which should be considered constant for the duration of the SPNEGO
context.  So don't free it.

CVE-2014-4343:

In MIT krb5 releases 1.10 and newer, an unauthenticated remote
attacker with the ability to spoof packets appearing to be from a
GSSAPI acceptor can cause a double-free condition in GSSAPI initiators
(clients) which are using the SPNEGO mechanism, by returning a
different underlying mechanism than was proposed by the initiator.  At
this stage of the negotiation, the acceptor is unauthenticated, and
the acceptor's response could be spoofed by an attacker with the
ability to inject traffic to the initiator.

Historically, some double-free vulnerabilities can be translated into
remote code execution, though the necessary exploits must be tailored
to the individual application and are usually quite
complicated. Double-frees can also be exploited to cause an
application crash, for a denial of service.  However, most GSSAPI
client applications are not vulnerable, as the SPNEGO mechanism is not
used by default (when GSS_C_NO_OID is passed as the mech_type argument
to gss_init_sec_context()).  The most common use of SPNEGO is for
HTTP-Negotiate, used in web browsers and other web clients.  Most such
clients are believed to not offer HTTP-Negotiate by default, instead
requiring a whitelist of sites for which it may be used to be
configured.  If the whitelist is configured to only allow
HTTP-Negotiate over TLS connections ("https://"), a successful
attacker must also spoof the web server's SSL certificate, due to the
way the WWW-Authenticate header is sent in a 401 (Unauthorized)
response message.  Unfortunately, many instructions for enabling
HTTP-Negotiate in common web browsers do not include a TLS
requirement.

    CVSSv2 Vector: AV:N/AC:H/Au:N/C:C/I:C/A:C/E:POC/RL:OF/RC:C

[kaduk@mit.edu: CVE summary and CVSSv2 vector]

ticket: 7969 (new)
target_version: 1.12.2
tags: pullup

11 years agoFix leak on GSS module symbol resolution error
Simo Sorce [Thu, 10 Jul 2014 14:04:06 +0000 (10:04 -0400)] 
Fix leak on GSS module symbol resolution error

If krb5int_get_plugin_func fails, errinfo may contain an allocated
error message.  Free it on error when loading GSS modules.

[ghudson@mit.edu: also fix GSS_ADD_DYNAMIC_METHOD; clarify commit
message]

ticket: 7966 (new)
target_version: 1.12.2
tags: pullup

11 years agoFix doc build
Greg Hudson [Sun, 20 Jul 2014 01:57:03 +0000 (21:57 -0400)] 
Fix doc build

Commit 15b7e405ff7b62ab96af45999d1350455948e602 contained an
indentation error which broke the doc build.  Fix it.

ticket: 7944

11 years agoDocument LDAP SASL configuration
Greg Hudson [Mon, 16 Jun 2014 17:15:33 +0000 (13:15 -0400)] 
Document LDAP SASL configuration

Document the LDAP SASL profile tags and DB options.  For consistency,
also condense the kdc.conf documentation for the two bind DN variables
into one entry.

ticket: 7944

11 years agoAdd tests for LDAP SASL support
Greg Hudson [Mon, 16 Jun 2014 16:52:29 +0000 (12:52 -0400)] 
Add tests for LDAP SASL support

In t_kdb.py, add a test case for EXTERNAL, and a test case for
DIGEST-MD5 if we built with the SASL header file and found the core
schema file.

ticket: 7944

11 years agoAdd SASL support to LDAP KDB module
Greg Hudson [Mon, 16 Jun 2014 16:41:03 +0000 (12:41 -0400)] 
Add SASL support to LDAP KDB module

Add variables for the SASL mechanism, authcid, authzid, and realm.  If
a SASL mechanism is set, perform an interactive bind with that
mechanism.  If <sasl/sasl.h> is found at build time, provide the
authcid, authzid, and realm in the interaction function, and provide a
SASL secret read from the service password file (under the authcid) if
we found one.

Based on a patch from Zoran Pericic <zpericic@netst.org>.

ticket: 7944 (new)

11 years agoModernize some LDAP sources
Greg Hudson [Mon, 9 Jun 2014 19:23:25 +0000 (15:23 -0400)] 
Modernize some LDAP sources

Bring ldap_misc.c up to date with current practices and make limited
changes to other files.  Of note:

* krb5_decode_krbsecretkey was freeing its bvalues argument; make that
  the caller's responsibility.
* Make is_principal_in_realm and has_modify_increment return
  krb5_boolean, reversing the sense of their results.
* Remove broken code path in decode_tl_data when an integer value has
  a length other than 2 (which should never happen).
* Simplify krb5_ldap_readpassword and make it take filename/name
  parameters instead of an LDAP context.
* Make krb5_ldap_bind (renamed to authenticate) responsible for
  setting a useful error message, so that its caller doesn't assume
  knowledge of the bind parameters.
* Make krb5_ldap_initialize (renamed to initialize_server) responsible
  for updating the handle list, and remove the otherwise unused
  krb5_update_ldap_handle.
* Remove remaining skeletal certificate support, including the unused
  has_sasl_external_mech function.
* Remove unused krb5_get_containerdn and KDB_TL_CONTAINERDN.
* Remove kdb_xdr.h; all of its prototypes were for functions that
  don't exist in the module or were duplicated in other headers.
* Remove krb5_ldap_get_strings and use ldap_get_values directly at
  its call sites; there was no need to copy the result.

11 years agoRename --with-proxy-tls-impl to --with-tls-impl
Greg Hudson [Thu, 17 Jul 2014 19:20:53 +0000 (15:20 -0400)] 
Rename --with-proxy-tls-impl to --with-tls-impl

Make the configure option for TLS implementation more generic, in case
we use the k5tls module for something other than KDC proxy support.
Rename all of the associated symbols for consistency.

ticket: 7929

11 years agoMove KKDCP OpenSSL code to an internal plugin
Greg Hudson [Sun, 22 Jun 2014 14:42:14 +0000 (10:42 -0400)] 
Move KKDCP OpenSSL code to an internal plugin

Create an internal pluggable interface "tls" with one in-tree dynamic
plugin module named "k5tls".  Move all of the OpenSSL calls to the
plugin module, and make the libkrb5 code load and invoke the plugin.
This way we do not load or initialize libssl unless an HTTP proxy is
used.

ticket: 7929

11 years agoFix calloc check in krb5_authdata_context_init
Greg Hudson [Fri, 18 Jul 2014 18:51:13 +0000 (14:51 -0400)] 
Fix calloc check in krb5_authdata_context_init

ticket: 7973
target_version: 1.12.2
tags: pullup

11 years agoRemove copyright statement added to bindresvport.c
Greg Hudson [Wed, 16 Jul 2014 01:34:08 +0000 (21:34 -0400)] 
Remove copyright statement added to bindresvport.c

Andreas's copyright statement was added to the Oracle license
statement by mistake; the code changes made to turn bindresvport into
bindresvport_sa are minimal.  Remove it with Andreas's permission.

ticket: 7935

11 years agoImprove error message for PRNG seeding failure
Greg Hudson [Wed, 16 Jul 2014 00:23:15 +0000 (20:23 -0400)] 
Improve error message for PRNG seeding failure

In prng_fortuna.c, if krb5_c_random_make_octets detects that we do not
have entropy, set an error message saying that the random number
generator could not be seeded, as we likely failed previously to read
from /dev/urandom or the Windows equivalent.

ticket: 7968 (new)

11 years agoImprove indentation of t_otp.py
Michael Mattioli [Tue, 15 Jul 2014 16:48:58 +0000 (12:48 -0400)] 
Improve indentation of t_otp.py

Move the RADIUS attribute dictionary text to a global variable defined
at indent level 0, so that we don't go back to indent level 0 in the
middle of the RadiusDaemon class definition.

[ghudson@mit.edu: clarified commit message, moved comment, changed
variable name]

11 years agoFix error check in krb5_ldap_parse_principal_name
Lukas Slebodnik [Sat, 21 Jun 2014 15:09:31 +0000 (17:09 +0200)] 
Fix error check in krb5_ldap_parse_principal_name

Test the correct variable for NULL to detect a strdup failure.

[ghudson@mit.edu: clarified commit message]

11 years agoAvoid closing fd -1 in libkrad
Lukas Slebodnik [Sat, 21 Jun 2014 14:43:12 +0000 (16:43 +0200)] 
Avoid closing fd -1 in libkrad

If a krad_remote is released before its fd is set, we could close the
file descriptor -1, which is harmless but incorrect.  Check the fd in
remote_disconnect to avoid this.

[ghudson@mit.edu: clarified commit message, minor style change]

11 years agoFix argment validation in krb5_make_fulladdr
Lukas Slebodnik [Sat, 21 Jun 2014 14:11:31 +0000 (16:11 +0200)] 
Fix argment validation in krb5_make_fulladdr

Check kaddr and kport, not kport twice.

[ghudson@mit.edu: clarified commit message, minor style change]

11 years agoFix error handling in k5_expand_path_tokens_extra
Lukas Slebodnik [Sat, 21 Jun 2014 12:59:29 +0000 (14:59 +0200)] 
Fix error handling in k5_expand_path_tokens_extra

If strdup fails when copying extra tokens, we must terminate the
argument traversal before returning.

[ghudson@mit.edu: clarified commit message]

11 years agoFix invalid test strings in t_oid.c
Lukas Slebodnik [Sat, 21 Jun 2014 21:36:38 +0000 (23:36 +0200)] 
Fix invalid test strings in t_oid.c

A missing comma caused two invalid strings to be concatenated.  The
resulting string was still invalid so the tests passed.

[ghudson@mit.edu: clarified commit message]

11 years agoRemove unused variables
Lukas Slebodnik [Sat, 21 Jun 2014 20:41:08 +0000 (22:41 +0200)] 
Remove unused variables

[ghudson@mit.edu: squashed with similar commits]

11 years agoFix several memory leaks in LDAP KDB modules
Greg Hudson [Wed, 11 Jun 2014 03:53:31 +0000 (23:53 -0400)] 
Fix several memory leaks in LDAP KDB modules

Fix memory leaks discovered by running valgrind over kdbtest, and some
related leaks.  Many of them result from not calling ldap_msgfree
after an unsuccessful search (as the OpenLDAP documentation requires)
or after an exception following a search, so many of the fixes move or
add ldap_msgfree calls to cleanup labels.

ldap_osa_free_princ_ent was not used, and could not be used because it
frees the container while krb5_lookup_tl_kadm_data uses a
caller-allocated container.  Change it to leave the container alone,
but to correctly destroy xdrs.  Use it in krb5_ldap_put_principal
where princ_ent was leaked.

In krb5_ldap_put_principal, subtreelist is declared twice in interior
scopes and not properly freed; move it to function scope and free it
up in the cleanup label.  Also in krb5_ldap_put_principal, avoiding
decoding multiple KBR5_TL_KADM_DATA values (which we don't expect to
see) as later decodes would cause earlier decodes to leak.

In krb5_encode_krbsecretkey, fix a leak of the krb5_data container and
also add an error check when calling asn1_encode_sequence_of_keys;
otherwise we would dereference a null pointer if we run out of memory
encoding keys (very unlikely).

ticket: 7941 (new)
target_version: 1.12.2
tags: pullup

11 years agomake depend
Greg Hudson [Tue, 8 Jul 2014 23:36:32 +0000 (19:36 -0400)] 
make depend

11 years agoDefine _GNU_SOURCE for glibc extensions
Greg Hudson [Sat, 5 Jul 2014 16:01:40 +0000 (12:01 -0400)] 
Define _GNU_SOURCE for glibc extensions

glibc does not declare a number of common, useful extensions such as
asprintf unless _GNU_SOURCE is defined.  Define it early in the
configure process so that it is available for autoconf tests.

Defining _GNU_SOURCE unfortunately causes glibc to use the non-POSIX
version of strerror_r, which we now handle using the k5-platform.h
wrapper.

ticket: 7961

11 years agoInclude autoconf.h before system headers
Greg Hudson [Sat, 5 Jul 2014 15:50:58 +0000 (11:50 -0400)] 
Include autoconf.h before system headers

Include autoconf.h (either directly or via proxy) before system
headers, so that feature test macros defined there can affect the
system namespace.  Where include order was changed, eliminate some
redundant or unnecessary includes.

ticket: 7961

11 years agoSimplify usage of strerror_r
Greg Hudson [Sat, 5 Jul 2014 14:23:11 +0000 (10:23 -0400)] 
Simplify usage of strerror_r

Take advantage of the strerror_r portability wrapper to simplify code
using it.  Remove unused macros related to strerror_r in
ldap_service_stash.c and plugins.c.

ticket: 7961

11 years agoDefine k5-platform.h wrapper for strerror_r
Greg Hudson [Sat, 5 Jul 2014 14:14:34 +0000 (10:14 -0400)] 
Define k5-platform.h wrapper for strerror_r

On systems where strerror_r is not the POSIX version, define it to
k5_strerror_r.  Implement k5_strerror_r in libkrb5support using
strerror_s, strerror, or the GNU strerror_r as appropriate.

ticket: 7961

11 years agoAvoid using length fields in socket addresses
Greg Hudson [Thu, 3 Jul 2014 16:48:53 +0000 (12:48 -0400)] 
Avoid using length fields in socket addresses

Remove code to set or reference the length fields of socket addresses
(sa_len/sin_len/sin6_len), since they aren't portable and setting them
is not required.  Remove autoconf tests for those fields which are no
longer used or which were never used.

There is one exception: in localaddr.c, we still neeed to reference
sa_len for the definition of ifreq_size on platforms which have
sa_len.  Leave that behind, along with the autoconf test which defines
SA_LEN.

11 years agoDon't depend on sa_len sockaddr field
Greg Hudson [Thu, 3 Jul 2014 16:17:25 +0000 (12:17 -0400)] 
Don't depend on sa_len sockaddr field

In socket-utils.h, replace the socklen macro with an inline function
sa_socklen which always uses the address family, even on platforms
with the sa_len sockaddr field.  This removes the need to set sa_len
in socket addresses we construct.

11 years agoSimplify net-server.c UDP listener setup
Greg Hudson [Thu, 3 Jul 2014 19:36:04 +0000 (15:36 -0400)] 
Simplify net-server.c UDP listener setup

In setup_udp_port_1, remove the haddrbuf parameter and use paddr like
we already do for one of the log messages.  In setup_udp_port, remove
the long switch statement and just look for AF_INET/AF_INET6
addresses.  Split up udp_flags into two booleans for clarity.  Update
the comment in loop_setup_network since we did the "To do" item a long
time ago.

11 years agoFix build on systems without RTM_OLD* 166/head
Ben Kaduk [Thu, 3 Jul 2014 14:42:21 +0000 (10:42 -0400)] 
Fix build on systems without RTM_OLD*

For example, FreeBSD has removed RTM_OLDADD and RTM_OLDDEL from its API
in March 2014, with the message:
Garbage collect long time obsoleted (or never used) stuff from routing API

Only attempt to define behavior for these cases if they are defined.

ticket: 7955 (new)
tags: pullup
target_version: 1.12.2

11 years agoFix bugs in bindresvport_sa() changes 165/head
Tom Yu [Wed, 2 Jul 2014 20:13:23 +0000 (16:13 -0400)] 
Fix bugs in bindresvport_sa() changes

In svctcp_create() and svcudp_bufcreate(), set sa->sa_len on platforms
where that field exists, so that a subsequent call to socklen() will
return the correct result.

To make the code more self-evidently correct, zero the entire struct
sockaddr_storage object, using the memset(&ss, 0, sizeof(ss)) idiom.

ticket: 7935

11 years agoRemove indent workaround in man page RST sources
Greg Hudson [Thu, 12 Jun 2014 18:34:26 +0000 (14:34 -0400)] 
Remove indent workaround in man page RST sources

docutils 0.10 properly adds indentation to example blocks in man
pages, so we do not need to force an extra indentation level.  Get rid
of the workaround wherever we use it.

ticket: 7954 (new)
target_version: 1.12.2
tags: pullup

11 years agoFix unlikely null dereference in TGS client code
Neng Xue [Mon, 30 Jun 2014 21:04:56 +0000 (14:04 -0700)] 
Fix unlikely null dereference in TGS client code

If krb5_get_tgs_ktypes fails (due to an out-of-memory condition or an
error re-reading the profile), k5_make_tgs_req will dereference a null
pointer.  Check the return value before dereferencing defenctypes.

[ghudson@mit.edu: clarified commit message]

ticket: 7952 (new)
target_version: 1.12.2
tags: pullup

11 years agoUse binresvport_sa when creating RPC handles
Andreas Schneider [Mon, 2 Jun 2014 18:46:48 +0000 (20:46 +0200)] 
Use binresvport_sa when creating RPC handles

Make clnttcp_create, clntudp_bufcreate, svctcp_create, and
svcudp_bufcreate work with unbound IPv6 sockets using bindresvport_sa
and other socket helpers.  For caller-supplied sockets, call
getsockname to determine the address family we should attempt to bind.

[ghudson@mit.edu: clarified commit message, minimized code changes,
used socket-utils.h helpers, fixed fallback find on bindresvport
failure, restored getsockaddr call to get port after binding]

ticket: 7935

11 years agoAdd a family-independent bindresvport_sa function
Andreas Schneider [Tue, 27 May 2014 17:47:22 +0000 (19:47 +0200)] 
Add a family-independent bindresvport_sa function

This functions allows you to pass IPv4 and IPv6 addresses.  If no
address is given, t will determine the family by checking the socket
with getsockname.

[ghudson@mit.edu: clarified commit message, split out setport helper,
squashed with next commit, minimized code changes from old
bindresvport, used socket-utils.h helpers]

ticket: 7935 (new)

11 years agoUse sa_setport and sa_getport where appropriate
Greg Hudson [Sat, 7 Jun 2014 20:25:35 +0000 (16:25 -0400)] 
Use sa_setport and sa_getport where appropriate

Use sa_setport and sa_getport in place of existing static helpers or
open-coded switch statements in net-server.c, fake-addrinfo.c, and
svc_tcp.c.

11 years agoAdd socket-utils.h helpers for ports
Greg Hudson [Sat, 7 Jun 2014 19:16:23 +0000 (15:16 -0400)] 
Add socket-utils.h helpers for ports

Add sa_setport, sa_getport, and sa_is_inet helpers for conveniently
manipulating port numbers on IPv4 and IPv6 socket addresses.

11 years agoFix KDC worker process argument parsing
Greg Hudson [Wed, 18 Jun 2014 16:58:39 +0000 (12:58 -0400)] 
Fix KDC worker process argument parsing

To create worker processes, the KDC shuts down realms, forks off the
worker processes, then reinitializes realms in each child.
Reinitializing realms requires making a second pass over the
command-line arguments.  To do this with getopt, optind must be
reinitialized to 1 for each pass; otherwise, no options will be seen
the second time around.

ticket: 7945
target_version: 1.12.2
tags: pullup

11 years agoAdd tests for invalid GSSAPI per-message tokens
Greg Hudson [Thu, 19 Jun 2014 17:13:33 +0000 (13:13 -0400)] 
Add tests for invalid GSSAPI per-message tokens

ticket: 7949

11 years agoHandle invalid RFC 1964 tokens [CVE-2014-4341...]
Greg Hudson [Thu, 19 Jun 2014 17:49:16 +0000 (13:49 -0400)] 
Handle invalid RFC 1964 tokens [CVE-2014-4341...]

Detect the following cases which would otherwise cause invalid memory
accesses and/or integer underflow:

* An RFC 1964 token being processed by an RFC 4121-only context
  [CVE-2014-4342]

* A header with fewer than 22 bytes after the token ID or an
  incomplete checksum [CVE-2014-4341 CVE-2014-4342]

* A ciphertext shorter than the confounder [CVE-2014-4341]

* A declared padding length longer than the plaintext [CVE-2014-4341]

If we detect a bad pad byte, continue on to compute the checksum to
avoid creating a padding oracle, but treat the checksum as invalid
even if it compares equal.

CVE-2014-4341:

In MIT krb5, an unauthenticated remote attacker with the ability to
inject packets into a legitimately established GSSAPI application
session can cause a program crash due to invalid memory references
when attempting to read beyond the end of a buffer.

    CVSSv2 Vector: AV:N/AC:M/Au:N/C:N/I:N/A:P/E:POC/RL:OF/RC:C

CVE-2014-4342:

In MIT krb5 releases krb5-1.7 and later, an unauthenticated remote
attacker with the ability to inject packets into a legitimately
established GSSAPI application session can cause a program crash due
to invalid memory references when reading beyond the end of a buffer
or by causing a null pointer dereference.

    CVSSv2 Vector: AV:N/AC:M/Au:N/C:N/I:N/A:P/E:POC/RL:OF/RC:C

[tlyu@mit.edu: CVE summaries, CVSS]

ticket: 7949 (new)
subject: Handle invalid RFC 1964 tokens [CVE-2014-4341 CVE-2014-4342]
taget_version: 1.12.2
tags: pullup

11 years agoLoad plugins with RTLD_NODELETE if possible
Greg Hudson [Wed, 25 Jun 2014 15:41:54 +0000 (11:41 -0400)] 
Load plugins with RTLD_NODELETE if possible

On platforms which support RTLD_NODELETE, use it to load plugin
modules.  While using this flag makes plugins stay in the process map
after libkrb5/libgssapi_krb5 are unloaded, it solves several problems:

1. It prevents plugin modules which link against OpenSSL (PKINIT and
k5tls) from repeatedly initializing instances of libssl or libcrypto,
leaking heap memory each time.  This is only an issue because we
cannot safely uninitialize OpenSSL.

2. It prevents finalization ordering issues from causing a process
crash when unloading libgssapi_krb5 (issue #7135).

3. It makes memory leak tracing with valgrind easier.

ticket: 7947 (new)

11 years agoFix unlikely null dereference in mk_cred()
Nalin Dahyabhai [Wed, 25 Jun 2014 16:56:42 +0000 (12:56 -0400)] 
Fix unlikely null dereference in mk_cred()

If krb5_encrypt_keyhelper() returns an error, the ciphertext structure
may contain a non-zero length, but it will already have freed the
pointer to its data, making encrypt_credencpart()'s subsequent attempt
to clear and free the memory fail.  Remove that logic.

Based on a patch from Jatin Nansi.

ticket: 7948 (new)
target_version: 1.12.2
tags: pullup

11 years agoFix error checking in PKINIT authdata creation
Greg Hudson [Sat, 14 Jun 2014 15:23:08 +0000 (11:23 -0400)] 
Fix error checking in PKINIT authdata creation

In create_identifiers_from_stack: check for allocation errors from
PKCS7_ISSUER_AND_SERIAL_new and M_ASN1_INTEGER_dup.  Use
PKCS7_ISSUER_AND_SERIAL_free to more concisely clean up the OpenSSL
issuer variable, and make sure that any partially processed value is
cleaned up on error.  Use calloc to allocate krb5_cas so that all of
its pointers are initially nulled, so that
free_krb5_external_principal_identifier can operate on it safely in
case of error.  Eliminate the retval variable as it was not used
safely.  Rename the error label from "cleanup" to "oom" and separate
it from the successful return path (which has nothing to clean up).

ticket: 7943 (new)
target_version: 1.12.2
tags: pullup

11 years agoConsolidate DB option documentation
Greg Hudson [Mon, 16 Jun 2014 19:46:09 +0000 (15:46 -0400)] 
Consolidate DB option documentation

Document DB options in the kadmin/kadmin.local man page, in their own
section.  Refer to that section from the documentation of the -x
parameter of each other command which supports DB options.  Add
documentation for the "dbname" DB2 option.

ticket: 7946 (new)
target_version: 1.12.2
tags: pullup

11 years agoTidy up k5-int.h variable name constants
Greg Hudson [Fri, 13 Jun 2014 17:52:55 +0000 (13:52 -0400)] 
Tidy up k5-int.h variable name constants

Fix three mismatched constant names, and properly alphabetize and
columnize the lists of definitions.  No functional changes.

11 years agoUpdate the kadm5.acl example 153/head
Ben Kaduk [Fri, 13 Jun 2014 18:59:39 +0000 (14:59 -0400)] 
Update the kadm5.acl example

Make the example and documentation a closer match to reality.
In particular, the list permission is all-or-nothing; it is not
restricted in scope by the target_principal field.  Change the
table entry to try and indicate this fact, and do not put list
permissions on any example line that is scoped by a target_principal
pattern.

While here, remove the nonsensical granting of global inquire
permissions to */* (inaccurately described as "all principals"),
and the granting of privileges to foreign-realm principals.
It is not possible to obtain an initial ticket (as required by
the kadmin service) for a principal in a different realm, and
the current kadmind implementation can serve only a single realm
at a time -- this permission literally has no effect.  Replace
it with a (presumably automated) "Service Management System"
example, where it might make sense to limit the principals which
are automatically created.

ticket: 7939

11 years agoRemove pkinit_win2k_require_binding option
Greg Hudson [Sat, 7 Jun 2014 03:24:00 +0000 (23:24 -0400)] 
Remove pkinit_win2k_require_binding option

When constructing a draft9 PKINIT request, always include
KRB5_PADATA_AS_CHECKSUM padata to ask for an RFC 4556 ReplyKeyPack.
Do not accept a draft9 ReplyKeyPack in the KDC response.

For now, retain the krb5_reply_key_pack_draft9 ASN.1 codec and the KDC
support for generating a draft9 ReplyKeyPack when a draft9 PKINIT
request does not contain KRB5_PADATA_AS_CHECKSUM.

ticket: 7933

11 years agoRemove PKINIT longhorn compatibility option
Greg Hudson [Sat, 7 Jun 2014 02:48:04 +0000 (22:48 -0400)] 
Remove PKINIT longhorn compatibility option

Remove the PKINIT Windows Server 2008 beta compatibility code
conditionalized under the "longhorn" variable.  It is not required to
interoperate with any released version of Windows.

ticket: 7934 (new)

11 years agoImprove PKINIT certificate documentation
Greg Hudson [Fri, 6 Jun 2014 21:41:51 +0000 (17:41 -0400)] 
Improve PKINIT certificate documentation

Describe how to use a commercially-issued server certificate for
anonymous PKINIT.  Separate the KDC and client configuration
instructions so that the steps necessary for anonymous PKINIT are not
combined with the additional steps necessary for regular PKINIT.
Describe kpServerAuth as the EKU used in commercially issued server
certificates, not as the value used by Microsoft (which does not
appear to be true according to [MS-PKCA]).

ticket: 7931 (new)
target_version: 1.12.2
tags: pullup

11 years agoSimplify and fix k5_check_cert_address
Greg Hudson [Tue, 3 Jun 2014 15:48:13 +0000 (11:48 -0400)] 
Simplify and fix k5_check_cert_address

Get rid of the address union.  Store the result of get_cert_cn in a
signed variable so we can meaningfully check for negative results.
Make get_cert_cn return int for consistency with
X509_NAME_get_text_by_NID and its two callers.

Also add an emacs mode line to the top of the file.

ticket: 7929

11 years agoDo not document pkinit_win2k
Greg Hudson [Fri, 6 Jun 2014 21:57:40 +0000 (17:57 -0400)] 
Do not document pkinit_win2k

This variable was never used in the PKINIT code as it was contributed;
there was only code to read its value.

ticket: 7932 (new)
target_version: 1.12.2
tags: pullup

11 years agoRemove stub pkinit_win2k code
Greg Hudson [Fri, 6 Jun 2014 21:56:23 +0000 (17:56 -0400)] 
Remove stub pkinit_win2k code

As contributed, the PKINIT module contained code to read the
pkinit_win2k variable, but never used it.  Get rid of the structure
field and the code to populate it.

11 years agoAdd missing profile functions to libkrb5 exports
Greg Hudson [Wed, 4 Jun 2014 20:18:21 +0000 (16:18 -0400)] 
Add missing profile functions to libkrb5 exports

profile_flush_to_buffer, profile_flush_to_file, profile_free_buffer,
profile_init_flags, and profile_init_vtable are all public profile
functions, but are inaccessible to libkrb5 applications on some
platforms because they were never added to the export list.  Add them
now.

(libprofile functions have never been part of the Windows DLL export
list, so do not change krb5_32.def at this time.)

ticket: 7930 (new)
target_version: 1.12.2
tags: pullup

11 years agoSimplify ticket retrieval from AP-REQs
Greg Hudson [Thu, 5 Jun 2014 16:03:16 +0000 (12:03 -0400)] 
Simplify ticket retrieval from AP-REQs

After krb5_rd_req_decoded or krb5_rd_req_decoded_anyflag, the ticket
(with enc_part2 if we could decrypt it) is accessible via
request->ticket; there is no need to copy it.  Stop using the ticket
parameter of those functions.  Where we need to save the ticket beyond
the lifetime of the krb5_ap_req, steal the pointer before freeing the
request.

11 years agoAdd test for KDC client logging
Greg Hudson [Wed, 4 Jun 2014 21:07:28 +0000 (17:07 -0400)] 
Add test for KDC client logging

Add a test case which performed a TGS request with an expired ticket
and checks that the client principal is logged.

ticket: 7910

11 years agoIn KDC, log client principal in bad header ticket
rbasch [Tue, 3 Jun 2014 22:44:17 +0000 (18:44 -0400)] 
In KDC, log client principal in bad header ticket

Fix KDC logging to include client principal in TGS_REQ logging even
during error conditions such as "Ticket expired".  As long as the
TGS_REQ can be decrypted and the client principal is available, it
should be included in the log, regardless of other errors which might
be detected.

krb5_rd_req_decoded and krb5_rd_req_decoded_anyflag (not public
interfaces) now leave the decrypted ticket in req->ticket->enc_part2
on success or failure, if the ticket was successfully decrypted.  This
does not affect the behavior of krb5_rd_req.

[ghudson@mit.edu: removed extraneous change, added commit message
summary and description of internal API change, fixed possible memory
leak, removed comment and #if 0 code block of purely historical
interest]

ticket: 7910

11 years agoDo not loop on add_cred_from and other new methods
Sam Hartman [Wed, 4 Jun 2014 16:06:27 +0000 (12:06 -0400)] 
Do not loop on add_cred_from and other new methods

Several new GSS-API methods were added but GSSAPI_ADD_METHOD was
called to add them rather than GSSAPI_ADD_METHOD_NOLOOP.  This means
that the implementation from the GSS-API mechglue would be used if the
mechanism had no implementation.  As a result, the mechglue will call
into itself exhausting the call stack in an endless loop when one of
these methods is called.

ticket: 7926
target_version: 1.12.2
tags: pullup

11 years agoTreat LDAP KrbKey salt field as optional
Greg Hudson [Fri, 23 May 2014 23:58:41 +0000 (19:58 -0400)] 
Treat LDAP KrbKey salt field as optional

Per the ASN.1 definition, the KrbKey salt field is optional.  Since
1.7, we have been treating it as mandatory in the encoder; since 1.11,
we have been treating it as mandatory in the decoder.  Mostly by luck,
we have been encoding a salt type of 0 when key_data_ver is 1, but we
really should not be looking at key_data_type[1] or key_data_length[1]
in this situation.  Treat the salt field as optional in the encoder
and decoder.  Although the previous commit ensures that we continue to
always encode a salt (without any dangerous assumptions about
krb5_key_data constructors), this change will allow us to decode key
data encoded by 1.6 without salt fields.

This also fixes issue #7918, by properly setting key_data_ver to 2 if
a salt type but no salt value is present.  It is difficult to get the
decoder to actually assign 2 to key_data_ver just because the salt
field is there, so take care of that in asn1_decode_sequence_of_keys.

Adjust kdbtest.c to match the new behavior by setting key_data_ver to
2 in both test keys.

ticket: 7919
target_version: 1.12.2
tags: pullup

11 years agoAlways include salt in LDAP KrbKey encoding
Greg Hudson [Sun, 25 May 2014 02:58:26 +0000 (22:58 -0400)] 
Always include salt in LDAP KrbKey encoding

In the LDAP KDB module, ensure that every krb5_key_data we pass to
asn1_encode_sequence_of_keys includes a salt type, for compatibility
with the decoder in unpatched krb5 1.11 and 1.12.

This is not a behavior change by itself; since 1.7 the encoder has
always included a KrbKey salt field because it erroneously treats that
field as non-optional.  (Luckily, the encoded salt always happens to
have salt type 0 because krb5_key_data constructors start with zeroed
memory.)  The next commit will fix the encoder and decoder to properly
treat the KrbKey salt field as optional, so we need this change to
ensure that our encodings remain compatible.

Also fix the ASN.1 tests to set key_data_ver correctly for the sample
test key data.

ticket: 7919

11 years agoUse k5_setmsg
Greg Hudson [Sat, 24 May 2014 16:15:32 +0000 (12:15 -0400)] 
Use k5_setmsg

Replace most calls to krb5_set_error_message with k5_setmsg for
brevity.  Leave alone plugin sources where we don't include k5-int.h
(mostly PKINIT).

11 years agoDefine k5_setmsg internal alias
Greg Hudson [Sat, 24 May 2014 15:38:42 +0000 (11:38 -0400)] 
Define k5_setmsg internal alias

This is just a shorter internal name for krb5_set_error_message.  The
full name is so long that we have to wrap error messages more than
we'd like.

11 years agoRemove DEBUG_ERROR_LOCATIONS support
Greg Hudson [Sat, 24 May 2014 15:35:30 +0000 (11:35 -0400)] 
Remove DEBUG_ERROR_LOCATIONS support

It wasn't being used and it added too much complexity to the
error-handling functions.

11 years agoRead /etc/gss/mech if no mech.d/*.conf found
Greg Hudson [Thu, 29 May 2014 03:51:49 +0000 (23:51 -0400)] 
Read /etc/gss/mech if no mech.d/*.conf found

Always read /etc/gss/mech, even if globbing /etc/gss/mech.d/*.conf
doesn't work.  Doing this using GLOB_DOOFFS proved error-prone, so use
a simpler approach: factor out the per-pathname handling into a helper
function load_if_changed, call it with MECH_CONF before the glob, then
pass each glob result through the helper.

ticket: 7925

11 years agoDo not document pkinit_mapping_file
Greg Hudson [Sun, 1 Jun 2014 14:41:27 +0000 (10:41 -0400)] 
Do not document pkinit_mapping_file

This feature was never implemented in the PKINIT code as it was
contributed; there was only stub support for reading the filename.

ticket: 7928 (new)
target_version: 1.12.2
tags: pullup

11 years agoRemove stub pkinit_mapping_file code
Greg Hudson [Sun, 1 Jun 2014 14:44:51 +0000 (10:44 -0400)] 
Remove stub pkinit_mapping_file code

As contributed, the PKINIT code contained code to read a mapping
filename, but never used the resulting structure variable.  Get rid of
the structure field and the code to populate it.

11 years agoAdd tests for MS-KKDCP client support
Nalin Dahyabhai [Fri, 7 Feb 2014 23:56:10 +0000 (18:56 -0500)] 
Add tests for MS-KKDCP client support

Exercise the MS-KKDCP client support using the test proxy server, for
AS, TGS, and kpasswd requests while also checking the certificate
verification and name checks.

ticket: 7929

11 years agoAdd a simple KDC proxy test server
Nalin Dahyabhai [Fri, 7 Feb 2014 23:03:29 +0000 (18:03 -0500)] 
Add a simple KDC proxy test server

This proxy server uses python-paste to run the kdcproxy from
https://pypi.python.org/pypi/kdcproxy.  It should be used along
with the proxy.pem certificate in ../tests/dejagnu/proxy-certs.

ticket: 7929

11 years agoHave k5test.py provide 'runenv' to python tests
Nalin Dahyabhai [Fri, 30 May 2014 21:13:31 +0000 (17:13 -0400)] 
Have k5test.py provide 'runenv' to python tests

Expose the formerly-internal _runenv module as k5test.runenv, so that
settings we store in the top-level runenv.py will be available to them.

ticket: 7929

11 years agoAdd some longer-form docs for HTTPS
Nalin Dahyabhai [Tue, 22 Apr 2014 20:31:14 +0000 (16:31 -0400)] 
Add some longer-form docs for HTTPS

Add some longer-form documentation for the new HTTPS support, walking a
prospective administrator through generating a bare minimal signing
setup, deploying a WSGI-based proxy server onto an Apache httpd server
using mod_ssl and mod_wsgi, and configuring clients to use it.

ticket: 7929

11 years agoCheck names in the server's cert when using KKDCP
Nalin Dahyabhai [Thu, 17 Apr 2014 21:19:03 +0000 (17:19 -0400)] 
Check names in the server's cert when using KKDCP

When we connect to a KDC using an HTTPS proxy, check that the naming
information in the certificate matches the name or address which we
extracted from the server URL in the configuration.

ticket: 7929

11 years agoLoad custom anchors when using KKDCP
Nalin Dahyabhai [Thu, 17 Apr 2014 21:17:13 +0000 (17:17 -0400)] 
Load custom anchors when using KKDCP

Add an http_anchors per-realm setting which we'll apply when using an
HTTPS proxy, more or less mimicking the syntax of its similarly-named
PKINIT counterpart.  We only check the [realms] section, though.

ticket: 7929

11 years agoHTTPS transport (Microsoft KKDCPP implementation)
Nalin Dahyabhai [Thu, 24 Apr 2014 20:30:56 +0000 (16:30 -0400)] 
HTTPS transport (Microsoft KKDCPP implementation)

Add an 'HTTPS' transport type which connects to an [MS-KKDCP] proxy
server using HTTPS to communicate with a KDC.  The KDC's name should
take the form of an HTTPS URL (e.g. "https://proxybox/KdcProxy").

An HTTPS connection's encryption layer can be reading and writing when
the application layer is expecting to write and read, so the HTTPS
callbacks have to handle being called multiple times.

[nalin@redhat.com: use cleanup labels, make sure we always send the
 realm name, keep a copy of the URI on-hand, move most of the
 conditionally-compiled sections into their own conditionally-built
 functions, break out HTTPS request formatting into a helper function,
 handle the MS-KKDCP length bytes, update comments to mention specific
 versions of the MS-KKDCP spec, differentiate TCP and HTTP trace
 messages, trace unparseable responses]

ticket: 7929

11 years agoDispatch-style protocol switching for transport
Robbie Harwood (frozencemetery) [Fri, 16 Aug 2013 18:48:55 +0000 (14:48 -0400)] 
Dispatch-style protocol switching for transport

Switch to using per-transport-type functions when a socket that we're
using to communicate with a server becomes readable or writable, and add
them as pointers to the connection state.  The functions are passed the
name of the realm of the server being contacted, as we expect to need
this in the near future.

[nalin@redhat.com: replace macros with typedefs]
[nalin@redhat.com: compare transports with TCP_OR_UDP rather than with 0]

ticket: 7929

11 years agoAdd ASN.1 codec for KKDCP's KDC-PROXY-MESSAGE
Nathaniel McCallum [Mon, 9 Sep 2013 18:23:56 +0000 (14:23 -0400)] 
Add ASN.1 codec for KKDCP's KDC-PROXY-MESSAGE

Handle encoding and decoding [MS-KKDCP] proxy messages, including
handling of the additional length bytes.  Early versions of [MS-KKDCP]
incorrectly omit that the size of the proxied message is prepended to
the proxied message, as it is when we're using plain TCP, before
encoding the proxy-message structure.  This is fixed at least as of
version 2.1 of the spec.

[nalin@redhat.com: add tests]

ticket: 7929

11 years agoBuild support for TLS used by HTTPS proxy support
Robbie Harwood (frozencemetery) [Fri, 16 Aug 2013 16:45:03 +0000 (12:45 -0400)] 
Build support for TLS used by HTTPS proxy support

Add a --with-proxy-tls-impl option to configure, taking 'openssl',
'auto', or invocation as --without-proxy-tls-impl.  Use related CFLAGS
when building lib/krb5/os, and LIBS when linking libkrb5.  Call the
OpenSSL library startup functions during library initialization.

ticket: 7929

11 years agoUse k5_transport(_strategy) enums for k5_sendto
Robbie Harwood (frozencemetery) [Thu, 15 Aug 2013 19:55:52 +0000 (15:55 -0400)] 
Use k5_transport(_strategy) enums for k5_sendto

In k5_sendto and k5_locate_server, replace "socktype" parameters with
a new enumerator k5_transport, so that we can add new transports which
are not in the socket type namespace.  Control the order in which we
make connections of different types using a new k5_transport_strategy
enumerator, to simplify the logic for adding new transports later.
Control the result of k5_locate_server with a no_udp boolean rather
than a socket type.

[ghudson@mit.edu: renamed type to k5_transport; k5_locate_server
 no_udp change; clarified commit message; fix for Solaris getaddrinfo]
[kaduk@mit.edu: name variables of type k5_transport 'transport']
[nalin@redhat.com: use transport rather than sock_type in more places,
 add and use k5_transport_strategy, update the test program]

ticket: 7929

11 years agoAdd helper to determine if a KDC is the master
Greg Hudson [Sun, 6 Apr 2014 22:06:14 +0000 (18:06 -0400)] 
Add helper to determine if a KDC is the master

Add a new function k5_kdc_is_master in locate_kdc.c to determine
whether a KDC matches one of the masters, and use it in
krb5_sendto_kdc.

11 years agoSimplify sendto_kdc.c
Greg Hudson [Wed, 9 Apr 2014 17:19:03 +0000 (13:19 -0400)] 
Simplify sendto_kdc.c

* Get rid of the "x" member of conn_state, which used to be a union
  but hasn't been since r14742.
* Define a structure type for the "out" member of conn_state.
* Rename incoming_krb5_message to incoming_message for brevity.
* Make the "pos" member of incoming_message an offset instead of a
  pointer, simplifying several present and future computations.
* Use "in" and "out" aliases to the conn_state in and out members
  where it improves brevity.
* Rename set_conn_state_msg_length to set_transport_message and give
  it a descriptive comment.
* Call set_transport_message from start_connection only, instead of
  once in add_connection and perhaps again in start_connection.  To
  make this possible, pass the original message argument to maybe_send
  and start_connection.
* Use make_data and empty_data helpers where appropriate.

11 years agoMake x-deltat.y work with bison 3
Greg Hudson [Thu, 29 May 2014 16:54:50 +0000 (12:54 -0400)] 
Make x-deltat.y work with bison 3

Bison 3 removed support for YYPARSE_PARAM and YYLEX_PARAM, breaking
x-deltat.y.  Use %parse-param and %lex-param instead.  (In Bison 3 we
could use just %param, but that doesn't work in 2.x.)  The parameter
added by %parse-param is also passed to yyerror, so adjust the macro
we use to suppress yyerror accordingly.

Also use "%define api.pure" instead of "%pure_parser", which was
deprecated in bison 2.3b.  (The correct spelling was actually
"%pure-parser", and bison 3 generates a warning about the underscore
spelling.)

Regenerate deltat.c using the new x-deltat.y and bison 3.0.2.

ticket: 7923