Commit Graph

63 Commits

Author SHA1 Message Date
Nicolas Williams
c4236f23bd krb5: Fix segfault in KCM ccache type 2022-01-24 13:52:36 -06:00
Nicolas Williams
1eda4920c8 krb5: Fix coverity warnings 2022-01-19 23:38:27 -06:00
Luke Howard
0452d8c601 krb5: check return value in krb5_get[_cache]_next()
krb5_get_next() and krb5_get_cache_next() do not check for krb5_kcm_call()
returning non-zero before accessing the repsonse data; they only handle the
case where the return value is KRB5_CC_END.

Return immediately if the return value of krb5_kcm_call() is not KRB5_CC_END or
0. This was fixed in the Apple code.
2021-06-16 12:09:19 +10:00
Nicolas Williams
fc7b7af95a krb5: Fix kcm client 2020-05-28 00:02:36 -05:00
Jeffrey Altman
d84512b8d2 krb5: krb5_cc_ops backward compatibility and extensibility
The krb5_cc_ops structure is an extensible structure to which new
functionality has been added over the years.

Version zero was the original.  It included all functions up to
and including get_default_name().

Version one added set_default().

Version two added lastchange().

Version three added set_kdc_offset() and get_kdc_offset().

Version four broke compatibility by modifying the signatures
of get_name() and resolve().   This was in change
7bf4d76e75 ("krb5: Improve cccol sub
naming; add gss_store_cred_into2()").

Version five restores the original signatures of get_name()
and resolve() and introduces get_name_2() and resolve_2() that
provide the additional cccol functionality.

This change

 * introduces version five
 * documents which functions are part of each version
 * replaces KRB5_CC_OPS_VERSION with KRB5_CC_OPS_VERSION_0,
   KRB5_CC_OPS_VERSION_1, KRB5_CC_OPS_VERSION_2, KRB5_CC_OPS_VERSION_3,
   and KRB5_CC_OPS_VERSION_5.  KRB5_CC_OPS_VERSION_4 is skipped
   because of the aforementioned breakage.
 * compatibility logic is added to permit ccache plugins to implement
   any of version one, two, three, five or a future version.
 * all in-tree krb5_cc_ops implementations are updated to version 5.

Change-Id: Iadfce01d10834bc6151939e4d9d196f03001626e
2020-05-27 23:22:40 -05:00
Nicolas Williams
7bf4d76e75 krb5: Improve cccol sub naming; add gss_store_cred_into2()
- Formalize the TYPE:collection_name:subsidiary_name naming scheme for
   ccaches in ccache collections
    - KEYRING: ccaches are weird because they have one more optional field: the
      "anchor", so rather than just assume a naming convention everywhere, we
      add new functions as well
 - Add krb5_cc_{resolve,default}_sub() that allows one to specify a
   "subsidiary" ccache name in a collection separately from the
   collection name
 - Add krb5_cc_{resolve,default}_for() which take a principal name,
   unparse it, and use it as the subsidiary ccache name (with colons
   replaced)
 - Make kinit use the new interfaces
 - Add missing DIR ccache iteration functionality
 - Revamps test_cc
 - Add krb5_cc_get_collection() and krb5_cc_get_subsidiary()
 - Bump the ccops SPI version number
 - Add gss_store_cred_into2()
 - Make MEMORY:anonymous not linked into the global MEMORY ccache
   collection, and uses this for delegated cred handles

TBD:

 - Split this up into a krb5 change and gss mech_krb5 change?
 - Add krb5_cc_init_and_store() utility, per Greg's suggestion?
2020-03-02 17:48:04 -06:00
Nicolas Williams
ec84667763 Fix krb5_cc_move() issues
Move init/copy/destroy fallback sequence from fcc_move() to
krb5_cc_move().

Make sure all backends's move() method calls krb5_cc_destroy() on the
source on success (and only on success).

In text_cc make sure that we can find in the destination the cred
stored into the source.
2019-10-03 13:09:18 -05:00
Jeffrey Altman
93518bfab4 use memset_s
lib roken includes support for memset_s() but it was not applied
to the Heimdal source tree.

Change-Id: I8362ec97a9be50205bb2d398e65b629b88ce1acd
2017-04-29 01:05:59 -04:00
Roland C. Dowdeswell
f0f07ff408 Use krb5_enomem() more consistently in lib/krb5. 2013-02-13 16:15:00 +08:00
Roland C. Dowdeswell
cc47c8fa7b Turn on -Wextra -Wno-sign-compare -Wno-unused-paramter and fix issues.
We turn on a few extra warnings and fix the fallout that occurs
when building with --enable-developer.  Note that we get different
warnings on different machines and so this will be a work in
progress.  So far, we have built on NetBSD/amd64 5.99.64 (which
uses gcc 4.5.3) and Ubuntu 10.04.3 LTS (which uses gcc 4.4.3).

Notably, we fixed

	1.  a lot of missing structure initialisers,

	2.  unchecked return values for functions that glibc
	    marks as __attribute__((warn-unused-result)),

	3.  made minor modifications to slc and asn1_compile
	    which can generate code which generates warnings,
	    and

	4.  a few stragglers here and there.

We turned off the extended warnings for many programs in appl/ as
they are nearing the end of their useful lifetime, e.g.  rsh, rcp,
popper, ftp and telnet.

Interestingly, glibc's strncmp() macro needed to be worked around
whereas the function calls did not.

We have not yet tried this on 32 bit platforms, so there will be
a few more warnings when we do.
2012-02-20 19:45:41 +00:00
Love Hornquist Astrand
0879b9831a remove trailing whitespace 2011-05-21 11:57:31 -07:00
Jeffrey Altman
0a36d16131 add KRB5_LIB_FUNCTION/KRB5_LIB_CALL to kcm.c
Change-Id: I7bc2f54b968843c05aabf03afa556a3d31b696c0
2011-05-17 12:02:13 -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 C. Herath
0f853405fe Add missing export and calling convention annotations 2010-11-24 15:32:49 -05:00
Love Hornquist Astrand
f97ce2849d remove unused functions 2010-05-27 11:08:51 -05:00
Love Hornquist Astrand
986aff5a86 (kcm_send_request): if heim_ipc_init_context, we have not kcm 2009-12-14 16:05:10 -08:00
Love Hornquist Astrand
9a5b9ed720 drop unused prototype 2009-11-22 00:39:21 -08:00
Love Hornquist Astrand
0adbdf8f98 drop include <sys/un.h> 2009-11-22 00:37:59 -08:00
Love Hornquist Astrand
99f171309f remove unused variables 2009-11-22 00:14:07 -08:00
Love Hornquist Astrand
eca5e4ecdf make more complete, expose kcm interface, use libheimipc 2009-11-22 00:07:03 -08:00
Love Hornquist Astrand
4e516cec33 Pruned to aggressivly 2009-07-29 23:14:44 +02:00
Love Hornquist Astrand
9b710bed81 store is never read again 2009-07-29 22:37:58 +02: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
71bab6db75 don't reset id pointer on free, upper layer does that for us.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25026 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-04-03 04:01:02 +00:00
Love Hörnquist Åstrand
90e52850c1 free data on error, cid#89
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24144 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-12-11 05:07:14 +00:00
Love Hörnquist Åstrand
dd4ed63ff5 fix uuid
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24044 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-11-16 21:12:52 +00:00
Love Hörnquist Åstrand
6f6dee5f38 don't even compile in the doors code if there is no door_create
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24020 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-11-03 19:15:55 +00:00
Love Hörnquist Åstrand
7e0745f3a4 remove kcmuuid_t
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24015 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-11-02 07:16:31 +00:00
Love Hörnquist Åstrand
9a1eac41e8 make independant of uuid's
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24013 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-11-02 07:16:08 +00:00
Love Hörnquist Åstrand
9eead5477d handle return value of krb5_storage_{read,write}
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24012 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-11-02 07:15:56 +00:00
Love Hörnquist Åstrand
7e6d2c0779 handle reading uuids diffrently
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24009 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-11-02 07:15:23 +00:00
Love Hörnquist Åstrand
011e338914 Get list of credential uuids and stuff them into the cursor and
itereate of them in get_next and free the cursor in end_get().

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24008 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-11-02 07:15:09 +00:00
Love Hörnquist Åstrand
5520b3633e indent
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23999 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-11-02 01:26:25 +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
3003f4c486 make compile
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23770 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-07 21:21:50 +00:00
Love Hörnquist Åstrand
c3eafbb2a5 N_()ify
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23766 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-07 21:20:09 +00:00
Love Hörnquist Åstrand
4384fb0209 use SOCK_CLOEXEC
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23517 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-08-11 10:01:38 +00:00
Love Hörnquist Åstrand
c7c6b6e527 close-on-exec
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23446 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-07-27 12:08:37 +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
f792b97fba use krb5_set_error_message
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23286 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-06-23 03:27:16 +00:00
Love Hörnquist Åstrand
093b99ac18 Add back krb5_kcmcache argument to try_door().
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23221 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-05-31 08:15:09 +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
Love Hörnquist Åstrand
96ece475a2 get_version returns an int, update
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22985 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-04-15 15:54:57 +00:00
Love Hörnquist Åstrand
331b920fdc Add version number to krb5_cc_ops
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22845 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-04-07 11:48:51 +00:00
Love Hörnquist Åstrand
adb952d840 Return KRB5_CC_NOSUPP on no kcm daemon in other end.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22782 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-03-25 13:33:31 +00:00
Love Hörnquist Åstrand
51feb996d3 add back k, its needed by consumers.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22781 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-03-25 13:33:26 +00:00
Love Hörnquist Åstrand
bdfb8e33c6 Drop unused variable krb5_kcmcache *k.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22778 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-03-25 12:21:00 +00:00
Love Hörnquist Åstrand
a760147457 first implementation of kcm-move-cache
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22777 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-03-25 12:20:55 +00:00