Commit Graph

16154 Commits

Author SHA1 Message Date
Viktor Dukhovni
bfc78d11dc Only use KDC offset when we have it 2015-04-14 11:27:24 -05:00
Nicolas Williams
bd71a22e20 Fix trailing whitespace in cache.c 2015-04-14 11:27:23 -05:00
Viktor Dukhovni
d09430d68b Fetch forwardable TGT without GC_CACHED
Just in case it is not the start TGT, in which case it is generally,
but not always, already cached.  Just in case get it again, if lost.
2015-04-14 11:27:23 -05:00
Nicolas Williams
52b046c636 Fix off-by-one in daemon detach 2015-04-14 11:27:23 -05:00
Nicolas Williams
617a82a0a5 Fix ENOENT msg clobbering in fcache.c
By not returning the same error code as we were setting on the context,
the error message was subsequently lost.
2015-04-14 11:27:23 -05:00
Nicolas Williams
a3b5dc2e34 Update _krb5_homedir_access() docs 2015-04-14 11:27:22 -05:00
Nicolas Williams
5f91ef7242 Use krb5_timeofday in krb5_cc_get_lifetime() 2015-04-14 11:27:22 -05:00
Viktor Dukhovni
f973a9f397 Use start_realm in cc lifetime 2015-04-14 11:27:22 -05:00
Viktor Dukhovni
f93947672d Use start_realm cc config in export cred 2015-04-14 11:27:22 -05:00
Nicolas Williams
629eeb811a Add start_realm cc config 2015-04-14 11:27:21 -05:00
Nicolas Williams
f5a86add5c krb5_cc_get_lifetime() misses the TGT 2015-04-13 16:59:21 -05:00
Nicolas Williams
7e51f78178 Simplify __gsskrb5_ccache_lifetime 2015-04-13 16:59:21 -05:00
Nicolas Williams
0306d70a91 Add --debug option to 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
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
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
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
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
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
db72e66eb9 kadm5: Add functions to check for bogus keys
Introduce kadm5_all_keys_are_bogus() and kadm5_some_keys_are_bogus()
which will be used in later changes.

Change-Id: I3a07ffe07bee7d6eb17c3d2eae91c107e0bac255
2015-03-14 16:08:34 -04:00
Viktor Dukhovni
cfdf6d5cbe gsskrb5: Make krb5 mech use referrals
Modify the gss krb5 mech to always use referrals unless the
KRB5_NCRO_NO_REFERRALS flag is set.

Change-Id: I7efd873ac922a43adafa2c492703b576847a885f
2015-03-14 16:08:32 -04:00
Nicolas Williams
8a5d50a328 krb5: do not store TGTs if GC_NO_STORE
krb5_get_credentials_with_flags() and krb5_get_creds() do not store
obtained TGTs if the KRB5_GC_NO_STORE flag is set.

Change-Id: Ie999ec4e985463ff60e9d499c3e870880033dfa7
2015-03-14 16:08:31 -04:00
Nicolas Williams
b84bdf213d krb5: improve comments in get_cred_kdc_capath_worker
Change-Id: I0d47ada32fdc9f7938d69d93022f1daac80d4e88
2015-03-14 16:08:29 -04:00
Nicolas Williams
4f074487b4 krb5: reject referrals in capath code paths
In get_cred_kdc_capath_worker() if the credentials obtained by
get_cred_kdc_address() does not exactly match the requested service
principal discard them and return KRB5KC_ERR_S_PRINCIPAL_UNKNOWN.

Change-Id: Iaeacd07f87374f64e3a7bb860adfeb2dc9550fd1
2015-03-14 16:08:28 -04:00
Jeffrey Altman
e13c0946f6 krb5: refactor get_cred_kdc_capath_worker
This change adds a common out: path for all cleanup.

It also adjusts whitespace for consistency.

Change-Id: Ic90d6568a44aebc0c0adb64fad641e5420ea8e27
2015-03-14 16:08:26 -04:00
Nicolas Williams
c37f1b3e4f krb5: Don't cache/reuse referral TGTs
Prior to this change _krb5_get_cred_kdc_any() would include TGTs obtained
via KDC referrals in the "*ret_tgts" array returned to the caller.  The
caller typically stores these TGTs in the active credential cache.

However, referrals TGTs must not be cached or reused for any request
beyond the one it was issued for.  The referral is for a specific service
principal and the resulting TGT could include service specific AuthData.
The referral might also direct the client along a transitive path that
is specific to this service and not applicable in the general case.

This change removes the *ret_tgts parameter from get_cred_kdc_referral()
so that the obtained TGTs are never returned to its caller.   This also
prevents these TGTs from being used by any subsequent call to
get_cred_kdc_capath().

Change-Id: Iacc76c5b1639af3cf6bf277966cfd1535dd1e84d
2015-03-14 16:08:25 -04:00
Nicolas Williams
95e56fa3ae hdb: fix hdb_unseal_keys_kvno return when no history
Prior to this change hdb_unseal_keys_kvno() could return successfully (0)
if the choice_HDB_extension_data_hist_keys extension was found but the
hist_keys list was empty.  As a side effect callers would believe that the
provide hdb_entry keys were unsealed when they weren't.  This could cause
the KDC or kadmin to report invalid key size errors.

If the extension is present and the history list is empty attempt to
unseal the provided hdb_entry using hdb_unseal_keys_mkey().

Change-Id: I9218b02bccdbcf22133a9464a677374db53ade85
2015-03-14 16:08:22 -04:00
Viktor Dukhovni
fca6363307 Drop delegated creds when target is NULL
In gsskrb5_accept_delegated_token() it is wrong to store the delegated
credentials in the default ccache by default.  When the caller does not
provide a target credential handle, we just do nothing and return success.

Test the return value of gsskrb5_accept_delegated_token() against
GSS_S_COMPLETE, rather than 0.
2015-03-10 03:07:29 +00:00
Viktor Dukhovni
ca052eadd5 Fix gss_inquire_cred_by_mech.
Delegated or other explicit credentials were mishandled, the code only
worked correctly when processing default credentials.  In particular
this caused root's default credential cache to be accessed when accepting
delegated credentials in SSH:

    ssh_gssapi_accept_ctx() ->
        ssh_gssapi_getclient() ->
	    gss_inquire_cred_by_mech()

When /tmp/krb5cc_0 contained expired tickets, cascaded credentials
stopped working for non-root users!
2015-03-10 03:07:29 +00:00