2N/A/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2N/A/*
2N/A * lib/gssapi/krb5/inq_names.c
2N/A *
2N/A * Copyright 1995 by the Massachusetts Institute of Technology.
2N/A * All Rights Reserved.
2N/A *
2N/A * Export of this software from the United States of America may
2N/A * require a specific license from the United States Government.
2N/A * It is the responsibility of any person or organization contemplating
2N/A * export to obtain such a license before exporting.
2N/A *
2N/A * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
2N/A * distribute this software and its documentation for any purpose and
2N/A * without fee is hereby granted, provided that the above copyright
2N/A * notice appear in all copies and that both that copyright notice and
2N/A * this permission notice appear in supporting documentation, and that
2N/A * the name of M.I.T. not be used in advertising or publicity pertaining
2N/A * to distribution of the software without specific, written prior
2N/A * permission. Furthermore if you modify this software you must label
2N/A * your software as modified software and not distribute it in such a
2N/A * fashion that it might be confused with the original M.I.T. software.
2N/A * M.I.T. makes no representations about the suitability of
2N/A * this software for any purpose. It is provided "as is" without express
2N/A * or implied warranty.
2N/A *
2N/A */
2N/A
2N/A/*
2N/A * inq_names.c - Return set of nametypes supported by the KRB5 mechanism.
2N/A */
2N/A#include "gssapiP_krb5.h"
2N/A#include "mglueP.h"
2N/A
2N/AOM_uint32
2N/Akrb5_gss_inquire_names_for_mech(minor_status, mechanism, name_types)
2N/A OM_uint32 *minor_status;
2N/A gss_OID mechanism;
2N/A gss_OID_set *name_types;
2N/A{
2N/A OM_uint32 major, minor;
2N/A
2N/A /*
2N/A * We only know how to handle our own mechanism.
2N/A */
2N/A if ((mechanism != GSS_C_NULL_OID) &&
2N/A !g_OID_equal(gss_mech_krb5, mechanism) &&
2N/A !g_OID_equal(gss_mech_krb5_old, mechanism)) {
2N/A *minor_status = 0;
2N/A return(GSS_S_BAD_MECH);
2N/A }
2N/A
2N/A /* We're okay. Create an empty OID set */
2N/A major = generic_gss_create_empty_oid_set(minor_status, name_types);
2N/A if (major == GSS_S_COMPLETE) {
2N/A /* Now add our members. */
2N/A if (
2N/A ((major = generic_gss_add_oid_set_member(minor_status,
2N/A gss_nt_user_name,
2N/A name_types)
2N/A ) == GSS_S_COMPLETE) &&
2N/A ((major = generic_gss_add_oid_set_member(minor_status,
2N/A gss_nt_machine_uid_name,
2N/A name_types)
2N/A ) == GSS_S_COMPLETE) &&
2N/A ((major = generic_gss_add_oid_set_member(minor_status,
2N/A gss_nt_string_uid_name,
2N/A name_types)
2N/A ) == GSS_S_COMPLETE) &&
2N/A ((major = generic_gss_add_oid_set_member(minor_status,
2N/A gss_nt_service_name,
2N/A name_types)
2N/A ) == GSS_S_COMPLETE) &&
2N/A ((major = generic_gss_add_oid_set_member(minor_status,
2N/A gss_nt_service_name_v2,
2N/A name_types)
2N/A ) == GSS_S_COMPLETE) &&
2N/A ((major = generic_gss_add_oid_set_member(minor_status,
2N/A gss_nt_exported_name,
2N/A name_types)
2N/A ) == GSS_S_COMPLETE) &&
2N/A ((major = generic_gss_add_oid_set_member(minor_status,
2N/A gss_nt_krb5_name,
2N/A name_types)
2N/A ) == GSS_S_COMPLETE)
2N/A ) {
2N/A major = generic_gss_add_oid_set_member(minor_status,
2N/A gss_nt_krb5_principal,
2N/A name_types);
2N/A }
2N/A
2N/A /*
2N/A * If we choked, then release the set, but don't overwrite the minor
2N/A * status with the release call.
2N/A */
2N/A if (major != GSS_S_COMPLETE)
2N/A (void) generic_gss_release_oid_set(&minor, name_types);
2N/A }
2N/A return(major);
2N/A}