Commit Graph

30312 Commits

Author SHA1 Message Date
Luke Howard
87e96b97bd kdc: fix warning in kdc_array_iterate()
Do not call return in a function returning void.
2022-01-29 10:26:54 +11:00
Luke Howard
144caf67fa kdc: add wrappers for heimbase object accessors
Add libkdc wrappers for heimbase object accessors so plugins can use audit and
request attribute APIs without consuming libheimbase. Exposed API surface is
minimal and is limited to reading array collections, and reading/creating base
and custom types.
2022-01-28 17:24:57 -06:00
Luke Howard
917e16049a base: make heim_alloc deallocator use HEIM_CALLCONV 2022-01-28 17:24:57 -06:00
Nicolas Williams
4748f3a19d asn1: Revert heim_object_t support 2022-01-28 17:24:57 -06:00
Luke Howard
327ec7e75c krb5: use void * instead of heim_object for PAC decoration 2022-01-28 17:24:57 -06:00
Luke Howard
5a579901fd kdc: fix warning in GSS pre-authentication support
Do not read an int32_t directly into a CKSUMTYPE enum.
2022-01-29 10:23:09 +11:00
Nicolas Williams
a835b9053d lib/asn1: generate_type_free heim_release not heim_retain
Do not leak the object when the intent is to free it.

Introduced by 40d1271094
("asn1: Expand decoration w/ C types")

Change-Id: If8cd502f61d6f9b72118630839525933911c6697
2022-01-28 13:54:16 -05:00
Jeffrey Altman
4185e87a6c lib/krb5: domain_X500_Compress not domain_X500_compress
3a7c2c6a7f
("krb5.h: define DOMAIN_X500_COMPRESS macro")
defined DOMAIN_X500_COMPRESS to the wrong name.

Change-Id: I5c60d86b856ce6d3fa94b1fa8d7ffe17b97c8513
2022-01-28 13:49:16 -05:00
Jeffrey Altman
7ad9d0ee0e windows: invert NODEBUG for cvarsmt and cvarsdll
ec866e635e
("Windows 10 SDK build fixes") inverted the meaning selecting
Debug versions for NODEBUG and vice versa.

Change-Id: I90771a71cd3efc93ba47076fbf5cd1efb0948f6f
2022-01-27 17:23:28 -05:00
Nicolas Williams
09da53f456 klist: Better recognize cc collection default 2022-01-26 16:40:38 -06:00
Nicolas Williams
2dec179e35 krb5: Add krb5_cccol_get_default_ccname() 2022-01-26 16:40:16 -06:00
Luke Howard
a8037d1916 hdb: define HDB flags using hex instead of decimal constants
Define HDB_F_XXX flags in lib/hdb/hdb.h using hexidecimal constants as they are
easier to read.
2022-01-26 11:17:35 +11:00
Luke Howard
11fa99416d hdb: remove HDB_F_CURRENT_KVNO flag
remove HDB_F_CURRENT_KVNO flag from hdb.h, it is no longer used
2022-01-26 11:10:03 +11:00
Nicolas Williams
5cd49a8032 krb5: Manually expand some macros in fcc_move()
To help in debugging.
2022-01-25 17:22:23 -06:00
Nicolas Williams
a4396ee819 krb5: Fix leak in kcm_gen_new() 2022-01-25 15:38:55 -06:00
Nicolas Williams
df244493ee krb5: Test KCM
Finally, we have a test for KCM.  It shall not break again.
2022-01-25 15:38:55 -06:00
Nicolas Williams
4dcfd968d0 krb5: Better default KCM cache logic (moar)
Ah, we can't use context->default_cc_name because that will be taken
from KRB5CCNAME if it's set, and then we'll think whatever that value is
is the default, but we're really looking to special case resolving of
the "%{UID}" KCM cache name.  So do that.
2022-01-25 14:46:32 -06:00
Nicolas Williams
1a719bdc0e krb5: Better default KCM cache logic
Our kcm daemon will resolve default cache names (%{UID}) to the user's
session's default cache name.  SSSD's kcm daemon will not.

Therefore we add a heuristic for "if we're resolving what may be the
local configured default KCM cache, and it doesn't exist as such in the
KCM session, then use the KCM session's default cache".

