Commit Graph

28215 Commits

Author SHA1 Message Date
Jeffrey Altman
80f8325c64 lib/krb5: krb5_locl.h do not replicate roken.h
Move roken.h to the top of the header after config.h and remove the
includes that are duplicated by roken.h.

Change-Id: I33e29736519177f17c36e5c5948d7022011ab2b2
2016-04-17 17:19:53 -05:00
Jeffrey Altman
ce4fd05b12 fixup pkinit-ec.c (kdc and lib/krb5) includes
All source files must start with

  include <config.h>
  include <roken.h>

when krb5_locl.h or kdc_locl.h are includes, they must come before
other Heimdal include files.

Do not include stdint.h when roken.h is included.
Do not include config.h more than once.

Change-Id: I0baecb5d48317996f48b1a6c41b051f42f2fde61
2016-04-17 17:10:08 -05:00
Jeffrey Altman
87d56ef018 kpasswd: check krb5_unparse_name return
In verify() if krb5_unparse_name() fails 'sname' will be used
unitialized in the subsequent krb5_warnx() and free() calls.

Change-Id: I5a49bf06879eb5a77cf2d1d3f0d4b9c6549aeff8
2016-04-17 15:17:30 -05:00
Jeffrey Altman
4ad2f5830a hcrypto: p11_module_init_once make handle static global
Coverity complains about the leakage of 'handle' when the identifier
goes out of scope.  Change handle into a static global to hold the
value instead of a stack variable.

Change-Id: I040707ac731558f7d523f128a006a80b98d45b79
2016-04-17 15:11:55 -05:00
Jeffrey Altman
a08431b658 gss/mech: fix make_sasl_name ctx leak
The EVP_MD_CTX created in make_sasl_name() must be destroyed
to prevent a memory allocation leak.

Change-Id: I0b7f5b1b0f4f252bfcdaec755d09ed75de505f75
2016-04-17 15:11:42 -05:00
Jeffrey Altman
22c5327287 gssmask: check return of krb5_init_context
Check the return value so that a more obtuse error does not occur
later on.

