Commit Graph

58 Commits

Author SHA1 Message Date
Jeffrey Altman
8de592ab5a improve resolve_origin readability
comment the HAVE_DLADDR preprocessor #else and #endif
because they are so many lines apart.

indent the strrchr() call after the _Win32 block to demonstrate
they are related.

Change-Id: I112dc91b350b277cdb1dc1cd3ccd8f31a2084409
2014-02-04 23:20:11 -05:00
Nicolas Williams
2820cd7716 Revert "Minor WIN32/POSIX bug in resolve_origin()"
This reverts commit c9985fc695.
2014-02-04 14:37:54 -06:00
Nicolas Williams
c9985fc695 Minor WIN32/POSIX bug in resolve_origin() 2013-12-13 13:28:51 -06:00
Arran Cudbard-Bell
f604e424d1 Issue #491: bus error in resolve_origin()
resolve_origin attempts to insert '\0' into a field from a DL_info
struct, causes BUS error.

Signed-off-by: Nicolas Williams <nico@cryptonector.com>
2013-12-13 13:27:57 -06:00
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
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
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
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
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
Nicolas Williams
d4f23fe2ae Revert c1423a8 and fix things up
Also, we were stopping as soon as one registered plugin returned
something other than KRB5_PLUGIN_NO_HANDLE, but we weren't doing the
same for discovered plugins.  Add KRB5_PLUGIN_INVOKE_ALL flag to deal
with this; by default we'll stop at the first plugin that returns
anything other than KRB5_PLUGIN_NO_HANDLE.

Other buglets fixed as in c1423a8.
2013-03-05 21:44:43 -06: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
Love Hornquist Astrand
b45e4a6f98 require version >= 0 2012-10-07 11:13:17 -07:00
Jeffrey Altman
8257cc2232 Plugin functions should be KRB5_LIB_CALL
Plugin functions should be KRB5_LIB_CALL for speed on Windows.

Change-Id: Iaa4dcf73fd2e29e3f95feede5217eac4eaded4e2
2012-03-13 23:56:11 -04:00
Love Hornquist Astrand
8e1b58e923 move function pointer to last argument 2011-12-15 21:48:33 -08:00
Nicolas Williams
ad7e54d698 Generalize token expansion to allow for context-specific tokens 2011-12-08 13:33:37 -06:00
Nicolas Williams
6aec02f979 Make krb5_kuserok() pluggable and add features (including MIT config compat) 2011-12-08 13:33:36 -06:00
Nicolas Williams
cfe7f6312a Improve _krb5_plugin_run_f() 2011-12-08 13:33:36 -06:00
Love Hörnquist Åstrand
01884ebf2f fix argument order 2011-12-03 13:24:15 -08:00
Nicolas Williams
d0abcebf80 Make _krb5_plugin_run_f() use krb5_plugin_register()ed plugins too 2011-12-02 00:58:26 -06:00
Love Hörnquist Åstrand
354ef711f3 restructure 2011-11-21 20:34:35 -08:00
Love Hörnquist Åstrand
1d7c483db2 use get and set 2011-11-21 20:34:35 -08:00
Love Hornquist Astrand
0879b9831a remove trailing whitespace 2011-05-21 11:57:31 -07:00
Jeffrey Altman
6850d6a65f avoid uninit variable and unreachable code warnings
most of these warnings are not problems because of ample
use of abort() calls.  However, the large number of warnings
makes it difficult to identify real problems.  Initialize
the variables to shut up the compilers.

Change-Id: I8477c11b17c7b6a7d9074c721fdd2d7303b186a8
2011-05-17 12:02:16 -04:00
Asanka C. Herath
0f853405fe Add missing export and calling convention annotations 2010-11-24 15:32:49 -05:00
Asanka C. Herath
03694f3505 Trim trailing slashes of plug-in paths 2010-11-24 15:32:11 -05:00
Asanka C. Herath
6abe08a0a3 Validate plug-in names before loading
On Windows, we only want to load .dll files are plug-ins, even though
there might be other support files present in the plug-in directory.
2010-11-24 15:32:06 -05:00
Asanka C. Herath
7fea5ff69a Use expanded path names when loading plug-ins 2010-11-24 15:32:05 -05:00
Love Hornquist Astrand
e0a1e0a806 simplify 2010-10-27 20:48:55 -07:00
Love Hornquist Astrand
7259b7deff new way to run plugins that have less overhead (code and performance vice) 2010-10-27 20:42:35 -07:00
Love Hornquist Astrand
788189805c catch error from as.*printf 2010-05-30 13:28:49 -07:00
Love Hornquist Astrand
2664543dd5 spelling 2010-05-27 10:41:39 -05:00
Asanka Herath
5c0f3f99c6 Use path tokens when locating plug-in .dlls 2010-05-26 10:38:44 -04:00
Asanka Herath
68cfbb7e19 Add rk_cloexec_dir() to lib/roken 2009-12-22 14:03:39 -05:00
Asanka Herath
78a237e3cc No dirfd() on Windows 2009-11-24 10:16:49 -08:00
Love Hornquist Astrand
9b710bed81 store is never read again 2009-07-29 22:37:58 +02:00
Love Hornquist Astrand
7e4854250e Actually register new plugins and plug a related memory leak 2009-07-19 21:23:56 -07:00
Love Hornquist Astrand
d4ca938866 Only load plugins once and never unload them
Its expensive to load and unload plugins all the time, so lets stop doing that.
Run over the plugin directory and load all plugins and remember them all.
In the future, something should watch the directory and if it changes,
load the new plugins that was put there.
2009-07-17 15:18:00 -07:00
Love Hörnquist Åstrand
98d9f63c51 find macos framework plugins
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25174 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-05-04 06:18:15 +00:00
Love Hörnquist Åstrand
942a821fab remove RCSID
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25171 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-05-04 06:17:40 +00:00
Love Hörnquist Åstrand
03babea1e3 switch to krb5_clear_error_message
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23911 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-10-14 02:55:39 +00:00
Love Hörnquist Åstrand
6937d41a02 remove trailing whitespace
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23815 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 09:21:03 +00:00
Love Hörnquist Åstrand
e172367898 switch to utf8 encoding of all files
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23814 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 08:53:55 +00:00
Love Hörnquist Åstrand
f8b6cf5b3a check for duplicates
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23701 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-08-27 11:14:17 +00:00
Love Hörnquist Åstrand
b2eed84f4c close-on-exec
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23451 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-07-27 12:10:30 +00:00
Love Hörnquist Åstrand
7fcd266fdd use krb5_set_error_message
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23316 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-06-23 04:32:32 +00:00
Love Hörnquist Åstrand
bb38dbf61b doxygen documentation
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22033 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-11-10 10:39:47 +00:00
Love Hörnquist Åstrand
9b1d640943 expose krb5_plugin_register
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22023 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-11-03 21:36:38 +00:00