krb5_gss_inquire_attrs_for_mech,
krb5_gss_acquire_cred_from,
krb5_gss_store_cred_into,
-};
-
-static struct gss_config_ext krb5_mechanism_ext = {
krb5_gss_acquire_cred_with_password,
};
-static struct gss_config_ext iakerb_mechanism_ext = {
- iakerb_gss_acquire_cred_with_password,
-};
-
#ifdef _GSS_STATIC_LINK
#include "mglueP.h"
static int gss_iakerbmechglue_init(void)
iakerb_mechanism.gss_init_sec_context = iakerb_gss_init_sec_context;
iakerb_mechanism.gss_delete_sec_context = iakerb_gss_delete_sec_context;
iakerb_mechanism.gss_acquire_cred = iakerb_gss_acquire_cred;
+ iakerb_mechanism.gssspi_acquire_cred_with_password
+ = iakerb_gss_acquire_cred_with_password;
memset(&mech_iakerb, 0, sizeof(mech_iakerb));
mech_iakerb.mech = &iakerb_mechanism;
- mech_iakerb.mech_ext = &iakerb_mechanism_ext;
mech_iakerb.mechNameStr = "iakerb";
mech_iakerb.mech_type = (gss_OID)gss_mech_iakerb;
memset(&mech_krb5, 0, sizeof(mech_krb5));
mech_krb5.mech = &krb5_mechanism;
- mech_krb5.mech_ext = &krb5_mechanism_ext;
mech_krb5.mechNameStr = "kerberos_v5";
mech_krb5.mech_type = (gss_OID)gss_mech_krb5;
gss_name_t internal_name = GSS_C_NO_NAME;
gss_name_t allocated_name = GSS_C_NO_NAME;
gss_mechanism mech;
- gss_mechanism_ext mech_ext;
gss_cred_id_t cred = NULL;
gss_OID new_mechs_array = NULL;
gss_cred_id_t * new_cred_array = NULL;
mech = gssint_get_mechanism(desired_mech);
if (!mech)
return GSS_S_BAD_MECH;
-
- mech_ext = gssint_get_mechanism_ext(desired_mech);
- if (!mech_ext || !mech_ext->gssspi_acquire_cred_with_password)
+ if (!mech->gssspi_acquire_cred_with_password)
return GSS_S_UNAVAILABLE;
if (input_cred_handle == GSS_C_NO_CREDENTIAL) {
if (status != GSS_S_COMPLETE)
goto errout;
- status = mech_ext->gssspi_acquire_cred_with_password(minor_status,
- internal_name,
- password,
- time_req,
- target_mechs,
- cred_usage,
- &cred,
- NULL,
- &time_rec);
+ status = mech->gssspi_acquire_cred_with_password(minor_status,
+ internal_name,
+ password,
+ time_req,
+ target_mechs,
+ cred_usage,
+ &cred,
+ NULL,
+ &time_rec);
if (status != GSS_S_COMPLETE) {
map_error(minor_status, mech);
goto errout;
memset(cf->mech, 0, sizeof(*cf->mech));
free(cf->mech);
}
- if (cf->mech_ext != NULL && cf->freeMech) {
- memset(cf->mech_ext, 0, sizeof(*cf->mech_ext));
- free(cf->mech_ext);
- }
if (cf->dl_handle != NULL)
krb5int_close_plugin(cf->dl_handle);
new_cf->freeMech = 1;
new_cf->next = NULL;
- if (template->mech_ext != NULL) {
- new_cf->mech_ext = (gss_mechanism_ext)calloc(1,
- sizeof(struct gss_config_ext));
- if (new_cf->mech_ext == NULL) {
- releaseMechInfo(&new_cf);
- return ENOMEM;
- }
- *new_cf->mech_ext = *template->mech_ext;
- }
-
if (template->kmodName != NULL) {
new_cf->kmodName = strdup(template->kmodName);
if (new_cf->kmodName == NULL) {
GSS_ADD_DYNAMIC_METHOD_NOLOOP(dl, mech, gss_inquire_mech_for_saslname);
/* RFC 5587 */
GSS_ADD_DYNAMIC_METHOD_NOLOOP(dl, mech, gss_inquire_attrs_for_mech);
+ GSS_ADD_DYNAMIC_METHOD(dl, mech, gssspi_acquire_cred_with_password);
assert(mech_type != GSS_C_NO_OID);
return mech;
}
-static gss_mechanism_ext
-build_dynamicMechExt(void *dl, const gss_OID mech_type)
-{
- gss_mechanism_ext mech_ext;
-
- mech_ext = (gss_mechanism_ext)calloc(1, sizeof(*mech_ext));
- if (mech_ext == NULL) {
- return NULL;
- }
-
- GSS_ADD_DYNAMIC_METHOD(dl, mech_ext, gssspi_acquire_cred_with_password);
-
- return mech_ext;
-}
-
static void
freeMechList(void)
{
return (aMech->mech);
} /* gssint_get_mechanism */
-gss_mechanism_ext
-gssint_get_mechanism_ext(oid)
-const gss_OID oid;
-{
- gss_mech_info aMech;
-
- if (gssint_mechglue_initialize_library() != 0)
- return (NULL);
-
- if (k5_mutex_lock(&g_mechListLock) != 0)
- return NULL;
- /* check if the mechanism is already loaded */
- if ((aMech = searchMechList(oid)) != NULL && aMech->mech_ext) {
- (void) k5_mutex_unlock(&g_mechListLock);
- return (aMech->mech_ext);
- }
-
- /*
- * might need to re-read the configuration file before loading
- * the mechanism to ensure we have the latest info.
- */
- updateMechList();
-
- aMech = searchMechList(oid);
-
- /* is the mechanism present in the list ? */
- if (aMech == NULL || aMech->dl_handle == NULL) {
- (void) k5_mutex_unlock(&g_mechListLock);
- return ((gss_mechanism_ext)NULL);
- }
-
- /* has another thread loaded the mech */
- if (aMech->mech_ext) {
- (void) k5_mutex_unlock(&g_mechListLock);
- return (aMech->mech_ext);
- }
-
- /* Try dynamic dispatch table */
- aMech->mech_ext = build_dynamicMechExt(aMech->dl_handle,
- aMech->mech_type);
- if (aMech->mech_ext == NULL) {
- (void) k5_mutex_unlock(&g_mechListLock);
- return ((gss_mechanism_ext)NULL);
- }
-
- (void) k5_mutex_unlock(&g_mechListLock);
- return (aMech->mech_ext);
-} /* gssint_get_mechanism_ext */
-
/*
* this routine is used for searching the list of mechanism data.
*
gss_cred_id_t *cred_array;
} gss_union_cred_desc, *gss_union_cred_t;
-typedef OM_uint32 (KRB5_CALLCONV *gss_acquire_cred_with_password_sfct)(
- 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 */
- int, /* cred_usage */
- gss_cred_id_t *, /* output_cred_handle */
- gss_OID_set *, /* actual_mechs */
- OM_uint32 * /* time_rec */
- /* */);
-
/*
* Rudimentary pointer validation macro to check whether the
* "loopback" field of an opaque struct points back to itself. This
gss_cred_usage_t * /* cred_usage_stored */
/* */);
-} *gss_mechanism;
+ OM_uint32 (KRB5_CALLCONV *gssspi_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 */
+ int, /* cred_usage */
+ gss_cred_id_t *, /* output_cred_handle */
+ gss_OID_set *, /* actual_mechs */
+ OM_uint32 * /* time_rec */
+ /* */);
-/* This structure MUST NOT be used by any code outside libgss */
-typedef struct gss_config_ext {
- gss_acquire_cred_with_password_sfct gssspi_acquire_cred_with_password;
-} *gss_mechanism_ext;
+} *gss_mechanism;
/*
* In the user space we use a wrapper structure to encompass the
void *dl_handle; /* RTLD object handle for the mech */
gss_OID mech_type; /* mechanism oid */
gss_mechanism mech; /* mechanism initialization struct */
- gss_mechanism_ext mech_ext; /* extensions */
int priority; /* mechanism preference order */
int freeMech; /* free mech table */
struct gss_mech_config *next; /* next element in the list */
#endif
gss_mechanism gssint_get_mechanism (gss_const_OID);
-gss_mechanism_ext gssint_get_mechanism_ext(const gss_OID);
OM_uint32 gssint_get_mech_type (gss_OID, gss_buffer_t);
char *gssint_get_kmodName(const gss_OID);
char *gssint_get_modOptions(const gss_OID);
spnego_gss_inquire_attrs_for_mech,
spnego_gss_acquire_cred_from,
NULL, /* gss_store_cred_into */
-};
-
-static struct gss_config_ext spnego_mechanism_ext =
-{
spnego_gss_acquire_cred_with_password
};
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;