Commit Graph

5204 Commits

Author SHA1 Message Date
Viktor Dukhovni
93af13ca12 Undo ntohs htons nesting to avoid variable shadowing 2015-04-14 23:02:58 +00:00
Nicolas Williams
f2549127e8 Add missing #include in aname_to_localname.c 2015-04-14 17:10:26 -05:00
Nicolas Williams
7b1ad2f1a3 Fix typo in Add start_realm cc config (629eeb8)
Maybe 'initialized' was not a good field name for this purpose.
2015-04-14 17:06:55 -05:00
Nicolas Williams
7da08a658b Try capaths first, then referrals
When looking for a ticket, use the capath codepath first when we know
the service's realm: because we might have local policy as to how to get
there.

Then, if that doesn't work, try referrals.  (For now unconditionally.)
2015-04-14 11:27:24 -05:00
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
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
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
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
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
2bbf56b2e4 Fix error-case memleak in aname2lname 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
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
Nicolas Williams
9fbbc4cf85 Refactor capath_worker() a bit more 2015-03-16 10:40:10 -05: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
Viktor Dukhovni
d4fda7e4f0 LLVM unused variable warning 2015-03-04 19:52:58 -05:00
Viktor Dukhovni
e4a8571434 Fix DB: prefix check 2015-03-04 16:58:36 -05:00
Luke Howard
5023f55208 Add Windows CNG (BCrypt) support to HCrypto EVP API 2015-02-11 16:00:32 +11:00
Viktor Dukhovni
49861eb2c5 Delay KRB5_KTNAME lookup until keytab resolution.
Previously getenv("KRB5_KTNAME") happened in

    init_context_from_config_file()

which would capture the environment value as an override without
using strdup() to get a private copy, so it would get trashed in
applications that dynamically update the environment (e.g. Perl
code that has a tied %ENV).

The patch delays getenv("KRB5_KTNAME") until the context's value
of default_keytab is actually needed, and the environment can preempt
the context's default at that time.

[ Do we need to worry about issuid() being true initially when the
  context is created, but not later, because the application changes
  both the real and effective uid?  If so the issuid() state should
  be saved when the context is created and the saved value queried. ]
2015-02-06 23:17:50 -05:00
Rok Papež, ARNES
59b8f4ff84 ipv6 loopbacks fix for GNU libc getaddrinfo()
On any OS with a properly implemented getaddrinfo() this change is a
no-op. Passing NULL for the hint is supposed to be the same as an
addrinfo structure with all fields set to 0. There is no need to set
ai_family to AF_UNSPEC because that value is already 0.

GNU libc doesn't follow standard behaviour. Quoting from
http://man7.org/linux/man-pages/man3/getaddrinfo.3.html :

  "Specifying hints as NULL is equivalent to setting ai_socktype and
  ai_protocol to 0; ai_family to AF_UNSPEC; and ai_flags to
  (AI_V4MAPPED | AI_ADDRCONFIG). (POSIX specifies different defaults for
  ai_flags; see NOTES.)"

The NOTES section says:

  "According to POSIX.1-2001, specifying hints as NULL should cause
  ai_flags to be assumed as 0. The GNU C library instead assumes a value
  of (AI_V4MAPPED | AI_ADDRCONFIG) for this case, since this value is
  considered an improvement on the specification."

The patch makes sure that krb5_parse_address works consistently on both
GNU libc and systems that follow POSIX.1-2001 to the letter. Some
incorrect Fedora 17 patches managed to break IPv6 connectivity and were
later backed out (see discussion at https://bugzilla.redhat.com/808147).
This patch resolves the incompatibility.

Signed-off-by: Ken Dreyer <ktdreyer@ktdreyer.com>
2015-01-25 13:51:41 -07:00
Jeffrey Altman
ef8e4da010 only perform dir separator normalization for file paths
Commit ad7e54d698 introduced the use
of _krb5_expand_path_tokens() to expand tokens (and on Windows convert
path delimiters) within credential cache names.  This is safe to do
for the path based credential cache types FILE, DIR and SCC but on
Windows is unsafe for the non-path types.

For example on Windows, the API credential cache names are often based
on the principal name and the principal name is parsed from the ccname.
This practice was introduced with the version v2 ccapi when there was
no method of enumerating the caches from the krb5 library.

This change adds a "filepath" boolean parameter to _krb5_expand_path_tokens()
which is set to TRUE (non-zero) when the input is a file path and FALSE
(zero) when the input is not a file path.  _krb5_expand_path_tokens() will
only perform directory separator normalization on Windows when the
"filepath" parameter is TRUE.

This change is not the preferred solution because it requires that the
library be aware of all credential cache types that use path based
residuals.  The preferred solution would require that the credential cache
implementation indicate whether or not it uses a path based residual.

This change has been implemented using a prefix test and not a change to
struct krb5_cc_ops because existing ccache plugins will not know how to
advertise their use of path based residuals and that path expansion is
safe.

Change-Id: I8135991e8ce69fc5273d381ea9c2078bc2bcd19a
2015-01-07 14:43:19 -05:00
Love Hörnquist Åstrand
0e93a04c01 arcfour-hmac-md5 is weak 2014-12-01 15:41:12 -08:00
Love Hörnquist Åstrand
d1cee9a14b now that use used up more then 16 flags and we have been using the right bit order for many years, lets stop dealing with broken bit fields from ticket flags 2014-08-23 18:48:34 -07:00
Love Hörnquist Åstrand
37afa01be3 rename roken base64, fixes #107 2014-08-22 20:57:24 -07:00
Love Hörnquist Åstrand
a84b572747 resurrect password change support again 2014-08-22 20:19:36 -07:00
Jelmer Vernooij
63e2f30fd5 Move kadmin and ktutil to /usr/bin. 2014-06-09 23:36:23 +02:00
Ken Dreyer
142a3cee1e test_fx: enable weak crypto
Now that test_fx checks 1DES keys, we need to call allow_weak_crypto on
the test's context.

Without this fix, "make check" was failing with the following error:

  lt-test_fx: krb5_crypto_init: Encryption type des-cbc-crc not
  supported
2014-04-29 11:04:21 -06:00
Jelmer Vernooij
4199081e94 Various manpages: Remove references to Kerberos 4. 2014-04-28 01:03:10 +02:00
Jelmer Vernooij
70e43e9808 Fix some typos. 2014-04-25 02:42:17 +02:00
Andrew Bartlett
9f392c134f heimdal: rename send and recv pointers to avoid conflict with socket wrapper 2014-03-24 23:07:52 -05:00