metze/heimdal/wip.git
4 years agogss: add some missing GM_USE_MG_CRED checks
Luke Howard [Sat, 28 Dec 2019 05:35:04 +0000 (16:35 +1100)]
gss: add some missing GM_USE_MG_CRED checks

GM_USE_MG_CRED allows a mechanism glue credential to be used by a mechanism
without additional wrapping. Although no extant mechanisms use this flag, the
flag had sporadic support in the mechanism glue already. In the interest of
consistency, add missing GM_USE_MG_CRED checks. If this functionality is not
desired, then all checks should be removed.

4 years agogss: make krb5 default GSS mech earlier in path
Luke Howard [Thu, 26 Dec 2019 13:15:13 +0000 (00:15 +1100)]
gss: make krb5 default GSS mech earlier in path

Defensively default to GSS_KRB5_MECHANISM on all calls to
gss_init_sec_context() if mech_type is GSS_C_NO_OID (rather than only on the
first call).

4 years agogss: expose gss_destroy_cred()
Luke Howard [Sat, 28 Dec 2019 13:15:49 +0000 (00:15 +1100)]
gss: expose gss_destroy_cred()

Build and export gss_destroy_cred(). This permanently destroys the credential,
rather than releasing a handle to it.

4 years agogss: merge Apple name helper APIs
Luke Howard [Sat, 28 Dec 2019 05:34:35 +0000 (16:34 +1100)]
gss: merge Apple name helper APIs

Add helper APIs to the mechanism glue from the Apple implementation.
gss_mg_export_name() can be used by a mechanism to create an exported name
(this is used by the future SAnon implementation). _gss_mech_import_name()
allows the mechanism to pass in a list of parsing functions for specific name
tiypes. This commit only adds support to the mechanism glue itself.

4 years agogss: merge enhanced Apple mechglue logging
Luke Howard [Sat, 28 Dec 2019 05:45:47 +0000 (16:45 +1100)]
gss: merge enhanced Apple mechglue logging

Add _gss_mg_log() and friends for logging from within the mechanism glue and
SPNEGO. These APIs wrap around the libkrb5 logging APIs.

4 years agogss: use tail queue instead of singly linked list in mechglue
Luke Howard [Sat, 28 Dec 2019 05:30:55 +0000 (16:30 +1100)]
gss: use tail queue instead of singly linked list in mechglue

The GSS mechglue uses singly linked lists for mechanisms and mechanism objects,
to which new entries are inserted at the head. This breaks ordering of
mechanisms specified in OID sets and in /etc/gss/mech, as they will be back to
front. Use a tail queue instead so that new entries are inserted at the end.

4 years agobase: make heimqueue.h a shared header
Luke Howard [Thu, 26 Dec 2019 10:41:29 +0000 (21:41 +1100)]
base: make heimqueue.h a shared header

Share heimqueue.h between base and asn1, to avoid duplication of code.

4 years agogss: mechanism optional interfaces
Luke Howard [Sat, 28 Dec 2019 13:17:26 +0000 (00:17 +1100)]
gss: mechanism optional interfaces

Make mechanism interfaces that are optional in usage, optional in
implementation, i.e. do not require them to be present when dynamically loading
a mechanism. In order to aid minimal mechanism implementation, more of these
should likely be made optional (this will require an additional check in the
mechglue to return GSS_S_UNAVAILABLE if the function pointer is NULL). This is
left as a future exercise.

4 years agogss: use _gss_ntlm_set_keys() in gss_init_sec_context()
Luke Howard [Fri, 27 Dec 2019 12:11:00 +0000 (23:11 +1100)]
gss: use _gss_ntlm_set_keys() in gss_init_sec_context()

DRY: use the _gss_ntlm_set_keys() helper function to initialize the key state
for both initiator and acceptor.

4 years agogss: don't provide domain to nsi_probe() in NTLM
Luke Howard [Fri, 27 Dec 2019 09:47:24 +0000 (20:47 +1100)]
gss: don't provide domain to nsi_probe() in NTLM

_gss_ntlm_accept_sec_context() does not provide the acceptor domain to
nsi_probe(); for consistency, _gss_ntlm_acquire_cred_from() should do that
same. Providing the acceptor domain was breaking tests.

