Commit Graph

5369 Commits

Author SHA1 Message Date
Jeffrey Altman
9f2a06a80e Windows: Construct paths for LoadLibrary with backslashes
Mixing forward and backslashes is confusing.  Use the expected
backslashes.

Change-Id: Ia775c73eca430138f677decc1975aad0a401fc53
2013-09-13 22:19:00 -04:00
Nicolas Williams
72f29bd807 Fix typo in lib/krb5/pcache.c 2013-09-12 13:32:22 -05:00
Nicolas Williams
ff0bdc9bc8 Test improved fcc_remove_cred() 2013-09-12 12:14:40 -05:00
Nicolas Williams
be816fadd4 Minor refactoring in fcache of common open flags 2013-09-12 12:14:40 -05:00
Nicolas Williams
8feed14fd0 Only gate the st_uid fcache checks 2013-09-12 12:14:40 -05:00
Nicolas Williams
a9bd3c6e50 Fix racy file ccache corruption in cred_delete()
We *really* need a ccache instance ID tag.  In fact, we should probably
never krb5_cc_initialize() a ccache that doesn't have such a tag.  But
for now cred_delete() is now safe enough.
2013-09-12 12:14:39 -05:00
Nicolas Williams
e3eb1305f5 Make Refuses to open symlinks msg less spurious
If we're racing enough we could complain about symlinks where there were
none.  This was very surprising.  Make it surprise less.

We should really #ifndef O_NOFOLLOW that code chunk too, for the obvious
reason that we don't need to worry about symlinks if we have and use
O_NOFOLLOW.

Also, since all uses of fcc_open() use O_NOFOLLOW we should move that
into fcc_open().  Ditto O_BINARY and O_CLOEXEC.
2013-09-12 12:14:39 -05:00
Nicolas Williams
0866ee2615 Make fcc_remove_cred() better
Don't use a memory ccache go between, just copy all but the matching
credential(s).
2013-09-12 12:14:39 -05:00
Nicolas Williams
0f1ae2d101 Use KRB5_TC_MATCH_TIMES when looking for creds 2013-09-12 12:14:39 -05:00
Jeffrey Altman
6ae305e7a4 Fix send_to_kdc for Windows sockets
Patchset 58ff480763 calls write() and read()
on rk_socket_t objects which on Windows are SOCKETs not C RTL file
descriptors.  This patchset uses krb5_net_write() and krb5_net_read()
in place of the direct write() and read() operations.

Change-Id: I3f7d4756357d432e4e62910f9a36824eb188b6e4
2013-09-12 12:36:39 -04:00
Jeffrey Altman
649a1f8ff3 krb5_sendto_context potentially uninitialized ret
Change-Id: Ia1f54f90900f78f25bb6e0573f707b4d2a7f6055
2013-09-11 01:42:16 -04:00
Jeffrey Altman
0db822a2f1 test_rfc3961.exe link to comerr.lib
Change-Id: I05941496af744a54380c04f0ecd0a9d608387980
2013-09-11 01:42:09 -04:00
Jeffrey Altman
ce3d2be1c7 _krb5_load_plugins: Windows naming rules
Windows plugins must be loaded from the same directory as the
heimdal.dll in order to ensure that "DLL Hell" is not revisited.
Since plugins cannot be grouped in a directory by "module" name
the plugins must have a name of the form:

  plugin_<module>_<name>.dll

Construct the "plugin_<module>_" prefix string dynamically and
test for both the prefix and the ".dll" extension when building
the list of plugins to load.

Change-Id: I0ff7bf7287f8fb38061c226f0844d7d0f1fb59ec
2013-09-10 22:31:43 -04:00
Jeffrey Altman
5a8da41b38 krb5 plugin fix typo in comment
Change-Id: Ic73d44fa14f38f078dbc97a0aa94d2b0ba1f5028
2013-09-10 22:31:42 -04:00
Jeffrey Altman
cd5cca0cac pcache: rename and fix callback()
rename callback() to cc_plugin_register_to_context() and document
its purpose.

The parameter that is the cc_ops structure is 'plugctx' not 'plug'.
This is critical because 'plug' is the common_plugin_model structure
and casting the wrong object leads to random behavior including
crashes.

The test to exit without action was reversed.

With these changes ccache plugins can be registered on each
krb5_init_context() operation.

Change-Id: I295ea91759f69b36ac13b1bfff87306d40df4a26
2013-09-10 22:31:41 -04:00
Jeffrey Altman
b845424a86 krb5: sync export lists
Sync the Windows and UNIX export lists for lib/krb5

Change-Id: I992921058c463335d0a3037ec035afd7f9d511b0
2013-09-10 22:31:39 -04:00
Jeffrey Altman
31a00d6647 ISPATHSEP and ISTILDE macros; Windows portability
Windows treats '\\' and '/' equivalently but we cannot control
the form that will be used by end users.  Introduce ISPATHSEP()
macro which tests only for '/' on UNIX and both on Windows.
Introduce ISTILDE() macro to test for '~'.   When testing for
'/' with strchr() or strrchr() add conditional checks for '\\' on
Windows.

Change-Id: Ia85e698fc88f15a6a71db649db5417f02ef7e5fe
2013-09-10 22:31:38 -04:00
Jeffrey Altman
235119c23f fcc_open: disable checks on Windows
st_dev and st_ino are not set in a consistent fashion by stat()
and fstat() so disable the symlink test.

disable the open group/other readable test because st_mode
cannot be used to perform such a test on Windows.

