lorikeet-heimdal.git
11 months agokdc: Return NEVER_VALID error code if ticket will never be valid lorikeet-heimdal lorikeet-heimdal-202305160500
Joseph Sutton [Thu, 13 Apr 2023 23:47:08 +0000 (11:47 +1200)]
kdc: Return NEVER_VALID error code if ticket will never be valid

This matches the error generated by Windows.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
11 months agokdc: Always apply maximum ticket lifetime and renew time when non-NULL
Joseph Sutton [Tue, 16 May 2023 05:10:09 +0000 (17:10 +1200)]
kdc: Always apply maximum ticket lifetime and renew time when non-NULL

This allows a lifetime of zero to work.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
11 months agohdb: Make maximum ticket lifetime and renew time signed integers
Joseph Sutton [Tue, 16 May 2023 05:07:07 +0000 (17:07 +1200)]
hdb: Make maximum ticket lifetime and renew time signed integers

This allows for negative lifetimes to be encoded, and fits in better
with our use elsewhere of time_t, which in POSIX is a signed integer
type.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
11 months agokdc: Pass in HDB_F_ARMOR_PRINCIPAL when fetching armor ticket client principal
Joseph Sutton [Tue, 16 May 2023 05:06:17 +0000 (17:06 +1200)]
kdc: Pass in HDB_F_ARMOR_PRINCIPAL when fetching armor ticket client principal

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
11 months agohdb: Add flag to indicate a fetch for the client of an armor ticket
Joseph Sutton [Tue, 16 May 2023 05:05:49 +0000 (17:05 +1200)]
hdb: Add flag to indicate a fetch for the client of an armor ticket

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
11 months agokdc: Have caller pass HDB_F_FOR_TGS_REQ into _kdc_fast_check_armor_pac()
Joseph Sutton [Tue, 16 May 2023 05:03:44 +0000 (17:03 +1200)]
kdc: Have caller pass HDB_F_FOR_TGS_REQ into _kdc_fast_check_armor_pac()

We shall soon want to use this function for AS-REQs as well as TGS-REQs.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
11 months agokdc: Set PAC as trusted if indicated by the plugin
Joseph Sutton [Thu, 16 Mar 2023 01:43:41 +0000 (14:43 +1300)]
kdc: Set PAC as trusted if indicated by the plugin

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
11 months agokrb5: Add functions to determine whether PAC is trusted
Joseph Sutton [Thu, 16 Mar 2023 22:21:39 +0000 (11:21 +1300)]
krb5: Add functions to determine whether PAC is trusted

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
11 months agokdc: Move _krb5_pac_get_attributes_info() call to right place
Joseph Sutton [Wed, 8 Mar 2023 19:55:02 +0000 (08:55 +1300)]
kdc: Move _krb5_pac_get_attributes_info() call to right place

Whether or not we set pac_attributes should not depend on pac_canon_name
being NULL or non-NULL.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
11 months agokdc-plugin: Split updating a PAC out of PAC verification
Joseph Sutton [Wed, 8 Mar 2023 02:22:29 +0000 (15:22 +1300)]
kdc-plugin: Split updating a PAC out of PAC verification

Up to now krb5plugin_kdc_pac_verify() has served to both verified and
updated a PAC. There are cases, however, when we only want to retrieve
and verify a PAC, but don't want to modify it. This is the case with the
PAC from a FAST armor ticket.

Therefore, add a new plugin function, pac_update(), that will update a
PAC obtained using pac_verify(). pac_verify() now only deals with
verifying a PAC, while pac_update() handles any necessary updates to it.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
11 months agokdc: Call _kdc_fast_check_armor_pac() prior to calling _kdc_check_pac()
Joseph Sutton [Wed, 8 Mar 2023 02:37:30 +0000 (15:37 +1300)]
kdc: Call _kdc_fast_check_armor_pac() prior to calling _kdc_check_pac()

The plugin code invoked by _kdc_check_pac() may need to access
explicit_armor_client and explicit_armor_pac, but those fields are not
set until after calling _kdc_fast_check_armor_pac(). Hence we must do
that first.

