Commit Graph

212 Commits

Author SHA1 Message Date
Luke Howard
7b720cf61c krb5: implement draft-ietf-kitten-aes-cts-hmac-sha2-07 2016-10-08 08:17:11 +02:00
Uri Simchoni
a3bece16c7 lib/krb5: keep a copy of config etypes in the context
When reading configuration file, keep an extra copy of
the encryption types, and use this when resetting the
encryption types to default.

GSSAPI always resets the enctypes to default before obtaining
a TGS, because the enctypes might have previously altered,
so this prevents changing the etypes from the configured ones
to the full set of supported etypes.

Signed-off-by: Uri Simchoni <uri@samba.org>
2016-09-30 08:37:06 -07:00
Jeffrey Altman
b7cf5e7caf lib/krb5: do not fail set_config_files due to parse error
Follow Apple's lead and do not fail krb5_set_config_files() simply
because one of the files in the profile list fails to parse correctly.
Doing so can lead to hard to find failures and could lead to an end
user shooting themselves in the foot and no longer be able to login
to their system to fix it.

Parse as many of the files as we can.  Only fail krb5_set_config_files()
if init_context_from_config_file() fails.

Change-Id: I122664c6d707a5f926643808ba414bf4f681f8b8
2016-06-16 16:38:17 -04:00
Nicolas Williams
2623cee389 Do not search system paths for non-ccapi plugins
On OS X anyways, since Heimdal cannot be built to replace the system
Kerberos implementation in OS X (even though it's based on Heimdal).

Heimdal plugins other than the CCAPI plugins have private ABIs with
strong coupling to the internals of the Heimdal libraries, thus using
system plugins in a non-system Heimdal is likely to end in tears (e.g.,
segfaults).

This means, for example, that OS X's plugins for PAC creation and
verification cannot be used by Heimdal.
2016-06-09 01:13:14 -04:00
Nicolas Williams
c80816f9c3 krb5_context: embed mutex in structure
Instead of allocating a separate mutex object on the heap,
include the HEIMDAL_MUTEX in the krb5_context structure.

Change-Id: If6db484177410487176985e43e3b43e0f2166518
2016-04-10 17:05:07 -05:00
Nicolas Williams
a3b5dc2e34 Update _krb5_homedir_access() docs 2015-04-14 11:27:22 -05:00
Nicolas Williams
487b6820f6 Revamp name canonicalization code 2015-03-24 11:49:58 -05: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
Volker Lendecke
56bcd356d8 heimdal: Fix CID 240779 Allocation size mismatch
(rebased on current Heimdal by abartlet)

The error Coverity complains about is in the malloc. krb5_enctypes is
an enum, so it is usually smaller than the size of a pointer. So we
overallocate, but in the memcpy further down we copy from potentially
invalid memory.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Nov 13 11:05:44 CET 2013 on sn-devel-104
2014-03-24 23:07:51 -05:00
Love Hornquist Astrand
ca24e29ad9 move krb5_generate_random() to krb5_init_context() and document (in doxygen) why its called 2013-10-22 18:19:11 -07:00
Love Hornquist Astrand
516c12c9a9 intruduce krb5_generate_random() that can fail and return an error, check for it at krb5_context creation time 2013-10-21 08:22:02 -07:00
Jeffrey Altman
a472904a64 krb5: windows sysplugin_dirs
Do not look for plugin DLLs in either

  $ORIGIN/../lib/plugin/krb5
  $ORIGIN/../lib

Only look for plugin DLLs in $ORIGIN

Change-Id: I432cd81720b172e7451601b56ea7bba3c03d7d47
2013-09-10 22:31:33 -04:00
Nicolas Williams
3e74e2e3bb Fix some DLL hell: use dladdr() to find plugin dir
Normally one would dlopen() a shared object's basename, not its absolute
path.  However, lib/krb5/plugin.c, in an effort to be zero-conf-ish,
wants to readdir() to find plugins to load, and in the process it ends
up defeating the RTLD's search-the-caller's-rpath.

This commit partially addresses this by allowing the use of $ORIGIN in
plugin_dir values and using them for the default (except on OS X).

This allows multiple Heimdal versions installed on the same host, but
with different plugin ABIs, to co-exist.  A step forward for doing make
check on hosts where Heimdal is installed.

For now we hardcode $ORIGIN/../lib/plugin/krb5 (linux, Solaris, *BSD),
or $ORIGIN (Windows; for assemblies objects need to be in the same
directory) and we eval $ORIGIN by using dladdr() (Linux, Solaris) or
GetModuleHandleEx() (Win32, via a dladdr() wrapper in libroken) to find
the path to libkrb5 whose dirname to use as $ORIGIN.  For Windows,
because we need the plugins to be in the same directory as libkrb5, we
require a prefix on plugin DLLs ("plugin_krb5_") to distinguish them
from other objects.

We should add a special token to mean "look in $ORIGIN, sure, but
dlopen() the plugin basenames only (so the RTLD can search the rpath)".
2013-09-06 16:51:53 -05:00
Love Hornquist Astrand
f396f66523 add [libdefaults]fcache_strict_checking to gate the strict checking, defaults to on 2013-07-11 21:17:49 +02:00
Jeffrey Altman
5f138a16ef libkrb5: Add missing KRB5_LIB_FUNCTION/KRB5_LIB_CALL
KRB5_LIB_FUNCTION and KRB5_LIB_CALL are necessary even on private
functions that are exported.

Change-Id: Iccd0cfe87ff0a9d851e29890e9cb55b3ae517ce1
2013-06-22 21:17:32 -04:00
Love Hornquist Astrand
a3f21747aa move to new plugin system 2013-06-04 00:16:55 -07:00
Love Hornquist Astrand
a7e86affd8 add basic DIR support for file caches 2013-04-29 12:30:21 -07:00
Love Hornquist Astrand
6f03e4ba76 plug memory leaks 2013-04-24 17:55:55 -07:00
Roland C. Dowdeswell
f0f07ff408 Use krb5_enomem() more consistently in lib/krb5. 2013-02-13 16:15:00 +08:00
Love Hornquist Astrand
c1423a8eea redo plugin interface 2013-02-10 22:50:49 -08:00
Love Hornquist Astrand
58ff480763 rewrite send to kdc to be more agressive, try kdcs in paralell and easier to configure behavior 2013-02-10 19:02:52 -08:00
Nicolas Williams
9323ca9341 Fix krb5_kuserok() ~/.k5login check for luser==root 2012-01-18 23:24:22 -06:00
Jeffrey Altman
3854e64a4a include weak etypes in default etype list if allow_weak_crypto
commit 0ed83cebd3 removed the
weak enctypes from the default enctype list.  This is a change
in behavior from 1.5.x which permitted the use of weak enctypes
if "allow_weak_crypto" is set to true.  This patchset creates
two default enctype lists.  One with weak enctypes and the other
without.  The weak version is used if "allow_weak_crypto" is set
to true.

Change-Id: Ide5cce0645836249031350bfaf619d970635e579
2011-09-26 01:44:16 -04:00
Love Hörnquist Åstrand
0ed83cebd3 disable old deprecated enctypes 2011-07-30 12:11:08 -07:00
Love Hörnquist Åstrand
7dccddc6fb count number of enctypes too 2011-06-14 21:44:23 -07:00
Love Hörnquist Åstrand
0f489b7b28 unexport krb5_init_etype, remove duplicate code 2011-06-14 21:08:52 -07:00
Nicolas Williams
2fbad6432b Initial support for default_{as, tgs}_etypes.
Signed-off-by: Love Hörnquist Åstrand <lha@h5l.org>
2011-06-14 20:35:19 -07:00
Nicolas Williams
a7a8a7e95c Initial patch to add as-use-strongest-session-key and same for tgs krb5.conf parameters for the KDC. These control the session key enctype selection algorithm for the AS and TGS respectively: if TRUE then they prefer the strongest enctype supported by the client, the KDC and the target principal, else they prefer the first enctype fromt he client's list that is also supported by the KDC and the target principal.
Signed-off-by: Love Hörnquist Åstrand <lha@h5l.org>
2011-06-14 20:35:19 -07:00
Love Hornquist Astrand
0879b9831a remove trailing whitespace 2011-05-21 11:57:31 -07:00
Asanka C. Herath
880d728e02 Un-const as necessary to silence compiler warnings 2010-11-24 15:33:07 -05:00
Asanka C. Herath
809eccb682 Windows: Add an API for reading a multistring from registry
The _krb5_parse_reg_value_as_string() used to concatenate
multi-strings using a space to be compatible with
krb5_config_get_strings() and friends.  Add a new function that can
read a multi-string with an arbitrary delimiter character
_krb5_parse_reg_value_as_multi_string().
2010-11-24 15:32:56 -05:00
Asanka C. Herath
d3582b56c6 Define and use a path separator string
A colon can't be used to separate paths on Windows since they are used
in drive sepecification.  Define a macro that can be used as a path
separator string.  On Windows, this is defined as ";".  It is a ":"
everywhere else.
2010-11-24 15:32:56 -05:00
Asanka C. Herath
0f853405fe Add missing export and calling convention annotations 2010-11-24 15:32:49 -05:00
Asanka C. Herath
c0b62e3204 Windows: Configuration file locations can be set in the registry 2010-11-24 15:32:42 -05:00
Asanka C. Herath
dd74713e22 Windows: _krb5_load_config_from_registry() is an internal API 2010-11-24 15:32:41 -05:00
Asanka C. Herath
d247242f63 Windows: Registry based configuration
Load configuration data in the registry into a krb5_config_section.
Each registry key corresponds to a krb5_config_section and each
registry value becomes a bound string value.

The set of values contained in the root Heimdal registry key is
treated as if they were defined in the [libdefaults] section.

E.g. the configuration file:

[libdefaults]
foo = bar

[Foo]
x = y
y = {
  baz = quux
}

is equivalent to the registry keys:

[HKEY_CURRENT_USER\Software\Heimdal]
"foo"="bar"

[HKEY_CURRENT_USER\Software\Heimdal\Foo]
"x"="y"

[HKEY_CURRENT_USER\Software\Heimdal\Foo\y]
"baz"="quux"
2010-11-24 15:32:08 -05:00
Love Hornquist Astrand
ba8fe4b799 load plugin once 2010-10-27 20:42:01 -07:00
Buck Huppmann
799956e9b7 Check if we should enable weak crypto before parsing enctypes list
This since the enctypes lists doesn't include weak crypto alg in the
resulting list.

Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2010-10-02 11:28:20 -07:00
Asanka C. Herath
cad554ad3d Generalize MSLSA ccache type to a plug-in based ccache type 2010-09-18 23:50:38 -04:00
Asanka Herath
9db9b146fb Windows: Add support for MSLSA: cache type using a plug-in 2010-09-14 08:04:11 -04:00
Love Hornquist Astrand
ba5c014af0 add krb5_get_permitted_enctypes 2010-09-08 22:04:03 -07:00
Love Hornquist Astrand
d893207413 add check-rd-req-server 2010-09-01 21:56:17 -07:00
Love Hornquist Astrand
f26d6c2398 (krb5_set_default_in_tkt_etypes): filter out unwanted enctypes
Needed for Samba that tries really hard to use DES encryption types.

Reported by Natanael Copa on heimdal-discuss
2010-03-17 09:30:11 -07:00
Love Hornquist Astrand
711ef346a0 move krb5_set_home_dir_access() group krb5 2010-02-10 18:26:46 -08:00
Love Hornquist Astrand
1f4bb75eef Only free hx509ctx if its actually allocated 2010-01-12 17:47:54 -08:00
Love Hornquist Astrand
c24a7d2d80 fix const-ifyier on cc-ops 2010-01-08 13:07:27 +01:00
Asanka Herath
16faee892e Use correct socket glue and try to maintain constness 2009-12-21 18:05:39 -05:00
Asanka Herath
a0ae9f5a0e Merge remote branch 'h-github/master' into win32-port2
* h-github/master: (64 commits)
  refix socket wrappers with rk_
  Patch from Secure Endpoints/Asanka Herath for windows support
  unset KRB5CCNAME
  its really just LIBADD more most of them
  correct quoting
  Use -lpthread for modern freebsd instead
  clean KRB5CCNAME and KRB5_CONFIG, require test to reset them
  more up ${env_setup}
  use PTHREADS_LIBADD for freebsd6 and newer
  add PTHREAD_LIBADD
  add PTHREAD_LIBADD
  add PTHREAD_LIBADD
  switch to PTHREADS_LIBADD
  log what the error string say too
  More debug logging
  sprinkle more 'echo "test failed"'
  sprinkle 'echo "test failed"'
  use calloc(), indent more prettier
  in sh, equal compare is really = for strings, not ==
  Check for duplicates, already loaded mechs
  ...

Conflicts (resolved):
	lib/krb5/auth_context.c
	lib/krb5/changepw.c
	lib/krb5/context.c
	lib/krb5/error_string.c
	lib/krb5/kuserok.c
	lib/krb5/libkrb5-exports.def.in
	lib/krb5/net_write.c
	lib/krb5/store_fd.c
	lib/krb5/test_cc.c
	lib/roken/strerror_r.c
2009-12-21 13:44:00 -05:00
Love Hornquist Astrand
687db64c56 Patch from Secure Endpoints/Asanka Herath for windows support 2009-12-21 08:45:28 +01:00
Kamen Mazdrashki
778df10ddc krb5: Fix leaked hx509_context pointer
Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2009-12-07 09:07:07 -08:00