Commit Graph

29933 Commits

Author SHA1 Message Date
Jeffrey Altman
42ad8b4c55 lib/asn1: build static runtime version of libasn1 on Windows
This commit builds a static runtime version of the asn1 library
which is required for some thirdparty applications.

  LIBASN1_S   =$(LIBDIR)\libasn1_s.lib

This differs from libasn1.lib which is compiled to use the
dynamic runtime.

Change-Id: Ib04f5b53a7f16d7bbe9d2debb75e944322a6792a
2022-01-05 12:58:48 -06:00
Jeffrey Altman
6694f98791 lib/asn1: gen require ASN1_LIB be defined on Windows when compiling
Instead of defining ASN1_LIB in each of the generated ASN1 source
files require that the generated source file be compiled with the
ASN1_LIB symbol defined (on Windows).  All of the compiled objects
linked into the same library which might be accessing an ASN1 exported
symbol must have ASN1_LIB defined to ensure that the use of the
exported symbols will not be via an import.

Change-Id: Ie38c105d1d376419717fce0830dc28f5b82547d4
2022-01-05 12:58:48 -06:00
Jeffrey Altman
4f4d1a0288 lib/hdb: define LIB_ASN1 on Windows if ASN1 generated objects
The LIB_ASN1 definition instructs the library objects to access
exported ASN1 generated DATA symbols as internal symbols.

Change-Id: I58b055808893c6f3af48fc2dd997e0dedea2ffcb
2022-01-05 12:58:48 -06:00
Jeffrey Altman
3efca1e98a lib/gssapi: define LIB_ASN1 on Windows if ASN1 generated objects
The LIB_ASN1 definition instructs the library objects to access
exported ASN1 generated DATA symbols as internal symbols.

Change-Id: Ia8c674c879c9bc46ca9dc7f249114f22b1d0dfd5
2022-01-05 12:58:48 -06:00
Jeffrey Altman
0a7d227788 lib/asn1: define LIB_ASN1 when building Windows ASN1 libraries
The LIB_ASN1 definition instructs the library objects to access
exported DATA symbols as internal symbols.

Change-Id: Ifbc80a4e3c357cb323f7763c116101ae495b11df
2022-01-05 12:58:48 -06:00
Jeffrey Altman
a4ba38ff7e asn1: NTMakefile include oid_resolution.obj in LIBASN1_OBJS
oid_resolution.obj does not depend upon $(LIBASN1_OBJ) object
files.  It depends upon the generated .x files produced by
asn1_compile.exe when building $(gen_files_xxx).   Create a
new list of those dependencies explicitly for oid_resolution.obj.

Change-Id: I09a4dc9efb7a84e68da939b6a3ec5f55354c02ee
2022-01-05 12:58:48 -06:00
Luke Howard
ec866e635e Windows 10 SDK build fixes
Build without Win32.mak, and using Universal C Runtime (UCRT)

windows: Check for APPVER, not VCVER for UCRT

When deciding whether UCRT is used (and thus no CRT merge modules), check for
Windows 10 rather than the version of Visual Studio, as we may be building with
an older SDK.
2022-01-05 12:58:48 -06:00
Luke Howard
7cc4b7a9e6 kdc: KDC plugin API contract notes
Add some notes about the KDC plugin API contract, and require plugins to
explicitly indicate which version of the API they support (remove the macro
alias for the current version).
2022-01-05 13:08:11 +11:00
Luke Howard
78ad37ee47 kdc: use r->canon_client_princ field in AS
r->canon_client_princ is always an alias to r->client->entry.principal in the
AS, but use it for consistency with the TGS. (In the TGS, it may also come from
te PAC.)
2022-01-05 13:01:06 +11:00
Luke Howard
0287558838 kdc: move Services for User implementation out of krb5tgs.c
Move the Services for User (SFU/S4U) implementation -- protocol transition and
constrained delegation -- into its own compilation unit, with an interface that
only takes an astgs_request_t, so it can be easily factored out into a plugin
module in the future.

This refactoring is also careful to update all client names in the request
structure after the SFU/S4U validation has successfully completed.
2022-01-05 13:01:06 +11:00
Luke Howard
06f8985c55 hdb: consolidate preauth audit event types
Instead of having distinct preauth success/failure events for different
mechanisms, have a single event; the mechanism can be disambiguated by querying
the HDB_REQUEST_KV_PA_NAME key.

Note: there is still an explicit event for long-term key-based success/failure
in order to help the backend implement lockout.