We also now call _kdc_fast_check_armor_pac() regardless of whether the
ticket was issued by the KDC or whether the server principal is the
krbtgt.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
11 months agolib/hdb: Make hdb_enctype2key() parameter const
Joseph Sutton [Wed, 8 Mar 2023 02:24:56 +0000 (15:24 +1300)]
lib/hdb: Make hdb_enctype2key() parameter const

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
11 months agoCVE-2022-37966 kdc: Implement new Kerberos session key behaviour since ENC_HMAC_SHA1_...
Andrew Bartlett [Tue, 1 Nov 2022 02:20:47 +0000 (15:20 +1300)]
CVE-2022-37966 kdc: Implement new Kerberos session key behaviour since ENC_HMAC_SHA1_96_AES256_SK was added

ENC_HMAC_SHA1_96_AES256_SK is a flag introduced for by Microsoft in this
CVE to indicate that additionally, AES session keys are available. We
set the etypes available for session keys depending on the encryption
types that are supported by the principal.

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

Pair-Programmed-With: Joseph Sutton <josephsutton@catalyst.net.nz>

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 months agoCVE-2022-37966 third_party/heimdal: Fix error message typo
Joseph Sutton [Mon, 21 Nov 2022 01:01:47 +0000 (14:01 +1300)]
CVE-2022-37966 third_party/heimdal: Fix error message typo

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agoCVE-2022-37967 Add new PAC checksum
Joseph Sutton [Wed, 9 Nov 2022 00:45:13 +0000 (13:45 +1300)]
CVE-2022-37967 Add new PAC checksum

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

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 months agoCVE-2022-37966 HEIMDAL: Look up the server keys to combine with clients etype list...
Andrew Bartlett [Tue, 1 Nov 2022 01:47:12 +0000 (14:47 +1300)]
CVE-2022-37966 HEIMDAL: Look up the server keys to combine with clients etype list to select a session key

We need to select server, not client, to compare client etypes against.

