Commit Graph

30450 Commits

Author SHA1 Message Date
Jeffrey Altman
3a52803e19 appl/kf: doit close socket before returning
Change-Id: Ida564ea4c27c1bd50004340ac7dbab5f11dbf531
2022-01-17 16:50:42 -05:00
Jeffrey Altman
27a2ad7bfc lib/kerb: verify_user_opt_int pass krb5_creds by ptr verify_common
Refactor the call to verify_common() to pass the krb5_cred by
pointer to and call krb5_free_cred_contents() in
verify_user_opt_int() instead of verify_common().
2022-01-17 16:31:48 -05:00
Nicolas Williams
b6114c5492 krb5: Make krb5_data_cmp() be good for sorting
The doc comment says it's good for sorting, but it wasn't really.  Now
it should be.
2022-01-17 15:17:33 -06:00
Nicolas Williams
4b7ad8ee43 hx509: Fix strerror(negative); streamline code
Calling strerror() with a negative value is an error.

Besides fixing that, we streamline hx509_get_error_string(), making it much
simpler and easier to read.
2022-01-17 15:17:33 -06:00
Nicolas Williams
7cfab00e37 kdc: One more memcmp() implicit comparison to 0 2022-01-17 15:17:33 -06:00
Joseph Sutton
9a0372d992 kdc: Still prefer encryption types with "not default" salts except for des-cbc-crc
Samba clients are often machine accounts with non-default salts that
will fail if they can't use the AES encryption type they know the KDC
supports.  The problem is that arcfour-hmac-md5 has no salt so was
being used in preference.

Samba started to fail when

kdc_config->preauth_use_strongest_session_key = true;

was forced into the KDC configuration.

The history here is an attempt to avoid Kerberos v4 salts in des-cbc-crc
keys, but this instead broke Samba clients with AES-keys on machine accounts
as these have a non-default salt by default.  These accounts were incorrectly
restricted to arcfour-hmac-md5 and they didn't like that.

A broader fix than Samba commit 8e1efd8bd3bf698dc0b6ed2081919f49b1412b53

REF: https://lists.samba.org/archive/samba/2021-October/237844.html

Samba BUG: https://bugzilla.samba.org/show_bug.cgi?id=14864

Change-Id: Ia8908a5a2eef107e6b133d7f0e4343c1988c18bb
2022-01-17 15:42:03 -05:00
Nicolas Williams
9fb444983e asn1: Better handling of >63 named bits/ints
First, we enlarge Member's val field to int64_t.

Then we warn about skipping 2int, int2, and parse units glue for such
things with too-large members.

And we error out when generating the template for such things with
>UINT32_MAX members.

