Commit Graph

17883 Commits

Author SHA1 Message Date
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
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
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
Luke Howard
4891d713fb bn_s_mp_rand_platform.c: s_read_urandom: correctly handle split read
s_read_urandom has a while loop to handle read() that returns less
than the full buffer (either due to EINTR or because more than the
atomic guarantee from urandom was requested). However, the target
of the read was always the base pointer p instead of the updated
pointer q, so in the end less than the requested randomness is returned.

Use q instead of p in the read() call.

Upstream pull request:
https://github.com/libtom/libtommath/pull/512

Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
2022-01-15 13:38:18 +11:00
Luke Howard
046675ce0e Revert "tommath: Fix warning in s_read_getrandom()"
This reverts commit 489da75e65.

Will be replaced with upstream commit.
2022-01-15 13:37:33 +11:00
Nicolas Williams
f076ed57cc Fix make dist 2022-01-14 20:10:19 -06:00
Nicolas Williams
754a49bd6b test_set_kvno0: Fix leak 2022-01-14 17:59:49 -06:00
Nicolas Williams
c4e962ea04 kafs: Fix a warning 2022-01-14 17:54:55 -06:00
Nicolas Williams
55fa5bf7d2 gsskrb5: Fix warnings 2022-01-14 17:39:05 -06:00
Nicolas Williams
96b7ea671d gss: Fix warnings 2022-01-14 17:39:05 -06:00
Nicolas Williams
65caff79a3 gss-token: Fix leak 2022-01-14 17:39:05 -06:00
Nicolas Williams
4f8399a433 hdb: Fix warnings and leaks 2022-01-14 17:10:16 -06:00
Nicolas Williams
fb553dde1d krb5: Fix warnings 2022-01-14 17:10:16 -06:00
Nicolas Williams
82a8744787 krb5: Fix SQLite3 ccache bugs/warnings 2022-01-14 17:10:16 -06:00
Nicolas Williams
aea18c3006 Use fallthrough statement attribute (moar)
GCC is very finicky.
2022-01-14 16:58:59 -06:00
Nicolas Williams
c607135a03 Use fallthrough statement attribute (moar) 2022-01-14 16:53:34 -06:00
Nicolas Williams
ddc6113610 Use fallthrough statement attribute 2022-01-14 16:32:58 -06:00
Nicolas Williams
367f9ddd7d kadm5: Revert part of 69eee19541 2022-01-14 15:41:32 -06:00
Nicolas Williams
489da75e65 tommath: Fix warning in s_read_getrandom()
See https://github.com/libtom/libtommath/pull/512

(Note: this has not shipped.  Only OS X would be affected, specifically
RSA key gen would be affected on OS X.)
2022-01-14 15:26:59 -06:00
Nicolas Williams
318b73f002 krb5: Drop duplicated krb5.conf.5 content 2022-01-14 14:59:02 -06:00
Nicolas Williams
69eee19541 kadm5: Fix warnings 2022-01-14 14:58:59 -06:00
Nicolas Williams
6f467b8097 wind: Fix some warnings 2022-01-14 14:47:13 -06:00
Nicolas Williams
005a43da96 gsspa: Quiet GCC fallthrough warning
Somehow GCC was honoring lower-case "fallthrough" comments elsewhere but
not here.  Anyways, there was no need to fall through, so now we don't.
2022-01-14 14:47:13 -06:00
Jeffrey Altman
6426e7550f roken: do not globally define 'timezone' and 'tzname'
ec866e635e
("Windows 10 SDK build fixes") introduced CPP macros

  timezone -> _timezone
  tzname   -> _tzname

but these names are common and the macros rewrite too much.

The name mapping is only required when building strftime.c
with Visual Studio 2017 and later.  Move the definitions
into strftime.c.

Change-Id: Ic813bff842124595fd3d86761cee6dcea4ae44e4
2022-01-14 14:56:39 -05:00
Nicolas Williams
05e8c0ede6 Check HMAC_Init_ex() return value 2022-01-14 12:48:32 -06:00
Nicolas Williams
52f3dc6aa4 hcrypto: HMAC_Init_Ex(): return int like OpenSSL 2022-01-14 12:48:32 -06:00
Nicolas Williams
77392d5d9c hcrypto: Fix warnings 2022-01-14 12:48:32 -06:00
Nicolas Williams
ea61f68d55 hx509: Fix name expansion bug 2022-01-14 12:44:00 -06:00
Nicolas Williams
e23bc7d53d hx509: Fix warnings and leaks 2022-01-14 12:42:52 -06:00
Nicolas Williams
d88298649b asn1: Fix ENOMEM NULL deref 2022-01-14 12:36:34 -06:00
Nicolas Williams
f0c46e7830 asn1: Use calloc() in generated C code 2022-01-14 12:25:43 -06:00
Nicolas Williams
1fe3d293e1 asn1: Fix warnings 2022-01-14 12:25:43 -06:00
Nicolas Williams
7f8fa65c5b asn1: Fix leak in der_copy_octet_string()
This manifested as a leak via _save fields in the template backend.
2022-01-14 12:01:34 -06:00
Nicolas Williams
a7e11df142 sl: Fix warnings in lib/sl/sl.c 2022-01-14 12:01:33 -06:00
Nicolas Williams
ed0fd1263a base: Fix warnings 2022-01-14 12:01:33 -06:00
Nicolas Williams
69b3c5368c base: Context should optional in more error funcs 2022-01-14 12:01:33 -06:00
Nicolas Williams
94bb267a8b roken: Delete getcap/cgetent/cgetstr() 2022-01-14 12:01:33 -06:00
Nicolas Williams
a90e1cb65c roken: Fix warnings 2022-01-14 12:01:33 -06:00
Jeffrey Altman
3a7c2c6a7f krb5.h: define DOMAIN_X500_COMPRESS macro
db7763ca7b
("asn1: X.681/682/683 magic handling of open types")
renamed 'DOMAIN_X500_COMPRESS' to 'domain_X500_Compress'
for compliance with ASN.1 which requires values to start with
lower case and types to start with upper case.

This change adds a CPP macro DOMAIN_X500_COMPRESS for use by
third-party applications that rely upon the prior name.

Change-Id: I2eb6fec2c795c8adeeef893b00909a202257ad74
2022-01-14 12:46:08 -05:00
Jeffrey Altman
05781f22ab roken: fix net_write if _WIN32 and !SOCKET_IS_NOT_AN_FD
12826c9586
("Handle partial writes on non-blocking sockets") introduced
unconditional use of 'use_write' which is only declared if
defined(SOCKET_IS_NOT_AN_FD).

Change-Id: I0c43ed44a86b4f245acba849afabeb9ce739d0e5
2022-01-14 12:35:50 -05:00