Change-Id: I2115cc58e6fc24b63272b2ae811d64a4966de5d4
2016-04-17 15:11:14 -05:00
Nicolas Williams
514f719e4a evp-openssl: fallback to hcrypto
The Windows and PKCS#11 backends do this.  The Common Crypto (OS X)
backend does not.  Ideally this should be a ./configure option, and that
might be the next step, but right now we need this fallback in order to
get tests passing in Travis-CI.
2016-04-16 18:05:26 -05:00
Nicolas Williams
c0f6213be7 Fix Windows build (lib/krb5/pkinit-ec.c) 2016-04-16 17:15:49 -05:00
Nicolas Williams
e2137c63f5 Fix Windows build 2016-04-16 16:58:08 -05:00
Nicolas Williams
3d4fbf9aac Fix lib/hcrypto for Windows 2016-04-16 16:58:08 -05:00
Nicolas Williams
1103fb19df Fix re-definition of keyex enum 2016-04-16 16:58:08 -05:00
Nicolas Williams
b2a78463de Add missing <hcrypto/undef.h> 2016-04-16 13:59:34 -05:00
Nicolas Williams
59b47eb7bb Fix lib/gssapi build race (fix #135) 2016-04-15 15:18:30 -05:00
Viktor Dukhovni
8078e089f1 Add support for ECDSA w/ SHA-2 signature algs 2016-04-15 10:32:50 -05:00
Nicolas Williams
7b2107fd2d Fix lib/krb5/test_plugin.c test
The resolver plugin doesn't have a way to say "and stop here", so the
lookup done in lib/krb5/test_plugin.c can produce more results than used
to be expected, and indeed nowadays it does.  The fix is to ensure that
we have the desired results and ignore the others.
2016-04-15 10:27:07 -05:00
Nicolas Williams
4a023499d3 Update NEWS for some recent changes
- CVE-2016-2400
 - OpenSSL as hcrypto backend
 - Thread support on Windows
 - HDB LMDB backend
 - iprop revamp
2016-04-15 00:26:08 -05:00
Nicolas Williams
f064f2d14b Add seed operation for unix RAND method 2016-04-15 00:16:18 -05:00
Nicolas Williams
2cd233db43 Add HEIMDAL_THREAD_create() macros 2016-04-15 00:16:17 -05:00
Nicolas Williams
2f0c45f784 Add thread-locals for WIN32 2016-04-15 00:16:17 -05:00
Nicolas Williams
fca9bc45e2 Add --with-hcrypto-default-backend 2016-04-15 00:16:17 -05:00
Nicolas Williams
490337f4f9 Make OpenSSL an hcrypto backend proper
This adds a new backend for libhcrypto: the OpenSSL backend.

Now libhcrypto has these backends:

 - hcrypto itself (i.e., the algorithms coded in lib/hcrypto)
 - Common Crypto (OS X)
 - PKCS#11 (specifically for Solaris, but not Solaris-specific)
 - Windows CNG (Windows)
 - OpenSSL (generic)

The ./configure --with-openssl=... option no longer disables the use of
hcrypto.  Instead it enables the use of OpenSSL as a (and the default)
backend in libhcrypto.  The libhcrypto framework is now always used.

OpenSSL should no longer be used directly within Heimdal, except in the
OpenSSL hcrypto backend itself, and files where elliptic curve (EC)
crypto is needed.

Because libhcrypto's EC support is incomplete, we can only use OpenSSL
for EC.  Currently that means separating all EC-using code so that it
does not use hcrypto, thus the libhx509/hxtool and PKINIT EC code has
been moved out of the files it used to be in.
2016-04-15 00:16:17 -05:00
Nicolas Williams
9df88205ba Fix double-free in lib/hx509/crypto.c 2016-04-15 00:16:16 -05:00
Nicolas Williams
6bbe7f0ffa Implement EVP_CIPH_CTRL_INIT 2016-04-15 00:16:16 -05:00
Nicolas Williams
8033eb298b lib/hcrypto/evp.c: missing MD guards 2016-04-15 00:16:16 -05:00
Nicolas Williams
5c2a3cb25a Always build hcrypto 2016-04-15 00:16:16 -05:00
Nicolas Williams
0f138cf2d5 Add missing hcrypto rename macros 2016-04-15 00:16:15 -05:00
Nicolas Williams
d494f2f679 hcrypto-pkcs11: fix MD4 block size 2016-04-15 00:16:15 -05:00
Nicolas Williams
0b3055fdad hcrypto-pkcs11: rc2_cbc is variable length 2016-04-15 00:16:15 -05:00
Nicolas Williams
1e6f88f721 Fix hcrypto evp_md cleanup call protocol 2016-04-15 00:16:14 -05:00
Nicolas Williams
d3f9bea491 Fix lib/gssapi/ntlm/crypto.c includes 2016-04-15 00:16:14 -05:00
Nicolas Williams
2d52e52401 Always build lib/sqlite in maintainer mode 2016-04-15 00:16:14 -05:00
Nicolas Williams
bfa1d9ba09 Remove debug echo in cf/db.m4 2016-04-15 00:16:14 -05:00
Nicolas Williams
9f2642acae Fix lib/base/test_base rwlock test 2016-04-15 00:16:14 -05:00
Nicolas Williams
22934bae7c Fix heim_threads.h rwlocks macros for pthreads 2016-04-15 00:16:13 -05:00
Nicolas Williams
c2fafff992 WIN32 thread primitives must return int
Also, zero return means "success", non-zero means "failure" and the
non-zero value is a system error.  That's how it is for the other
platforms' thread primitives.

(The no-threads defaults are still wrong though, as then are macros that
expand into do..while, which can't be used as expressions and don't
"return" values.)
2016-04-15 00:16:13 -05:00
Nicolas Williams
4b37c27515 Make aes-test.c more useful 2016-04-15 00:16:13 -05:00
Jeffrey Altman
15a2537a79 lib/ntlm: double quote backslash in error tables
The error string

  missing @ or \ in name

must have the backslash double quoted as

  missing @ or \\\\ in name

because of how compile_et parses the input and generates its output.
Otherwise, when compiling the generated ntlm_err.c a warning will
be produced because of invalid quoting of a space.

Change-Id: I994d3eb896098914702e418a0ef5cad783d16a5a
2016-04-13 19:38:34 -05:00
Jeffrey Altman
cc62c1a4ae lib/krb5: fix srv_find_realm invalid gTLD test
In srv_find_realm() the conditional for testing whether an entry
is the invalid gTLD response was inverted.  Refactor the conditional
into a helper function is_invalid_tld_srv_target().  Use the helper
to simplify the conditional making it easier to confirm that the
test is correct.

Change-Id: I3220753b5585ac535862c4617030377c7a1f4bbe
2016-04-13 18:52:55 -05:00
Jeffrey Altman
1007d104fa lib/kadm5: do not prototype imported _krb5_put_int
The function _krb5_put_int() is a private function exported from
lib/krb5.  Its declaration should come from krb5-private.h.  A local
declaration will not result in the proper import qualifiers on
Windows.

See also: e1a244f Make it possible to include krb5_locl.h in kadm5

Change-Id: I53e7aeea9f2f34cab105f2e331f3c6522847ccfe
2016-04-11 16:01:27 -05:00
Nicolas Williams
e1a244f0aa Make it possible to include krb5_locl.h in kadm5
This and ffc525aad1 are the correct fix
rather than f1d73a8e46.  The next commit
reverts f1d73a8 by re-applying ffc525a.
2016-04-11 16:00:12 -05:00
Jeffrey Altman
f1d73a8e46 Revert "lib/kadm5: do not prototype imported _krb5_put_int"
krb5_locl.h cannot be included from within lib/kadm5 in the
current UNIX builds.  Reverting this change which is necessary
to properly build on Windows until an alternate solution is
agreed upon.

This reverts commit ffc525aad1.
2016-04-11 14:40:57 -05:00
Jeffrey Altman
278cd63306 lib/hdb: hdb_method functions !KRB5_LIB_CALL
The hdb_method functions cannot be KRB5_LIB_CALL as lib/hdb is not
lib/krb5.  KRB5_LIB_CALL will be inconsistently defined.

This inconsistency resulted in crashes of test_hdbplugin on 32-bit
Windows.

Change-Id: I4cf8d3ef76f31a3cae923df234a19610d956e7ee
2016-04-11 00:33:42 -05:00
Jeffrey Altman
ffc525aad1 lib/kadm5: do not prototype imported _krb5_put_int
The function _krb5_put_int() is a private function exported from
lib/krb5.  Its declaration should come from krb5-private.h.  A local
declaration will not result in the proper import qualifiers on
Windows.

Change-Id: I53e7aeea9f2f34cab105f2e331f3c6522847ccfe
2016-04-10 19:04:30 -05:00
Jeffrey Altman
924f7b9190 lib/krb5: Windows API:krb5cc ccache fallback
If there is no MSLSA: credential cache principal, then try to
fallback to the MIT default MIT credential cache name, API:krb5cc.

Change-Id: I8f981c5401b4f962cf808e7b0dc782e42bc03023
2016-04-10 17:05:07 -05:00
Jeffrey Altman
1b95a70e4f lib/krb5: krb5_cc_set_default_name Windows MSLSA:
If there is no default credential cache obtained from the registry
or from configuration files, then check to see if there is a valid
principal available from the MSLSA: credential cache.  If so, use
"MSLSA:" as the default credential cache.  This will simply configuration
for users on domain joined Windows machines when logged in using a
domain account.

Change-Id: I4c4392e0fdcec89aff3d258ce1b753e6458e3eec
2016-04-10 17:05:07 -05:00
Jeffrey Altman
338b4a1fba lib/krb5: reformat krb5_cc_set_default_name
Remove unnecessary levels of indentation.

Switch the conditional from "(e == NULL)" to "(p == NULL)" since it
the variable 'p' that is actually used to store the name of the
default credential cache.

Change-Id: Id884e2cd80b42e47d3c219ac3777161087467a14
2016-04-10 17:05:07 -05:00
Jeffrey Altman
eb1545382a lib/krb5: fallback Windows default ccname to HLKM
Windows queries the default ccache name via the registry.  Prior
to this change only the HKEY_CURRENT_USER hive.  Fallback to
HKEY_LOCAL_MACHINE if there is no "ccname" value specified for the
user.  This permits system or domain administrators to set the
default ccache to MSLSA: for all users.

Change-Id: Ide3b51358f8fc6944ca698e4a68295be9463d4e0
2016-04-10 17:05:07 -05:00
Jeffrey Altman
13568961ec krb5: DNS A record fallback test for invalid gTLD
As per
https://www.icann.org/en/system/files/files/name-collision-mitigation-01aug14-en.pdf
prior to a new top-level domain being put into service there is controlled
interuption service which will return explicit responses to DNS A, MX, SRV, and TXT
queries that can be used to detect private namespace collisions.

When performing fallback_get_hosts() check the AF_INET responses to ensure
that they are not the gTLD name collision address 127.0.53.53.  If so, add
an error message to the context and return KRB5_KDC_UNREACH.

Write a warning to the log (if any).

Change-Id: I2578f13948b8327cc3f06542c1e489f02410143a
2016-04-10 17:05:07 -05:00
Jeffrey Altman
4b45355162 krb5: DNS SRV records test for invalid gTLD
As per
https://www.icann.org/en/system/files/files/name-collision-mitigation-01aug14-en.pdf
prior to a new top-level domain being put into service there is a
controlled interuption service which will return explicit responses to DNS
A, MX, SRV, and TXT queries that can be used to detect private namespace collisions.

Modify SRV records lookups to detect the special hostname returned in the
SRV response, skip the response, and record an appropriate error if it is detected.

Write a warning to the log (if any).

Change-Id: I47e049b617e39e49939bc92d513a547de1d04624
2016-04-10 17:05:07 -05:00
Jeffrey Altman
b0e7dc5106 krb5: DNS TXT records test for invalid gTLD
As per
https://www.icann.org/en/system/files/files/name-collision-mitigation-01aug14-en.pdf
prior to a new top-level domain being put into service there is a
controlled interuption service which will return explicit responses to DNS
A, MX, SRV, and TXT queries that can be used to detect private namespace collisions.

Modify the signature of copy_txt_to_realm() to accept a krb5_context so
that meaningful errors can be recorded.

Write a warning to the log (if any).

Change-Id: I51ff8feed4f9d2af8b956bd4ba26e1c4644247c2
2016-04-10 17:05:07 -05:00