Note that the Heimdal NTLM implementation is old and has few consumers (Apple
and Samba use their own implementations). Arguably we should merge the Apple
implementation or remove it.

4 years agogss: NTLM nsi_probe returns a krb5, not gss error
Luke Howard [Fri, 27 Dec 2019 09:31:45 +0000 (20:31 +1100)]
gss: NTLM nsi_probe returns a krb5, not gss error

The nsi_probe() error code was treated as a GSS error code, rather than a krb5
error. Return a GSS error code, setting the krb5 error in minor_status.

4 years agogss: register GSS_KRB5_S error table
Luke Howard [Sun, 29 Dec 2019 06:44:26 +0000 (17:44 +1100)]
gss: register GSS_KRB5_S error table

The Kerberos GSS mechanism specific error table in gkrb5_err.et was never
registered with libkrb5, so the messages corresponding to those errors would
never be available. Register them with the thread local context used by the
krb5 mechanism.

4 years agoWindows: Fix type cast warning.
Rod Widdowson [Wed, 29 Jan 2020 10:31:15 +0000 (10:31 +0000)]
Windows: Fix type cast warning.

Since at least SDK V6.1 HCRYPTPROV has been specified as ULONG_PTR
this means that comparing or setting one with NULL causes a cast
warning.

Use an explicit cast from zero to that type.

4 years agoUpdate README.md
Jeffrey Altman [Fri, 10 Jan 2020 20:00:16 +0000 (15:00 -0500)]
Update README.md

4 years agobx509: Add /, /health for load balancer checking
Nicolas Williams [Fri, 10 Jan 2020 17:39:56 +0000 (11:39 -0600)]
bx509: Add /, /health for load balancer checking

A HEAD or GET of / or /health will now produce a 200 instead of a 404.

Ideally we should add configuration arguments that would allow /health
to get a token, make a CSR, and test the /bx509 (and/or /bnegotiate)
functionality, that way we'd have a real health check.  For now we defer
that work, as external health monitoring can be done using a simple
script anyways.

4 years agobx509: Do not clobber library error info
Nicolas Williams [Fri, 10 Jan 2020 17:34:33 +0000 (11:34 -0600)]
bx509: Do not clobber library error info

4 years agokdc: add test_token_validator -a option
Nicolas Williams [Fri, 10 Jan 2020 17:32:59 +0000 (11:32 -0600)]
kdc: add test_token_validator -a option

4 years agokdc: implement test_kdc_ca -a option
Nicolas Williams [Fri, 10 Jan 2020 17:30:56 +0000 (11:30 -0600)]
kdc: implement test_kdc_ca -a option

4 years agobx509: Fix CSR authorizer IPC plugin bug
Nicolas Williams [Fri, 10 Jan 2020 17:29:21 +0000 (11:29 -0600)]
bx509: Fix CSR authorizer IPC plugin bug

When marking SANs authorized, mark the SAN, not some EKU, authorized!

4 years agoAdd bx509d.8 man page
Nicolas Williams [Fri, 3 Jan 2020 06:12:43 +0000 (00:12 -0600)]
Add bx509d.8 man page

4 years agoDocument Heimdal's PKIX, kx509, bx509
Nicolas Williams [Wed, 1 Jan 2020 19:43:10 +0000 (13:43 -0600)]
Document Heimdal's PKIX, kx509, bx509

This reverts commit 5c25450e504f525720b5565f5f6c5367bc238f21.

4 years agokdc: link test_token_validator against libgssapi
Luke Howard [Wed, 1 Jan 2020 08:15:59 +0000 (19:15 +1100)]
kdc: link test_token_validator against libgssapi

The Negotiate token validation plugin links against libgssapi, but on macOS the
dynamic linker cannot find it before Heimdal is installed. This causes tests to
fail. Although test_token_validator itself does not require libgsaspi, link
against it so that the test can proceed.

4 years agokrb5: Do not write start_realm ccconfig twice
Nicolas Williams [Tue, 31 Dec 2019 02:45:40 +0000 (20:45 -0600)]
krb5: Do not write start_realm ccconfig twice

