remove debugging statement
[moonshot.git] / mech_eap / set_sec_context_option.c
index 3e0654b..1f373c2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, JANET(UK)
+ * Copyright (c) 2011, JANET(UK)
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * SUCH DAMAGE.
  */
 
+/*
+ * Set an extended property on a context handle.
+ */
+
 #include "gssapiP_eap.h"
 
+static struct {
+    gss_OID_desc oid;
+    OM_uint32 (*setOption)(OM_uint32 *, gss_ctx_id_t *pCtx,
+                           const gss_OID, const gss_buffer_t);
+} setCtxOps[] = {
+};
+
+OM_uint32
+gss_set_sec_context_option(OM_uint32 *minor,
+                           gss_ctx_id_t *pCtx,
+                           const gss_OID desired_object,
+                           const gss_buffer_t value)
+{
+    OM_uint32 major;
+    gss_ctx_id_t ctx = *pCtx;
+    int i;
+
+    major = GSS_S_UNAVAILABLE;
+    *minor = GSSEAP_BAD_CONTEXT_OPTION;
+
+    if (ctx != GSS_C_NO_CONTEXT)
+        GSSEAP_MUTEX_LOCK(&ctx->mutex);
+
+    for (i = 0; i < sizeof(setCtxOps) / sizeof(setCtxOps[0]); i++) {
+        if (oidEqual(&setCtxOps[i].oid, desired_object)) {
+            major = (*setCtxOps[i].setOption)(minor, &ctx,
+                                              desired_object, value);
+            break;
+        }
+    }
+
+    if (*pCtx == NULL)
+        *pCtx = ctx;
+    else
+        GSSEAP_MUTEX_UNLOCK(&ctx->mutex);
+
+    return major;
+}