Commit Graph

30088 Commits

Author SHA1 Message Date
Luke Howard
ab042dca36 gss_preauth: use memset rather than {0} to initialize cb 2022-01-17 10:05:59 +11:00
Luke Howard
0a59cbca51 kdc: use memset rather than {0} to initialize fxreq 2022-01-17 10:05:59 +11:00
Jeffrey Altman
7fb4698aa3 lib/krb5: gen_priv_key do not leak error string
hx509_get_error_string() returns an allocated string that must
be freed with hx509_free_error_string().

Change-Id: Ib24713d2425f53eb69fc9ebfc7cc1af3272b6271
2022-01-16 17:48:13 -05:00
Jeffrey Altman
c844a1c62b lib/krb5: load_priv_key do not leak error string
hx509_get_error_string() returns an allocated string that must
be freed with hx509_free_error_string().

Change-Id: I58d160ce1b09c48b587e8adce74277f6da469ceb
2022-01-16 17:45:21 -05:00
Jeffrey Altman
c8956523a1 lib/krb5: scc_alloc do not leak 'freeme'
Introduce a common 'out' label to avoid leaking 'freeme'.

Change-Id: I8d58efc75125ee553b462372ad160394013f9a3a
2022-01-16 17:36:17 -05:00
Jeffrey Altman
5667e80742 lib/krb5: fkt_remove_entry do not leak 'emsg'
7ae2dfd853
("krb5: Fix error msg when removing keytab entries") allocated
'emsg' to prevent the leak but then forgot to use it in place
of the original krb5_get_error_message() call.

Change-Id: I0b5acdab54d75399be970837a421740f2ad7d73b
2022-01-16 17:12:34 -05:00
Jeffrey Altman
43592b2e78 lib/krb5: pa_gss_step do not leak 'from' if unparse cname fails
Change-Id: I9edcaab26b5197265dabc5feae0f83fd1c60686c
2022-01-16 17:07:05 -05:00
Jeffrey Altman
8eaecdaa59 lib/krb5: srv_find_realm do not leak 'r' if unreachable
Change-Id: I6e16676c9cb820d6a25820523608cb9854fa2ce4
2022-01-16 17:04:04 -05:00
Jeffrey Altman
65276af7f6 kdc: fast_unwrap_request use memset to init fastreq
Change-Id: I4e872126f5c1deb48d36f5bdac22da7c0df3c8a1
warning: missing braces around initializer [-Wmissing-braces]
warning: (near initialization for 'fastreq.fast_options') [-Wmissing-braces]
warning: missing initializer for field 'padata' of 'struct KrbFastReq' [-Wmissing-field-initializers]
2022-01-16 16:00:40 -05:00
Jeffrey Altman
e8ccb2b86b lib/kadm5: send_diffs() init 'ver'
warning: ‘ver’ may be used uninitialized in this function [-Wmaybe-uninitialized]

'ver' can be uninitialized if get_right() fails.

Change-Id: If6019cc3c491b8be321ff3e08f3d27292f0f1f95
2022-01-16 15:54:53 -05:00
Jeffrey Altman
c822b9bc96 gssapi/krb5: _gsskrb5_inquire_name init 'major'
If no attributes are indicated 'major' is unset.  Default to
GSS_S_UNAVAILABLE.

Change-Id: I277ebdebab0fb0322b702638c57548d1f4c4be3d
2022-01-16 15:54:47 -05:00
Jeffrey Altman
085cf47738 lib/krb5: get_cred_kdc use memset to initialize 'rep'
Change-Id: Icc211f165c7aff1b0268b4c6df12eb976df2f8bd
warning: missing braces around initializer [-Wmissing-braces]
warning: (near initialization for 'rep.kdc_rep') [-Wmissing-braces]
warning: missing initializer for field 'enc_part' of 'krb5_kdc_rep' [-Wmissing-field-initializers]
2022-01-16 15:39:11 -05:00
Jeffrey Altman
14cb8eef60 lib/base: heim_audit_trail init all fields of 'kvb' before use
Change-Id: I7a3cdb038eb441a394a41c52a488ed98f87dbebd
2022-01-16 15:36:02 -05:00
Jeffrey Altman
7ae24732c7 clang-format generated hdb, spnego and krb5 asn1.c files
Alphabetically sorted the $(spnego_files), $(gssapi_files), and $(gen_files_hdb)
lists.

Added rules to execute clang-format when available on the included files.