What about too-negative members?  That could be a thing for INTEGER /
ENUMERATED.  We'll look at that later.
2022-01-17 12:39:19 -06:00
Nicolas Williams
bf243c1f41 kdc: Fix ENOMEM path null deref (synthetic princs) 2022-01-17 12:20:15 -06:00
Nicolas Williams
a25cf6335e krb5: Fix ENOMEM path null deref in _krb5_pac_sign 2022-01-17 12:16:28 -06:00
Nicolas Williams
e15657679c krb5: Check for errors in pa_announce() 2022-01-17 12:14:23 -06:00
Nicolas Williams
014aa4569d krb5: Attempt to quiet coverity in warning user
We sometimes use this idiom where we ignore the result of some function
such as krb5_unparse_name() and then we log something and we use the
ternary operator to handle any error from that function by substituting
a string like "<unknown>" or "<out-of-memory>".  This yields some static
analyzer complaints.  Maybe casting the function's result to void will
help.
2022-01-17 12:11:49 -06:00
Nicolas Williams
2e631d3b1b krb5: FAST: Remove dead code 2022-01-17 11:53:42 -06:00
Nicolas Williams
7fe5799090 gsskrb5: Fix dead code in get_transited() 2022-01-17 11:50:16 -06:00
Nicolas Williams
e894ed0162 krb5: Remove dead code in enc_chal_step() 2022-01-17 11:35:12 -06:00
Nicolas Williams
5c68a02407 krb5: FAST: Fix potential double-free
Coverity incorrectly thinks this is a NULL dereference after NULL check,
but it's not.  If anything, this could be a double-free.
2022-01-17 11:22:19 -06:00
Nicolas Williams
fc42ff0212 krb5: Fix NULL-deref in send_to_kdc
Coverity thinks `handle` in lib/krb5/send_to_kdc.c:krb5_sendto_context()
at 1241 can be NULL, leading to a NULL derefence in `get_next()`.  This
is an attempt to fix this by having `get_next()` check handle for NULL.
2022-01-17 11:16:07 -06:00
Nicolas Williams
04b07ff8b6 kdc: Quiet a coverity warning (TGS) 2022-01-17 11:05:05 -06:00
Nicolas Williams
3e51a0b84a kdc: Quiet a coverity warning 2022-01-17 11:04:21 -06:00
Nicolas Williams
fe63ddc487 gsskrb5: Remove dead code in split_attr() 2022-01-17 11:01:19 -06:00
Nicolas Williams
ad4e055831 base: Add r->kv not-null check before using it 2022-01-17 10:58:40 -06:00
Nicolas Williams
cf37c99222 krb5: get_cred: Add missing enc retval check 2022-01-17 10:53:13 -06:00
Nicolas Williams
c3643bb607 krb5: Remove KEYRING ccache dead code 2022-01-17 10:48:28 -06:00
Nicolas Williams
d658aa9b11 kadm5: Fix error-path leak 2022-01-17 10:48:07 -06:00
Nicolas Williams
4d5c5c6737 kdc: Add missing encryption retval check 2022-01-17 10:47:41 -06:00
Luke Howard
dca1048e96 gss: use memset rather than {0} to initialize channel bindings 2022-01-17 22:18:44 +11:00
Nicolas Williams
0f843189a4 kadmin: Check for errors in init 2022-01-17 00:45:37 -06:00
Nicolas Williams
fc5f917a66 hdb: Fix SQLite3 backend EXISTS error 2022-01-17 00:45:37 -06:00
Jeffrey Altman
63f9fc172c kadmin: kadmind_dispatch free 'ks_tuple' before overwriting
Change-Id: I8719c610a34ca128cc8a0b3d7f94dafc26b21e01
2022-01-17 00:16:27 -05:00
Nicolas Williams
6fc38099f7 ipropd: Initialize struct sigaction 2022-01-16 23:09:17 -06:00
Nicolas Williams
3d9333cefa kdc: Fix build 2022-01-16 23:08:49 -06:00
Nicolas Williams
d974c37a90 kadmin: Remove dead code in add_one_namespace() 2022-01-16 23:08:32 -06:00
Luke Howard
7f2cf34b1d gss: _gss_negoex_accept make error const
krb5_get_error_message() returns a const char *, not a char *. Amends
Change-Id I464b3c5.
2022-01-17 15:46:45 +11:00
Luke Howard
ce0ba125d9 gss: _gss_negoex_init make error const
krb5_get_error_message() returns a const char *, not a char *. Amends
Change-Id I870ed0b.
2022-01-17 15:46:41 +11:00
Jeffrey Altman
231aa68895 kadmin: add_one_namespace do not leak princ_ent
princ_ent must be saved to princ.principal early in order to
ensure that it is not leaked.