(It is not useful to compare the client-supplied encryption types with
the client's own long-term keys.)

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 months agoSAMBA ONLY krb5: Don't generate PAC_ATTRIBUTES_INFO and UPN_DNS_INFO buffers
Joseph Sutton [Tue, 4 Jan 2022 21:39:14 +0000 (10:39 +1300)]
SAMBA ONLY krb5: Don't generate PAC_ATTRIBUTES_INFO and UPN_DNS_INFO buffers

Currently we leave it up to the plugin to generate them, which allows
more control over what situations they are included in.

[abartlet@samba.org This commit makes the check-context test fail, but
is critical to how Samba operates an AD DC, because Samba wants full
control of the buffers here.  A way to make this behaviour
optional would be useful in the future]

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
11 months agoSAMBA ONLY kdc: Always include PAC if it is non-NULL
Joseph Sutton [Tue, 4 Jan 2022 21:18:28 +0000 (10:18 +1300)]
SAMBA ONLY kdc: Always include PAC if it is non-NULL

Currently, we allow the plugin to specify that the PAC should be omitted
by returning NULL for the PAC.

[abartlet@samba.org This commit needs to be reworked to use a plugin hook
as it overrides the default PAC behaviour and so the check-kdc and
check-kdc-weak tests fail as they don't get the client-controlled
behaviour they expect any more]

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
11 months agokdc: Allow requesting no PAC for AS-REQ to non-TGS server
Joseph Sutton [Tue, 4 Jan 2022 21:25:31 +0000 (10:25 +1300)]
kdc: Allow requesting no PAC for AS-REQ to non-TGS server

Note that we still get a PAC even if the NO_AUTH_DATA_REQUIRED flag is
set, which matches Windows behaviour.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
11 months agokrb5: Remove UPN_DNS_INFO_EX realm check
Joseph Sutton [Tue, 4 Jan 2022 21:44:42 +0000 (10:44 +1300)]
krb5: Remove UPN_DNS_INFO_EX realm check

This check may fail if the realms do not match due to the netbios or
lowercase realm being used.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
11 months agokdc: don't fail salt_fastuser_crypto with r->req.req_body.cname == NULL for TGS-REQ
Stefan Metzmacher [Fri, 25 Feb 2022 03:09:47 +0000 (04:09 +0100)]
kdc: don't fail salt_fastuser_crypto with r->req.req_body.cname == NULL for TGS-REQ

11 months agokdc: Add function to get current KDC time
Joseph Sutton [Wed, 22 Jun 2022 08:01:12 +0000 (20:01 +1200)]
kdc: Add function to get current KDC time

Assists Samba to address CVE-2022-2031

This allows the plugin to check the endtime of a ticket against the
KDC's current time, to see if the ticket will expire in the next two
minutes.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
11 months agokdc: add kdc_log() before _kdc_fast_mk_error() also for as-req
Stefan Metzmacher [Thu, 24 Feb 2022 12:27:29 +0000 (13:27 +0100)]
kdc: add kdc_log() before _kdc_fast_mk_error() also for as-req

We already have the same for the tgs-req case.

Got lost in https://github.com/heimdal/heimdal/pull/964

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agokrb5: Check for signed overflow
Joseph Sutton [Mon, 28 Feb 2022 23:00:48 +0000 (12:00 +1300)]
krb5: Check for signed overflow

This avoids a compiler error:

../../third_party/heimdal/lib/krb5/krbhst.c: In function ‘srv_find_realm.constprop’:
../../third_party/heimdal/lib/krb5/krbhst.c:113:8: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
     if (num_srv == 0) {
        ^

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
11 months agokdc: Reinstate publicly accessible configuration structure members
Joseph Sutton [Tue, 22 Feb 2022 20:53:27 +0000 (09:53 +1300)]
kdc: Reinstate publicly accessible configuration structure members

We add some specific configuration options into
KRB5_KDC_CONFIGURATION_COMMON_ELEMENTS, as otherwise Samba no longer has
any way to access those options, other than through the configuration
file.

This is an adaptation to Heimdal:

commit b82815733598da9ba0807ad4754572276b6ffc06
Author: Luke Howard <lukeh@padl.com>
Date:   Thu Jan 20 09:15:24 2022 +1100

    kdc: add accessor functions for KDC request structure

    Add accessor functions for use by Samba and other plugin developers.
    Documentation is in kdc/kdc-accessors.h.

11 months agokuser: Avoid conflicting macro definitions
Joseph Sutton [Mon, 21 Feb 2022 06:47:14 +0000 (19:47 +1300)]
kuser: Avoid conflicting macro definitions

This avoids a conflict introduced in:

commit 78b3507131482d0a5d2c0b362a0970a6d0e4025d
Author: Nicolas Williams <nico@twosigma.com>
Date:   Wed Dec 15 16:17:52 2021 -0600

    kinit: Use optimistic anon PKINIT armored FAST

    Now that we can optimistically try FAST w/ anon PINIT armor, we should
    do so in kinit whenever it makes sense.

11 months agokrb5: Set canonicalize flag for enterprise principals
Stefan Metzmacher [Mon, 6 Apr 2020 13:16:42 +0000 (15:16 +0200)]
krb5: Set canonicalize flag for enterprise principals

11 months agolib/krb5: allow access to anonymous mcache entries via name
Stefan Metzmacher [Wed, 1 Apr 2020 21:09:57 +0000 (23:09 +0200)]
lib/krb5: allow access to anonymous mcache entries via name

The idea of anonymous mcache entries is that they won't be
included in the global ccache collection. But at the
same time they should be accessable via a name.

There might be better ways to do this, e.g. let the
caller specify a name like 'anonymous-application-key1'.

But we need a way to use MEMORY ccaches for different
security contexts, without the fear that they are randomly
used from the global list.

The better way would have been to opt-in in order to
fill the global ccache collection.

See 7e858c51b690ff0322766b328f60b41bc38d4ae3 for (at least part)
of the mess... there should not be a single global ccache collection
for MEMORY: ccaches! That is a security problem for applications
which used to be able to switch between different MEMORY ccaches!

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agolib/krb5: Fix loss of information in _gsskrb5_canon_name() from call to krb5_sname_to...
Andrew Bartlett [Tue, 26 Sep 2017 03:34:38 +0000 (16:34 +1300)]
lib/krb5: Fix loss of information in _gsskrb5_canon_name() from call to krb5_sname_to_principal()

This would discard the realm the client specified.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
11 months agolib/krb5: Honour KRB5_CTX_F_DNS_CANONICALIZE_HOSTNAME in parse_name_canon_rules()
Andrew Bartlett [Tue, 26 Sep 2017 02:11:53 +0000 (15:11 +1300)]
lib/krb5: Honour KRB5_CTX_F_DNS_CANONICALIZE_HOSTNAME in parse_name_canon_rules()

This is called from gsskrb5_set_dns_canonicalize() and krb5_set_dns_canonicalize_hostname()
and is used by Samba to ensure that the AD DC sees the name as specified by the client.

We allow the krb5.conf to override, if specifically configured.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
11 months agokdc: Change KDC to respect HDB server name type if f.canonicalize is set
Andrew Bartlett [Wed, 5 Sep 2018 02:50:00 +0000 (14:50 +1200)]
kdc: Change KDC to respect HDB server name type if f.canonicalize is set

This changes behaviour flagged as being for Java 1.6.  My hope is that this does not
set f.canonicalize

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
11 months agokdc: Don't conceal error code when using FAST
Joseph Sutton [Tue, 16 Nov 2021 06:59:44 +0000 (19:59 +1300)]
kdc: Don't conceal error code when using FAST

This matches Windows behaviour, which also places the error code in the
outer error.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
11 months agokdc: Send ETYPE-INFO2 instead of PW-SALT for validated timestamp
Joseph Sutton [Tue, 14 Dec 2021 01:19:15 +0000 (14:19 +1300)]
kdc: Send ETYPE-INFO2 instead of PW-SALT for validated timestamp

This matches Windows behaviour.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
11 months agoAdapt apply_heimdal.sh to new Heimdal location in Samba
Andrew Bartlett [Tue, 25 Oct 2022 19:18:33 +0000 (08:18 +1300)]
Adapt apply_heimdal.sh to new Heimdal location in Samba

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
11 months agolorikeet-heimdal: Move Heimdal into third_party directory
Joseph Sutton [Tue, 1 Mar 2022 00:56:25 +0000 (13:56 +1300)]
lorikeet-heimdal: Move Heimdal into third_party directory

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
11 months agolorikeet-heimdal: modernize URLs in helper scripts
Andrew Bartlett [Mon, 10 Sep 2018 21:13:07 +0000 (16:13 -0500)]
lorikeet-heimdal: modernize URLs in helper scripts

We have moved some repos and have https these days

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
11 months agolorikeet-heimdal: import-lorikeet: Use --no-verify when importing heimdal
Andrew Bartlett [Mon, 10 Sep 2018 21:05:40 +0000 (16:05 -0500)]
lorikeet-heimdal: import-lorikeet: Use --no-verify when importing heimdal

This allows us to import byte-for-byte files even if they have whitespace "errors".

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
11 months agolorikeet-heimdal: apply_heimdal: Try harder to apply patches from Samba
Andrew Bartlett [Wed, 5 Sep 2018 02:04:44 +0000 (14:04 +1200)]
lorikeet-heimdal: apply_heimdal: Try harder to apply patches from Samba

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
11 months agolorikeet-heimdal: apply_heimdal: Only show the Heimdal part of the patch to cherry...
Andrew Bartlett [Wed, 5 Sep 2018 01:57:35 +0000 (13:57 +1200)]
lorikeet-heimdal: apply_heimdal: Only show the Heimdal part of the patch to cherry-pick

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
11 months agolorikeet-heimdal: Include Samba commit in cherry-picked patches
Andrew Bartlett [Wed, 5 Sep 2018 01:45:04 +0000 (13:45 +1200)]
lorikeet-heimdal: Include Samba commit in cherry-picked patches

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
11 months agolorikeet-heimdal: improve apply_heimdal.sh
Andrew Bartlett [Fri, 21 Feb 2014 02:58:20 +0000 (15:58 +1300)]
lorikeet-heimdal: improve apply_heimdal.sh

11 months agolorikeet-heimdal: specify hash to heimdal import, rather than using the date
Andrew Bartlett [Wed, 19 Feb 2014 09:06:57 +0000 (22:06 +1300)]
lorikeet-heimdal: specify hash to heimdal import, rather than using the date

11 months agolorikeet-heimdal: rebase-lorikeet: Explicitly use bash.
Jelmer Vernooij [Fri, 26 Oct 2012 14:34:47 +0000 (06:34 -0800)]
lorikeet-heimdal: rebase-lorikeet: Explicitly use bash.

Standard sh doesn't have pushd/popd.

11 months agolorikeet-heimdal: Add a new script to help merging patches from Samba4 to heimdal
Andrew Tridgell [Wed, 1 Dec 2010 02:00:08 +0000 (13:00 +1100)]
lorikeet-heimdal: Add a new script to help merging patches from Samba4 to heimdal

11 months agolorikeet-heimdal: improve import-lorikeet.sh for the toplevel build
Stefan Metzmacher [Thu, 14 Jul 2011 14:24:37 +0000 (16:24 +0200)]
lorikeet-heimdal: improve import-lorikeet.sh for the toplevel build

metze

11 months agolorikeet-heimdal: Improve the heimdal import scripts
Andrew Bartlett [Tue, 30 Nov 2010 23:54:49 +0000 (10:54 +1100)]
lorikeet-heimdal: Improve the heimdal import scripts

11 months agolorikeet-heimdal: add scipts to rebase and import the latest version into samba4
Stefan Metzmacher [Fri, 27 Mar 2009 06:31:11 +0000 (07:31 +0100)]
lorikeet-heimdal: add scipts to rebase and import the latest version into samba4

If you use this scripts, read them! :-)

metze

[abartlet@samba.org Removed lexyacc build step as this is no longer required
 in Samba, which builds the files at compile time]

11 months agolorikeet-heimdal: add HEIMDAL-LICENCE.txt
Stefan Metzmacher [Fri, 22 Aug 2008 09:57:06 +0000 (11:57 +0200)]
lorikeet-heimdal: add HEIMDAL-LICENCE.txt

metze

11 months agolorikeet-heimdal: camellia-ntt GPLv2+ license
Stefan Metzmacher [Fri, 22 Aug 2008 09:43:50 +0000 (11:43 +0200)]
lorikeet-heimdal: camellia-ntt GPLv2+ license

metze

11 months agolorikeet-heimdal: autogen.sh modifications
Stefan Metzmacher [Fri, 22 Aug 2008 09:42:21 +0000 (11:42 +0200)]
lorikeet-heimdal: autogen.sh modifications

metze

13 months agokinit: w/ command ignore SIGINT/SIGQUIT (fix #1077)
Nicolas Williams [Mon, 6 Feb 2023 23:40:33 +0000 (17:40 -0600)]
kinit: w/ command ignore SIGINT/SIGQUIT (fix #1077)

14 months agospnego/context_storage: undef sc_flags (for hpux)
Robert Manner [Fri, 25 Nov 2022 14:27:37 +0000 (15:27 +0100)]
spnego/context_storage: undef sc_flags (for hpux)

On hpux this is seems to be a define from sys/signal.h:

which renders the variable name invalid.

14 months agoheimdal/asn1: do not throw error when trying to allocate 0 bytes of memory
Norbert Bokor [Thu, 1 Dec 2022 10:08:46 +0000 (11:08 +0100)]
heimdal/asn1: do not throw error when trying to allocate 0 bytes of memory

14 months agoheimbase-atomics.h: replace heim_base_atomic_barrier with syntax valid noop
Robert Manner [Thu, 24 Nov 2022 14:46:16 +0000 (15:46 +0100)]
heimbase-atomics.h: replace heim_base_atomic_barrier with syntax valid noop

in case there is no implementation available.

15 months agohcrypto: Fix performance regression
Nicolas Williams [Fri, 27 Jan 2023 17:00:23 +0000 (11:00 -0600)]
hcrypto: Fix performance regression

15 months agogss: colaesce DCE_STYLE padding/trailer buffer check
Luke Howard [Fri, 13 Jan 2023 23:43:13 +0000 (10:43 +1100)]
gss: colaesce DCE_STYLE padding/trailer buffer check

15 months agogss: use mechglue instead of gssntlm encoders
Luke Howard [Mon, 16 Jan 2023 08:11:03 +0000 (19:11 +1100)]
gss: use mechglue instead of gssntlm encoders

Replace calls to {en,de}code...() with mechglue equivalents.

15 months agogss: don't truncate authtime in gsskrb5_extract_authtime_from_sec_context()
Luke Howard [Sat, 14 Jan 2023 23:20:54 +0000 (10:20 +1100)]
gss: don't truncate authtime in gsskrb5_extract_authtime_from_sec_context()

The interface between the krb5 mechanism and the mechglue API
gsskrb5_extract_authtime_from_sec_context() assumed the authtime would fit into
an uint32_t, which is not the case on platforms where time_t is 64-bit.

Fixes: #1073
15 months agogss: add 64-bit int {en,de}coders to mechglue
Luke Howard [Sat, 14 Jan 2023 23:17:21 +0000 (10:17 +1100)]
gss: add 64-bit int {en,de}coders to mechglue

15 months agogss: use mechglue instead of gsskrb5 encoders
Luke Howard [Sat, 14 Jan 2023 23:00:50 +0000 (10:00 +1100)]
gss: use mechglue instead of gsskrb5 encoders

Replace calls to _gsskrb5_{en,de}code...() with mechglue equivalents.

15 months agoUpdate krb5.conf
ChristianBoehm [Thu, 12 Jan 2023 15:20:29 +0000 (16:20 +0100)]
Update krb5.conf

proposal adding include or include.d in krb5.conf as comment

15 months agotest: Add minimal interop test with MIT Kerberos
Nicolas Williams [Mon, 9 Jan 2023 19:32:36 +0000 (13:32 -0600)]
test: Add minimal interop test with MIT Kerberos

15 months agobase: Fix fallback atomics
Nicolas Williams [Wed, 11 Jan 2023 18:59:04 +0000 (12:59 -0600)]
base: Fix fallback atomics

15 months agobase: Add atomic CAS macros/functions
Nicolas Williams [Mon, 9 Jan 2023 17:26:21 +0000 (11:26 -0600)]
base: Add atomic CAS macros/functions

15 months agokrb5: Document pkinit_revoke (fix #991)
Nicolas Williams [Tue, 10 Jan 2023 04:57:48 +0000 (22:57 -0600)]
krb5: Document pkinit_revoke (fix #991)

15 months agoRevert "kdc: Quiet warning in FAST unwrap"
Nicolas Williams [Tue, 10 Jan 2023 04:29:58 +0000 (22:29 -0600)]
Revert "kdc: Quiet warning in FAST unwrap"

This reverts commit a9c0b8f2645d3fc0395a1451a9251253489a88bc.

From Joseph Sutton:

> I found that this commit would result in `KRB5KRB_AP_ERR_BAD_INTEGRITY`
> errors in Samba whenever explicit FAST armor was present. Reverting the
> commit made FAST work again.

> It should be safe to use `tgs_ac` here, since it will always be non-NULL if
> `r->explicit_armor_present` is true. Maybe a local variable
> `explicit_armor_present` (which would be assigned to
> `r->explicit_armor_present` before the function returns successfully) would
> help a static analyser to deduce that its value doesn't change within the
> function, and that `tgs_ac != NULL` still holds.

https://github.com/heimdal/heimdal/commit/a9c0b8f2645d3fc0395a1451a9251253489a88bc#commitcomment-95581208

15 months agokrb5: Always fseek before fwrite in storage_stdio
Nicolas Williams [Mon, 9 Jan 2023 19:21:59 +0000 (13:21 -0600)]
krb5: Always fseek before fwrite in storage_stdio

15 months agoroken: ROKEN_xxx_ATTRIBUTE macros
Luke Howard [Sun, 8 Jan 2023 04:54:02 +0000 (15:54 +1100)]
roken: ROKEN_xxx_ATTRIBUTE macros

Add ROKEN_xxx_ATTRIBUTE macros, derived from krb5-types.h, to aid compiling
with compilers that don't have __attribute__ defined.

15 months agokrb5/store_stdio.c: workaround for solaris10/hpux/aix fread/fwrite duplication bug
Robert Manner [Tue, 29 Nov 2022 14:21:46 +0000 (15:21 +0100)]
krb5/store_stdio.c: workaround for solaris10/hpux/aix fread/fwrite duplication bug

15 months agoroken/mkdtemp.c: fix incorrect indexing
Robert Manner [Mon, 28 Nov 2022 15:44:16 +0000 (16:44 +0100)]
roken/mkdtemp.c: fix incorrect indexing

Both the len and the index was decremented, which made the exit
condition (template[len - i] == 'X') trigger before it should.
Fixes solaris10 where mkdtemp is not available.

15 months agokrb5: Fix wrong cast in _krb5_store_data_at_offset()
Nicolas Williams [Sat, 7 Jan 2023 17:08:00 +0000 (11:08 -0600)]
krb5: Fix wrong cast in _krb5_store_data_at_offset()

15 months agobase: support for 64-bit atomic increment/decrement
Luke Howard [Fri, 6 Jan 2023 23:53:06 +0000 (10:53 +1100)]
base: support for 64-bit atomic increment/decrement

15 months agobase: wrap __machine_rw_barrier() in function for Solaris
Luke Howard [Sat, 7 Jan 2023 09:39:46 +0000 (20:39 +1100)]
base: wrap __machine_rw_barrier() in function for Solaris

__machine_rw_barrier() assembly expansion cannot be treated as a function call
(as it is later in the heim_base_atomic_store() macro definition)

15 months agoroken: declare rk_freeifaddrs() prototype if using system ifaddrs.h
Luke Howard [Sat, 7 Jan 2023 09:22:04 +0000 (20:22 +1100)]
roken: declare rk_freeifaddrs() prototype if using system ifaddrs.h

15 months agoroken: use correct calling conventions for rk_getifaddrs()
Luke Howard [Sat, 7 Jan 2023 09:21:10 +0000 (20:21 +1100)]
roken: use correct calling conventions for rk_getifaddrs()

15 months agobase: add back libheimbase HEIMDAL_xxx_ATTRIBUTEs
Luke Howard [Sat, 7 Jan 2023 09:11:13 +0000 (20:11 +1100)]
base: add back libheimbase HEIMDAL_xxx_ATTRIBUTEs

Fix regression introduced in 62f83ad0 by adding HEIMDAL_NORETURN_ATTRIBUTE and
HEIMDAL_PRINTF_ATTRIBUTE to function definitions, so they will be included in
heimbase-protos.h.

15 months agoipc: fix Solaris build
Luke Howard [Fri, 6 Jan 2023 23:59:02 +0000 (10:59 +1100)]
ipc: fix Solaris build

Link libheim_ipcc against -lsocket on Solaris

15 months agokrb5: include config.h before string.h
Luke Howard [Fri, 6 Jan 2023 23:58:38 +0000 (10:58 +1100)]
krb5: include config.h before string.h

Solaris requires __EXTENSIONS__ to be defined before including string.h so that
the strnlen() prototype is visible

15 months agoroken: fix Solaris build
Luke Howard [Fri, 6 Jan 2023 23:52:47 +0000 (10:52 +1100)]
roken: fix Solaris build

libroken needs to be linked against libsocket for socket()

15 months agobase: don't duplicate prototypes in heimbase.h
Luke Howard [Sat, 7 Jan 2023 00:06:46 +0000 (11:06 +1100)]
base: don't duplicate prototypes in heimbase.h

15 months agobase: include config.h
Luke Howard [Fri, 6 Jan 2023 23:45:37 +0000 (10:45 +1100)]
base: include config.h

Solaris requires __EXTENSIONS__ to be defined before including string.h so that
the strnlen() prototype is visible

15 months agoroken: fix Solaris build
Luke Howard [Fri, 6 Jan 2023 23:43:32 +0000 (10:43 +1100)]
roken: fix Solaris build

libroken needs to be linked against libnsl for inet_ntoa()

15 months agokrb5: Do not fail to rd_req if no AD-KDC-ISSUED
Nicolas Williams [Thu, 5 Jan 2023 23:57:36 +0000 (17:57 -0600)]
krb5: Do not fail to rd_req if no AD-KDC-ISSUED

We reject tickets that have no AD-KDC-ISSUED(!).

This was reported by Samba.  The workaround they found was to set
check_pac = true in krb5.conf, as that clobbers the ret from
krb5_ticket_get_authorization_data_type() not having found an
AD-KDC-ISSUED element.

This was introduced in 1cede09a0b772e99beac6fcc440a917c9e8b183a.

15 months agosanon: Fix export/import_cred mismatch
Nicolas Williams [Thu, 5 Jan 2023 22:58:57 +0000 (16:58 -0600)]
sanon: Fix export/import_cred mismatch

SANON cred export/import never worked correctly as the export function was
producing the wrong form of token, which was leading gss_import_cred() to
allocate more than 64MB of memory to parse the SANON exported credential.  The
recent change to reduce the default `max_alloc` of krb5_storage exposed this.

15 months agokdc: Explicitly ignore return in audit code
Nicolas Williams [Wed, 4 Jan 2023 22:25:22 +0000 (16:25 -0600)]
kdc: Explicitly ignore return in audit code

15 months agohttpkadmind: If early ENOMEM, close the connection
Nicolas Williams [Wed, 4 Jan 2023 22:24:55 +0000 (16:24 -0600)]
httpkadmind: If early ENOMEM, close the connection

15 months agobx509d: If early ENOMEM, close the connection
Nicolas Williams [Wed, 4 Jan 2023 22:24:32 +0000 (16:24 -0600)]
bx509d: If early ENOMEM, close the connection

15 months agobx509: Fix error path NULL dereference
Nicolas Williams [Wed, 4 Jan 2023 22:23:56 +0000 (16:23 -0600)]
bx509: Fix error path NULL dereference

15 months agogssmask: Fix wrong sizeof() expression
Nicolas Williams [Wed, 4 Jan 2023 22:23:07 +0000 (16:23 -0600)]
gssmask: Fix wrong sizeof() expression

15 months agokadmin: Fix return value non-checking in format_field()
Nicolas Williams [Wed, 4 Jan 2023 22:22:41 +0000 (16:22 -0600)]
kadmin: Fix return value non-checking in format_field()

15 months agokadm5: Fix return value non-checking
Nicolas Williams [Wed, 4 Jan 2023 22:22:12 +0000 (16:22 -0600)]
kadm5: Fix return value non-checking

15 months agonegoex: Fix incorrect ENOMEM check in storage_from_memory()
Nicolas Williams [Wed, 4 Jan 2023 22:21:34 +0000 (16:21 -0600)]
negoex: Fix incorrect ENOMEM check in storage_from_memory()

15 months agogsskrb5: Explicitly ignore return from _gsskrb5_lifetime_left()
Nicolas Williams [Wed, 4 Jan 2023 22:21:11 +0000 (16:21 -0600)]
gsskrb5: Explicitly ignore return from _gsskrb5_lifetime_left()

15 months agogsskrb5: Add missing unlock in _gsskrb5_duplicate_cred() failure case
Nicolas Williams [Wed, 4 Jan 2023 22:20:32 +0000 (16:20 -0600)]
gsskrb5: Add missing unlock in _gsskrb5_duplicate_cred() failure case

15 months agohxtool: Check hx509_request_init() return
Nicolas Williams [Wed, 4 Jan 2023 22:17:57 +0000 (16:17 -0600)]
hxtool: Check hx509_request_init() return

15 months agokrb5: Quiet warning in socket_free()
Nicolas Williams [Wed, 4 Jan 2023 22:17:30 +0000 (16:17 -0600)]
krb5: Quiet warning in socket_free()

15 months agokrb5: Reduce storage max_alloc
Nicolas Williams [Wed, 4 Jan 2023 22:17:09 +0000 (16:17 -0600)]
krb5: Reduce storage max_alloc

15 months agoasn1: Don't check for NULL when it's not (template_members())
Nicolas Williams [Wed, 4 Jan 2023 22:07:13 +0000 (16:07 -0600)]
asn1: Don't check for NULL when it's not (template_members())

15 months agowind: Quiet warnings in idn-lookup utility
Nicolas Williams [Wed, 4 Jan 2023 22:06:06 +0000 (16:06 -0600)]
wind: Quiet warnings in idn-lookup utility

15 months agoipc: Quiet warning about ignoring fcntl() and chmod() return values
Nicolas Williams [Wed, 4 Jan 2023 22:05:38 +0000 (16:05 -0600)]
ipc: Quiet warning about ignoring fcntl() and chmod() return values