Change-Id: If3cde862f3237bc7cd100bc82d4fbbf568f1a354
2022-01-16 15:11:22 -05:00
Nicolas Williams
bb791ee52c hcrypto: dlclose(dso) at ENGINE finish time 2022-01-16 14:08:22 -06:00
Nicolas Williams
febdcd4cbd cf: Make clang-format style common makefile macro 2022-01-16 14:07:03 -06:00
Nicolas Williams
940aea6653 gss: clang-format ASN.1 compiler outputs 2022-01-16 14:07:03 -06:00
Nicolas Williams
2065d02aaf hdb: clang-format ASN.1 compiler outputs 2022-01-16 14:07:03 -06:00
Nicolas Williams
fcfd380d15 asn1: Better clang-format / makefile pattern 2022-01-16 13:41:37 -06:00
Nicolas Williams
b889942340 bx509d: Add missing check of result of key2SPKI() 2022-01-16 13:12:22 -06:00
Jeffrey Altman
32e1604e76 lib/ipc: heim_sipc_stream_listener 'ct' lifecycle
return failure if calloc() fails

do not leak 'ct' if called with invalid 'type'

Change-Id: I384f80a51c6ec1d0980cce645c41ff3f6006fd3e
2022-01-16 00:56:16 -05:00
Jeffrey Altman
041f6d5c7c lib\krb5: krb5_parse_address out of order parameters
fix the order of parameters passed to krb5_eai_to_heim_errno

Change-Id: I31271283f3f31fcb0345dd766bc511825ddd362d
2022-01-16 00:51:22 -05:00
Jeffrey Altman
363bc7d983 handle negative return values
do not pass negative values to malloc

do not pass negative values to strerror

do not pass negative values to ftruncate

do not pass negative values to fclose

Change-Id: I79ebef4e22edd14343ebeebb2ef8308785064fe8
2022-01-16 00:48:09 -05:00
Jeffrey Altman
558300cfd2 kcm: kcmss_get_name_2 test correct output parameter
Do not assign to *sub if sub is NULL.

Change-Id: Iee9fa61e10ace69a64d986ca5d104974d2344e89
2022-01-16 00:31:03 -05:00
Jeffrey Altman
f341fa7721 prevent unintended sign extension errors
When an unsigned char is shifted << 24 bits its type will be
promoted to signed 32-bits.   If the value is then assigned to
an unsigned 64-bit value sign extension will occur.

Prevent the unwanted sign extension by explicitly casting the
value to unsigned long before shifting.

Change-Id: Iabeac0f17dc3229a2dc89abe71960a8ffbf523f8
2022-01-16 00:23:05 -05:00
Jeffrey Altman
3707c52ea7 lib/hcrypto: ENGINE_by_dso do not leak handle
Must dlclose(handle) before returning even if 'engine' is
returned to caller.

Change-Id: I169044a768934e9b7774a323fe6c855fd07a09e4
2022-01-16 00:05:07 -05:00
Nicolas Williams
440ea95b56 GitHub: Add Failed Test Logs sections 2022-01-15 23:01:42 -06:00
Jeffrey Altman
19eae8b4a9 lib/hcrypto: BN_set_word return false if input 'bn' is NULL
If the input 'bn' is NULL then BN_bin2bn() will allocate and
return a BIGNUM which will then be leaked.   BN_set_word()
would then return true even though it didn't set the word
into a BIGNUM known to the caller.

Change-Id: I6681f548e6bfb330cec009ae7c18e6151016179e
2022-01-15 23:17:26 -05:00
Nicolas Williams
b8450a04a1 GitHub: Non-conflicting artifact names 2022-01-15 21:53:24 -06:00
Jeffrey Altman
2660580507 lib/otp: opt_md_init do not leak ctx if malloc fails
Change-Id: I21d7d50e11430bea18832854d817405b761c254c
2022-01-15 22:49:56 -05:00
Jeffrey Altman
fe76d53316 lib/asn1: pass correct size to mergesort_r
introduced by df3e08485b
("asn1: Add support for decoration w/ external types")

Change-Id: I6cd8b56766e4aabddb9c523cd3b4fe203d988afe
2022-01-15 22:45:59 -05:00
Nicolas Williams
883f3cdfb5 GitHub: Fix linux build (make dist)? 2022-01-15 21:32:22 -06:00
Jeffrey Altman
a84186653c kadmin: list_princs zero get_opt structure before use
Not all fields are assigned to.  Initialize the structure
to zero before use.

Change-Id: I2cfc60baaf8bf80389950a373c2a82f600a71aa2
2022-01-15 22:28:42 -05:00
Nicolas Williams
4b3f8266d7 GitHub: Fix osx build 2022-01-15 21:23:26 -06:00
Nicolas Williams
a31db2af0d asn1: Allow CHOICEs to be decorated too
Prior to this commit only those C structs for SET and SEQUENCE types
could be decorated.  Now those for CHOICE types also can be decorated.

