Commit Graph

30444 Commits

Author SHA1 Message Date
Nicolas Williams
f26bc69ded gss: Fix name attr leak in test_context 2022-01-18 12:35:26 -06:00
Nicolas Williams
0b137e3287 gss: Workaround valgrind "lifetime not equal" issue 2022-01-18 12:35:26 -06:00
Nicolas Williams
257be08bbb GitHub: Make valgrind build a debug build
To get line numbers from valgrind stack traces we need the valgrind
build to be a debug (-g) build.
2022-01-18 10:31:20 -06:00
Nicolas Williams
f155150969 kdc: Rewrite get_pa_etype_info and set_salt_padata
We weren't checking for errors, and we weren't using the convience
SEQUENCE OF add_METHOD_DATA() and add_ETYPE_INFO() functions generated
by the ASN.1 compiler.  Using those utilities made get_pa_etype_info()
and make_etype_info_entry() sufficiently simpler that merging the two
makes for simpler, more readable code.
2022-01-18 09:14:29 -05:00
Nicolas Williams
2801606b80 GitHub: Fix valgrind build 2022-01-18 01:15:09 -06:00
Nicolas Williams
a1481f1f05 kdc: Check krb5_ret_uint32() in connect loop 2022-01-18 00:42:11 -06:00
Nicolas Williams
fcba7a9fd1 kdc: Check errors from krb5_auth_con_getauthenticator() 2022-01-18 00:32:51 -06:00
Nicolas Williams
4ed4f2159c krb5: Check errors in krb5_auth_con_getauthenticator() 2022-01-18 00:32:51 -06:00
Nicolas Williams
1a08b3b47f kdc: Make --kdc-request-log-file concrrency-safe
Build the entry to write to the log file in memory, the write it with
O_APPEND.  This should make writes to the request log file safer in
multi-process KDC configurations.

Also, check results of krb5_store_*() functions (coverity alerted to
this).
2022-01-18 00:19:15 -06:00
Nicolas Williams
d41467dcde kdc: Explicitly ignore setsockopt() result 2022-01-18 00:16:09 -06:00
Joseph Sutton
ef059b8831 heimdal:base: Don't perform arithmetic on a NULL pointer
Doing so is undefined behaviour.

Change-Id: Ic57baac0fc5fb06945c0dfbd5d4eb913a12fc13d
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2022-01-18 00:31:45 -05:00
Joseph Sutton
1c93a6ff26 heimdal: Avoid overflow when performing bitwise shift operations
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2022-01-18 00:31:45 -05:00
Luke Howard
bc37bf1afd kdc: use public audit API in altsecid authorizer plugin
Regression fix for 94ed961d02 when building
altsecid_gss_preauth_authorizer.
2022-01-18 16:27:05 +11:00
Nicolas Williams
376d347500 GitHub: Use just clang for valgrind build 2022-01-17 23:14:16 -06:00
Luke Howard
94ed961d02 kdc: make auditing API public
Samba plugins will need to use auditing API without including krb5-private.h,
so make the auditing APIs public.
2022-01-18 16:09:50 +11:00
Luke Howard
4befd3e355 kdc: remove krb5_ prefix for KDC attribute functions
We will use the kdc_ rather than krb5_kdc_ prefix for new public APIs exported
from libkdc. Amend the recently introduced
request_{get,set,copy,delete}_attribute APIs to conform.
2022-01-17 23:50:04 -05:00
Jeffrey Altman
5fa0b7b6ff lib/krb5: krb5_sento_context KRB5_SENDTO_DONE KRB5_SENDTO_FAILED
Let the KRB5_SENDTO_DONE and KRB5_SENDTO_FAILED action states be
handled by the provided switch blocks.   This ensures that the
'ret' value is set appropriately before exiting the loop.

Change-Id: I56f4cea83efd86203a9a7a36cf48c80f632cf779
2022-01-17 23:02:01 -05:00
Jeffrey Altman
238fd7c6c6 kdc: kdc_issue_certificate remove dead code
'ret' cannot equal EACCES after setting it to KRB5KDC_ERR_POLICY.

Change-Id: I2fbb0c91f6fdc541813685fde26229833fa56e42
2022-01-17 22:41:33 -05:00
Jeffrey Altman
51575264d4 kadmin: read_words pass correct type to sizeof
(char *) not (char **).

Change-Id: I2c34fa5b0ea9f81b08451ed1b4a816684b7ab638
2022-01-17 22:36:29 -05:00
Jeffrey Altman
2cd3f7089e kdc: cmd_append fix broken commit
4101280459
("kdc: cmd_append do not forget va_end()")

Change-Id: Ief8b8b4a5c85a38c799e2aa554e845728a92b1fd
2022-01-17 22:36:29 -05:00
Nicolas Williams
0e19c6b429 GitHub: Don't use find -cpio 2022-01-17 21:29:46 -06:00
Jeffrey Altman
4101280459 kdc: cmd_append do not forget va_end()
If va_start() is called then va_end() must be called before
returning.

Change-Id: I5312cf9b6ff238fc76bea248472302d5094bbc2b
2022-01-17 22:05:36 -05:00
Jeffrey Altman
d0e2467120 kdc: _kdc_do_kx509 prevent use of NULL cprincipal
If the return code is non-zero do not call krb5_unparse_name()
as cprincipal will be NULL.