This allows our kinit and klist to work as intended.
2022-01-25 13:12:06 -06:00
Nicolas Williams
ae181ee52e krb5: Check for KRB5_CC_NOSUPP in krb5_cc_move()
The KCM cache can return KRB5_CC_NOSUPP instead of ENOTSUP.
2022-01-25 13:12:06 -06:00
Jeffrey Altman
468a06e612 lib/krb5: krb5_store_string*() input must be non-NULL
krb5_store_string, krb5_store_stringz, krb5_store_stringnl

If the input string is NULL, fail the call with EINVAL.
Do not pass the NULL pointer to strlen().

Change-Id: Id87d72e263dde798f300353ec4c1656b310d17a4
2022-01-25 12:42:09 -05:00
Nicolas Williams
a56382ce4d kcm: Treat default name as alias
Both MIT and Heimdal are unable to, in krb5_cc_default(), call to KCM
(or CCAPI, or LSA, or...) to get the user's default ccache name in their
collection.  Instead, the default ccache name is obtained in a static
way, and for KCM that's "%{UID}".  When we krb5_cc_switch(), we simply
maintain a pointer to the name of the ccache that was made the default,
but klist can't make use of this because krb5_cc_default() can't.

The solution here is to first try resolving the ccache name given by the
client, and if that fails but the name happens to be what would be the
library's default KCM ccache name for that user, then try resolving it
through the default ccache name pointer saved at switch time.
2022-01-25 01:17:04 -06:00
Nicolas Williams
727682ec41 krb5: Fix KCM/API ccache type name confusion
Wrap all KCM cc ops that need to call kcm_alloc() so that they pass in
the cc ops pointer that they're associated with so that kcm_alloc() can
use the correct ccache type name if needed.
2022-01-25 01:16:08 -06:00
Nicolas Williams
c44f94fa7e krb5: Use krb5_enomem() in KCM 2022-01-24 22:11:49 -06:00
Nicolas Williams
2a7095971a krb5: Fix cccol support in KCM 2022-01-24 22:11:35 -06:00
Nicolas Williams
2137f0c28e kcm: Do not clobber error from server 2022-01-24 18:27:35 -06:00
Nicolas Williams
f3517c0d01 ipc: Handle POLLIN/OUT even when ERR 2022-01-24 18:26:55 -06:00
Nicolas Williams
5bb5033f10 krb5: "KEYRING:" should work 2022-01-24 15:38:47 -06:00
Nicolas Williams
c4236f23bd krb5: Fix segfault in KCM ccache type 2022-01-24 13:52:36 -06:00
Nicolas Williams
f5180f6776 kimpersonate: Fix typo 2022-01-24 13:51:43 -06:00
Jeffrey Altman
eb08f2ecdd kdc: _kdc_find_etype if is_preauth must use long term keys
is_preauth (KFE_IS_PREAUTH is set) might require replying with
PA-ETYPE-INFO[2] which requires use of the long-term keys.
Without this change is_default_salt_p() can be called with 'key'
eq NULL.

Change-Id: I513fa768680225d4501d8b390e349a011666d90c
2022-01-24 10:41:51 -05:00
Jeffrey Altman
31d5c38976 lib/hcrypto: mpz2BN return NULL if mp_ubin_size(s) returns zero
If mp_ubin_size(s) returns zero then mp_to_ubin() will fail and
not return MP_OKAY.  If MP_OKAY is not returned, NULL is returned
to the caller of mpz2BN().

This change avoids the unnecessary memory allocation and function
calls.  It also removes a dereference after null warning from
coverity.

Change-Id: I52ff2c166964e41cb4eef1dac637904bf2bf13bf
2022-01-24 10:14:17 -05:00
Jeffrey Altman
d8dcb3f7a4 kuser: generate-requests read_words fix sizeof_mistmatch
Use 'sizeof(*w)' to compute the correct size passed to erealloc().
Although sizeof(char **) == sizeof(char *), it is not guaranteed.

Change-Id: I5f66fafe20343d7e736922038d24abcd48bab8bd
2022-01-24 10:02:26 -05:00
Jeffrey Altman
ee56cb33b2 lib/asn1: prevent wrong size argument warnings
190263bb7a
("assert non-NULL ptrs before calling mem funcs") introduced
two wrong size argument warnings.  These locations are not
errors since the allocation is simply to ensure that the
data pointer is non-NULL; length is zero.