We could further extend this to SET OF and SEQUENCE OF types if it
proves useful.
2022-01-15 21:09:12 -06:00
Jeffrey Altman
1685c34b0d remove (krb5_enctype) cast for ETYPE_xxx
Now that ETYPE_xxx names are macros to the KRB5_ENCTYPE_xxx
symbols there is no longer a need to cast to (krb5_enctype).

Change-Id: Ib561f6e45346abac7a53eb1db0bfef60ee3bcb74
2022-01-15 22:05:50 -05:00
Jeffrey Altman
90e51a3d18 krb5.h: do not use anonymous enum for alternate E[NC]TYPE names
Use of an anonymous enum for ETYPE_xxx and ENCTYPE_xxx alternative
names results in loss of the original KRB5_ENCTYPE_xxx type.
Use CPP macros instead.

Change-Id: I84620aabd672db1d2cd0ff7a65f3ae8b34c0c684
2022-01-15 22:05:50 -05:00
Jeffrey Altman
7145a8e908 gssapi/mech: mech_locl.h roken.h must be included earlier
If included roken.h should be immediately following config.h.
Doing so ensures that all platform specific headers are
included in the proper order and avoids unnecessary includes
of headers managed by roken.h.

Change-Id: I27f11b42300b6ebcfbcc8d2c53915e96b6eec1d9
2022-01-15 21:24:10 -05:00
Nicolas Williams
c74d1992e1 GitHub: Output artifacts (fix yaml moar) 2022-01-15 19:31:05 -06:00
Nicolas Williams
27deb05e72 GitHub: Output artifacts (fix yaml) 2022-01-15 19:27:16 -06:00
Nicolas Williams
1e205ca77e GitHub: Output artifacts 2022-01-15 19:20:23 -06:00
Nicolas Williams
6ea0520388 GitHub: Special builds for more branches
Instead of triggering scan-build builds on pushes to the `scan-build` branch,
or valgrind builds on pushes to the `valgrind` branch, let's have pushes to
branches matching `scan-build*` and `valgrind*` branch name globs trigger the
corresponding builds.

Do not forget to delete those branches when you're done!
2022-01-15 16:29:11 -06:00
Nicolas Williams
1ba296dc6a GitHub: Add more build types
- s/build.yml/${build}.yml/ for the existing builds

 - add filter on branches on push

 - add scan-build build triggered by pushes to the scan-build branch or by PRs
   that touch the scan-build.yml

 - add valgrind build triggered by pushes to the valgrind branch or by PRs that
   touch the valgrind.yml
2022-01-15 16:18:03 -06:00
Luke Howard
867457871a krb5: make krb5_pac a heim_object_t
Make krb5_pac a heim_object_t and use heim_retain() (i.e. reference count +1)
as the copy constructor for the type decoration.

Note: this assumes that PACs included in naming attributes are immutable.
2022-01-15 18:54:57 +11:00
Luke Howard
5a952ee7b5 krb5: decorate PrincipalNameAttrs with krb5_pac
Add krb5_pac to PrincipalNameAttrs to avoid needing to re-parse it each time
gss_get_name_attribute() is called.
2022-01-15 18:54:57 +11:00
Luke Howard
0e8c4ccc6e hdb: eliminate hdb_entry_ex
Remove hdb_entry_ex and revert to the original design of hdb_entry (except with
an additional context member in hdb_entry which is managed by the free_entry
method in HDB).
2022-01-15 18:54:57 +11:00
Luke Howard
c5551775e2 hdb: decorate HDB_entry with context member
Decorate HDB_entry with context and move free_entry callback into HDB structure
itself. Requires updating hdb_free_entry() signature to include HDB parameter.
A follow-up commit will consolidate hdb_entry_ex (which has a single hdb_entry
member) into hdb_entry.
2022-01-15 18:54:57 +11:00
Jeffrey Altman
923067e099 lib/kadm5: kadm_connect do not close 's' more than once
If 's' is closed before exiting, it must be set to rk_INVALID_SOCKET.

Change-Id: I63caf992aa3a6b2c86c918a660025fc054d396d6
2022-01-14 23:21:16 -05:00
Nicolas Williams
a4e6c33780 asn1: Fix double-free in asn1parse.y 2022-01-14 22:16:50 -06:00
Jeffrey Altman
9f3004bfd5 gssapi/krb5: _gsskrb5_export_sec_context copy/paste error
80f3194a76
("gssapi/krb5/{export,import}_sec_context: make smaller tokens.")
stored the source principal when it should have stored the target
principal.

Change-Id: Ife6b137f9fe8f63cdb78b4212f74d502080ec2a2
2022-01-14 23:01:30 -05:00