Commit Graph

162 Commits

Author SHA1 Message Date
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
Love Hörnquist Åstrand
65353f9173 update documentation
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24926 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-03-22 17:24:36 +00:00
Love Hörnquist Åstrand
4fbab16b41 If data == NULL, not store the config.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24911 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-03-22 17:22:00 +00:00
Love Hörnquist Åstrand
1f11af2c0c Remove unused variable.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24829 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-02-27 03:26:12 +00:00
Love Hörnquist Åstrand
905469a1ee more casting
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24322 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-17 21:51:05 +00:00
Love Hörnquist Åstrand
f14a4e5b43 doxygen
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24321 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-17 21:50:53 +00:00
Love Hörnquist Åstrand
dbe87bb882 doxygen
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24320 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-17 21:50:43 +00:00
Love Hörnquist Åstrand
7e12f65467 doxygen fixup
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24275 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-11 21:47:43 +00:00
Love Hörnquist Åstrand
0aef0e3e46 add krb5_cc_[gs]et_friendly_name, match MIT config name
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24181 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-12-15 04:29:03 +00:00
Love Hörnquist Åstrand
a5013943ed better english
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24046 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-11-23 22:04:52 +00:00
Love Hörnquist Åstrand
8879177460 fix documentation
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24042 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-11-15 04:44:04 +00:00
Love Hörnquist Åstrand
c5770cfd91 check cache returned from krb5_cccol_cursor_next
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24037 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-11-12 04:20:14 +00:00
Love Hörnquist Åstrand
be699eb984 add krb5_cccol_last_change_time
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23924 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-10-18 21:15:10 +00:00