Commit Graph

2104 Commits

Author SHA1 Message Date
Luke Howard
7e0ff63b38 gssapi: add OPTSYM for gss_duplicate_cred() (#487)
Allow API-as-SPI mechanisms to provide gss_duplicate_cred(), introduced
in e6d1c108.
2018-12-29 20:22:12 +11:00
Nicolas Williams
e6d1c10808 Rewrite gss_add_cred() (fix #413)
It turns out gss_add_cred() really needed a complete rewrite.  It's much
better to first have a gss_duplicate_cred() (which has been needed for
other reasons anyways), and use that when the input_cred_handle is not
GSS_C_NO_CREDENTIAL and output_cred_handle is not NULL, then mutate that
duplicate credential handle (or the input_cred_handle if
output_cred_handle is NULL).
2018-12-28 19:26:25 -06:00
Nicolas Williams
b0a357429d Fix warning in lib/gssapi/test_context.c 2018-12-28 01:09:38 -06:00
Luke Howard
9763482d9f gssapi: fix pointer type mismatch in NTLM mech 2018-12-23 07:42:16 +00:00
Luke Howard
3c92747f2a gss: fix leak in add_builtin() if interning OID fails
4a93c477 (#447) introduced a leak in add_builtin().  Reported by
jaltman@auristor.com.
2018-12-23 15:34:27 +11:00
Luke Howard
efc5ad8b3c gss: cleanup warnings in HEIM_SLIST_ATOMIC_FOREACH (#447)
Cleanup unused result warning when calling heim_base_exchange_pointer()
from HEIM_SLIST_ATOMIC_FOREACH() in mechqueue.h.
2018-12-19 00:36:11 -08:00
Luke Howard
4a93c4774a gss: intern OIDs (#447)
Intern OIDs so that gss_release_oid() can be a NOOP.
2018-12-18 23:28:38 -06:00
Olly Betts
7ad6c01a8d Fix assorted typos 2018-12-14 17:30:14 -05:00
Benjamin Kaduk
e21866f7a2 GSS unwrap: wipe copy of DES key when done with it
Zero out the DES_cblock structure instead of the (not yet used at this point
in the function) key schedule.  The contents could potentially be left
on the stack in the case of an error return from _gssapi_verify_pad().
2018-12-14 06:18:26 -05:00
Benjamin Kaduk
56fe2f8620 Clear DES key (schedule) in unwrap BAD_MIC case
We generally clear out the cryptographic key and key schedule from
local variables before relinquishing control flow, but this case was
missed.  Reported by jhb@FreeBSD.org.
2018-09-22 13:25:00 -04:00
Simon Wilkinson
07b3e6fd74 Allow zero-length encrypt IOVs in _krb5_evp_encrypt_iov_cts()
The iovec encryption code doesn't handle 0 length iovecs correctly.
Instead of just skipping them, _krb5_evp_encrypt_iov_cts() will spin
on the 0 length iovec.

Modify the _krb5_evp_iov_cursor_expand helper so that iovec expansion
simply skips 0 length iovecs, and make _krb5_evp_iov_cursor_nextcrypt
do the same.

Original bug report and tests from Andrew Bartlett <abartlet@samba.org>
2018-09-18 19:23:31 -04:00
Jeffrey Altman
d570541e3d Update accept_sec_context.c 2018-09-17 18:12:25 -04:00
Markus Moeller
635ac1aa85 Free context in case of error 2018-09-17 18:12:25 -04:00
Chris Lamb
946caad7d0 Correct "extention" typos.
Signed-off-by: Chris Lamb <chris@chris-lamb.co.uk>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
(cherry picked from Samba commit afa9bb4ac55d616fe7816e3830bab5e3a51aed7a)
2018-09-10 14:42:18 -04:00
Gary Lockyer
1c8cae58cc heimdal: Use #ifdef HAVE_DLOPEN around functions and variables used by HAVE_DLOPEN
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
2018-09-10 14:40:51 -04:00
Daria Phoebe Brashear
b12e01035c gss: _locl.h files should include local copy of -private.h files
apparently some versions of heimdal installed mech private headers.
don't inadvertantly end up with it in your path from a previous version
2018-04-19 13:12:59 -04:00
Daria Phoebe Brashear
bc1b936a1d move _gssapi_make_mech_header to avoid need to prototype
move _gssapi_make_mech_header so it's declared before use
2018-04-19 13:12:59 -04:00
Nicolas Williams
122cdc578e Fix some krb5_storage_write() usages 2017-05-26 23:24:30 -04:00
Aleksei Martynov
a666bf165e Fix memory leak in _gss_ntlm_release_cred.
ntlm_cred is always allocated with calloc, so we need to free the cred
object too, similarly to what _gsskrb5_release_cred does.
2017-05-22 12:05:00 -05:00
Jeffrey Altman
02ea07f93d gssapi: remove dead code
Remove assignment of a variable to itself.

Identified by AppChecker.

Change-Id: I94012849d8200dc91394a8548e72c61404d7e5b6
2017-04-29 01:06:00 -04:00
Jeffrey Altman
93518bfab4 use memset_s
lib roken includes support for memset_s() but it was not applied
to the Heimdal source tree.

Change-Id: I8362ec97a9be50205bb2d398e65b629b88ce1acd
2017-04-29 01:05:59 -04:00
Nicolas Williams
7dfad1ab0b Use secure_getenv() instead of issuid() 2017-04-17 18:02:30 -04:00
Nicolas Williams
c9e5da9d2b NTLM memleak
Originally by Christos Zoulas.
2017-03-13 18:39:41 -04:00
Nicolas Williams
8e5e8aacbc Misc fixes to man pages
Originally by Christos Zoulas.
2017-03-13 18:39:41 -04:00
Quanah Gibson-Mount
7c16ce3457 Minor typo/grammar fixes 2017-03-10 15:47:43 -05:00
Nicolas Williams
3e65dfbc32 Fix make dist missing files (#228) 2016-12-15 12:15:56 -06:00
Nicolas Williams
2ebec2e4ec Fix some Doxygen warnings 2016-12-14 22:05:46 -06:00
Jeffrey Altman
d9f7718a42 gss/krb5: gsskrb5_acceptor_start authenticator leak (take two)
Change-Id: I11be62ab806ea89258fe60e29e6d6488908070fa
2016-11-19 23:59:30 -05:00
Jeffrey Altman
2be6646adc gss/krb5: gsskrb5_acceptor_start authenticator leak
Change-Id: I78c546590776ae4c30a49bfb919285b0eb15a06b
2016-11-19 10:18:12 -05:00
Nicolas Williams
52a562a3a4 Misc fixes (coverity) 2016-11-18 22:21:45 -06:00
Nicolas Williams
1c81ddf4e2 Round #2 of scan-build warnings cleanup 2016-11-16 17:03:14 -06:00
Jeffrey Altman
6a1db3fb1c princ type NT-UNKNOWN + "host" == NT-SRV-HST
Treat principals of type NT-UNKNOWN as NT-SRV-HST if the first component
of the principal name is "host".

Change-Id: I28fb619379daac827436040e701d4ab7b279852b
2016-11-14 21:29:47 -06:00
Jeffrey Altman
5aef50c800 gss-krb5: do_delegate remove dead comment
The check on principal type has been commented out since do_delegate()
was committed.  Remove it.

Change-Id: Id98f35471e346cb3d0e9666b7cdb6f564191e6c1
2016-11-14 21:29:47 -06:00
Heath Kehoe
545b5b41ce Fix race condition with global _gsskrb5_keytab
gsskrb5_acceptor_start() was making a copy of the global pointer
_gsskrb5_keytab to use later. This invites a race condition where
another thread could call gsskrb5_register_acceptor_identity()
(thus invalidating the target of the copied pointer) before it is
used by gsskrb5_acceptor_start().

So instead, clone the keytab to a new one while protected by the
mutex lock (similar to get_keytab() in acquire_cred.c).

Signed-off-by: Nicolas Williams <nico@twosigma.com>
2016-11-10 18:32:15 -06:00
Luke Howard
7b720cf61c krb5: implement draft-ietf-kitten-aes-cts-hmac-sha2-07 2016-10-08 08:17:11 +02:00
Jeffrey Altman
4c1728ff73 Windows: code sign gsstool.exe
Change-Id: I1d79de51bdeefe1611eb69248d11d411361ab5d6
2016-04-18 23:36:16 -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
Nicolas Williams
59b47eb7bb Fix lib/gssapi build race (fix #135) 2016-04-15 15:18:30 -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
d3f9bea491 Fix lib/gssapi/ntlm/crypto.c includes 2016-04-15 00:16:14 -05:00
aaptel
c868b6ac0b lib/gssapi/mech/gss_compare_name.c: fix memcmp() call
Make memcmp() compare the name1 and name2 value instead of comparing
name1 with itself.

The memcmp() is only executed if the left-hand side of the || is false
i.e. when both length are equal so the length argument is correct (no out-of-bounds reads).
2016-03-10 10:51:58 +01:00
Luke Howard
33ce593b6d gss_wrap/gss_unwrap_aead implementation
Signed-off-by: Nicolas Williams <nico@twosigma.com>
2016-02-05 18:01:15 -06:00
Luke Howard
bfd72f9ed5 gssapi: correct OID for GSS_C_PEER_HAS_UPDATED_SPNEGO
restore correct OID for GSS_C_PEER_HAS_UPDATED_SPNEGO, this should have no
ABI implications, it's for internal use only. The current OID was incorrectly
copied in commit dbeeb18a, it should belong to 1.3.6.1.4.1.5322.19 which is
... enterprise(1) padl(5322) gssKrb5Extensions(19). The OID we were camping
on belongs to another party.
2015-12-16 23:26:20 +11:00
Luke Howard
f5b4ef3ed8 gssapi: plug leak in test_context IOV test 2015-12-09 19:05:11 +11:00
Love Hörnquist Åstrand
0a5de96d72 Merge pull request #134 from abartlet/allow-null-authenticator
gssapi: Allow a NULL authenticator
2015-08-03 20:18:16 +02:00
Stefan Metzmacher
ad3acc2aef lib/gssapi/krb5: implement gss_[un]wrap_iov[_length] with arcfour-hmac-md5
Pair-Programmed-With: Andreas Schneider <asn@samba.org>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
2015-07-31 17:30:23 +12:00
Stefan Metzmacher
bafefad87f lib/gssapi/krb5: split out a arcfour_mic_cksum_iov() function
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2015-07-31 17:30:23 +12:00
Stefan Metzmacher
ef0059b8b6 lib/gssapi/krb5: add const to arcfour_mic_key()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2015-07-31 17:30:23 +12:00
Stefan Metzmacher
5f79ac2bb9 lib/gssapi/krb5: clear temporary buffer with cleartext data.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2015-07-31 17:30:23 +12:00
Stefan Metzmacher
e33e47650a lib/gssapi/krb5: fix indentation in _gk_wrap_iov()
Now it matches _gk_unwrap_iov() and _gk_wrap_iov_length().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2015-07-31 17:30:23 +12:00