/*
- * Copyright (c) 2010, JANET(UK)
+ * Copyright (c) 2011, JANET(UK)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "config.h"
+#ifdef HAVE_HEIMDAL_VERSION
+#define KRB5_DEPRECATED /* so we can use krb5_free_unparsed_name() */
+#endif
+
#include <assert.h>
#include <string.h>
#include <errno.h>
/* GSS headers */
#include <gssapi/gssapi.h>
#include <gssapi/gssapi_krb5.h>
+#ifndef HAVE_HEIMDAL_VERSION
#include <gssapi/gssapi_ext.h>
+#endif
#include "gssapi_eap.h"
/* Kerberos headers */
#include <eap_peer/eap.h>
#include <eap_peer/eap_config.h>
#include <eap_peer/eap_methods.h>
+#include <eap_common/eap_common.h>
#include <wpabuf.h>
/* FreeRADIUS headers */
struct gss_eap_saml_attr_ctx;
struct gss_eap_attr_ctx;
-struct gss_name_struct {
+#ifdef HAVE_HEIMDAL_VERSION
+struct gss_name_t_desc_struct
+#else
+struct gss_name_struct
+#endif
+{
GSSEAP_MUTEX mutex; /* mutex protects attrCtx */
OM_uint32 flags;
krb5_principal krbPrincipal; /* this is immutable */
#define CRED_FLAG_DEFAULT_CCACHE 0x00100000
#define CRED_FLAG_PUBLIC_MASK 0x0000FFFF
-struct gss_cred_id_struct {
+#ifdef HAVE_HEIMDAL_VERSION
+struct gss_cred_id_t_desc_struct
+#else
+struct gss_cred_id_struct
+#endif
+{
GSSEAP_MUTEX mutex;
OM_uint32 flags;
gss_name_t name;
#define CTX_IS_INITIATOR(ctx) (((ctx)->flags & CTX_FLAG_INITIATOR) != 0)
enum gss_eap_state {
- GSSEAP_STATE_IDENTITY = 0, /* identify peer */
- GSSEAP_STATE_AUTHENTICATE, /* exchange EAP messages */
- GSSEAP_STATE_EXTENSIONS_REQ, /* initiator extensions */
- GSSEAP_STATE_EXTENSIONS_RESP, /* acceptor extensions */
- GSSEAP_STATE_ESTABLISHED, /* context established */
- GSSEAP_STATE_ERROR, /* context error */
-#ifdef GSSEAP_ENABLE_REAUTH
- GSSEAP_STATE_KRB_REAUTH /* fast reauthentication */
-#endif
+ GSSEAP_STATE_INITIAL = 0x01, /* initial state */
+ GSSEAP_STATE_AUTHENTICATE = 0x02, /* exchange EAP messages */
+ GSSEAP_STATE_NEGO_EXT = 0x04, /* negotiate extensions */
+ GSSEAP_STATE_ESTABLISHED = 0x08, /* context established */
+ GSSEAP_STATE_ALL = 0x0F
+};
+
+#define GSSEAP_STATE_NEXT(s) ((s) << 1)
+
+/* state machine entry */
+struct gss_eap_sm {
+ OM_uint32 inputTokenType;
+ OM_uint32 outputTokenType;
+ enum gss_eap_state validStates;
+ int critical;
+ int required;
+ OM_uint32 (*processToken)(OM_uint32 *,
+ gss_cred_id_t,
+ gss_ctx_id_t,
+ gss_name_t,
+ gss_OID,
+ OM_uint32,
+ OM_uint32,
+ gss_channel_bindings_t,
+ gss_buffer_t,
+ gss_buffer_t);
};
#define CTX_IS_ESTABLISHED(ctx) ((ctx)->state == GSSEAP_STATE_ESTABLISHED)
#define CTX_FLAG_EAP_MASK 0xFFFF0000
struct gss_eap_initiator_ctx {
- gss_cred_id_t defaultCred;
unsigned int idleWhile;
#ifndef __cplusplus
struct eap_peer_config eapPeerConfig;
VALUE_PAIR *vps;
};
-struct gss_ctx_id_struct {
+#ifdef HAVE_HEIMDAL_VERSION
+struct gss_ctx_id_t_desc_struct
+#else
+struct gss_ctx_id_struct
+#endif
+{
GSSEAP_MUTEX mutex;
enum gss_eap_state state;
OM_uint32 flags;
time_t expiryTime;
uint64_t sendSeq, recvSeq;
void *seqState;
+ gss_cred_id_t defaultCred;
union {
struct gss_eap_initiator_ctx initiator;
#define initiatorCtx ctxU.initiator