4 years agobx509: Make test work with older curl versions
Nicolas Williams [Thu, 26 Dec 2019 22:37:28 +0000 (16:37 -0600)]
bx509: Make test work with older curl versions

The --connect-to option is much nicer and better than --resolve for testing,
but for testing against localhost --resolve is good enough and available in
older versions of curl.

4 years agoiprop: Use test port for testing
Nicolas Williams [Fri, 20 Dec 2019 22:52:00 +0000 (16:52 -0600)]
iprop: Use test port for testing

4 years agohx509: Better handle OpenSSL diffs in test_req
Nicolas Williams [Fri, 20 Dec 2019 22:14:00 +0000 (16:14 -0600)]
hx509: Better handle OpenSSL diffs in test_req

4 years agokdc: Fix build race
Nicolas Williams [Fri, 20 Dec 2019 22:05:03 +0000 (16:05 -0600)]
kdc: Fix build race

4 years agobx509: Tolerate older microhttpd versions
Nicolas Williams [Fri, 20 Dec 2019 21:59:21 +0000 (15:59 -0600)]
bx509: Tolerate older microhttpd versions

4 years agobx509: Fix cjwt_token_validator build
Nicolas Williams [Fri, 20 Dec 2019 21:58:44 +0000 (15:58 -0600)]
bx509: Fix cjwt_token_validator build

4 years agobx509: Work around microhttpd bug
Nicolas Williams [Fri, 20 Dec 2019 21:54:27 +0000 (15:54 -0600)]
bx509: Work around microhttpd bug

4 years agohx509: Avoid double-free on CSR parse error
Nicolas Williams [Fri, 20 Dec 2019 21:50:22 +0000 (15:50 -0600)]
hx509: Avoid double-free on CSR parse error

4 years agoFix Windows build
Nicolas Williams [Thu, 12 Dec 2019 01:41:22 +0000 (19:41 -0600)]
Fix Windows build

4 years agokdc: Modernize kx509 logging too
Nicolas Williams [Wed, 11 Dec 2019 17:44:26 +0000 (11:44 -0600)]
kdc: Modernize kx509 logging too

4 years agokdc: Fix audit_addkv() typos and reason handling
Nicolas Williams [Wed, 11 Dec 2019 03:17:23 +0000 (21:17 -0600)]
kdc: Fix audit_addkv() typos and reason handling

Now we'll put the "reason=..." last in the log lines and we won't escape
spaces -- just newlines and other control characters.  This makes
reading log lines much easier without complicating parsing of log lines
because interior key=value pairs do get whitespace escaped or removed.

4 years agokrb5: Fix fcc_open() leak on double-init, and msg
Nicolas Williams [Wed, 11 Dec 2019 02:55:48 +0000 (20:55 -0600)]
krb5: Fix fcc_open() leak on double-init, and msg

4 years agobx509: Add proper logging
Nicolas Williams [Tue, 10 Dec 2019 23:24:09 +0000 (17:24 -0600)]
bx509: Add proper logging

4 years agokdc: Add missing exports
Nicolas Williams [Tue, 10 Dec 2019 23:23:46 +0000 (17:23 -0600)]
kdc: Add missing exports

4 years agoRevert docs changes for bx509 for now
Nicolas Williams [Tue, 10 Dec 2019 20:10:53 +0000 (14:10 -0600)]
Revert docs changes for bx509 for now

4 years agoCVE-2019-14870: Validate client attributes in protocol-transition
Isaac Boukris [Wed, 6 Nov 2019 23:05:05 +0000 (00:05 +0100)]
CVE-2019-14870: Validate client attributes in protocol-transition

Signed-off-by: Isaac Boukris <iboukris@gmail.com>
4 years agoCVE-2019-14870: Apply forwardable policy in protocol-transition
Isaac Boukris [Tue, 5 Nov 2019 01:37:30 +0000 (02:37 +0100)]
CVE-2019-14870: Apply forwardable policy in protocol-transition

Signed-off-by: Isaac Boukris <iboukris@gmail.com>
4 years agoCVE-2019-14870: Always lookup impersonate client in DB
Isaac Boukris [Tue, 5 Nov 2019 01:35:35 +0000 (02:35 +0100)]
CVE-2019-14870: Always lookup impersonate client in DB

