Commit Graph

28277 Commits

Author SHA1 Message Date
Nicolas Williams
6001e2adbc kgetcred.1 better describe referrals 2015-04-13 16:59:21 -05:00
Nicolas Williams
e695766d65 Add kgetcred --no-store and --cached-only options
These are useful for diagnostics and for exercising more krb5 get
credentials API options.
2015-04-13 16:59:21 -05:00
Nicolas Williams
50615d2a37 Add --hostbased and --canonical kgetcred options 2015-04-13 16:59:20 -05:00
Nicolas Williams
0306d70a91 Add --debug option to kgetcred 2015-04-13 16:59:20 -05:00
Nicolas Williams
c2961ced3c Fix leak in kimpersonate 2015-04-13 16:59:20 -05:00
Nicolas Williams
4ae3e7d40a Fix leak in kgetcred 2015-04-13 16:59:20 -05:00
Nicolas Williams
febe23a399 Improve and export krb5_principal_set_comp_string 2015-04-13 16:59:20 -05:00
Nicolas Williams
c5e91cf462 Add debug messages to krb5_get_creds 2015-04-13 16:59:19 -05:00
Nicolas Williams
d5044abac8 Improve gss_store_cred() for cred sets 2015-04-13 16:59:19 -05:00
Simon Wilkinson
e0dd26d963 roken: rand.c needs to include config.h
If we don't include config.h, we don't get the results of any
autoconf tests.
2015-04-13 08:38:14 +01:00
Jeffrey Altman
4cf66ae8e4 roken: use Win32 rand_s() for rk_random() when available
On Windows if the compiler and C RTL is >= 1400 then the rand_s()
function is available.  rand_s() unlike rand() makes use of the
RtlGenRandom() API to produce a random number between 0 and UINT_MAX.
If rand_s() is not available or fails, fallback to rand().

One of the benefits of rand_s() is that no initialization is required
so it will provide random output even if rk_random_init() is not called.

Change-Id: I2768155de744bd49604fc8237728bb205d637f2a
2015-04-11 01:35:32 -04:00
Bernard
828f4f4fb1 Fix build when OpenSSL has no EGD support 2015-04-10 22:47:03 +02:00
Nicolas Williams
0de18bdb5f Add missing lib/gssapi/test_add_store_cred.c 2015-04-01 20:28:31 -05:00
Nicolas Williams
465483de49 Fix use after free in test_kuserok.c 2015-03-24 11:50:04 -05:00
Nicolas Williams
945fe5fb2f Fix leak in fcc_remove_cred() 2015-03-24 11:50:04 -05:00
Nicolas Williams
333c6fe95d Fix leak in kinit 2015-03-24 11:50:03 -05:00
Nicolas Williams
3d54f93bed Fix leak in kadmin ank 2015-03-24 11:50:03 -05:00
Nicolas Williams
b81f16abf6 Fix memleak in kswitch rare error 2015-03-24 11:50:03 -05:00
Nicolas Williams
86017e8798 Fix leaks in test_kuserok.c 2015-03-24 11:50:03 -05:00
Nicolas Williams
2fbd7331a6 Fix error-case leaks in lib/base/db.c 2015-03-24 11:50:02 -05:00
Nicolas Williams
2bbf56b2e4 Fix error-case memleak in aname2lname 2015-03-24 11:50:02 -05:00
Nicolas Williams
13759fb73f Free kadm5 princ policy 2015-03-24 11:50:02 -05:00
Nicolas Williams
d07d93ce35 Bounds check in aname2lname 2015-03-24 11:50:02 -05:00
Nicolas Williams
89aed008a9 Fix memleak in kswitch 2015-03-24 11:50:01 -05:00
Nicolas Williams
a318ac86f5 Run tests/gss/check-basic 2015-03-24 11:50:01 -05:00
Nicolas Williams
f73c4edf69 Fix gss_store_cred() 2015-03-24 11:50:01 -05:00
Nicolas Williams
df41d53c67 Fix gss_add_cred() (krb5)
gss_add_cred() with GSS_C_NO_CREDENTIAL as the input_cred_handle should
act like gss_acquire_cred() with desired_mechs containing just the
desired_mech.
2015-03-24 11:50:01 -05:00
Nicolas Williams
533578e726 Make gss_store_cred() work 2015-03-24 11:50:00 -05:00
Nicolas Williams
3021258f60 Add tests/bin/intr
This utility, inspired by the old SunOS 4.x intr(8) utility, will be
used to start daemons with --detach and a timeout, like this:

    intr -t 5 kdc --detach || { echo failed to start kdc; exit 1 }

This will allow tests to stop having to sleep poll for "started" output
from the daemons they start, allowing them to run faster and to impose a
reasonable timeout on daemon startup.

The default timeout is 3 seconds.
2015-03-24 11:50:00 -05:00
Nicolas Williams
e75f790fe6 Use getauxval() for issuid() on Linux 2015-03-24 11:50:00 -05:00
Nicolas Williams
b48bed5f42 Daemons detach atomically to avoid having to wait
Tests that start daemons have to "wait" for them to start.

This commit makes Heimdal daemons prep to detach (when requested) by
forking early, then having the child signal readiness to the parent when
the child really is ready.  The parent exits only which the child is
ready.  This means that tests will no longer need to wait for daemons.

However, tests will still need a pidfile or such so they can stop the
daemons.

