Commit Graph

80 Commits

Author SHA1 Message Date
Luke Howard
69973757ce gss: remove gss_get_instance() 2022-01-30 14:20:05 -05:00
Jeffrey Altman
ca4ff365f8 lib/gssapi/mech: gss_mech_switch do not leak 'm'
If there is a memory allocation failure after 'm'
is allocated, 'm' will be leaked; free it.

Change-Id: I625273634af207fac7c489df166cebde4d467cbc
2022-01-23 23:07:36 -05:00
Nicolas Williams
77c048db9b gss: Check add_builtin() errors 2022-01-17 17:59:10 -06:00
Nicolas Williams
96b7ea671d gss: Fix warnings 2022-01-14 17:39:05 -06:00
Robert Crowston
5d462795ce Add stub for gss_acquire_cred_impersonate_name(). 2021-10-19 20:45:40 +11:00
Luke Howard
b3511c145c gss: check for NULL before calling dlclose()
Calling dlclose(NULL) on some recent versions of Linux appears to cause the
process to segfault.
2021-08-20 00:07:12 +10:00
Luke Howard
49f3f5bd99 kdc: support for GSS-API pre-authentication
Add support for GSS-API pre-authentication to the KDC, using a simplified
variation of draft-perez-krb-wg-gss-preauth-02 that encodes GSS-API context
tokens directly in PADATA, and uses FX-COOKIE for state management.

More information on the protocol and implementation may be found in
lib/gssapi/preauth/README.md.
2021-08-12 17:37:01 +10:00
Andrew Bartlett
3587b8c08c Allow _gss_string_to_oid() without HAVE_DLOPEN
This function became used outside the protection of
HAVE_DLOPEN (which Samba sets) with:

commit 5966c00701
Author: Luke Howard <lukeh@padl.com>
Date:   Sun Aug 8 10:34:28 2021 +1000

    gss: add gss_mg_name_to_oid internal API

    Add a new function for future internal use, gss_mg_name_to_oid(), which takes
    either a dot-separated OID or a "short" mechanism name (such as
    "sanon-x25519"), and returns a mechanism OID.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2021-08-09 09:58:58 +10:00
Luke Howard
18c18d84b1 gss: merge gss_name_to_oid and gss_mg_name_to_oid
The recently introduced gss_mg_name_to_oid() function supported looking up
dynamically loaded mechanisms by name, but did not support partial matches or
the legacy "Kerberos 5" name as supported by gss_name_to_oid().

Consolidate these into a single function, and also add support for dynamically
loaded mechanisms to gss_oid_to_name().

API behavior difference: the Kerberos mechanism is now referred to by "krb5"
rather tha "Kerberos 5", although for legacy compatibility gss_name_to_oid()
will recognize the old name. However, gss_oid_to_name() will return "krb5". The
anticipated impact is minimal as these are not standard GSS-APIs and do not
appear to have any public usage outside Heimdal.
2021-08-08 11:37:09 +10:00
Luke Howard
5966c00701 gss: add gss_mg_name_to_oid internal API
Add a new function for future internal use, gss_mg_name_to_oid(), which takes
either a dot-separated OID or a "short" mechanism name (such as
"sanon-x25519"), and returns a mechanism OID.
2021-08-08 10:34:28 +10:00
Andrew Bartlett
4a5fc6bcde Move out: label to inside #endif of HAVE_DLOPEN
Samba compiles Heimdal internally without HAVE_DLOPEN to keep
to internally supplied mechanisms and plugins.

Samba compiles with strict warning flags and on Ubuntu 20.04
with gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) we see:

../../source4/heimdal/lib/gssapi/mech/gss_mech_switch.c: In function ‘_gss_load_mech’:
../../source4/heimdal/lib/gssapi/mech/gss_mech_switch.c:462:1: error: label ‘out’ defined but not used [-Werror=unused-label]
  462 | out:
      | ^~~
cc1: all warnings being treated as errors

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2021-06-25 09:44:53 +10:00
Luke Howard
4a7eb74374 gss: SAnon - the Simple Anonymous GSS-API mechanism
Add support for SAnon, a simple key agreement protocol that provides no
authentication of initiator or acceptor using x25519 ECDH key exchange.
See doc/standardization/draft-howard-gss-sanon-xx.txt for a protocol
description.
2020-04-25 23:19:30 -05:00
Nicolas Williams
a54761d68a Properly implement neg_mechs & GM_USE_MG_CRED
SPNEGO was already using union creds.  Now make the mechglue know about
it, delete all of the cred-related SPNEGO stubs that are now not called
(lib/gssapi/spnego/cred_stubs.c), and implement gss_get/set_neg_mechs()
by storing the OID set in the union cred.

