ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry/*
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * Copyright 2008 by the Massachusetts Institute of Technology.
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * All Rights Reserved.
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry *
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * Export of this software from the United States of America may
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * require a specific license from the United States Government.
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * It is the responsibility of any person or organization contemplating
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * export to obtain such a license before exporting.
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry *
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * distribute this software and its documentation for any purpose and
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * without fee is hereby granted, provided that the above copyright
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * notice appear in all copies and that both that copyright notice and
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * this permission notice appear in supporting documentation, and that
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * the name of M.I.T. not be used in advertising or publicity pertaining
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * to distribution of the software without specific, written prior
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * permission. Furthermore if you modify this software you must label
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * your software as modified software and not distribute it in such a
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * fashion that it might be confused with the original M.I.T. software.
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * M.I.T. makes no representations about the suitability of
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * this software for any purpose. It is provided "as is" without express
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * or implied warranty.
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry *
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry */
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry/*
5e01956f3000408c2a2c5a08c8d0acf2c2a9d8eeGlenn Barry * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry */
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry/*
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * glue routine for gss_inquire_sec_context_by_oid
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry */
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry#include "mglueP.h"
5e01956f3000408c2a2c5a08c8d0acf2c2a9d8eeGlenn Barry#include "gssapiP_generic.h"
5e01956f3000408c2a2c5a08c8d0acf2c2a9d8eeGlenn Barry
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry#define gssint_get_mechanism __gss_get_mechanism /* SUNW17PACresync */
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry
ba7b222e36bac28710a7f43739283302b617e7f5Glenn BarryOM_uint32
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barrygss_inquire_sec_context_by_oid (OM_uint32 *minor_status,
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry const gss_ctx_id_t context_handle,
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry const gss_OID desired_object,
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry gss_buffer_set_t *data_set)
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry{
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry OM_uint32 status;
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry gss_union_ctx_id_t ctx;
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry gss_mechanism mech;
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry if (minor_status == NULL)
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry return GSS_S_CALL_INACCESSIBLE_WRITE;
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry if (context_handle == GSS_C_NO_CONTEXT)
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry return GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT;
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry /*
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * select the approprate underlying mechanism routine and
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry * call it.
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry */
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry ctx = (gss_union_ctx_id_t) context_handle;
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry mech = gssint_get_mechanism (ctx->mech_type);
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry if (mech != NULL) {
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry if (mech->gss_inquire_sec_context_by_oid != NULL) {
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry status = mech->gss_inquire_sec_context_by_oid(minor_status,
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry ctx->internal_ctx_id,
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry desired_object,
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry data_set);
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry if (status != GSS_S_COMPLETE)
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry map_error(minor_status, mech);
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry } else
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry status = GSS_S_BAD_MECH;
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry return status;
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry }
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry return GSS_S_NO_CONTEXT;
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry}
ba7b222e36bac28710a7f43739283302b617e7f5Glenn Barry