Signed-off-by: Isaac Boukris <iboukris@gmail.com>
4 years agokdc: Fix leaks
Nicolas Williams [Tue, 10 Dec 2019 03:39:30 +0000 (21:39 -0600)]
kdc: Fix leaks

4 years agobx509: CSRF protection for /bnegotiate
Nicolas Williams [Fri, 6 Dec 2019 01:52:47 +0000 (19:52 -0600)]
bx509: CSRF protection for /bnegotiate

4 years agokdc: bx509: Do not vend issuer private keys
Nicolas Williams [Fri, 6 Dec 2019 23:34:04 +0000 (17:34 -0600)]
kdc: bx509: Do not vend issuer private keys

4 years agohx509: private key exclusion options
Nicolas Williams [Fri, 6 Dec 2019 23:11:01 +0000 (17:11 -0600)]
hx509: private key exclusion options

Add two ways to exclude private keys when dealing with an hx509
certificate store.  One as a load option (load no private keys, never
add private keys), one as a store option (store no private keys).

This is useful for CA code so it can have a single store with the
issuer's credentials _and_ the chain for it, and copy those to a store
with the issued certificate and _not_ accidentally include the issuer's
private key.

It would be much safer still to flip the default for this flag, but that
could break out-of-tree libhx509 dependents.

4 years agohx509: Fix unauthorized feature accounting
Nicolas Williams [Tue, 10 Dec 2019 00:09:58 +0000 (18:09 -0600)]
hx509: Fix unauthorized feature accounting

4 years agogss: Fix leak in gss_add_cred_from()
Nicolas Williams [Sat, 7 Dec 2019 04:05:21 +0000 (22:05 -0600)]
gss: Fix leak in gss_add_cred_from()

4 years agokrb5: Fix leak in PKINIT client
Nicolas Williams [Sat, 7 Dec 2019 04:05:02 +0000 (22:05 -0600)]
krb5: Fix leak in PKINIT client

4 years agokrb5: Fix fcc_open() FD leak
Nicolas Williams [Sat, 7 Dec 2019 05:06:57 +0000 (23:06 -0600)]
krb5: Fix fcc_open() FD leak

4 years agogss: fix gss-token accept bug
Nicolas Williams [Fri, 6 Dec 2019 23:09:15 +0000 (17:09 -0600)]
gss: fix gss-token accept bug

4 years agokadmin: Improve ext_keytab usage
Nicolas Williams [Sat, 7 Dec 2019 00:31:45 +0000 (18:31 -0600)]
kadmin: Improve ext_keytab usage

4 years agohcrypto: support BCRYPT_HASH_REUSABLE_FLAG
Luke Howard [Wed, 13 Nov 2019 04:56:55 +0000 (15:56 +1100)]
hcrypto: support BCRYPT_HASH_REUSABLE_FLAG

support BCRYPT_HASH_REUSABLE_FLAG in the WinCNG backend on versions of Windows
that support it, to avoid destroying and recreating a hash object

4 years agoroken: Windows version support helpers
Luke Howard [Wed, 13 Nov 2019 04:56:22 +0000 (15:56 +1100)]
roken: Windows version support helpers

Add helper functions for determining the version of Windows upon which we are
running.

4 years agobx509: do not test bx509d if not built
Nicolas Williams [Thu, 5 Dec 2019 23:37:19 +0000 (17:37 -0600)]
bx509: do not test bx509d if not built

4 years agoFix tests/can and tests/kdc
Nicolas Williams [Thu, 5 Dec 2019 23:22:47 +0000 (17:22 -0600)]
Fix tests/can and tests/kdc

krb5_kdc_process_request() must return 0 when it produces a reply, and only
return non-zero when it could not construct any kind of reply (e.g., ENOMEM, or
-1 if no handler claimed responsibility for the request).

4 years agoFix Travis build moar
Nicolas Williams [Thu, 5 Dec 2019 21:34:09 +0000 (15:34 -0600)]
Fix Travis build moar

4 years agokdc: Fix JWK key rotation danger
Nicolas Williams [Thu, 5 Dec 2019 17:26:36 +0000 (11:26 -0600)]
kdc: Fix JWK key rotation danger