Audit failure (HDB_AUTH_EVENT_PREAUTH_FAILED) in the main preauth loop, rather
than in each mechanism. Success is still audited in the mechanism to allow
client pre-authentication success to be noted even if something subsequent
(e.g. encoding a reply, memory allocation) fails. The generic catch-all for
success remains.
2022-01-05 09:42:03 +11:00
Luke Howard
68c4fd6572 kdc: audit preauth event only at end of PA loop
Don't audit preauth event if the preauth mech returns
KRB5_KDC_ERR_MORE_PREAUTH_DATA_REQUIRED; only set the event on (final) failure
or success.
2022-01-05 09:37:55 +11:00
Luke Howard
d90718c9b6 base: set HEIM_JSON_F_NO_DATA_DICT in heim_audit_setkv_object()
Fixes pretty-printing data print to work with heim_audit_setkv_object() as well
as heim_audit_addkv_object().
2022-01-04 06:30:32 +00:00
Luke Howard
503cb27740 base: add heim_data_t support to heim_audit_trail()
Allow heim_audit_trail() to log heim_data_t types.
2022-01-04 17:17:56 +11:00
Luke Howard
2574648308 base: pretty-print heim_data_t when debug logging 2022-01-04 17:10:33 +11:00
Jeffrey Altman
bda5919f6b Windows: MSVC does not support 'restrict' keyword
Use of the C99 'restrict' keyword was introduced by
be708ca3cf
("gsskrb5: Add simple name attributes support")

Change-Id: I8272f595af53741ee7c59750bb2d388faeb01f8f
2022-01-03 22:46:08 -05:00
Luke Howard
466658e929 Revert "Windows 10 SDK build fixes"
This reverts commit ceef0a0089.
2022-01-04 14:44:13 +11:00
Luke Howard
6d505df510 gss: link test_names.exe against Heimdal DLL 2022-01-04 14:35:28 +11:00
Nicolas Williams
b102c3c27f krb5: Fix canon name w/ attrs issue 2022-01-03 20:39:12 -06:00
Nicolas Williams
9e683f3d9a asn1: Fix template decoration copy moar 2022-01-03 20:39:12 -06:00
Luke Howard
bb699fb819 kdc: audit requestor SID in altsecid GSS PA plugin 2022-01-04 02:30:42 +00:00
Luke Howard
efdd0bda24 base: export heim_audit_addkv_{number,object} 2022-01-04 02:22:23 +00:00
Luke Howard
d0c861a2d3 kdc: fix build regression in fixing Windows build
Fix regression introduced in 7bb00a40; need to pass -E KDC_LIB to make-proto.pl
in Makefile.am, as well as NTMakefile.
2022-01-04 13:14:06 +11:00
Luke Howard
daf1eacfdb base: cast int64_t to long long
In heim_audit_{add,set}kv_number, cast int64_t to long long/use %lld format
string, to avoid compiler warnings.
2022-01-04 13:12:41 +11:00
Luke Howard
7bb00a40ea kdc: fix Windows build 2022-01-04 13:08:35 +11:00
Luke Howard
a1fd5c176d kdc: fix misplaced semi-colons in ASTGS_REQUEST
ASTGS_REQUEST_DESC_COMMON_ELEMENTS should not terminate in a semi-colon;
the consuming structure should include it. This is consistent with
HEIM_SVC_REQUEST_DESC_COMMON_ELEMENTS. This fixes the build on Windows.
2022-01-04 13:07:18 +11:00
Luke Howard
4803969580 gssapi: add name_attrs.c to Windows build 2022-01-04 13:06:48 +11:00
Luke Howard
e0ea123e1c asn1: export CompositePrincipal on Windows
Export CompositePrincipal functions on Windows, because libasn1
functions are explictiyl exported (unlike with libtool).
2022-01-04 13:06:02 +11:00
Luke Howard
d77e9988ec kdc: add _kdc_audit_addkv_{number,object}
Wrappers for new auditing functions in libheimbase.
2022-01-04 12:37:39 +11:00
Luke Howard
3b7a17e8b1 base: heim_audit_{add,set}kv_number should take int64_t
heim_number_t holds int64_t, not intptr_t; adjust heim_audit_{add,set}kv_number
accordingly. The libkdc wrapper functions were previously updated.
2022-01-04 12:35:57 +11:00
Luke Howard
81708f9f39 base: add heim_audit_addkv_{number,object} 2022-01-04 12:35:55 +11:00
Luke Howard
ce58eb9081 kdc: annotate libkdc Windows function annotations
Annotate libkdc APIs with KDC_LIB_{CALL,FUNCTION} to ensure correct calling
convention and optimized DLL importing on Windows.

