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.
This commit is contained in:
@@ -35,6 +35,81 @@
|
||||
#ifndef _HEIM_QUEUE_H_
|
||||
#define _HEIM_QUEUE_H_
|
||||
|
||||
/*
|
||||
* Singly-linked List definitions.
|
||||
*/
|
||||
#define HEIM_SLIST_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *slh_first; /* first element */ \
|
||||
}
|
||||
|
||||
#define HEIM_SLIST_HEAD_INITIALIZER(head) \
|
||||
{ NULL }
|
||||
|
||||
#define HEIM_SLIST_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *sle_next; /* next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* Singly-linked List functions.
|
||||
*/
|
||||
#define HEIM_SLIST_INIT(head) do { \
|
||||
(head)->slh_first = NULL; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define HEIM_SLIST_INSERT_AFTER(slistelm, elm, field) do { \
|
||||
(elm)->field.sle_next = (slistelm)->field.sle_next; \
|
||||
(slistelm)->field.sle_next = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define HEIM_SLIST_INSERT_HEAD(head, elm, field) do { \
|
||||
(elm)->field.sle_next = (head)->slh_first; \
|
||||
(head)->slh_first = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define HEIM_SLIST_REMOVE_HEAD(head, field) do { \
|
||||
(head)->slh_first = (head)->slh_first->field.sle_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define HEIM_SLIST_REMOVE(head, elm, type, field) do { \
|
||||
if ((head)->slh_first == (elm)) { \
|
||||
HEIM_SLIST_REMOVE_HEAD((head), field); \
|
||||
} \
|
||||
else { \
|
||||
struct type *curelm = (head)->slh_first; \
|
||||
while(curelm->field.sle_next != (elm)) \
|
||||
curelm = curelm->field.sle_next; \
|
||||
curelm->field.sle_next = \
|
||||
curelm->field.sle_next->field.sle_next; \
|
||||
} \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define HEIM_SLIST_FOREACH(var, head, field) \
|
||||
for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
|
||||
|
||||
/*
|
||||
* Singly-linked List access methods.
|
||||
*/
|
||||
#define HEIM_SLIST_EMPTY(head) ((head)->slh_first == NULL)
|
||||
#define HEIM_SLIST_FIRST(head) ((head)->slh_first)
|
||||
#define HEIM_SLIST_NEXT(elm, field) ((elm)->field.sle_next)
|
||||
|
||||
/*
|
||||
* Singly-linked List atomic functions.
|
||||
*/
|
||||
#include "heimbase.h"
|
||||
|
||||
#define HEIM_SLIST_ATOMIC_INSERT_HEAD(head, elm, field) do { \
|
||||
(elm)->field.sle_next = \
|
||||
heim_base_exchange_pointer(&(head)->slh_first, (elm)); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define HEIM_SLIST_ATOMIC_FOREACH(var, head, field) \
|
||||
for ((void)heim_base_exchange_pointer(&(var), (head)->slh_first); \
|
||||
(var) != NULL; \
|
||||
(void)heim_base_exchange_pointer(&(var), (var)->field.sle_next))
|
||||
|
||||
/*
|
||||
* Tail queue definitions.
|
||||
*/
|
||||
@@ -146,11 +221,30 @@ struct { \
|
||||
(var); \
|
||||
(var) = ((var)->field.tqe_next))
|
||||
|
||||
#define HEIM_TAILQ_FOREACH_SAFE(var, head, field, next) \
|
||||
for ((var) = ((head)->tqh_first); \
|
||||
(var) != NULL && ((next) = HEIM_TAILQ_NEXT(var, field), 1); \
|
||||
(var) = (next))
|
||||
|
||||
#define HEIM_TAILQ_FOREACH_REVERSE(var, head, headname, field) \
|
||||
for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \
|
||||
(var); \
|
||||
(var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
|
||||
|
||||
#define HEIM_TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev) \
|
||||
for ((var) = HEIM_TAILQ_LAST((head), headname); \
|
||||
(var) && ((prev) = HEIM_TAILQ_PREV((var), headname, field), 1);\
|
||||
(var) = (prev))
|
||||
|
||||
#define HEIM_TAILQ_CONCAT(head1, head2, field) do { \
|
||||
if (!HEIM_TAILQ_EMPTY(head2)) { \
|
||||
*(head1)->tqh_last = (head2)->tqh_first; \
|
||||
(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
|
||||
(head1)->tqh_last = (head2)->tqh_last; \
|
||||
HEIM_TAILQ_INIT((head2)); \
|
||||
} \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
/*
|
||||
* Tail queue access methods.
|
||||
*/
|
||||
|
@@ -157,7 +157,6 @@ mechsrc = \
|
||||
mech/gss_wrap_size_limit.c \
|
||||
mech/gss_inquire_sec_context_by_oid.c \
|
||||
mech/mech_switch.h \
|
||||
mech/mechqueue.h \
|
||||
mech/mech_locl.h \
|
||||
mech/name.h \
|
||||
mech/utils.h
|
||||
|
@@ -173,7 +173,6 @@ mechsrc = \
|
||||
mech/gss_wrap_size_limit.c \
|
||||
mech/gss_inquire_sec_context_by_oid.c \
|
||||
mech/mech_switch.h \
|
||||
mech/mechqueue.h \
|
||||
mech/mech_locl.h \
|
||||
mech/name.h \
|
||||
mech/utils.h
|
||||
|
@@ -52,12 +52,11 @@ release_mech_cred(OM_uint32 *minor, struct _gss_mechanism_cred *mc)
|
||||
void
|
||||
_gss_mg_release_cred(struct _gss_cred *cred)
|
||||
{
|
||||
struct _gss_mechanism_cred *mc;
|
||||
struct _gss_mechanism_cred *mc, *next;
|
||||
OM_uint32 junk;
|
||||
|
||||
while (HEIM_SLIST_FIRST(&cred->gc_mc)) {
|
||||
mc = HEIM_SLIST_FIRST(&cred->gc_mc);
|
||||
HEIM_SLIST_REMOVE_HEAD(&cred->gc_mc, gmc_link);
|
||||
HEIM_TAILQ_FOREACH_SAFE(mc, &cred->gc_mc, gmc_link, next) {
|
||||
HEIM_TAILQ_REMOVE(&cred->gc_mc, mc, gmc_link);
|
||||
release_mech_cred(&junk, mc);
|
||||
}
|
||||
free(cred);
|
||||
@@ -70,7 +69,7 @@ _gss_mg_alloc_cred(void)
|
||||
cred = calloc(1, sizeof(struct _gss_cred));
|
||||
if (cred == NULL)
|
||||
return NULL;
|
||||
HEIM_SLIST_INIT(&cred->gc_mc);
|
||||
HEIM_TAILQ_INIT(&cred->gc_mc);
|
||||
|
||||
return cred;
|
||||
}
|
||||
@@ -81,20 +80,17 @@ gss_release_cred_by_mech(OM_uint32 *minor_status,
|
||||
gss_const_OID mech_oid)
|
||||
{
|
||||
struct _gss_cred *cred = (struct _gss_cred *)cred_handle;
|
||||
struct _gss_mechanism_cred *mc;
|
||||
OM_uint32 major_status;
|
||||
struct _gss_mechanism_cred *mc, *next;
|
||||
OM_uint32 major_status = GSS_S_NO_CRED;
|
||||
|
||||
HEIM_SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) {
|
||||
if (gss_oid_equal(mech_oid, mc->gmc_mech_oid))
|
||||
break;
|
||||
}
|
||||
*minor_status = 0;
|
||||
|
||||
if (mc) {
|
||||
HEIM_SLIST_REMOVE(&cred->gc_mc, mc, _gss_mechanism_cred, gmc_link);
|
||||
major_status = release_mech_cred(minor_status, mc);
|
||||
} else {
|
||||
*minor_status = 0;
|
||||
major_status = GSS_S_NO_CRED;
|
||||
HEIM_TAILQ_FOREACH_SAFE(mc, &cred->gc_mc, gmc_link, next) {
|
||||
if (gss_oid_equal(mech_oid, mc->gmc_mech_oid)) {
|
||||
HEIM_TAILQ_REMOVE(&cred->gc_mc, mc, gmc_link);
|
||||
major_status = release_mech_cred(minor_status, mc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return major_status;
|
||||
|
@@ -28,12 +28,12 @@
|
||||
*/
|
||||
|
||||
struct _gss_mechanism_cred {
|
||||
HEIM_SLIST_ENTRY(_gss_mechanism_cred) gmc_link;
|
||||
HEIM_TAILQ_ENTRY(_gss_mechanism_cred) gmc_link;
|
||||
gssapi_mech_interface gmc_mech; /* mechanism ops for MC */
|
||||
gss_OID gmc_mech_oid; /* mechanism oid for MC */
|
||||
gss_cred_id_t gmc_cred; /* underlying MC */
|
||||
};
|
||||
HEIM_SLIST_HEAD(_gss_mechanism_cred_list, _gss_mechanism_cred);
|
||||
HEIM_TAILQ_HEAD(_gss_mechanism_cred_list, _gss_mechanism_cred);
|
||||
|
||||
struct _gss_cred {
|
||||
struct _gss_mechanism_cred_list gc_mc;
|
||||
|
@@ -209,7 +209,7 @@ gss_accept_sec_context(OM_uint32 *minor_status,
|
||||
}
|
||||
|
||||
if (cred) {
|
||||
HEIM_SLIST_FOREACH(mc, &cred->gc_mc, gmc_link)
|
||||
HEIM_TAILQ_FOREACH(mc, &cred->gc_mc, gmc_link)
|
||||
if (mc->gmc_mech == m)
|
||||
break;
|
||||
if (!mc) {
|
||||
@@ -295,7 +295,7 @@ gss_accept_sec_context(OM_uint32 *minor_status,
|
||||
dmc->gmc_mech = m;
|
||||
dmc->gmc_mech_oid = &m->gm_mech_oid;
|
||||
dmc->gmc_cred = delegated_mc;
|
||||
HEIM_SLIST_INSERT_HEAD(&dcred->gc_mc, dmc, gmc_link);
|
||||
HEIM_TAILQ_INSERT_TAIL(&dcred->gc_mc, dmc, gmc_link);
|
||||
|
||||
*delegated_cred_handle = (gss_cred_id_t) dcred;
|
||||
}
|
||||
|
@@ -219,7 +219,7 @@ gss_acquire_cred_from(OM_uint32 *minor_status,
|
||||
continue;
|
||||
}
|
||||
|
||||
HEIM_SLIST_INSERT_HEAD(&cred->gc_mc, mc, gmc_link);
|
||||
HEIM_TAILQ_INSERT_TAIL(&cred->gc_mc, mc, gmc_link);
|
||||
|
||||
if (cred_time < min_time)
|
||||
min_time = cred_time;
|
||||
@@ -236,7 +236,7 @@ gss_acquire_cred_from(OM_uint32 *minor_status,
|
||||
* If we didn't manage to create a single credential, return
|
||||
* an error.
|
||||
*/
|
||||
if (!HEIM_SLIST_FIRST(&cred->gc_mc)) {
|
||||
if (!HEIM_TAILQ_FIRST(&cred->gc_mc)) {
|
||||
if (mechs->count > 1) {
|
||||
*minor_status = 0;
|
||||
major_status = GSS_S_NO_CRED;
|
||||
|
@@ -175,7 +175,7 @@ gss_add_cred_from(OM_uint32 *minor_status,
|
||||
* mechanism. If it matches, we call gss_add_cred for that mechanism,
|
||||
* otherwise we just add a new mc.
|
||||
*/
|
||||
HEIM_SLIST_FOREACH(mc, &mut_cred->gc_mc, gmc_link) {
|
||||
HEIM_TAILQ_FOREACH(mc, &mut_cred->gc_mc, gmc_link) {
|
||||
if (!gss_oid_equal(mc->gmc_mech_oid, desired_mech))
|
||||
continue;
|
||||
major_status = _gss_mg_add_mech_cred(minor_status, m,
|
||||
@@ -196,7 +196,7 @@ gss_add_cred_from(OM_uint32 *minor_status,
|
||||
_gss_mg_error(m, *minor_status);
|
||||
goto done;
|
||||
}
|
||||
HEIM_SLIST_INSERT_HEAD(&mut_cred->gc_mc, new_mc, gmc_link);
|
||||
HEIM_TAILQ_INSERT_TAIL(&mut_cred->gc_mc, new_mc, gmc_link);
|
||||
new_mc = NULL;
|
||||
|
||||
done:
|
||||
|
@@ -45,7 +45,7 @@ mech_authorize_localname(OM_uint32 *minor_status,
|
||||
OM_uint32 major_status = GSS_S_NAME_NOT_MN;
|
||||
struct _gss_mechanism_name *mn;
|
||||
|
||||
HEIM_SLIST_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
HEIM_TAILQ_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
gssapi_mech_interface m = mn->gmn_mech;
|
||||
|
||||
if (m->gm_authorize_localname == NULL) {
|
||||
@@ -134,7 +134,7 @@ gss_authorize_localname(OM_uint32 *minor_status,
|
||||
* not possible to make this check.
|
||||
*/
|
||||
#if 0
|
||||
if (HEIM_SLIST_FIRST(&user->gn_mn) != NULL)
|
||||
if (HEIM_TAILQ_FIRST(&user->gn_mn) != NULL)
|
||||
return GSS_S_BAD_NAME;
|
||||
#endif
|
||||
|
||||
|
@@ -57,7 +57,7 @@ gss_compare_name(OM_uint32 *minor_status,
|
||||
struct _gss_mechanism_name *mn1;
|
||||
struct _gss_mechanism_name *mn2;
|
||||
|
||||
HEIM_SLIST_FOREACH(mn1, &name1->gn_mn, gmn_link) {
|
||||
HEIM_TAILQ_FOREACH(mn1, &name1->gn_mn, gmn_link) {
|
||||
OM_uint32 major_status;
|
||||
|
||||
major_status = _gss_find_mn(minor_status, name2,
|
||||
@@ -70,7 +70,7 @@ gss_compare_name(OM_uint32 *minor_status,
|
||||
name_equal));
|
||||
}
|
||||
}
|
||||
HEIM_SLIST_FOREACH(mn2, &name2->gn_mn, gmn_link) {
|
||||
HEIM_TAILQ_FOREACH(mn2, &name2->gn_mn, gmn_link) {
|
||||
OM_uint32 major_status;
|
||||
|
||||
major_status = _gss_find_mn(minor_status, name1,
|
||||
|
@@ -63,7 +63,7 @@ gss_export_cred(OM_uint32 * minor_status,
|
||||
return GSS_S_NO_CRED;
|
||||
}
|
||||
|
||||
HEIM_SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) {
|
||||
HEIM_TAILQ_FOREACH(mc, &cred->gc_mc, gmc_link) {
|
||||
if (mc->gmc_mech->gm_export_cred == NULL) {
|
||||
*minor_status = 0;
|
||||
return GSS_S_NO_CRED;
|
||||
@@ -76,7 +76,7 @@ gss_export_cred(OM_uint32 * minor_status,
|
||||
return GSS_S_FAILURE;
|
||||
}
|
||||
|
||||
HEIM_SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) {
|
||||
HEIM_TAILQ_FOREACH(mc, &cred->gc_mc, gmc_link) {
|
||||
|
||||
major = mc->gmc_mech->gm_export_cred(minor_status,
|
||||
mc->gmc_cred, &buffer);
|
||||
@@ -201,12 +201,12 @@ gss_import_cred(OM_uint32 * minor_status,
|
||||
mc->gmc_mech_oid = &m->gm_mech_oid;
|
||||
mc->gmc_cred = mcred;
|
||||
|
||||
HEIM_SLIST_INSERT_HEAD(&cred->gc_mc, mc, gmc_link);
|
||||
HEIM_TAILQ_INSERT_TAIL(&cred->gc_mc, mc, gmc_link);
|
||||
}
|
||||
krb5_storage_free(sp);
|
||||
sp = NULL;
|
||||
|
||||
if (HEIM_SLIST_EMPTY(&cred->gc_mc)) {
|
||||
if (HEIM_TAILQ_EMPTY(&cred->gc_mc)) {
|
||||
major = GSS_S_NO_CRED;
|
||||
goto out;
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ gss_delete_name_attribute(OM_uint32 *minor_status,
|
||||
if (input_name == GSS_C_NO_NAME)
|
||||
return GSS_S_BAD_NAME;
|
||||
|
||||
HEIM_SLIST_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
HEIM_TAILQ_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
gssapi_mech_interface m = mn->gmn_mech;
|
||||
|
||||
if (!m->gm_delete_name_attribute)
|
||||
|
@@ -34,7 +34,8 @@ gss_destroy_cred(void *status,
|
||||
gss_cred_id_t *cred_handle)
|
||||
{
|
||||
struct _gss_cred *cred;
|
||||
struct _gss_mechanism_cred *mc;
|
||||
struct _gss_mechanism_cred *mc, *next;
|
||||
|
||||
OM_uint32 junk;
|
||||
|
||||
if (cred_handle == NULL)
|
||||
@@ -45,9 +46,8 @@ gss_destroy_cred(void *status,
|
||||
cred = (struct _gss_cred *)*cred_handle;
|
||||
*cred_handle = GSS_C_NO_CREDENTIAL;
|
||||
|
||||
while (HEIM_SLIST_FIRST(&cred->gc_mc)) {
|
||||
mc = HEIM_SLIST_FIRST(&cred->gc_mc);
|
||||
HEIM_SLIST_REMOVE_HEAD(&cred->gc_mc, gmc_link);
|
||||
HEIM_TAILQ_FOREACH_SAFE(mc, &cred->gc_mc, gmc_link, next) {
|
||||
HEIM_TAILQ_REMOVE(&cred->gc_mc, mc, gmc_link);
|
||||
if (mc->gmc_mech->gm_destroy_cred)
|
||||
mc->gmc_mech->gm_destroy_cred(&junk, &mc->gmc_cred);
|
||||
else
|
||||
|
@@ -67,7 +67,7 @@ gss_display_name(OM_uint32 *minor_status,
|
||||
*minor_status = 0;
|
||||
return (GSS_S_COMPLETE);
|
||||
} else {
|
||||
HEIM_SLIST_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
HEIM_TAILQ_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
major_status = mn->gmn_mech->gm_display_name(
|
||||
minor_status, mn->gmn_name,
|
||||
output_name_buffer,
|
||||
|
@@ -48,7 +48,7 @@ gss_display_name_ext(OM_uint32 *minor_status,
|
||||
if (input_name == GSS_C_NO_NAME)
|
||||
return GSS_S_BAD_NAME;
|
||||
|
||||
HEIM_SLIST_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
HEIM_TAILQ_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
gssapi_mech_interface m = mn->gmn_mech;
|
||||
|
||||
if (!m->gm_display_name_ext)
|
||||
|
@@ -132,14 +132,14 @@ gss_duplicate_cred(OM_uint32 *minor_status,
|
||||
*minor_status = 0;
|
||||
major_status = GSS_S_NO_CRED;
|
||||
|
||||
HEIM_SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) {
|
||||
HEIM_TAILQ_FOREACH(mc, &cred->gc_mc, gmc_link) {
|
||||
struct _gss_mechanism_cred *copy_mc;
|
||||
|
||||
major_status = copy_cred_element(minor_status, mc, ©_mc);
|
||||
if (major_status != GSS_S_COMPLETE)
|
||||
break;
|
||||
|
||||
HEIM_SLIST_INSERT_HEAD(&new_cred->gc_mc, copy_mc, gmc_link);
|
||||
HEIM_TAILQ_INSERT_TAIL(&new_cred->gc_mc, copy_mc, gmc_link);
|
||||
}
|
||||
|
||||
if (major_status != GSS_S_COMPLETE) {
|
||||
|
@@ -53,7 +53,7 @@ gss_duplicate_name(OM_uint32 *minor_status,
|
||||
return (major_status);
|
||||
new_name = (struct _gss_name *) *dest_name;
|
||||
|
||||
HEIM_SLIST_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
HEIM_TAILQ_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
struct _gss_mechanism_name *mn2;
|
||||
_gss_find_mn(minor_status, new_name,
|
||||
mn->gmn_mech_oid, &mn2);
|
||||
@@ -66,7 +66,7 @@ gss_duplicate_name(OM_uint32 *minor_status,
|
||||
}
|
||||
*dest_name = (gss_name_t) new_name;
|
||||
|
||||
HEIM_SLIST_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
HEIM_TAILQ_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
struct _gss_mechanism_name *new_mn;
|
||||
|
||||
new_mn = malloc(sizeof(*new_mn));
|
||||
@@ -84,7 +84,7 @@ gss_duplicate_name(OM_uint32 *minor_status,
|
||||
free(new_mn);
|
||||
continue;
|
||||
}
|
||||
HEIM_SLIST_INSERT_HEAD(&new_name->gn_mn, new_mn, gmn_link);
|
||||
HEIM_TAILQ_INSERT_TAIL(&new_name->gn_mn, new_mn, gmn_link);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -57,7 +57,7 @@ gss_export_name(OM_uint32 *minor_status,
|
||||
* one, otherwise export based on the first mechanism in our
|
||||
* list.
|
||||
*/
|
||||
mn = HEIM_SLIST_FIRST(&name->gn_mn);
|
||||
mn = HEIM_TAILQ_FIRST(&name->gn_mn);
|
||||
if (!mn) {
|
||||
*minor_status = 0;
|
||||
return (GSS_S_NAME_NOT_MN);
|
||||
|
@@ -47,7 +47,7 @@ gss_export_name_composite(OM_uint32 *minor_status,
|
||||
if (input_name == GSS_C_NO_NAME)
|
||||
return GSS_S_BAD_NAME;
|
||||
|
||||
HEIM_SLIST_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
HEIM_TAILQ_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
gssapi_mech_interface m = mn->gmn_mech;
|
||||
|
||||
if (!m->gm_export_name_composite)
|
||||
|
@@ -57,7 +57,7 @@ gss_get_name_attribute(OM_uint32 *minor_status,
|
||||
if (input_name == GSS_C_NO_NAME)
|
||||
return GSS_S_BAD_NAME;
|
||||
|
||||
HEIM_SLIST_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
HEIM_TAILQ_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
gssapi_mech_interface m = mn->gmn_mech;
|
||||
|
||||
if (!m->gm_get_name_attribute)
|
||||
|
@@ -68,7 +68,7 @@ gss_get_neg_mechs (OM_uint32 *minor_status,
|
||||
|
||||
major = GSS_S_UNAVAILABLE;
|
||||
|
||||
HEIM_SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) {
|
||||
HEIM_TAILQ_FOREACH(mc, &cred->gc_mc, gmc_link) {
|
||||
gssapi_mech_interface m;
|
||||
gss_OID_set mechs2 = GSS_C_NO_OID_SET;
|
||||
size_t i;
|
||||
|
@@ -221,8 +221,6 @@ gss_import_name(OM_uint32 *minor_status,
|
||||
return (GSS_S_FAILURE);
|
||||
}
|
||||
|
||||
HEIM_SLIST_INIT(&name->gn_mn);
|
||||
|
||||
major_status = _gss_intern_oid(minor_status,
|
||||
name_type, &name->gn_type);
|
||||
if (major_status) {
|
||||
@@ -241,7 +239,7 @@ gss_import_name(OM_uint32 *minor_status,
|
||||
* for those supported this nametype.
|
||||
*/
|
||||
|
||||
HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
HEIM_TAILQ_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
int present = 0;
|
||||
|
||||
major_status = gss_test_oid_set_member(minor_status,
|
||||
@@ -276,14 +274,14 @@ gss_import_name(OM_uint32 *minor_status,
|
||||
|
||||
mn->gmn_mech = &m->gm_mech;
|
||||
mn->gmn_mech_oid = m->gm_mech_oid;
|
||||
HEIM_SLIST_INSERT_HEAD(&name->gn_mn, mn, gmn_link);
|
||||
HEIM_TAILQ_INSERT_TAIL(&name->gn_mn, mn, gmn_link);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we can't find a mn for the name, bail out already here.
|
||||
*/
|
||||
|
||||
mn = HEIM_SLIST_FIRST(&name->gn_mn);
|
||||
mn = HEIM_TAILQ_FIRST(&name->gn_mn);
|
||||
if (!mn) {
|
||||
*minor_status = 0;
|
||||
major_status = GSS_S_NAME_NOT_MN;
|
||||
|
@@ -44,7 +44,7 @@ gss_indicate_mechs(OM_uint32 *minor_status,
|
||||
return (major_status);
|
||||
|
||||
/* XXX We ignore ENOMEM from gss_add_oid_set_member() */
|
||||
HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
HEIM_TAILQ_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
if (m->gm_mech.gm_indicate_mechs) {
|
||||
major_status = m->gm_mech.gm_indicate_mechs(
|
||||
minor_status, &set);
|
||||
|
@@ -39,7 +39,7 @@ _gss_mech_cred_find(gss_const_cred_id_t cred_handle, gss_OID mech_type)
|
||||
if (cred == NULL)
|
||||
return GSS_C_NO_CREDENTIAL;
|
||||
|
||||
HEIM_SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) {
|
||||
HEIM_TAILQ_FOREACH(mc, &cred->gc_mc, gmc_link) {
|
||||
if (gss_oid_equal(mech_type, mc->gmc_mech_oid))
|
||||
return mc->gmc_cred;
|
||||
}
|
||||
|
@@ -95,7 +95,7 @@ gss_inquire_cred(OM_uint32 *minor_status,
|
||||
if (cred) {
|
||||
struct _gss_mechanism_cred *mc;
|
||||
|
||||
HEIM_SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) {
|
||||
HEIM_TAILQ_FOREACH(mc, &cred->gc_mc, gmc_link) {
|
||||
gss_name_t mc_name;
|
||||
OM_uint32 mc_lifetime;
|
||||
|
||||
@@ -118,7 +118,7 @@ gss_inquire_cred(OM_uint32 *minor_status,
|
||||
mn->gmn_mech = mc->gmc_mech;
|
||||
mn->gmn_mech_oid = mc->gmc_mech_oid;
|
||||
mn->gmn_name = mc_name;
|
||||
HEIM_SLIST_INSERT_HEAD(&name->gn_mn, mn, gmn_link);
|
||||
HEIM_TAILQ_INSERT_TAIL(&name->gn_mn, mn, gmn_link);
|
||||
} else {
|
||||
mc->gmc_mech->gm_release_name(minor_status,
|
||||
&mc_name);
|
||||
@@ -133,7 +133,7 @@ gss_inquire_cred(OM_uint32 *minor_status,
|
||||
found++;
|
||||
}
|
||||
} else {
|
||||
HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
HEIM_TAILQ_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
gss_name_t mc_name;
|
||||
OM_uint32 mc_lifetime;
|
||||
|
||||
@@ -158,7 +158,7 @@ gss_inquire_cred(OM_uint32 *minor_status,
|
||||
mn->gmn_mech = &m->gm_mech;
|
||||
mn->gmn_mech_oid = m->gm_mech_oid;
|
||||
mn->gmn_name = mc_name;
|
||||
HEIM_SLIST_INSERT_HEAD(&name->gn_mn, mn, gmn_link);
|
||||
HEIM_TAILQ_INSERT_TAIL(&name->gn_mn, mn, gmn_link);
|
||||
} else if (mc_name) {
|
||||
m->gm_mech.gm_release_name(minor_status,
|
||||
&mc_name);
|
||||
|
@@ -60,7 +60,7 @@ gss_inquire_cred_by_mech(OM_uint32 *minor_status,
|
||||
|
||||
if (cred_handle != GSS_C_NO_CREDENTIAL) {
|
||||
struct _gss_cred *cred = (struct _gss_cred *) cred_handle;
|
||||
HEIM_SLIST_FOREACH(mcp, &cred->gc_mc, gmc_link)
|
||||
HEIM_TAILQ_FOREACH(mcp, &cred->gc_mc, gmc_link)
|
||||
if (mcp->gmc_mech == m)
|
||||
break;
|
||||
if (!mcp)
|
||||
|
@@ -52,7 +52,7 @@ gss_inquire_cred_by_oid (OM_uint32 *minor_status,
|
||||
|
||||
status = GSS_S_FAILURE;
|
||||
|
||||
HEIM_SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) {
|
||||
HEIM_TAILQ_FOREACH(mc, &cred->gc_mc, gmc_link) {
|
||||
gss_buffer_set_t rset = GSS_C_NO_BUFFER_SET;
|
||||
size_t i;
|
||||
|
||||
|
@@ -52,7 +52,7 @@ gss_inquire_mechs_for_name(OM_uint32 *minor_status,
|
||||
* name's type is supported by the mechanism. If it is, add
|
||||
* the mechanism to the set.
|
||||
*/
|
||||
HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
HEIM_TAILQ_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
major_status = gss_inquire_names_for_mech(minor_status,
|
||||
m->gm_mech_oid, &name_types);
|
||||
if (major_status) {
|
||||
|
@@ -54,7 +54,7 @@ gss_inquire_name(OM_uint32 *minor_status,
|
||||
if (input_name == GSS_C_NO_NAME)
|
||||
return GSS_S_BAD_NAME;
|
||||
|
||||
HEIM_SLIST_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
HEIM_TAILQ_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
gssapi_mech_interface m = mn->gmn_mech;
|
||||
|
||||
if (!m->gm_inquire_name)
|
||||
|
@@ -225,7 +225,7 @@ gsskrb5_set_dns_canonicalize(int flag)
|
||||
buffer.value = &b;
|
||||
buffer.length = sizeof(b);
|
||||
|
||||
HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
HEIM_TAILQ_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
if (m->gm_mech.gm_set_sec_context_option == NULL)
|
||||
continue;
|
||||
m->gm_mech.gm_set_sec_context_option(&junk, NULL,
|
||||
@@ -500,7 +500,7 @@ gsskrb5_set_send_to_kdc(struct gsskrb5_send_to_kdc *c)
|
||||
buffer.length = 0;
|
||||
}
|
||||
|
||||
HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
HEIM_TAILQ_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
if (m->gm_mech.gm_set_sec_context_option == NULL)
|
||||
continue;
|
||||
m->gm_mech.gm_set_sec_context_option(&junk, NULL,
|
||||
@@ -535,7 +535,7 @@ gss_krb5_ccache_name(OM_uint32 *minor_status,
|
||||
_mg_buffer_zero(&buffer);
|
||||
}
|
||||
|
||||
HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
HEIM_TAILQ_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
if (m->gm_mech.gm_set_sec_context_option == NULL)
|
||||
continue;
|
||||
m->gm_mech.gm_set_sec_context_option(&junk, NULL,
|
||||
@@ -823,7 +823,7 @@ gsskrb5_set_default_realm(const char *realm)
|
||||
buffer.value = rk_UNCONST(realm);
|
||||
buffer.length = strlen(realm);
|
||||
|
||||
HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
HEIM_TAILQ_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
if (m->gm_mech.gm_set_sec_context_option == NULL)
|
||||
continue;
|
||||
m->gm_mech.gm_set_sec_context_option(&junk, NULL,
|
||||
@@ -885,7 +885,7 @@ gsskrb5_set_time_offset(int offset)
|
||||
buffer.value = &o;
|
||||
buffer.length = sizeof(o);
|
||||
|
||||
HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
HEIM_TAILQ_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
if (m->gm_mech.gm_set_sec_context_option == NULL)
|
||||
continue;
|
||||
m->gm_mech.gm_set_sec_context_option(&junk, NULL,
|
||||
@@ -908,7 +908,7 @@ gsskrb5_get_time_offset(int *offset)
|
||||
buffer.value = &o;
|
||||
buffer.length = sizeof(o);
|
||||
|
||||
HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
HEIM_TAILQ_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
if (m->gm_mech.gm_set_sec_context_option == NULL)
|
||||
continue;
|
||||
maj_stat = m->gm_mech.gm_set_sec_context_option(&junk, NULL,
|
||||
@@ -935,7 +935,7 @@ gsskrb5_plugin_register(struct gsskrb5_krb5_plugin *c)
|
||||
buffer.value = c;
|
||||
buffer.length = sizeof(*c);
|
||||
|
||||
HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
HEIM_TAILQ_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
if (m->gm_mech.gm_set_sec_context_option == NULL)
|
||||
continue;
|
||||
m->gm_mech.gm_set_sec_context_option(&junk, NULL,
|
||||
|
@@ -33,7 +33,7 @@
|
||||
#define _PATH_GSS_MECH "/etc/gss/mech"
|
||||
#endif
|
||||
|
||||
struct _gss_mech_switch_list _gss_mechs = { NULL } ;
|
||||
struct _gss_mech_switch_list _gss_mechs = { NULL, NULL } ;
|
||||
gss_OID_set _gss_mech_oids;
|
||||
static HEIMDAL_MUTEX _gss_mech_mutex = HEIMDAL_MUTEX_INITIALIZER;
|
||||
|
||||
@@ -233,10 +233,18 @@ add_builtin(gssapi_mech_interface mech)
|
||||
if (m->gm_name_types == NULL)
|
||||
gss_create_empty_oid_set(&minor_status, &m->gm_name_types);
|
||||
|
||||
HEIM_SLIST_INSERT_HEAD(&_gss_mechs, m, gm_link);
|
||||
HEIM_TAILQ_INSERT_TAIL(&_gss_mechs, m, gm_link);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
init_mech_switch_list(void *p)
|
||||
{
|
||||
struct _gss_mech_switch_list *mechs = p;
|
||||
|
||||
HEIM_TAILQ_INIT(mechs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Load the mechanisms file (/etc/gss/mech).
|
||||
*/
|
||||
@@ -244,6 +252,7 @@ void
|
||||
_gss_load_mech(void)
|
||||
{
|
||||
OM_uint32 major_status, minor_status;
|
||||
static heim_base_once_t once = HEIM_BASE_ONCE_INIT;
|
||||
#ifdef HAVE_DLOPEN
|
||||
FILE *fp;
|
||||
char buf[256];
|
||||
@@ -255,10 +264,11 @@ _gss_load_mech(void)
|
||||
int found;
|
||||
#endif
|
||||
|
||||
heim_base_once_f(&once, &_gss_mechs, init_mech_switch_list);
|
||||
|
||||
HEIMDAL_MUTEX_lock(&_gss_mech_mutex);
|
||||
|
||||
if (HEIM_SLIST_FIRST(&_gss_mechs)) {
|
||||
if (!HEIM_TAILQ_EMPTY(&_gss_mechs)) {
|
||||
HEIMDAL_MUTEX_unlock(&_gss_mech_mutex);
|
||||
return;
|
||||
}
|
||||
@@ -305,7 +315,7 @@ _gss_load_mech(void)
|
||||
* Check for duplicates, already loaded mechs.
|
||||
*/
|
||||
found = 0;
|
||||
HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
HEIM_TAILQ_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
if (gss_oid_equal(&m->gm_mech.gm_mech_oid, mech_oid)) {
|
||||
found = 1;
|
||||
break;
|
||||
@@ -424,7 +434,7 @@ _gss_load_mech(void)
|
||||
if (m->gm_name_types == NULL)
|
||||
gss_create_empty_oid_set(&minor_status, &m->gm_name_types);
|
||||
|
||||
HEIM_SLIST_INSERT_HEAD(&_gss_mechs, m, gm_link);
|
||||
HEIM_TAILQ_INSERT_TAIL(&_gss_mechs, m, gm_link);
|
||||
continue;
|
||||
|
||||
bad:
|
||||
@@ -448,7 +458,7 @@ __gss_get_mechanism(gss_const_OID mech)
|
||||
struct _gss_mech_switch *m;
|
||||
|
||||
_gss_load_mech();
|
||||
HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
HEIM_TAILQ_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
if (gss_oid_equal(&m->gm_mech.gm_mech_oid, mech))
|
||||
return &m->gm_mech;
|
||||
}
|
||||
@@ -461,7 +471,7 @@ _gss_mg_support_mechanism(gss_const_OID mech)
|
||||
struct _gss_mech_switch *m;
|
||||
|
||||
_gss_load_mech();
|
||||
HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
HEIM_TAILQ_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
if (gss_oid_equal(&m->gm_mech.gm_mech_oid, mech))
|
||||
return m->gm_mech_oid;
|
||||
}
|
||||
|
@@ -353,7 +353,7 @@ gss_inquire_mech_for_saslname(OM_uint32 *minor_status,
|
||||
|
||||
*mech_type = NULL;
|
||||
|
||||
HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
HEIM_TAILQ_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
struct gss_mech_compat_desc_struct *gmc;
|
||||
|
||||
/* Native SPI */
|
||||
@@ -461,7 +461,7 @@ gss_indicate_mechs_by_attrs(OM_uint32 * minor_status,
|
||||
|
||||
_gss_load_mech();
|
||||
|
||||
HEIM_SLIST_FOREACH(ms, &_gss_mechs, gm_link) {
|
||||
HEIM_TAILQ_FOREACH(ms, &_gss_mechs, gm_link) {
|
||||
gssapi_mech_interface mi = &ms->gm_mech;
|
||||
struct gss_mech_compat_desc_struct *gmc = mi->gm_compat;
|
||||
OM_uint32 tmp;
|
||||
@@ -560,7 +560,7 @@ gss_inquire_attrs_for_mech(OM_uint32 * minor_status,
|
||||
|
||||
_gss_load_mech();
|
||||
|
||||
HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link)
|
||||
HEIM_TAILQ_FOREACH(m, &_gss_mechs, gm_link)
|
||||
add_all_mo(&m->gm_mech, known_mech_attrs, GSS_MO_MA);
|
||||
}
|
||||
|
||||
|
@@ -46,7 +46,7 @@ _gss_find_mn(OM_uint32 *minor_status,
|
||||
if (name == NULL)
|
||||
return GSS_S_COMPLETE;
|
||||
|
||||
HEIM_SLIST_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
HEIM_TAILQ_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
if (gss_oid_equal(mech, mn->gmn_mech_oid))
|
||||
break;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ _gss_find_mn(OM_uint32 *minor_status,
|
||||
|
||||
mn->gmn_mech = m;
|
||||
mn->gmn_mech_oid = &m->gm_mech_oid;
|
||||
HEIM_SLIST_INSERT_HEAD(&name->gn_mn, mn, gmn_link);
|
||||
HEIM_TAILQ_INSERT_TAIL(&name->gn_mn, mn, gmn_link);
|
||||
}
|
||||
*output_mn = mn;
|
||||
return 0;
|
||||
@@ -100,7 +100,7 @@ _gss_create_name(gss_name_t new_mn,
|
||||
if (!name)
|
||||
return (0);
|
||||
|
||||
HEIM_SLIST_INIT(&name->gn_mn);
|
||||
HEIM_TAILQ_INIT(&name->gn_mn);
|
||||
|
||||
if (new_mn) {
|
||||
mn = malloc(sizeof(struct _gss_mechanism_name));
|
||||
@@ -112,7 +112,7 @@ _gss_create_name(gss_name_t new_mn,
|
||||
mn->gmn_mech = m;
|
||||
mn->gmn_mech_oid = &m->gm_mech_oid;
|
||||
mn->gmn_name = new_mn;
|
||||
HEIM_SLIST_INSERT_HEAD(&name->gn_mn, mn, gmn_link);
|
||||
HEIM_TAILQ_INSERT_TAIL(&name->gn_mn, mn, gmn_link);
|
||||
}
|
||||
|
||||
return (name);
|
||||
@@ -126,13 +126,12 @@ void
|
||||
_gss_mg_release_name(struct _gss_name *name)
|
||||
{
|
||||
OM_uint32 junk;
|
||||
struct _gss_mechanism_name *mn, *next;
|
||||
|
||||
gss_release_oid(&junk, &name->gn_type);
|
||||
|
||||
while (HEIM_SLIST_FIRST(&name->gn_mn)) {
|
||||
struct _gss_mechanism_name *mn;
|
||||
mn = HEIM_SLIST_FIRST(&name->gn_mn);
|
||||
HEIM_SLIST_REMOVE_HEAD(&name->gn_mn, gmn_link);
|
||||
HEIM_TAILQ_FOREACH_SAFE(mn, &name->gn_mn, gmn_link, next) {
|
||||
HEIM_TAILQ_REMOVE(&name->gn_mn, mn, gmn_link);
|
||||
mn->gmn_mech->gm_release_name(&junk, &mn->gmn_name);
|
||||
free(mn);
|
||||
}
|
||||
|
@@ -120,7 +120,7 @@ gss_localname(OM_uint32 *minor_status,
|
||||
if (major_status != GSS_S_COMPLETE)
|
||||
major_status = attr_localname(minor_status, mn, localname);
|
||||
} else {
|
||||
HEIM_SLIST_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
HEIM_TAILQ_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
major_status = mech_localname(minor_status, mn, localname);
|
||||
if (major_status != GSS_S_COMPLETE)
|
||||
major_status = attr_localname(minor_status, mn, localname);
|
||||
|
@@ -56,7 +56,7 @@ gss_set_cred_option (OM_uint32 *minor_status,
|
||||
return GSS_S_FAILURE;
|
||||
}
|
||||
|
||||
HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
HEIM_TAILQ_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
|
||||
if (m->gm_mech.gm_set_cred_option == NULL)
|
||||
continue;
|
||||
@@ -81,7 +81,7 @@ gss_set_cred_option (OM_uint32 *minor_status,
|
||||
continue;
|
||||
}
|
||||
one_ok = 1;
|
||||
HEIM_SLIST_INSERT_HEAD(&cred->gc_mc, mc, gmc_link);
|
||||
HEIM_TAILQ_INSERT_TAIL(&cred->gc_mc, mc, gmc_link);
|
||||
}
|
||||
*cred_handle = (gss_cred_id_t)cred;
|
||||
if (!one_ok) {
|
||||
@@ -91,7 +91,7 @@ gss_set_cred_option (OM_uint32 *minor_status,
|
||||
} else {
|
||||
gssapi_mech_interface m;
|
||||
|
||||
HEIM_SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) {
|
||||
HEIM_TAILQ_FOREACH(mc, &cred->gc_mc, gmc_link) {
|
||||
m = mc->gmc_mech;
|
||||
|
||||
if (m == NULL)
|
||||
|
@@ -48,7 +48,7 @@ gss_set_name_attribute(OM_uint32 *minor_status,
|
||||
if (input_name == GSS_C_NO_NAME)
|
||||
return GSS_S_BAD_NAME;
|
||||
|
||||
HEIM_SLIST_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
HEIM_TAILQ_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||
gssapi_mech_interface m = mn->gmn_mech;
|
||||
|
||||
if (!m->gm_set_name_attribute)
|
||||
|
@@ -55,7 +55,7 @@ gss_set_neg_mechs (OM_uint32 *minor_status,
|
||||
if (cred == NULL) {
|
||||
struct _gss_mech_switch *m;
|
||||
|
||||
HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
HEIM_TAILQ_FOREACH(m, &_gss_mechs, gm_link) {
|
||||
if (m->gm_mech.gm_set_neg_mechs == NULL)
|
||||
continue;
|
||||
major = m->gm_mech.gm_set_neg_mechs(minor_status,
|
||||
@@ -68,7 +68,7 @@ gss_set_neg_mechs (OM_uint32 *minor_status,
|
||||
} else {
|
||||
struct _gss_mechanism_cred *mc;
|
||||
|
||||
HEIM_SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) {
|
||||
HEIM_TAILQ_FOREACH(mc, &cred->gc_mc, gmc_link) {
|
||||
gssapi_mech_interface m;
|
||||
|
||||
m = mc->gmc_mech;
|
||||
|
@@ -107,7 +107,7 @@ gss_store_cred_into(OM_uint32 *minor_status,
|
||||
major_status = GSS_S_NO_CRED;
|
||||
successes = 0;
|
||||
|
||||
HEIM_SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) {
|
||||
HEIM_TAILQ_FOREACH(mc, &cred->gc_mc, gmc_link) {
|
||||
gssapi_mech_interface m = mc->gmc_mech;
|
||||
|
||||
if (m == NULL)
|
||||
|
@@ -57,7 +57,7 @@
|
||||
#include <gssapi_mech.h>
|
||||
#include <gssapi_krb5.h>
|
||||
|
||||
#include "mechqueue.h"
|
||||
#include <heimqueue.h>
|
||||
|
||||
#include "context.h"
|
||||
#include "cred.h"
|
||||
|
@@ -30,13 +30,13 @@
|
||||
#include <gssapi_mech.h>
|
||||
|
||||
struct _gss_mech_switch {
|
||||
HEIM_SLIST_ENTRY(_gss_mech_switch) gm_link;
|
||||
HEIM_TAILQ_ENTRY(_gss_mech_switch) gm_link;
|
||||
gss_OID gm_mech_oid;
|
||||
gss_OID_set gm_name_types;
|
||||
void *gm_so;
|
||||
gssapi_mech_interface_desc gm_mech;
|
||||
};
|
||||
HEIM_SLIST_HEAD(_gss_mech_switch_list, _gss_mech_switch);
|
||||
HEIM_TAILQ_HEAD(_gss_mech_switch_list, _gss_mech_switch);
|
||||
extern struct _gss_mech_switch_list _gss_mechs;
|
||||
extern gss_OID_set _gss_mech_oids;
|
||||
|
||||
|
@@ -1,112 +0,0 @@
|
||||
/* $NetBSD: queue.h,v 1.39 2004/04/18 14:25:34 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)queue.h 8.5 (Berkeley) 8/20/94
|
||||
*/
|
||||
|
||||
#ifndef _MECHQUEUE_H_
|
||||
#define _MECHQUEUE_H_
|
||||
|
||||
/*
|
||||
* Singly-linked List definitions.
|
||||
*/
|
||||
#define HEIM_SLIST_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *slh_first; /* first element */ \
|
||||
}
|
||||
|
||||
#define HEIM_SLIST_HEAD_INITIALIZER(head) \
|
||||
{ NULL }
|
||||
|
||||
#define HEIM_SLIST_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *sle_next; /* next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* Singly-linked List functions.
|
||||
*/
|
||||
#define HEIM_SLIST_INIT(head) do { \
|
||||
(head)->slh_first = NULL; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define HEIM_SLIST_INSERT_AFTER(slistelm, elm, field) do { \
|
||||
(elm)->field.sle_next = (slistelm)->field.sle_next; \
|
||||
(slistelm)->field.sle_next = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define HEIM_SLIST_INSERT_HEAD(head, elm, field) do { \
|
||||
(elm)->field.sle_next = (head)->slh_first; \
|
||||
(head)->slh_first = (elm); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define HEIM_SLIST_REMOVE_HEAD(head, field) do { \
|
||||
(head)->slh_first = (head)->slh_first->field.sle_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define HEIM_SLIST_REMOVE(head, elm, type, field) do { \
|
||||
if ((head)->slh_first == (elm)) { \
|
||||
HEIM_SLIST_REMOVE_HEAD((head), field); \
|
||||
} \
|
||||
else { \
|
||||
struct type *curelm = (head)->slh_first; \
|
||||
while(curelm->field.sle_next != (elm)) \
|
||||
curelm = curelm->field.sle_next; \
|
||||
curelm->field.sle_next = \
|
||||
curelm->field.sle_next->field.sle_next; \
|
||||
} \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define HEIM_SLIST_FOREACH(var, head, field) \
|
||||
for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
|
||||
|
||||
/*
|
||||
* Singly-linked List access methods.
|
||||
*/
|
||||
#define HEIM_SLIST_EMPTY(head) ((head)->slh_first == NULL)
|
||||
#define HEIM_SLIST_FIRST(head) ((head)->slh_first)
|
||||
#define HEIM_SLIST_NEXT(elm, field) ((elm)->field.sle_next)
|
||||
|
||||
/*
|
||||
* Singly-linked List atomic functions.
|
||||
*/
|
||||
#include "heimbase.h"
|
||||
|
||||
#define HEIM_SLIST_ATOMIC_INSERT_HEAD(head, elm, field) do { \
|
||||
(elm)->field.sle_next = \
|
||||
heim_base_exchange_pointer(&(head)->slh_first, (elm)); \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define HEIM_SLIST_ATOMIC_FOREACH(var, head, field) \
|
||||
for ((void)heim_base_exchange_pointer(&(var), (head)->slh_first); \
|
||||
(var) != NULL; \
|
||||
(void)heim_base_exchange_pointer(&(var), (var)->field.sle_next))
|
||||
|
||||
#endif /* !_MECHQUEUE_H_ */
|
@@ -28,12 +28,12 @@
|
||||
*/
|
||||
|
||||
struct _gss_mechanism_name {
|
||||
HEIM_SLIST_ENTRY(_gss_mechanism_name) gmn_link;
|
||||
HEIM_TAILQ_ENTRY(_gss_mechanism_name) gmn_link;
|
||||
gssapi_mech_interface gmn_mech; /* mechanism ops for MN */
|
||||
gss_OID gmn_mech_oid; /* mechanism oid for MN */
|
||||
gss_name_t gmn_name; /* underlying MN */
|
||||
};
|
||||
HEIM_SLIST_HEAD(_gss_mechanism_name_list, _gss_mechanism_name);
|
||||
HEIM_TAILQ_HEAD(_gss_mechanism_name_list, _gss_mechanism_name);
|
||||
|
||||
struct _gss_name {
|
||||
gss_OID gn_type; /* type of name */
|
||||
|
Reference in New Issue
Block a user