4 years agokdc: Fix warnings: fix _kdc_audit_addkv() usage
Nicolas Williams [Thu, 5 Dec 2019 17:26:11 +0000 (11:26 -0600)]
kdc: Fix warnings: fix _kdc_audit_addkv() usage

4 years agoFix Travis build
Nicolas Williams [Thu, 5 Dec 2019 05:12:04 +0000 (23:12 -0600)]
Fix Travis build

4 years agoMake krb5_cc_close(ctx, NULL) stop SEGV'ing.
Roland C. Dowdeswell [Thu, 21 Nov 2019 22:29:21 +0000 (22:29 +0000)]
Make krb5_cc_close(ctx, NULL) stop SEGV'ing.

4 years agokdc/fast.c: fix leak in unusual error path.
Roland C. Dowdeswell [Thu, 21 Nov 2019 20:16:32 +0000 (20:16 +0000)]
kdc/fast.c: fix leak in unusual error path.

4 years agokdc/process.c: add tracing messages.
Roland C. Dowdeswell [Thu, 21 Nov 2019 15:33:49 +0000 (15:33 +0000)]
kdc/process.c: add tracing messages.

4 years agoDocument that log level 7 is for tracing.
Roland C. Dowdeswell [Thu, 21 Nov 2019 15:27:09 +0000 (15:27 +0000)]
Document that log level 7 is for tracing.

4 years agoReduce older log messages to level 4 and collect some errors.
Roland C. Dowdeswell [Mon, 18 Nov 2019 22:49:22 +0000 (22:49 +0000)]
Reduce older log messages to level 4 and collect some errors.

We take all of the kdc_log() and _kdc_r_log() calls in AS and TGS
and move their log levels down to debugging on the assumption that
our new log line subsumes the "informational" requirements.  We
collect some additional information in the kv-pair "pe-text" which
is like e-text except it is not returned to the client.

4 years agoGenerate a single summary audit line for AS/TGS.
Roland C. Dowdeswell [Mon, 18 Nov 2019 21:34:35 +0000 (21:34 +0000)]
Generate a single summary audit line for AS/TGS.

We refactor the code a bit to extend kdc_request_t which until now
was only used for the AS.  We make the structure extensible and
start using it for the TGS as well.  We leave digest and kx509
alone for the time being.

We also define the concept of kv-pairs in our audit trail which
allows us to define a rigorous but extensible format:

type error from-addr client server key1=val1 key2=val2 ...

4 years agoWe stop strnvisx(3)ing logs to FILE: by default.
Roland C. Dowdeswell [Mon, 18 Nov 2019 21:26:09 +0000 (21:26 +0000)]
We stop strnvisx(3)ing logs to FILE: by default.

Our logging framework used to strnvisx(3) each and every line
iff it is written to a FILE.  This is often unhelpful because
the line usually contains a number of elements that have already
been quoted and it makes the logs much more difficult to read in
this case.  An example if krb5_unparse_name() which will already
quote most characters that one cares about.

We change the behaviour to simply drop unprintable characters
rather than encoding them.  We thus rely on the rest of the
code to properly encode data elements written into the logs.

4 years agoAdd bx509d
Nicolas Williams [Thu, 10 Oct 2019 01:18:01 +0000 (20:18 -0500)]
Add bx509d

4 years agokx509: Add desired_life to Kx509CSRPlus
Nicolas Williams [Sun, 27 Oct 2019 21:22:24 +0000 (16:22 -0500)]
kx509: Add desired_life to Kx509CSRPlus

4 years agohx509: keep track of authorized CSR features
Nicolas Williams [Tue, 19 Nov 2019 05:18:57 +0000 (23:18 -0600)]
hx509: keep track of authorized CSR features

This commit adds a few functions for marking KU, EKUs, and SANs as
authorized, and for getting a count of unsupported certificate
extensions requested, and a count of authorized KU/EKUs/SANs.

The intent is to make it easier to build CSR authorization and CA code
that is robust in the face of future support for certificate extensions
and SAN types not currently supported.  An application could parse a
CSR, iterate all KU/EKUs/SANs, check a subject's authorization to them,
mark them authorized where authorized, then check if there are any
remaining unauthorized extensions or unsupported extensions requested.

