/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*
* Copyright (c) 1997, by Sun Microsystems, Inc.
* All rights reserved.
*
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <libintl.h>
#include <locale.h>
#include "dh_gssapi.h"
/*
* __dh_gss_display_status: This is the routine that implements
* gss_display_status for Diffie-Hellman mechanism. Note we will
* return failure if the status_type parameter is GSS_C_GSS_CODE
* since libgss should handle the mechanism independent codes.
*/
int status_type, /* Shoud alway be GSS_C_MECH_COE */
{
char *str;
if (!minor)
return (GSS_S_CALL_INACCESSIBLE_WRITE);
*minor = DH_SUCCESS;
if (!mesg_ctx)
return (GSS_S_CALL_INACCESSIBLE_WRITE);
/* We only have one message per status value */
*mesg_ctx = 0;
/*
* If status_type equals GSS_C_GSS_CODE, we'll return
* GSS_S_FAILURE. This status type is handled by the caller,
* libgss, since it is mechanism independent. We should never see
* this. If the status type does not equal GSS_C_MECH_CODE and
* does not equal GSS_C_GSS_CODE we return GSS_S_BAD_STATUS as per
* spec.
*/
if (status_type != GSS_C_MECH_CODE)
return ((status_type == GSS_C_GSS_CODE ?
if (mech != GSS_C_NO_OID &&
return (GSS_S_BAD_MECH);
/* Convert the DH status value to an internationalize string */
switch (status_value) {
case DH_SUCCESS:
break;
case DH_NOMEM_FAILURE:
break;
case DH_ENCODE_FAILURE:
"mech_dh: Could not encode token");
break;
case DH_DECODE_FAILURE:
"mech_dh: Could not decode token");
break;
case DH_BADARG_FAILURE:
break;
case DH_CIPHER_FAILURE:
break;
case DH_VERIFIER_FAILURE:
break;
break;
case DH_NO_SECRET:
break;
case DH_NO_PRINCIPAL:
break;
case DH_NOT_LOCAL:
break;
case DH_UNKNOWN_QOP:
break;
case DH_VERIFIER_MISMATCH:
break;
case DH_NO_SUCH_USER:
break;
case DH_NETNAME_FAILURE:
"mech_dh: Could not generate netname");
break;
case DH_BAD_CRED:
break;
case DH_BAD_CONTEXT:
break;
case DH_PROTO_MISMATCH:
"mismatch");
break;
default:
"unknown error");
break;
}
/* Copy the string to the output */
if (status_str == 0) {
return (GSS_S_FAILURE);
}
/* Return the GSS status of GSS_S_COMPLETE or GSS_S_BAD_STATUS */
return (major);
}
/*
* This function is completely implemented in libgss. Its entry point is
* set to NULL in dhmech.c
*/
/*
* OM_uint32
* __dh_gss_indicate_mechs(void *ctx, OM_uint32 *minor, gss_OID_set *mechs)
* {
* return (GSS_S_UNAVAILABLE);
* }
*/