Note that the --detach options should not be used on OS X from launchd,
only from tests.
2015-03-24 11:49:59 -05:00
Nicolas Williams
0778b19c3f Revive name rule docs 2015-03-24 11:49:59 -05:00
Nicolas Williams
a7587b08e2 Support hostname:port svc princs 2015-03-24 11:49:59 -05:00
Nicolas Williams
5fffc4061f Don't use canon rules in principal name comparison 2015-03-24 11:49:59 -05:00
Nicolas Williams
487b6820f6 Revamp name canonicalization code 2015-03-24 11:49:58 -05:00
Nicolas Williams
a1c87df260 Add guard in krb5_free_creds()
Don't call krb5_free_contents() if the creds pointer is NULL.

MIT krb5 also has this guard.
2015-03-24 11:49:58 -05:00
Jeffrey Altman
902aa4ee02 tests on Windows
Modify the NTMakefile rules for tests so that a failed test does
not prevent subsequent tests from being executed.

Change-Id: I9595ad4a1527feae7c402241bf06ab21a0b76d4a
2015-03-21 15:44:48 -04:00
Jeffrey Altman
2c68305856 hcrypto: Remove w32crypt NTDDI_VERSION checks
The library delay loads bcrypt.dll so that it can run on versions of
Windows older than Vista.  Remove the compile time checks.

Change-Id: I632b248dcca8b6e40e47011fc11d277e911ff209
2015-03-21 15:43:33 -04:00
Nicolas Williams
540c3273c4 kadmin: improve warnings in ext_keytab 2015-03-16 11:36:41 -05:00
Jeffrey Altman
15e69fbb58 kadmin: add ext_keytab --random-key switch
Add a --random-key switch to kadmin's ext_keytab to force the generation
of a new keyset consisting of random keys and a new key version number.
2015-03-16 11:36:41 -05:00
Jeffrey Altman
34bf7ae162 kadmind: don't send bogus keys to ext_keytab et al
The Heimdal kadmind sends bogus keys when the client has 'get'
but not 'get-keys' permission.  For some kadmin commands this is
dangerous.  For example, ext_keytab could happily write bogus
keys to a keytab when real keys are expected, causing eventual
breakage.  Sending bogus keys is important for the kadmin get
command: so it can list the keysets that a principal has.

This patch implements a heuristic detection of kadmin get vs.
ext_keytab, add_enctype, del_enctype, and check commands.  If the
client principal lacks 'get-keys' permission, then the server
will fail requests that appear to be from those kadmin commands,
but will continue to serve bogus keys to kadmin get commands.

Thanks to Nico Williams for the idea behind this implementation.
2015-03-16 11:03:58 -05:00
Jeffrey Altman
6043cc8c88 kadmind: check for KADM5_PRIV_GET when op GET
When performing a permission check for a GET operation the
KADM5_PRIV_GET_KEYS privilege should not be assumed to be a pure
superset of KADM5_PRIV_GET.  If the "get" permission is denied the
user cannot get an entry with or without key data.
2015-03-16 10:47:16 -05:00
Nicolas Williams
9fbbc4cf85 Refactor capath_worker() a bit more 2015-03-16 10:40:10 -05:00
Nicolas Williams
69b0a8f4eb kadm5: kadmin modify must refuse bogus keys
kadmin should not permit a modify that stores invalid keys into the
database.  Accepting bad key data into the database will result in
errors when those keys are eventually used.

This change does not address the general case.  It does address the
specific case of the kadmin client attempting to store the magic
bogus key since that is trivial to check for and can be unintentionally
returned to kadmind by a 1.6rc2 or prior client.  This can happen when
a user has get privilege but lacks the new get-keys privilege.

Change-Id: I44795e6428472b75ab1e4257ce7cb9160f0299f5
2015-03-14 16:08:44 -04:00
Nicolas Williams
dcbe8ae73b kadmin: do_ext_keytab add bogus key warnings
If any of the keys returned by kadmin are the magic bogus key
generate a warning to the user that they are missing the git-keys
privilege.

Change-Id: I235b87eeb2f81e8fd8c8481154d613e92a7e11e2
2015-03-14 16:08:42 -04:00
Jeffrey Altman
1bfb759a64 kadmin: refactor do_ext_keytab for common cleanup
Refactor do_ext_keytab() so that all cleanup is performed by jumping
to the out label on error.

Change-Id: Ic0c0f57e8ebabf30b49519f14743370d1c1672d2
2015-03-14 16:08:41 -04:00
Nicolas Williams
14195658a4 kadmin: del_enctype check for bogus keys
If kadmind returned bogus keys it means that the user lacks the
get-keys permission.   Generate a warning and exit.

Change-Id: Ib76dd86b65bd84a00f3e27c245b9cfc0173fff56
2015-03-14 16:08:39 -04:00
Nicolas Williams
7ab1e01d75 kadmin: add_enctype check for bogus keys
If kadmind returned bogus keys it means that the user lacks the
get-keys permission.   Generate a warning and exit.

Also use calloc() to allocate the new_key_data.

Change-Id: I21b697e2ff5adf753b1cfe698877b3f593bbea9e
2015-03-14 16:08:38 -04:00
Nicolas Williams
edb6c1b075 kadmin: del_enctype whitespace
Fix whitespace and bracing in del_enctype().

No functional change.

Change-Id: I4e70b381aa54a6b0965c88713fbfb4d29bc4495e
2015-03-14 16:08:36 -04:00
Nicolas Williams
6683650337 kadmin: add_enctype fix whitespace
Correct whitespace in add_enctype()

Change-Id: Iebc1df46496b0340c418d7a44a6071b48f44f828
2015-03-14 16:08:35 -04:00