Ultimately, if a CSR's KU/EKUs/SANs are all authorized, then they can
all be copied to a TBS, and a certificate can be issued.

4 years agohxtool: fix leak
Nicolas Williams [Wed, 4 Dec 2019 01:36:25 +0000 (19:36 -0600)]
hxtool: fix leak

4 years agohxtool: add cert type: https-negotiate-server
Nicolas Williams [Tue, 3 Dec 2019 06:13:08 +0000 (00:13 -0600)]
hxtool: add cert type: https-negotiate-server

4 years agoroken: add rkbase64 noinst program
Nicolas Williams [Tue, 3 Dec 2019 04:33:25 +0000 (22:33 -0600)]
roken: add rkbase64 noinst program

This will be useful in tests.

4 years agoroken: fix leak in roken_detach_prep()
Nicolas Williams [Wed, 4 Dec 2019 01:07:34 +0000 (19:07 -0600)]
roken: fix leak in roken_detach_prep()

4 years agokuser/kx509.c: Fix add1_2chain.
Roland C. Dowdeswell [Tue, 26 Nov 2019 19:33:41 +0000 (19:33 +0000)]
kuser/kx509.c: Fix add1_2chain.

4 years agolib/krb5/kx509.c: fix memory leak in an error case.
Roland C. Dowdeswell [Tue, 26 Nov 2019 19:28:57 +0000 (19:28 +0000)]
lib/krb5/kx509.c: fix memory leak in an error case.

4 years agoFix windows build
Roland C. Dowdeswell [Thu, 21 Nov 2019 14:25:15 +0000 (14:25 +0000)]
Fix windows build

In 0cc708ba36, we removed the definition of id-ms-client-authentication
without a corresponding removal from lib/asn1/libasn1-exports.def.

Maybe we should generate lib*-exports.def?

4 years agoAdd enforce_ok_as_delegate setting
Roland C. Dowdeswell [Wed, 20 Nov 2019 21:19:57 +0000 (21:19 +0000)]
Add enforce_ok_as_delegate setting

If this flag is set to true, then GSSAPI credential delegation will
be disabled when the "ok-as-delegate" flag is not set in the service
ticket.

4 years agodisable test_cc on Windows
Roland C. Dowdeswell [Tue, 19 Nov 2019 16:27:54 +0000 (16:27 +0000)]
disable test_cc on Windows

4 years agodisable test-detach on Windows
Roland C. Dowdeswell [Tue, 19 Nov 2019 16:16:21 +0000 (16:16 +0000)]
disable test-detach on Windows

4 years agoDon't build the docs on appveyor
Roland C. Dowdeswell [Tue, 19 Nov 2019 15:59:53 +0000 (15:59 +0000)]
Don't build the docs on appveyor

4 years agoStop stuttering in libkrb5-exports.def.in
Roland C. Dowdeswell [Tue, 19 Nov 2019 16:40:54 +0000 (16:40 +0000)]
Stop stuttering in libkrb5-exports.def.in

4 years agoDeclare variables at the beginning of a block.
Roland C. Dowdeswell [Tue, 19 Nov 2019 13:10:52 +0000 (13:10 +0000)]
Declare variables at the beginning of a block.

Looks like this fixes the Appveyor build.

4 years agow32-check-exported-symbols: Eliminate perl warning
Roland C. Dowdeswell [Tue, 19 Nov 2019 16:41:26 +0000 (16:41 +0000)]
w32-check-exported-symbols: Eliminate perl warning

This will become fatal in the next version of Perl, so we need
to eliminate it now.

4 years agoUpdate .gitignore to catch more test remains
Roland C. Dowdeswell [Tue, 19 Nov 2019 16:09:23 +0000 (16:09 +0000)]
Update .gitignore to catch more test remains

4 years agohx509: Show query expression parse errors
Nicolas Williams [Fri, 8 Nov 2019 03:47:54 +0000 (21:47 -0600)]
hx509: Show query expression parse errors

4 years agoasn1: Add der_find_or_parse_heim_oid()
Nicolas Williams [Fri, 8 Nov 2019 00:16:08 +0000 (18:16 -0600)]
asn1: Add der_find_or_parse_heim_oid()