Change-Id: Ic74b48f434c727401c00e6fdcaecead988fe4263
2022-01-16 23:42:21 -05:00
Jeffrey Altman
54adba6023 kadmin: format_field KRB5_TL_ETYPES do not leak enctype string
Change-Id: I745216c334c038f55711c27f7885d8f96f656e79
2022-01-16 23:32:10 -05:00
Jeffrey Altman
1383677642 kdc: update_csr do not leak error messages
Change-Id: I478bf001ebf555dce067916e7198053ef3a0bd08
2022-01-16 23:28:13 -05:00
Jeffrey Altman
423acdfe77 kdc: check_authz free 'cprinc' on success
Change-Id: I1823a4d74c7c2823f2148f694bff1fc064d834ed
2022-01-16 23:25:06 -05:00
Jeffrey Altman
ff18c32ae4 lib/gssapi/ntlm: from_file do not leak 'f' on error
Change-Id: Ica774bc3c156c384a2cf7084259d31f445d24a7d
2022-01-16 23:10:33 -05:00
Jeffrey Altman
6e8ab0c204 lib/gssapi/spnego: _gss_negoex_accept do not leak error message
Change-Id: I464b3c5e5b96b36da2cda71b1dacc8ad971fda35
2022-01-16 23:04:54 -05:00
Jeffrey Altman
ac53ce5c99 lib/gssapi/spnego: _gss_negoex_init do not leak error message
Change-Id: I870ed0bd8de7bc6ab5b8cf7c6d3816d04de354fa
2022-01-16 23:02:38 -05:00
Jeffrey Altman
8254c01ae7 lib/gssapi/spnego: accept_sec_context free 'supported_mechs'
If no preferred mechanism was found 'supported_mechs' was leaked.

Change-Id: I2982f94d7e9569461f562987609ff7bff57b3f88
2022-01-16 22:57:15 -05:00
Jeffrey Altman
401bdd8bf3 lib/hx509: hx509_request_get_san SAN_TYPE_PKINIT return failure
if _hx509_unparse_KRB5PrincipalName() fails return the error code
to the hx509_request_get_san() caller.

Change-Id: I3ad8ceda23f00263890115f292ca7e4c8ce9317b
2022-01-16 22:43:02 -05:00
Jeffrey Altman
424aa1cb78 lib/asn1: _asn1_print_open_type free 'indents'
'indents' was leaked on one code path.

Change-Id: Ib4a7a8dcf7aae05a79ac6738da3a87a61e85c48e
2022-01-16 22:22:48 -05:00
Jeffrey Altman
73e2f335c2 lib/hdb: entry2mit_string_int free unparsed name on error
if append_string() fails do not leak the unparsed name.

Change-Id: I29d909c35e0e5d7282577ce37ec283efc33edbbf
2022-01-16 22:19:39 -05:00
Jeffrey Altman
b63da31622 lib/hdb: test_namespace free hex string
Change-Id: Id69643ca70eb2c19b6c3cfc6fb99308aa29e3cc1
2022-01-16 22:14:26 -05:00
Jeffrey Altman
a73c45bef1 lib/hx509: hxtool test_crypto destroy 'vctx'
call hx509_verify_destroy_ctx to free 'vctx'

Change-Id: I4125a46760b8b988a63fb8d96d91a4a8b948b606
2022-01-16 22:11:28 -05:00
Jeffrey Altman
53e0b5448e lib/hx509: revoke_print addrof to hx509_revoke_free
1a793c04fa
("lib/hx509: revoke_print free revoke_context") forgot to pass
the address of 'revoke_ctx' to hx509_revoke_free().

Change-Id: I430a72a4dc7bce7099fc02bbe1feae625304a53a
2022-01-16 22:07:52 -05:00
Jeffrey Altman
603ee4d65d lib/hx509: _hx509_cert_to_env free 'buf'
The output buffer returned from hx509_name_to_string() must be
freed before it is overwritten by another call to
hx509_name_to_string().

Change-Id: Iaf28b14a2712cd28085ac5452819818e739d43ed
2022-01-16 21:59:49 -05:00
Jeffrey Altman
1a793c04fa lib/hx509: revoke_print free revoke_context
call hx509_revoke_free() to free the context.

Change-Id: I2f4439a848011cc0ab46f2802f5e4871baba348f
2022-01-16 21:53:06 -05:00
Jeffrey Altman
c59dd0b36c lib/hx509: hx509_request_get_san handle strpool on error
_hx509_unparse_utf8_string_name() and
_hx509_unparse_KRB5PrincipalName() can return a strpool even if
they fail.  The strpool must be passed through rk_strpoolcollect()
in order to return the contents to the caller of
hx509_request_get_san().

Change-Id: Ifda5620f4e9e00ca188aa138f692fccc12621ae8
2022-01-16 21:49:34 -05:00