Commit Graph

28968 Commits

Author SHA1 Message Date
Jeffrey Altman
10164490b7 windows/installer: code sign all merge modules
The assembly, policy, command and gss merge modules were unsigned.

Change-Id: I0a12576ce1a465741cb91bf670981952d776b1a7
2019-01-14 06:12:36 -05:00
Jeffrey Altman
a205fe17c6 lib/kadm5: WIN32 fix callback calling conventions
chpass_principal_with_key_hook_cb added by 57c25d9828 must be
KRB5_LIB_CALL for 32-bit Windows builds.

Change-Id: Ifd61caeee76f9d048bb13f93e226b99ce7e8b75c
2019-01-14 06:12:36 -05:00
Jeffrey Altman
387684aa93 WIN32: fix calling conventions for 32-bit builds
On 32-bit Windows Intel builds the __cdecl and __stdcall calling
conventions are different so labeling the functions that are
exported or assigned to function pointers matters.

Change-Id: I03b6f34baeb9ffb2e683fd979f12f27a5078a4da
2019-01-14 06:12:36 -05:00
Jeffrey Altman
dcfcdd00d8 lib/asn1: WIN32 suppress "unreferenced local variable" warning
the code generated by asn1_compile.exe includes a large number
of unreferenced local variables.  The resulting warnings drown
out other potentially more serious warnings.

This change suppresses the C4101 warnings in the generated
source files.

Change-Id: I17642ff427f457c885b1eb0e62436f3bc9057ee1
2019-01-14 06:12:36 -05:00
Jeffrey Altman
63579e6eb1 packages/windows/sdk: include dlfcn.h
dlfcn.h is now included from roken.h so must be included in
the sdk.

Change-Id: I76d6d9df965785c47cfefd349462a2e71fc58b63
2019-01-14 06:12:36 -05:00
Jeffrey Altman
7d5b844538 lib/krb5: WIN32 disable warnings
Heimdal declares functions that never return as non-void.  Suppress
the following warnings now that functions are labeled 'noreturn'.

4646 - function declared with __declspec(noreturn) has non-void return type

4716 - 'function' must return a value

Change-Id: Id85cc435e99688bae7326a723a5a80d828859bf2
2019-01-14 06:12:36 -05:00
Jeffrey Altman
9d3e206b76 lib/krb5: WIN32 _krb5_load_plugins wrong constness
The 'plugin_prefix' variable was declared 'const' which generates
a warning because the C string is freed.

This change removes the 'const' designation.

Change-Id: I6f3838d6dbf1bb496f286c96aea96bae8948930d
2019-01-14 06:12:36 -05:00
Jeffrey Altman
9358747426 lib/gssapi/mech: gss_acquire_cred_from calling conventions
gss_acquire_cred_from() is an exported function and therefore
must be tagged with GSSAPI_LIB_FUNCTION and GSSAPI_LIB_CALL.