4 years agoasn1: Remove alias of id-kp-clientAuth
Nicolas Williams [Fri, 8 Nov 2019 00:04:41 +0000 (18:04 -0600)]
asn1: Remove alias of id-kp-clientAuth

4 years agogssapi: Import elric1's gss-token
Nicolas Williams [Mon, 18 Nov 2019 21:54:39 +0000 (15:54 -0600)]
gssapi: Import elric1's gss-token

4 years agoroken: Add rkvis program for test scripts
Nicolas Williams [Fri, 8 Nov 2019 05:56:35 +0000 (23:56 -0600)]
roken: Add rkvis program for test scripts

This will help programs that need to URL-escape strings.

Also, this changes `do_hvis()` to not fallback on `do_svis()` for chars in
`extra` -- that `do_hvis()` was doing that seems like an oversight.  Christos
Zoulas, of NetBSD, agrees.  `do_hvis()` still falls back on `do_svis()` for
characters not in the RFC 1808 / 3986 to-be-escaped set *and* characters not in
the `extra` set -- that much seems to have been the intent.

4 years agoroken: base64: set errno on decode errors
Nicolas Williams [Mon, 18 Nov 2019 21:53:45 +0000 (15:53 -0600)]
roken: base64: set errno on decode errors

4 years agoinclude <sys/exec_elf.h> if it's available.
Roland C. Dowdeswell [Mon, 18 Nov 2019 20:04:44 +0000 (20:04 +0000)]
include <sys/exec_elf.h> if it's available.

This fixes the auxval logic on NetBSD.

4 years agokrb5: disable automatic kx509 by default
Nicolas Williams [Wed, 13 Nov 2019 23:42:25 +0000 (17:42 -0600)]
krb5: disable automatic kx509 by default

4 years agoAdd an "EFILE:" target for logging.
Roland C. Dowdeswell [Thu, 7 Nov 2019 23:25:50 +0000 (23:25 +0000)]
Add an "EFILE:" target for logging.

This target will write to a file IFF it exists.

4 years agoMake logging path definitions subject to token expansion.
Roland C. Dowdeswell [Thu, 7 Nov 2019 22:30:05 +0000 (22:30 +0000)]
Make logging path definitions subject to token expansion.

4 years agoDefine a token expansion for %{strftime:<string>}.
Roland C. Dowdeswell [Thu, 7 Nov 2019 22:29:14 +0000 (22:29 +0000)]
Define a token expansion for %{strftime:<string>}.

4 years agoderived keys: ensure that princ is correct
Roland C. Dowdeswell [Tue, 5 Nov 2019 16:00:58 +0000 (16:00 +0000)]
derived keys: ensure that princ is correct

We copy the princ in the hdb_entry so that if it is later used, it
will reflect what we want.

4 years agokx509: Fix uninitalized ret var use
Nicolas Williams [Thu, 7 Nov 2019 01:51:13 +0000 (19:51 -0600)]
kx509: Fix uninitalized ret var use

4 years agohx509: Add hx509_ca_tbs_get_name()
Nicolas Williams [Wed, 6 Nov 2019 17:08:00 +0000 (11:08 -0600)]
hx509: Add hx509_ca_tbs_get_name()

This is so we can check if a TBS gets an empty subject name, then refuse
to issue the certificate if it doesn't also have at least one SAN.

4 years agoHandle partial writes on non-blocking sockets
Viktor Dukhovni [Thu, 7 Nov 2019 01:27:58 +0000 (20:27 -0500)]
Handle partial writes on non-blocking sockets

Now that we're using krb5_net_write() with non-blocking sockets in
ipropd_master, we MUST correctly account for partial writes.

Therefore, roken net_write() called from krb5_net_write() now
returns the number of bytes written when the socket error was
EWOULDBLOCK (or EAGAIN).

Also, fix potential issue on Windows, where errno was used instead
of rk_SOCKET_ERRNO whether or not we used _write() or send().

4 years agohx509: fix hx509_request_get_eku()
Nicolas Williams [Mon, 4 Nov 2019 20:10:30 +0000 (14:10 -0600)]
hx509: fix hx509_request_get_eku()