Change-Id: I901b3f5dcdbc186f89257aef935b91e1d207119c
2022-01-17 21:57:07 -05:00
Jeffrey Altman
4b6fb5ab1a kdc: _kdc_find_etype prevent NULL dereference
If use_strongest_session_key and no keys are found the return
code will be set to KRB5KDC_ERR_ETYPE_NOSUPP.  However, before
exiting if the principal is a weak exception then the return
code will be set to success and a NULL key pointer will be
dereferenced.   Skip the weak exception check if the return
code is non-zero.

Change-Id: I36d0e1b179b3392171ad6767c75111d59c3f2f7d
2022-01-17 21:51:57 -05:00
Jeffrey Altman
0e3acff241 lib/hcrypto: mpz2BN unsafe to call mp_to_ubin with NULL
remove the (size != 0) exception to malloc() failure.

Change-Id: I7a678b0fadd51c673491b61c06afd4203c871318
2022-01-17 21:41:21 -05:00
Jeffrey Altman
1ebebe1d2f lib/hcrypto: RSA_check_key if rsa->n is NULL cannot call RSA_size
Avoid a theoretical NULL pointer dereference.

Change-Id: Ia7b8671152b5444fd5cfdb3e37fd62e4db68c9c5
2022-01-17 21:36:49 -05:00
Jeffrey Altman
ee3cd2e4a9 lib/hcrypto: RSA_new_method pass correct ptr to ENGINE_finish
Pass rsa->engine not engine.

Change-Id: I1251c50898b267d14cbf0bb2adb40516d24fa369
2022-01-17 21:28:37 -05:00
Jeffrey Altman
94a7e97e09 lib/hcrypto: DH_new_method pass correct ptr to ENGINE_finish
Pass dh->engine not engine.

Change-Id: Id7294a5ac3715d557202349bf20755d873ced7ae
2022-01-17 21:27:00 -05:00
Jeffrey Altman
5c7a4436e3 lib/hcrypto: dh-ltm update use of libtommath
warning: 'mp_read_unsigned_bin' is deprecated
(declared at ./libtommath/tommath.h:732): replaced by mp_from_ubin
[-Wdeprecated-declarations]

warning: 'mp_unsigned_bin_size' is deprecated
(declared at ./libtommath/tommath.h:731): replaced by mp_ubin_size
[-Wdeprecated-declarations]

warning: 'mp_to_unsigned_bin' is deprecated
(declared at ./libtommath/tommath.h:733): replaced by mp_to_ubin
[-Wdeprecated-declarations]

warning: 'mp_unsigned_bin_size' is deprecated
(declared at ./libtommath/tommath.h:731): replaced by mp_ubin_size
[-Wdeprecated-declarations]

warning: ignoring return value of 'mp_init_multi',
declared with attribute warn_unused_result [-Wunused-result]

warning: ignoring return value of 'mp_to_unsigned_bin',
declared with attribute warn_unused_result [-Wunused-result]

warning: ignoring return value of 'mp_read_unsigned_bin',
declared with attribute warn_unused_result [-Wunused-result]

Change-Id: I510fd7a57c9cd52b59086a85d13aa6204ebb9fd9
2022-01-17 21:11:54 -05:00
Nicolas Williams
00dd104b96 gsskrb5: Fix dead code issues in deleg cred path 2022-01-17 18:10:08 -06:00
Nicolas Williams
82b8c906e9 gsskrb5: Fix incorrect allocation failure check 2022-01-17 18:00:51 -06:00
Nicolas Williams
77c048db9b gss: Check add_builtin() errors 2022-01-17 17:59:10 -06:00
Nicolas Williams
0bbf13722d roken: Remove dead code in rk_strsvisx() 2022-01-17 17:49:29 -06:00
Nicolas Williams
990816bc4b roken: Cast ignored function returns to void 2022-01-17 17:46:26 -06:00
Nicolas Williams
b4f9c8772b roken: Fix base32(1) crash on empty file 2022-01-17 17:43:23 -06:00
Nicolas Williams
68ddc50020 roken: Fix base64(1) crash on empty file 2022-01-17 17:42:17 -06:00
Nicolas Williams
dd71303a2f hx509: Fix coverity warnings 2022-01-17 17:36:48 -06:00
Nicolas Williams
2e729a9aa2 hdb: Fix coverity warnings 2022-01-17 17:32:24 -06:00
Nicolas Williams
b9a915c163 base: Fix various coverity warnings 2022-01-17 16:23:36 -06:00
Jeffrey Altman
9c41d66447 kcm: kcm_op_do_ntlm dead code removal
duplicate error check introduced by
fe2dfe83a8
("clean up and make work, require libheim-ipcs")
2022-01-17 17:07:14 -05:00
Nicolas Williams
68e2135361 asn1: Fix coverity warnings 2022-01-17 16:00:07 -06:00
Nicolas Williams
a0278f7da2 asn1: Add error checking for open types 2022-01-17 16:00:07 -06:00
Jeffrey Altman
9ab9fe04f2 lib/ntlm: ret_string fix memory allocation check
Assignment to '*s'.   Do not test 's'.
s
2022-01-17 16:59:06 -05:00
Jeffrey Altman
15ef584f59 lib/sl: gen_wrapper free 'n' before return 2022-01-17 16:59:06 -05:00
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