Commit Graph

174 Commits

Author SHA1 Message Date
Viktor Dukhovni
7d9fcb46b9 Ensure newly allocated ccache handles are zeroed
Otherwise, type-independent fields such as `initialized` have
uninitialized values, and incorrect behaviour may result.
2016-06-02 02:40:50 -04:00
Jeffrey Altman
924f7b9190 lib/krb5: Windows API:krb5cc ccache fallback
If there is no MSLSA: credential cache principal, then try to
fallback to the MIT default MIT credential cache name, API:krb5cc.

Change-Id: I8f981c5401b4f962cf808e7b0dc782e42bc03023
2016-04-10 17:05:07 -05:00
Jeffrey Altman
1b95a70e4f lib/krb5: krb5_cc_set_default_name Windows MSLSA:
If there is no default credential cache obtained from the registry
or from configuration files, then check to see if there is a valid
principal available from the MSLSA: credential cache.  If so, use
"MSLSA:" as the default credential cache.  This will simply configuration
for users on domain joined Windows machines when logged in using a
domain account.

Change-Id: I4c4392e0fdcec89aff3d258ce1b753e6458e3eec
2016-04-10 17:05:07 -05:00
Jeffrey Altman
338b4a1fba lib/krb5: reformat krb5_cc_set_default_name
Remove unnecessary levels of indentation.

Switch the conditional from "(e == NULL)" to "(p == NULL)" since it
the variable 'p' that is actually used to store the name of the
default credential cache.

Change-Id: Id884e2cd80b42e47d3c219ac3777161087467a14
2016-04-10 17:05:07 -05:00
Jeffrey Altman
eb1545382a lib/krb5: fallback Windows default ccname to HLKM
Windows queries the default ccache name via the registry.  Prior
to this change only the HKEY_CURRENT_USER hive.  Fallback to
HKEY_LOCAL_MACHINE if there is no "ccname" value specified for the
user.  This permits system or domain administrators to set the
default ccache to MSLSA: for all users.

Change-Id: Ide3b51358f8fc6944ca698e4a68295be9463d4e0
2016-04-10 17:05:07 -05:00
Nicolas Williams
56b67ac2eb start-realm: don't write NUL 2015-05-20 10:07:51 -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
bd71a22e20 Fix trailing whitespace in cache.c 2015-04-14 11:27:23 -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
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
Jeffrey Altman
d0b8bb27d5 Windows: krb5_cc_get_prefix_ops test drive letter
If the prefix starts with a drive letter then it is a FILE ccache.

Change-Id: I03399f8f512d555481608d2fc90c8d6ecaba73ad
2013-09-15 11:17:53 -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
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
ed6c3921e6 make krb5_cc_get_lifetime sane 2013-05-07 13:10:22 -07:00
Love Hörnquist Åstrand
9bde530ceb match function returns boolean true 2013-04-13 12:31:33 -07: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
Jeffrey Altman
9a127beb26 Windows: set default ccache to registry
Add _krb5_set_default_cc_name_to_registry() function and
call use it on Windows to set the user's default credential cache.

Change-Id: Ib59ff218a098a841bc61846abf873736380b5c6c
2011-09-26 02:00:13 -04: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
0f853405fe Add missing export and calling convention annotations 2010-11-24 15:32:49 -05:00
Asanka C. Herath
7569337e9f Windows: Move cache specific code out of mit_glue.c
Move code for checking backwards compatible configuration file location into cache.c.  Also use registry handling code from config_reg.c.
2010-11-24 15:32:41 -05:00
Asanka C. Herath
00ba841893 Windows: Use backwards compatible registry key for default cache
On Windows, existing applications determine and change the default
credentials cache using the Kerberos for Windows registry key
(\Software\MIT\Kerberos5, ccname).  Use it for backwards
compatibility.
2010-11-24 15:32:34 -05:00
Love Hornquist Astrand
0bfd697f62 use krb5_unparse_name instead of krb5_unparse_name_short since that doesnt fail. From Zdenek Hatas 2010-09-16 20:59:35 -07:00
Asanka Herath
d4a80084f1 Don't return a freed pointer in allocate_ccache() 2010-09-14 08:04:17 -04:00
Asanka Herath
fa4021698e Handle Windows pathnames properly in krb5_cc_resolve()
On Windows, a pathname can contain a drive letter and a colon.
krb5_cc_resolve() used to check whether there were any colons in the
ccache name string and assume it is a FILE: cache if there weren't.
In addition, on Windows, check for a drive specification.
2010-09-14 08:04:17 -04:00
Asanka Herath
24cbddd4b9 Resolve warnings on Windows
Appease the compiler by resolving some of the reported warnings,
including:

- Control paths that don't return.

- Potentially uninitialized variables.

- Unused local variables.

- Unreachable code.

- Type safety.

- Synchronize declarations with definitions for functions.
2010-08-20 13:03:38 -04:00
Love Hornquist Astrand
f2c29f2b1e use ret 0 2010-05-27 12:43:09 -05:00
Love Hornquist Astrand
44fd145d05 always use _krb5_expand_path_tokens 2010-05-27 12:31:23 -05:00
Love Hornquist Astrand
58022d0721 use _krb5_expand_path_tokens 2010-05-27 11:54:39 -05:00
Love Hornquist Astrand
26770c90f3 move unused variable to inside #ifdef 2010-01-08 12:59:35 +01: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
826c14833f make cpp safe, from Allan McRae 2009-11-23 07:19:00 -08:00
Love Hornquist Astrand
1494b7b611 add kdc syncing, more API cache glue, query if switching is supported 2009-11-22 12:32:39 -08:00
Love Hornquist Astrand
32d69c77f4 more doxygen 2009-09-08 11:09:55 -07:00
Love Hornquist Astrand
9f9783464c Don't make krb5_ccache point into krb5_context allocated memory
Don't make a copy of the krb5_cc_ops into krb5_context and hand that
out to callers of the api, this way its possible to free a krb5_context
w/o invalidating all krb5_ccaches that was allocated using that krb5_context
(also, it saves memory)
2009-09-01 12:22:16 -07:00
Love Hornquist Astrand
9020bb0208 some more doxygen 2009-08-21 06:07:53 -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
4fbbe8b5cf doxygen
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25131 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-04-25 16:26:00 +00:00
Love Hörnquist Åstrand
ae96106d76 add krb5_cc_get_lifetime
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25106 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-04-16 07:53:13 +00:00
Love Hörnquist Åstrand
48e9a84d44 rename SDB to SCC
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25069 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-04-03 04:09:11 +00:00
Love Hörnquist Åstrand
90ca46c387 move krb5_cc_gen_new to deprecated, but don't mark it yet.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25029 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-04-03 04:01:40 +00:00
Love Hörnquist Åstrand
47de5125a8 free on failure
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25027 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-04-03 04:01:15 +00:00
Love Hörnquist Åstrand
6f3721ba18 remove krb5_cc_next_cred_match, make work
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25022 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-04-03 04:00:05 +00:00
Love Hörnquist Åstrand
9dab5271de rename copy_match to copy_match_f
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25018 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-04-03 03:59:15 +00:00
Love Hörnquist Åstrand
f2cb188d59 move krb5_cc_copy_creds to mit_glue.c
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25009 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-04-03 03:57:24 +00:00