Ensure Windows and libtool export tables are consistent.
2022-01-04 12:27:43 +11:00
Luke Howard
b0f0ed74e8 kdc: use attribute dictionary in altsec authorizer plugin 2022-01-04 12:27:43 +11:00
Luke Howard
a8ff420b16 kdc: add attribute dictionary to kdc_request_t
Add a heim_dict_t to the KDC request structure for use by pre-authentication
mechanisms and plugins.
2022-01-04 12:27:43 +11:00
Luke Howard
b27026996a base: s/addkv_{bool,number,object}/setkv
Now heim_audit_addkv() correctly supports multiple values, the other functions
that (by design) replace existing values with a single value should use the
heim_audit_setkv prefix.

A subsequent commit could add variants that support multiple values for
non-string types.
2022-01-04 09:07:10 +11:00
Luke Howard
c8656863ba base: factor out addkv() array promotion logic 2022-01-04 09:07:10 +11:00
Luke Howard
ceef0a0089 Windows 10 SDK build fixes
Build without Win32.mak, and using Universal C Runtime (UCRT)

windows: Check for APPVER, not VCVER for UCRT

When deciding whether UCRT is used (and thus no CRT merge modules), check for
Windows 10 rather than the version of Visual Studio, as we may be building with
an older SDK.
2022-01-03 09:25:18 -05:00
Jeffrey Altman
95021a3284 roken: ndbm_wrap support for db6
use the db6/db.h header if present on the system.
2022-01-03 18:09:08 +11:00
Jeffrey Altman
7cae05061a cf: check libdb-6 for db_create
787d9ceec9 ("check for db6/db.h")
added a check for the db6 header defining HAVE_DB6_DB_H but failed
to add a check for existence of db_create() in the libdb-6 library.
2022-01-03 18:09:08 +11:00
Jeffrey Altman
0fbd163640 cf: db.m4 remove db_create check in non-existent libdb5
The correct library name is libdb-5.
2022-01-03 18:09:08 +11:00
Luke Howard
77f33c1fde base: preserve multiple values in heim_audit_vaddkv()
Previously, if heim_audit_vaddkv() was called multiple times, values would be
concatenated; since changing the request kv type to a dictionary, only the most
recently set value was preserved.

Fix this by promoting multi-valued values to an array of values, which is
visualized in the same manner as it was prior to b1dcc1a4.
2022-01-03 16:35:36 +11:00
Luke Howard
2a2a83b712 base: fix string description of array-object type 2022-01-03 16:24:11 +11:00
Luke Howard
44a8cf1747 base: avoid unnecessary allocation of "reason" key
"reason" key is unused, don't allocate it
2022-01-03 16:19:49 +11:00
Luke Howard
097a3de44e kdc: don't cast away const in krb5plugin_kdc_ftable 2022-01-03 16:17:01 +11:00
Luke Howard
fcff5933ad kdc: rename windc to kdc plugin
Rename the "windc" plugin API to the more general "kdc" plugin API, for two
reasons: the Heimdal KDC uses the Windows PAC even when not emulating a domain
controller, and the plugin API has accreted methods that are not specific to
emulating a domain controller (such as referral_policy and finalize_reply).
2022-01-03 16:17:01 +11:00
Luke Howard
a4c6b81ce9 kdc: add audit plugin API to windc API
Allow the windc plugin to also implement an audit callback. As part of this
change, both the HDB and windc audit function signatures are changed to return
void.
2022-01-03 16:17:01 +11:00
Luke Howard
98070b5eaa Revert "heimdal: handle referrals for 3 part DRSUAPI SPNs"
Active Directory/Samba-specific referral policy should be implemented by a
windc plugin, not in the main KDC code. It looks like it probably isn't
necessary at all if Samba wishes to bypass Heimdal's referral handling.

This reverts commit 6f0cafa6cf.
2022-01-03 16:17:01 +11:00
Luke Howard
3fa47f5a1a kdc: add referral_policy callback to windc plugin
Add a referral policy hook to the TGS as a more elegant way of resolving
referral detection for Samba). The hook can either rewrite the server_princ in
the request, or it can return an error to disable built-in referral processing.
2022-01-03 16:17:01 +11:00
Luke Howard
5cce73a6ef gss: expose canonical name from PAC if present
Expose canonical name via the canonical-name naming attribute.
2022-01-03 15:59:16 +11:00
Luke Howard
2a826d769f gss: expose PAC info buffers under urn:mspac:
Expose PAC info buffers using naming attributes prefixed with urn:mspac:,
aligned with MIT.
2022-01-03 15:59:16 +11:00