summaryrefslogtreecommitdiffstats
path: root/src/lib/gssapi/spnego
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2010-04-30 21:22:48 +0000
committerGreg Hudson <ghudson@mit.edu>2010-04-30 21:22:48 +0000
commitbaea9a7a27d781581505f0bb6d0ac4e4f24053aa (patch)
treeaf04244ed8b910bed378296d0b263c5f2b3a3ffc /src/lib/gssapi/spnego
parentd20d802b8e44178017fd1a1da55a72194f50da55 (diff)
downloadkrb5-baea9a7a27d781581505f0bb6d0ac4e4f24053aa.tar.gz
krb5-baea9a7a27d781581505f0bb6d0ac4e4f24053aa.tar.xz
krb5-baea9a7a27d781581505f0bb6d0ac4e4f24053aa.zip
Add IAKERB mechanism and gss_acquire_cred_with_password
Merge branches/iakerb to trunk. Includes the following: * New IAKERB mechanism. * New gss_acquire_cred_with_password mechglue function. * ASN.1 encoders and decoders for IAKERB structures (with tests). * New shortcuts in gss-sample client and server. * Tests to exercise SPNEGO and IAKERB using gss-sample application. ticket: 6712 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23960 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/gssapi/spnego')
-rw-r--r--src/lib/gssapi/spnego/gssapiP_spnego.h12
-rw-r--r--src/lib/gssapi/spnego/spnego_mech.c64
2 files changed, 76 insertions, 0 deletions
diff --git a/src/lib/gssapi/spnego/gssapiP_spnego.h b/src/lib/gssapi/spnego/gssapiP_spnego.h
index a1cd2b4a63..d72c85da71 100644
--- a/src/lib/gssapi/spnego/gssapiP_spnego.h
+++ b/src/lib/gssapi/spnego/gssapiP_spnego.h
@@ -458,6 +458,18 @@ spnego_gss_acquire_cred_impersonate_name(
OM_uint32 *); /* time_rec */
OM_uint32
+spnego_gss_acquire_cred_with_password(
+ OM_uint32 *minor_status,
+ const gss_name_t desired_name,
+ const gss_buffer_t password,
+ OM_uint32 time_req,
+ const gss_OID_set desired_mechs,
+ gss_cred_usage_t cred_usage,
+ gss_cred_id_t *output_cred_handle,
+ gss_OID_set *actual_mechs,
+ OM_uint32 *time_rec);
+
+OM_uint32
spnego_gss_display_name_ext
(
OM_uint32 *minor_status,
diff --git a/src/lib/gssapi/spnego/spnego_mech.c b/src/lib/gssapi/spnego/spnego_mech.c
index 86ba89a399..c9cf441e0e 100644
--- a/src/lib/gssapi/spnego/spnego_mech.c
+++ b/src/lib/gssapi/spnego/spnego_mech.c
@@ -274,6 +274,11 @@ static struct gss_config spnego_mechanism =
spnego_gss_set_neg_mechs,
};
+static struct gss_config_ext spnego_mechanism_ext =
+{
+ spnego_gss_acquire_cred_with_password
+};
+
#ifdef _GSS_STATIC_LINK
#include "mglueP.h"
@@ -283,6 +288,7 @@ static int gss_spnegomechglue_init(void)
memset(&mech_spnego, 0, sizeof(mech_spnego));
mech_spnego.mech = &spnego_mechanism;
+ mech_spnego.mech_ext = &spnego_mechanism_ext;
mech_spnego.mechNameStr = "spnego";
mech_spnego.mech_type = GSS_C_NO_OID;
@@ -2447,6 +2453,64 @@ spnego_gss_acquire_cred_impersonate_name(OM_uint32 *minor_status,
}
OM_uint32
+spnego_gss_acquire_cred_with_password(OM_uint32 *minor_status,
+ const gss_name_t desired_name,
+ const gss_buffer_t password,
+ OM_uint32 time_req,
+ const gss_OID_set desired_mechs,
+ gss_cred_usage_t cred_usage,
+ gss_cred_id_t *output_cred_handle,
+ gss_OID_set *actual_mechs,
+ OM_uint32 *time_rec)
+{
+ OM_uint32 status, tmpmin;
+ gss_OID_set amechs = GSS_C_NULL_OID_SET, dmechs;
+ gss_cred_id_t mcred = NULL;
+ spnego_gss_cred_id_t spcred = NULL;
+
+ dsyslog("Entering spnego_gss_acquire_cred_with_password\n");
+
+ if (actual_mechs)
+ *actual_mechs = NULL;
+
+ if (time_rec)
+ *time_rec = 0;
+
+ dmechs = desired_mechs;
+ if (desired_mechs == GSS_C_NULL_OID_SET) {
+ status = get_available_mechs(minor_status, desired_name,
+ cred_usage, NULL, &amechs);
+ dmechs = amechs;
+ }
+
+ status = gss_acquire_cred_with_password(minor_status, desired_name,
+ password, time_req, dmechs,
+ cred_usage, &mcred,
+ actual_mechs, time_rec);
+ if (status != GSS_S_COMPLETE)
+ goto cleanup;
+
+ spcred = malloc(sizeof(spnego_gss_cred_id_rec));
+ if (spcred == NULL) {
+ *minor_status = ENOMEM;
+ status = GSS_S_FAILURE;
+ goto cleanup;
+ }
+ spcred->neg_mechs = GSS_C_NULL_OID_SET;
+ spcred->mcred = mcred;
+ mcred = GSS_C_NO_CREDENTIAL;
+ *output_cred_handle = (gss_cred_id_t)spcred;
+
+cleanup:
+
+ (void) gss_release_oid_set(&tmpmin, &amechs);
+ (void) gss_release_cred(&tmpmin, &mcred);
+
+ dsyslog("Leaving spnego_gss_acquire_cred_with_password\n");
+ return (status);
+}
+
+OM_uint32
spnego_gss_display_name_ext(OM_uint32 *minor_status,
gss_name_t name,
gss_OID display_as_name_type,