Change-Id: I7b3b58247799a48da3653008c7b6d7fbbbf83e25
2022-01-24 00:31:27 -05:00
Jeffrey Altman
190263bb7a assert non-NULL ptrs before calling mem funcs
The definitions of memcpy(), memmove(), and memset() state that
the behaviour is undefined if any of the pointer arguments are
NULL, and some compilers are known to make use of this to
optimise away existing NULL checks in the source.

Change-Id: I489bc256e3eac7ff41d91becb0b43aba73dbb3f9
Link: https://www.imperialviolet.org/2016/06/26/nonnull.html
2022-01-24 00:07:51 -05:00
Jeffrey Altman
d35c9b2d67 lib/gssapi/ntlm: _gss_ntlm_inquire_cred dead code removal
do not check 'cred_handle' for GSS-C_NO_CREDENTIAL twice.

Change-Id: I3629aa49b2d20d3444c6ede46715d65b6072484f
2022-01-23 23:11:46 -05:00
Jeffrey Altman
ca4ff365f8 lib/gssapi/mech: gss_mech_switch do not leak 'm'
If there is a memory allocation failure after 'm'
is allocated, 'm' will be leaked; free it.

Change-Id: I625273634af207fac7c489df166cebde4d467cbc
2022-01-23 23:07:36 -05:00
Jeffrey Altman
693191b23d lib/kadm5: kadm5_c_randkey_principal check store_int return
do not ignore failures to krb5_store_int() ks_salttype.

Change-Id: I4144376f24ac00f45073daec4fa5835706b1ad09
2022-01-23 22:49:57 -05:00
Jeffrey Altman
d80a1b9556 kdc: hprop propagate_database do not leak 'server'
Change-Id: I0b2b6343134603ecffb6cd827d0828463378cff4
2022-01-23 22:25:43 -05:00
Jeffrey Altman
a3f4a0bf0b kdc: hprop check return code if local realm
If 'local_realm' is true, must protect against failure
of krb5_get_default_realm() and krb5_principal_set_realm().
Otherwise, the wrong realm might be used.

Change-Id: Ib7a92559da1ac062c71228c5530106a13d836d53
2022-01-23 21:59:13 -05:00
Jeffrey Altman
0a17a0b3b7 lib/asn1: der_put_length test 'size' is non-NULL
Change-Id: I1ffbf1998485fdca7cf151c24c440fb0b35e77e4
2022-01-23 21:47:58 -05:00
Jeffrey Altman
e0e61d2b91 lib/hdb: hdb_create consistently check cb_ctx.h
instead of testing both cb_ctx.h and cb_ctx.h->prefix
for non-NULL, ensure that cb_ctx.h is NULL after each
failed for() loop.  This also ensures that cb_ctx.h
is never left pointing to an invalid non-NULL value.

Change-Id: I3264577b0fbf1d620b00f87d251e8c43b81e0f29
2022-01-23 21:27:56 -05:00
Jeffrey Altman
38536d7313 lib/asn1: set *size output to zero at start of der funcs
Assign zero to the output size parameter at the start so that
callers that use the value when an error occurs do not see
garbage that might be misinterpreted.

Change-Id: Iccfcf4f6944b1bf72789c83919901d9b9d6f9153
2022-01-23 00:10:14 -05:00
Roland C. Dowdeswell
8dcd05ed4d _gss_ntlm_init_sec_context() mem leaks 2022-01-22 21:54:20 -05:00
Roland C. Dowdeswell
e87fca8091 _gss_ntlm_delete_sec_context() mem leaks 2022-01-22 21:54:20 -05:00
Roland C. Dowdeswell
8526b4c627 fix memory leak near NTLM type2 response 2022-01-22 21:54:20 -05:00
Nicolas Williams
d64076dfd9 asn1: Update commentary on grammar 2022-01-22 03:48:27 -06:00
Nicolas Williams
dfc26ae8c1 asn1: Fix last remaining shift/reduce conflict 2022-01-22 03:48:27 -06:00
Nicolas Williams
563964ce96 hx509: Use %left for ! instead of %precedence 2022-01-21 23:34:40 -06:00
Nicolas Williams
88e31d2da8 sl: Add missing sel-gram.h target 2022-01-21 23:15:21 -06:00
Nicolas Williams
cb9b1842ea sl: Fix bison/byacc invocation 2022-01-21 23:01:44 -06:00