Commit Graph

116 Commits

Author SHA1 Message Date
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
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
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
403f599dbd better error reporting 2013-07-10 21:50:23 +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
Roland C. Dowdeswell
f0f07ff408 Use krb5_enomem() more consistently in lib/krb5. 2013-02-13 16:15:00 +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
Love Hornquist Astrand
0879b9831a remove trailing whitespace 2011-05-21 11:57:31 -07:00
Love Hornquist Astrand
492492e42a use new function krb5_einval instead of returning EINVAL directly 2011-05-18 21:59:23 -07:00
Jeffrey Altman
18b76b6236 fcache: prevent null pointer dereference
Validate krb5_ccache and krb5_cc_cursor inputs
before use.  Avoid null pointer dereference which
can occur if an application fails to properly check
return codes.

Change-Id: I8023808936e60cc7b8e57a062106cfcdc51ee7d7
2011-05-18 10:20:09 -04:00
Love Hornquist Astrand
f5f9014c90 Warning fixes from Christos Zoulas
- shadowed variables
- signed/unsigned confusion
- const lossage
- incomplete structure initializations
- unused code
2011-04-29 20:25:05 -07:00
Asanka Herath
4b36b36e0b Add roken/rename.c to fix non-standard rename()
roken/rename.c is for platforms where the native rename()
implementation does not replace the target if it already exists.  This
implementation isn't atomic, but should be close enough for most
purposes.

For correct behavior, rk_rename() should be used instead of rename().
rk_rename() is #defined to be rename() on platforms where this fix is
not necessary.
2010-09-14 08:03:34 -04:00
Asanka Herath
bd795255aa Fix fcc_remove_cred() on platforms with non-standard rename() 2010-09-14 08:03:31 -04:00
Asanka Herath
5dcc605f6b Fix calling conventions for Windows 2010-08-20 13:14:10 -04:00
Love Hornquist Astrand
0b2b9d9834 catch error from as.*printf 2010-05-30 14:12:39 -07:00
Love Hornquist Astrand
886914f8f9 always use _krb5_expand_path_tokens 2010-05-27 12:25:47 -05:00
Asanka Herath
b9567cb158 Don't attempt to release unallocated resource in fcc_move() 2010-05-26 10:38:43 -04:00
Love Hornquist Astrand
687db64c56 Patch from Secure Endpoints/Asanka Herath for windows support 2009-12-21 08:45:28 +01:00
Love Hornquist Astrand
75aa4b44fa switch to rk_strerror_r 2009-12-13 11:42:12 -08:00
Ted Percival
bfcdeda3b4 Fix memory leak in fcc_move
This usually occurs when re-initializing a file credential
cache over the top of an existing one.

This was meant to be fixed in commit 48cb3aa by calling
fcc_destroy(), but that only unlinks the "from" file
(which was already renamed or unlinked) but still doesn't
free the in-memory credentials. Using fcc_close() instead of
fcc_destroy() frees the leaked in-memory credentials.

Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2009-12-10 23:35:44 +01:00
Love Hornquist Astrand
b3e86a1cb6 track kdc offset better 2009-11-22 12:25:15 -08:00
Love Hornquist Astrand
f5e2873be2 Use strerror_r 2009-10-12 09:34:37 -07: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
9c18bf414c use constants for cache types
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25063 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-04-03 04:08:09 +00:00
Love Hörnquist Åstrand
a7e136a5d7 use krb5_cc_new_unique, use constants for cache types
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25058 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-04-03 04:07:17 +00:00
Love Hörnquist Åstrand
53dcd1bdd3 test leak and make behavie sanely.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25025 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-04-03 04:00:51 +00:00
Love Hörnquist Åstrand
48cb3aa538 plugs leaks
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25021 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-04-03 03:59:54 +00:00
Love Hörnquist Åstrand
5e4d827e61 Patch from Riverbed (Derrick Pallas) under the license of the files they are in:
Fix resource leak in heimdal/krb5/fcache/fcc_remove_cred
	In fcache, fcc_remove_cred generates a ccache called
	"newfile," which is not cleaned up if the final call
	(krb5_cc_move) fails.

Free of uninitialized value in fcache/fcc_move(...)
	If init_fcc fails to acquire a file handle, sp will be
	uninitialized. If this is the case, the call to
	krb5_storage_free will dereference this uninitialized value,
	which causes undefined behaviour.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24944 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-03-25 15:37:21 +00:00
Love Hörnquist Åstrand
d9a3a6a070 export _krb5_erase_file
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24450 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-25 00:46:06 +00:00
Love Hörnquist Åstrand
06e31e6376 handle krb5_cc_default_name() returning NULL in a diffrent way.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24029 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-11-12 04:18:50 +00:00
Love Hörnquist Åstrand
f9d5a05854 krb5_cc_default_name() can fail if the configuration file is strange.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24025 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-11-12 04:18:04 +00:00
Love Hörnquist Åstrand
9aa9efb279 make get_default_name have a better name
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23959 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-10-26 18:21:11 +00:00
Love Hörnquist Åstrand
7811db9c1f add lastmodified
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23923 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-10-18 21:14:54 +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
29047d38f3 strings should be i18n
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23769 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-07 21:21:18 +00:00
Love Hörnquist Åstrand
7b5981996c sprinle O_CLOEXEC, from Andrew Bartlett
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23474 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-07-28 08:49:43 +00:00
Love Hörnquist Åstrand
30e523c1a5 close-on-exec
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23444 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-07-27 12:07:47 +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
d542833a1f use krb5_set_error_message
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23280 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-06-23 03:26:18 +00:00
Love Hörnquist Åstrand
3b7ff465c1 Add declspec for Windows
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23026 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-04-17 10:02:03 +00:00