Change-Id: I80918cb8083eaeac2d0eba5347f7b428e997cfaa
2019-01-14 06:12:36 -05:00
Luke Howard
57c25d9828 kadm5: add chpass_with_key hook (#397)
Add a hook for changing a password with a key. This hook should be consolidated
into one shared with randkey and setkey, but for now I have continued to have
the hooks follow the kadm5 APIs themselves in both signature and quantity.

(This means the randkey one isn't actually very useful because it doesn't
provide the hook with the keys.)
2019-01-10 15:18:10 +11:00
Luke Howard
59ba12f832 kadm5: remove unused variable from sample_hook 2019-01-10 12:40:11 +11:00
Ake Sandgren
907b9ee6c4 Fix broken return from _krb5_erase_file on missing file.
The return of lstat should be handled like the "open" if errno = ENOENT.
2019-01-09 11:27:09 -06:00
Nicolas Williams
717a399bbd Fix ktutil weak password for principal creation
Now that we always enforce password quality policies, ktutil get fails
because it uses "x" as a password when creating a principal.

Of course, it's probably a misfeature that ktutil get creates principals when
they don't exist...
2019-01-09 00:14:11 -06:00
Nicolas Williams
c2b106def5 Fix wrong keepold default in kadmin and ktutil 2019-01-09 00:14:11 -06:00
Nicolas Williams
7808e898e5 Appveyor: fix SetEnv.cmd invocation 2019-01-07 11:55:40 -06:00
Luke Howard
5abb68c891 hdb: ensure Salt is zero'd in add_default_salts()
Ensure Salt is zero'd in add_default_salts(), as the structure has members
other than the salt type and value.
2019-01-07 18:07:53 +11:00
Luke Howard
ff21a49cb0 krb5: change "version" to "instance" in plugin error message
A mismatch of instance cookie just means that the instances of Heimdal do not
match; they may in fact be the same version.
2019-01-07 16:49:38 +11:00
Luke Howard
de1f37a6aa kdc: omit default salt from PA-ETYPE-INFO[2]
If the salt for the AS-REP client key matches the default password salt for the
client principal in the AS-REQ, then it can be omitted from the PA-ETYPE-INFO,
PA-ETYPE-INFO2 (RFC4120) as the client will assume the default salt in its
absence.
2019-01-07 16:33:08 +11:00
Luke Howard
a3fd75f368 hdb: generate default salts for entries missing them
Older databases may lack explicitly stored salts where the salt is the default
one. When fetching a client entry for an AS-REQ, add default salts to keys that
lack one.
2019-01-07 16:33:08 +11:00
Jeffrey Altman
828ddecd61 kdc: get_pa_etype_info_both comply with RFC4120
Heimdal's current behavior regarding the generation of PA-ETYPE-INFO2
and PA-ETYPE-INFO violates RFC4120 in two ways:

 1. when generating responding both PA-ETYPE-INFO2 and PA-ETYPE-INFO
    the hints returned in the inverse order: INFO then INFO2 instead
    of INFO2 then INFO.

 2. the determination that both PA-ETYPE-INFO2 and PA-ETYPE-INFO is
    currently based upon the KDC selected enctype when it should be
    determine based upon examining the entire enctype list specified
    by the requesting client.

This change corrects the behavior to follow the RFC4120 guidance.

Change-Id: I6ebda8a813c25f9296f10314e32e93a22380ca72
2019-01-07 15:43:54 +11:00
Luke Howard
83d2951c0d gssapi: SPNEGO does not reset NTLM RC4 state (#509) 2019-01-06 20:50:24 -06:00
Luke Howard
9750f2d915 hdb: force canonicalization of enterprise principal names
Whilst Windows does not canonicalize enterprise principal names if the
canonicalize flag is unset, the original specification in
draft-ietf-krb-wg-kerberos-referrals-03.txt says we should. Non-Windows
deployments of Heimdals are unlikely to understand enterprise principal names
in tickets, and are also unlikely to set the canonicalize flag, so this makes
sense. (It was also the behavior prior to moving the name canonicalization
logic into the KDC.)
2019-01-06 18:03:07 +11:00
Luke Howard
4ea5cc2eff kdc: only set HDB_F_GET_KRBTGT when requesting TGS principal 2019-01-06 17:54:58 +11:00
Luke Howard
0141e7a497 Revert "kdc: move more name canonicalization logic to KDC"
This reverts commit 1b7e196e66.

It turns out that, contrary to the referrals draft, Windows does not
canonicalize enterprise principal names if the canonicalize KDC option is
unset.
2019-01-06 17:45:05 +11:00
Luke Howard
79f84913c9 hdb: krb5_locl.h obviates need for forward declarations 2019-01-05 16:32:00 +11:00
Luke Howard
1b7e196e66 kdc: move more name canonicalization logic to KDC
Enterprise principal client names in AS-REQs should always be canonicalized
irrespective of the setting the canonicalize KDC option. Perform this check in
the KDC rather than HDB.

Do not set the HDB_F_GET_KRBTGT flag unless the client actually requested a TGS
principal.
2019-01-05 15:51:11 +11:00
Luke Howard
c6232299c3 kdc: perform AS-REQ canonicalization in kdc
Mirroring the logic recently introduced in the TGS, this patch modifies the KDC
to perform client and server canonicalization itself rather than relying on the
backend to do so. Per RFC 6806, the behavior is slightly different for the AS
in that the setting of the canonicalize flag in the AS-REQ does impact the
returned names in the ticket. In order to support realm canonicalization or
other custom behavior, we allow the backend to force the KDC to canonicalize by
setting the force-canonicalize flag in the returned client or server entries.
2019-01-05 15:51:11 +11:00
Luke Howard
6bb8eaca20 hdb: dereference principal aliases in all KDC lookups (#452)
e11abf41 added support in libhdb for always dereferencing principal aliases
during an AS-REQ (where dereferencing refers to enabling alias lookups, and
rewriting the returned entry with the alias name unless canonicalization was
enabled).

Due to the KDC setting HDB_F_FOR_AS_REQ for all lookups from the AS, this
allowed aliases on the TGS itself to be dereferenced during an AS-REQ; however,
on presenting the TGT, the TGS would fail to resolve. Creating an explicit TGS
principal for the aliased realm would work (at least prior to c555ed6a), but
this could be confusing to deploy.

This commit changes enables alias dereferencing when HDB_F_GET_ANY is set,
which essentially means dereference whenever the request is coming from the KDC
(as opposed to, say, kadmin).

We also backout c555ed6a, which changed the TGS to always canonicalize the
server realm, as this breaks serving multiple realms from a single KDC, where
server principals in different realms share a single canonical entry.
HDB_F_CANON is now passed to the backend as a hint only, and per RFC 6806 the
principal name is never changed in TGS replies. (However, for Samba interop,
backends can override this by setting the force-canonicalize HDB flag.)
2019-01-05 14:01:26 +11:00
Luke Howard
c6d00f2502 Revert "KDC: Allow hdb to set the issued ticket's realm"
This reverts commit c555ed6a1f.
2019-01-05 14:01:26 +11:00
Luke Howard
2287c250b2 Revert "Revert "Fix tests/plugin/windc.c""
windc doesn't link against libkdc, so it doesn't need to check its instance;
however, we will continue to export kdc_get_instance() from libkdc in case
other windc plugins do link against it.
2019-01-05 10:55:13 +11:00
Luke Howard
ac544a6da6 kdc: export kdc_get_instance() for windc plugins 2019-01-05 10:48:04 +11:00
Luke Howard
e776e6c5ed Revert "Fix tests/plugin/windc.c"
Will fix by exporting kdc_get_instance() from libkdc.
2019-01-05 10:47:42 +11:00
Nicolas Williams
99188ea797 Bump roken SONAME version (fix #279) 2019-01-04 12:49:58 -06:00
Nicolas Williams
26048694d7 One more Travis fix 2019-01-04 11:30:53 -06:00
Nicolas Williams
9b39978ddd Fix tests/plugin/windc.c 2019-01-04 11:26:28 -06:00
Luke Howard
7de958252c gssapi: add some Apple (c) notices for mechglue bugfix import
ad426d03 imported some minor bugfixes from the Darwin Heimdal-520 drop; a few
copyright notices were omitted in the merge, which are included here.
2019-01-04 21:30:10 +11:00
Nicolas Williams
99e98520ba Travis: only one core analysis command 2019-01-04 01:27:38 -06:00
Nicolas Williams
9a6436fe3c Fix Travis core analysis; do not cat config.log 2019-01-04 01:23:26 -06:00
Luke Howard
7fc79a393c gssapi: defensively initialize *out in gss_duplicate_cred() 2019-01-04 18:12:11 +11:00
Luke Howard
178588516d gssapi: refactor gss_duplicate_cred()
Refactor gss_duplicate_cred() to consolidate branches in copy_cred_element()
and eliminate use of GSS_S_UNAVAILABLE sentinel
2019-01-04 18:07:41 +11:00
Jeffrey Altman
b025f20eb4 kadmin: kadmind_dispatch incompatible pointer warning
warning: incompatible pointer types passing 'int *' to parameter
  of type 'size_t *' (aka 'unsigned long *') [-Wincompatible-pointer-types]

Change-Id: Id75b1b1c9b46b63ab61134f4f91b7c2909d87077
2019-01-04 01:47:11 -05:00
Jeffrey Altman
750cfc092c fix 00c590e4ff
Change-Id: I73623d71842086374ae58c6e751395fd6925a704
2019-01-04 01:41:23 -05:00
Luke Howard
e23b0a39d3 gssapi: argument validation fixes gss_store_cred_into() 2019-01-04 17:31:28 +11:00
Jeffrey Altman
9119136967 fix memory leaks
Change-Id: I18ad15dc802842324b3712f3f7833953434b1cf1
2019-01-04 01:22:20 -05:00
Jeffrey Altman
00c590e4ff fix null pointer dereference errors
Change-Id: I82a849afe9f432a1084ad2505ce88b1fe4d3d3af
2019-01-04 01:02:59 -05:00
Luke Howard
735039dbdc gssapi: implement gss_set_neg_mechs() (#495)
Implementation of gss_set_neg_mechs() and gss_get_neg_mechs() as defined in RFC
4178. New gss_release_cred_by_mech() API for dropping a credential from a
mechanism glue credential.
2019-01-04 15:50:11 +11:00
Luke Howard
dfaaf9c93f gssapi: honor acceptor credential in SPNEGO (#506)
SPNEGO uses the callback function acceptor_approved() in order to determine
which mechanisms to advertise to the initiator in the case that the initiator
sent an empty initial context token. Prior to this commit, that function was
not passed in the acceptor credential (if present), so always uses a default
credential. For correctness, we should only advertise the availability of
mechanisms for which we have a credential.
2019-01-04 15:49:44 +11:00
Nicolas Williams
d5536d4dd3 Fix wrong context bugs in kadmin randkey 2019-01-03 22:26:31 -06:00
Luke Howard
e739c4d0c2 windc: update test windc plugin to use new load SPI 2019-01-04 15:17:20 +11:00
Luke Howard
befe1b8f90 always load plugins with RTLD_LOCAL/RTLD_GROUP if available 2019-01-03 20:06:27 -06:00
Luke Howard
803efebca5 krb5, kadm5: refactor plugin API
Refactor plugin framework to use a single list of loaded plugins; add a new
plugin API where DSOs export a load function that can declare dependencies and
export multiple plugins; refactor kadm5 hook API to use krb5 plugin framework.

More information in krb5-plugin(7).
2019-01-03 20:06:27 -06:00