This commit was essentially authored as much if not more by Luke Howard
<lukeh at padl.com> as much as by the listed author.
2020-04-21 00:21:32 -05:00
Luke Howard
4fb6a6adc9 gss: port NegoEx implementation from MIT
An implementation of draft-zhu-negoex-04 for MIT Kerberos was developed in
2011. This has been recently integrated, with many fixes from Greg Hudson. This
commit ports it to Heimdal. The implementation has been interoperability tested
with MIT Kerberos and Windows, using the GSS EAP mechanism developed as part of
the Moonshot project.

The SPNEGO code was also updated to import the state machine from Apple which
improves mechListMIC processing and avoids discarding initial context tokens
generated during mechanism probing, that can be used for optimistic tokens.

Finally, to aid in testing, the GSS-API mechanism glue configuration file can
be changed using the environment variable GSS_MECH_CONFIG. This environment
variable name, along with the format of the configuration file, is compatible
with MIT (although it would be difficult for a single mechanism binary to
support both implementations).
2020-02-04 17:28:35 +11:00
Luke Howard
6af3ea9099 gss: merge enhanced Apple mechglue logging
Add _gss_mg_log() and friends for logging from within the mechanism glue and
SPNEGO. These APIs wrap around the libkrb5 logging APIs.
2020-02-04 17:28:35 +11:00
Luke Howard
31af9ba703 gss: use tail queue instead of singly linked list in mechglue
The GSS mechglue uses singly linked lists for mechanisms and mechanism objects,
to which new entries are inserted at the head. This breaks ordering of
mechanisms specified in OID sets and in /etc/gss/mech, as they will be back to
front. Use a tail queue instead so that new entries are inserted at the end.
2020-02-04 17:28:35 +11:00
Luke Howard
64d5d138a9 gss: mechanism optional interfaces
Make mechanism interfaces that are optional in usage, optional in
implementation, i.e. do not require them to be present when dynamically loading
a mechanism. In order to aid minimal mechanism implementation, more of these
should likely be made optional (this will require an additional check in the
mechglue to return GSS_S_UNAVAILABLE if the function pointer is NULL). This is
left as a future exercise.
2020-02-04 17:28:35 +11:00
Luke Howard
735039dbdc gssapi: implement gss_set_neg_mechs() (#495)
Implementation of gss_set_neg_mechs() and gss_get_neg_mechs() as defined in RFC
4178. New gss_release_cred_by_mech() API for dropping a credential from a
mechanism glue credential.
2019-01-04 15:50:11 +11:00
Luke Howard
befe1b8f90 always load plugins with RTLD_LOCAL/RTLD_GROUP if available 2019-01-03 20:06:27 -06:00
Luke Howard
e0bb9c10ca gssapi: credential store extensions (#451)
Implement the GSS-API credential store API extensions defined by MIT here:

https://k5wiki.kerberos.org/wiki/Projects/Credential_Store_extensions

Note: we kill off gss_acquire_cred_ext() here. This was never a public API,
although mechanisms could have implemented it and I briefly used it in my
BrowserID prototype mechanism. gss_acquire_cred_ext_from() occupies the place
in the dispatch table where gss_acquire_cred_ext() used to, but this structure
was never visible outside Heimdal (i.e. it is only used by internal
mechanisms);

(Mechanisms that need to accept arbitrary key/value dictionaries from
applications should now implement gss_acquire_cred_from().)
2019-01-03 14:38:39 -06:00
Luke Howard
728650f3dd gssapi: canonicalize mech OID in gss_accept_sec_context() 2019-01-03 17:54:32 +11:00
Luke Howard
29fe69f95f gssapi: fix dlsym() return value casting
Fix warnings on Windows (and possibly other platforms) but appropriately
casting the return value of dlsym().
2019-01-03 17:53:15 +11:00
Luke Howard
7e0ff63b38 gssapi: add OPTSYM for gss_duplicate_cred() (#487)
Allow API-as-SPI mechanisms to provide gss_duplicate_cred(), introduced
in e6d1c108.
2018-12-29 20:22:12 +11:00
Luke Howard
3c92747f2a gss: fix leak in add_builtin() if interning OID fails
4a93c477 (#447) introduced a leak in add_builtin().  Reported by
jaltman@auristor.com.
2018-12-23 15:34:27 +11:00
Luke Howard
4a93c4774a gss: intern OIDs (#447)
Intern OIDs so that gss_release_oid() can be a NOOP.
2018-12-18 23:28:38 -06:00
Gary Lockyer
1c8cae58cc heimdal: Use #ifdef HAVE_DLOPEN around functions and variables used by HAVE_DLOPEN
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
2018-09-10 14:40:51 -04:00
Luke Howard
788d39b3ce set m->gm_mech.gm_name 2014-01-04 16:31:01 +11:00
Luke Howard
4ff005a6a4 gm_mech_oid must be set
mechanism credentials created by dynamically loaded mechanisms do not work
because the gm_mech_oid field is unset for such mechanisms (instead, only
gm_mech.gm_mech_oid is).
2014-01-04 15:58:10 +11:00
Luke Howard
07777511d1 implement gss_localname 2011-10-08 12:15:09 +11:00
Love Hornquist Astrand
0879b9831a remove trailing whitespace 2011-05-21 11:57:31 -07:00
Luke Howard
79ff133ae9 make gss_acquire_cred_ext private 2011-05-20 14:31:08 +02:00
Luke Howard
cbebf13216 acquire_cred_with_password is a SPI symbol 2011-05-14 17:09:20 +02:00
Luke Howard
48719d5651 shim acquire_cred_with_password SPI into acquire_cred_ext 2011-05-14 17:00:55 +02:00
Luke Howard
dfba868910 Merge branch 'master' into lukeh/acquire-cred-ex-moonshot-integ
Conflicts:
	lib/gssapi/Makefile.am
	lib/gssapi/mech/gss_acquire_cred_with_password.c
	lib/gssapi/test_context.c
	lib/gssapi/version-script.map
2011-05-14 16:48:49 +02:00
Luke Howard
3069d80734 Merge branch 'master' into lukeh/acquire-cred-ex 2011-05-14 14:56:16 +02:00
Luke Howard
d1b553aae2 add some loopback detection in GSS dynamic loading 2011-05-13 02:27:01 +02:00
Luke Howard
6971125a79 add some loopback detection in GSS dynamic loading 2011-05-13 02:26:41 +02:00
Luke Howard
5dc4aeee49 Merge branch 'master' into lukeh/moonshot
Conflicts:
	lib/gssapi/mech/gss_mech_switch.c
2011-05-13 00:19:01 +02:00
Luke Howard
b323601091 mechglue fixes
- support gssspi_set_cred_option
- pick up OID sets of names for dynamic mechs
2011-05-13 00:16:56 +02:00
Luke Howard
02cf28e20b implement gss_acquire_cred_ex with password support
add missing SPIs to gss_mech_switch

s/acquire_cred_ex/acquire_cred_ext/g
2011-04-16 11:06:24 +02:00
Luke Howard
6c6e483e00 gss_authorize_localname implementation 2011-04-08 10:58:57 +10:00
Luke Howard
d116a78297 add missing exports 2011-03-21 23:53:17 +11:00
Luke Howard
e78371829c implement gss_userok/gss_pname_to_uid 2011-03-20 20:34:59 +11:00
Luke Howard
9455577b65 Merge branch 'master' of github.com:heimdal/heimdal
Conflicts:
	lib/gssapi/gssapi/gssapi.h
	lib/gssapi/gssapi_mech.h
	lib/gssapi/mech/gss_mech_switch.c
2011-03-20 19:08:10 +11:00
Love Hornquist Astrand
4248882381 drop gss_name_any since it removed from the draft 2011-03-12 12:49:42 -08:00
Love Hornquist Astrand
fbf5cff0ac Patch from Luke Howard to allow dynamic gss_mo 2011-03-12 12:45:53 -08:00
Luke Howard
2b2ab30f53 Add naming extension SPIs
Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2011-03-12 12:35:43 -08:00
Luke Howard
4304e719a6 Add SPI for dynamically loading mechanism object information 2011-01-09 22:16:18 +11:00
Luke Howard
45cd381f53 Cleanup API-as-SPI compatibility layer 2011-01-09 22:05:27 +11:00
Luke Howard
0b4f6bbfc2 Use RTLD_GROUP
Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2011-01-03 13:21:47 +01:00