Change-Id: I1b68c672f882018def7e6d40d4bc7f7add58df36
2013-09-10 22:31:35 -04: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
Jeffrey Altman
64e8cc04c7 krb5 tests on windows
Execute tests that were built on Windows but previously skipped.

Remove the duplicate build rules for test-rfc3961.exe.

Change-Id: Icc84c07a33afbdc6ffa509222a3c81de35168eaf
2013-09-10 22:31:32 -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
Nicolas Williams
13814606f4 Fix keytab file and lock leak when trying all keys 2013-07-31 18:17:17 -05:00
Nicolas Williams
f4f89ac8e0 Fix bug with use strongest session key feature 2013-07-27 03:21:12 -05:00
Love Hornquist Astrand
afa9db62ba match code, pointed out by Sergio Gelato <Sergio.Gelato@astro.su.se> 2013-07-26 10:35:49 +02:00
Love Hornquist Astrand
1a8038d8a6 don't free armor_ccache, since krb5_cc are not yet ref counted 2013-07-19 14:56:01 +02:00
Love Hornquist Astrand
39abb10aa9 move where we reset etypelist 2013-07-18 16:36:08 +02:00
Love Hornquist Astrand
f8fb62ff1b remember to free auth_data 2013-07-18 14:58:54 +02:00
Nico Williams
ea1e3776fb heim_ipc is not available on Win32 yet 2013-07-16 21:06:34 -05:00
Love Hornquist Astrand
f49339f31b make fast work with mit kerberos 2013-07-16 15:31:30 +02:00
Love Hornquist Astrand
ad74581850 add KRB5_PADATA_FX_FAST_ARMOR to the fast armor data 2013-07-16 15:17:25 +02:00
Love Hornquist Astrand
5be2888433 add auth_data bits 2013-07-16 15:14:57 +02:00
Love Hornquist Astrand
b4d1168557 add auth_data 2013-07-16 15:13:31 +02:00
Love Hornquist Astrand
28611511ec adopt _krb5_get_ad 2013-07-16 15:10:24 +02:00
Love Hornquist Astrand
4d799bdd26 support derive key and prf for des3 2013-07-16 15:00:19 +02:00
Love Hornquist Astrand
d41f005cc1 add _krb5_get_ad 2013-07-16 14:57:03 +02:00
Jeffrey Altman
72e6a0f383 fcache: correct build errors on Windows
Windows does not have getuid().

Change-Id: Ib92785716b056a69e42c32ec122d8a5f6f12ffbe

Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2013-07-16 12:44:36 +02:00
Love Hornquist Astrand
884b007938 Check owner too 2013-07-12 17:20:41 +02: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
Love Hornquist Astrand
2a565482f4 More strict fcache rules
- use O_NOFOLLOW
- be more strict not to follow symlinks
- require cache files to be owned by the user
- have sane permissions (not group/other readable)
2013-07-11 19:29:04 +02:00
Love Hornquist Astrand
44ddd05ec1 honor env when not issuid 2013-07-10 22:02:43 +02:00
Love Hornquist Astrand
403f599dbd better error reporting 2013-07-10 21:50:23 +02:00
Ben Kaduk
5dfaa0d10b Be friendly to krb5_generate_random_block consumers
Allow them to disable the EGD/profile access and the use of a
random seed file.

These facilities are not tenable when running in the kernel.
2013-07-03 23:17:38 -05:00
Love Hornquist Astrand
786e790f2c mdoc uses the .Lk macro to mark up hyperlinks (from Igor Sobrado <sobrado@orion.ciencias.uniovi.es>) 2013-06-27 19:41:10 +02:00
Igor Sobrado
be204adf4c Add more documentation links to section 8 pages
As kerberos(8) provides a brief outline of this network authentication
system I would suggest extending SEE ALSO to include a few section 8
commands.  I have excluded kadmind(8) and kpasswdd(8) as these servers
can be easily reachable from kadmin(8) and kpasswd(8) manual pages
respectively.

Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2013-06-27 09:33:08 +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
Jeffrey Altman
dd47d25e5d libkrb5: No fchmod on Windows
There is no fchmod() implementation on Windows.  For now prevent its
use on Windows with #ifndef _WIN32 but in the future set_default_cache()
should be updated to set ownership permissions for the cache file.

Change-Id: I57214dfecbd25d7b337a568fa5e522c0a22dbb76
2013-06-22 21:17:29 -04:00
Jeffrey Altman
57d55d2b81 libkrb5: replace mkdir with rk_mkdir in dcache.c
Now that libroken provides rk_mkdir(), use it.

Change-Id: Ibf208e45cc36b85198bcb266267bf4665f32ba2f
2013-06-22 21:17:27 -04:00
Jeffrey Altman
b07058dbe1 Build new lib/krb5 sources on Windows
db_plugin.c
   dcache.c
   plugin.c

Change-Id: Icb67253d8c1cb8a368c886010e7b4aedca61348c
2013-06-22 21:17:19 -04:00
Jeffrey Altman
eccbdac238 Remove unused variable
Change-Id: Id0249ead009e0a544913460aec15a3abc5bc0f98
2013-06-22 21:17:13 -04:00
Jeffrey Altman
423ef23e43 Windows: _krb5_store_string_to_reg_value REG_DWORD
If the registry type is NONE and the string is all numeric or
if the type is DWORD, the string is converted to a DWORD and then
stored into the registry as a REG_DWORD using RegSetValueEx().
The input parameter should be a pointer to the DWORD variable not
its value.

Change-Id: I9ff12121c6c17eb5afb2ea89adf8bb9cc6aa3a89
2013-06-22 21:17:12 -04:00